Re: [PATCH v17 2/6] ring-buffer: Introducing ring-buffer mapping functions

From: Steven Rostedt
Date: Tue Feb 13 2024 - 17:54:30 EST


On Tue, 13 Feb 2024 15:53:09 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> On Tue, 13 Feb 2024 11:49:41 +0000
> Vincent Donnefort <vdonnefort@xxxxxxxxxx> wrote:
>
> Did you test with lockdep?
>
> > +static int __rb_inc_dec_mapped(struct trace_buffer *buffer,
> > + struct ring_buffer_per_cpu *cpu_buffer,
> > + bool inc)
> > +{
> > + unsigned long flags;
> > +
> > + lockdep_assert_held(cpu_buffer->mapping_lock);
>
> /work/git/linux-trace.git/kernel/trace/ring_buffer.c: In function ‘__rb_inc_dec_mapped’:
> /work/git/linux-trace.git/include/linux/lockdep.h:234:61: error: invalid type argument of ‘->’ (have ‘struct mutex’)
> 234 | #define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map)
> | ^~
> /work/git/linux-trace.git/include/asm-generic/bug.h:123:32: note: in definition of macro ‘WARN_ON’
> 123 | int __ret_warn_on = !!(condition); \
> | ^~~~~~~~~
> /work/git/linux-trace.git/include/linux/lockdep.h:267:9: note: in expansion of macro ‘lockdep_assert’
> 267 | lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
> | ^~~~~~~~~~~~~~
> /work/git/linux-trace.git/include/linux/lockdep.h:267:24: note: in expansion of macro ‘lockdep_is_held’
> 267 | lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
> | ^~~~~~~~~~~~~~~
> /work/git/linux-trace.git/kernel/trace/ring_buffer.c:6167:9: note: in expansion of macro ‘lockdep_assert_held’
> 6167 | lockdep_assert_held(cpu_buffer->mapping_lock);
> | ^~~~~~~~~~~~~~~~~~~
>
> I believe that is supposed to be:
>
> lockdep_assert_held(&cpu_buffer->mapping_lock);

If this is the only issue with this series, I may just fix up the patch
myself.