From: Steven Rostedt <rostedt@goodmis.org> Date: 2025-05-27 18:45:26
From: Steven Rostedt <rostedt@goodmis.org>
Use guard(raw_spinlock_irqsave)() in reset_disabled_cpu_buffer() to
simplify the locking.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/ring_buffer.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
@@ -6112,21 +6112,16 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)/* Must have disabled the cpu buffer then done a synchronize_rcu */staticvoidreset_disabled_cpu_buffer(structring_buffer_per_cpu*cpu_buffer){-unsignedlongflags;--raw_spin_lock_irqsave(&cpu_buffer->reader_lock,flags);+guard(raw_spinlock_irqsave)(&cpu_buffer->reader_lock);if(RB_WARN_ON(cpu_buffer,local_read(&cpu_buffer->committing)))-gotoout;+return;arch_spin_lock(&cpu_buffer->lock);rb_reset_cpu(cpu_buffer);arch_spin_unlock(&cpu_buffer->lock);--out:-raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock,flags);}/**
@@ -6112,21 +6112,16 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)/* Must have disabled the cpu buffer then done a synchronize_rcu */staticvoidreset_disabled_cpu_buffer(structring_buffer_per_cpu*cpu_buffer){-unsignedlongflags;--raw_spin_lock_irqsave(&cpu_buffer->reader_lock,flags);+guard(raw_spinlock_irqsave)(&cpu_buffer->reader_lock);if(RB_WARN_ON(cpu_buffer,local_read(&cpu_buffer->committing)))-gotoout;+return;arch_spin_lock(&cpu_buffer->lock);rb_reset_cpu(cpu_buffer);arch_spin_unlock(&cpu_buffer->lock);--out:-raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock,flags);}/**