On Fri, 20 Dec 2024 14:55:27 +0100 Ludwig Rydberg <ludwig.rydb...@gaisler.com> wrote:
> On 2024-12-18 22:35, Steven Rostedt wrote: > > > > > Can you test this patch? > > > > I have tested the patch on both riscv32 (qemu) & sparc32 (leon) and it seems > to be working fine. > > But I can mention that I ran into a deadlock situation on sparc32. > I had to remove CC_FLAGS_FTRACE for the code that is responsible for > flushing TLBs (SMP). It uses an NMI to signal other CPUs which triggered > the deadlock if tracing was enabled on that path. Can you try this patch on top of the last one? -- Steve diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 7e257e855dd1..a9fe54b79ce5 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -4398,8 +4398,13 @@ rb_reserve_next_event(struct trace_buffer *buffer, int nr_loops = 0; int add_ts_default; - /* ring buffer does cmpxchg, make sure it is safe in NMI context */ - if (!IS_ENABLED(CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG) && + /* + * ring buffer does cmpxchg as well as atomic64 operations + * (which some archs use locking for atomic64), make sure this + * is safe in NMI context + */ + if ((!IS_ENABLED(CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG) || + IS_ENABLED(CONFIG_GENERIC_ATOMIC64)) && (unlikely(in_nmi()))) { return NULL; }