On Wed, Sep 03, 2025 at 07:54:29PM +0000, Alexandre Ghiti wrote:
kprobe has been broken on riscv for quite some time. There is an attempt [1] to fix that which actually works. This patch works because it enables ARCH_HAVE_NMI_SAFE_CMPXCHG and that makes the ring buffer allocation succeed when handling a kprobe because we handle *all* kprobes in nmi context. We do so because Peter advised us to treat all kernel traps as nmi [2].
But that does not seem right for kprobe handling, so instead, treat break traps from kernel as non-nmi.
You can put a kprobe inside: local_irq_disable(), no? Inside any random spinlock region in fact. How is the probe then not NMI like?