Hi Peter,
On 9/3/25 22:28, Peter Zijlstra wrote:
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?
Yes yes, in that case that will be NMI-like, sorry this patch is coarse grain. The ideal solution would be to re-enable the interrupts if they were enabled at the moment of the trap. In that case, would that make sense to you?
Thanks,
Alex
linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv