Re: [PATCH v17 2/6] ring-buffer: Introducing ring-buffer mapping functions
Hi Vincent, kernel test robot noticed the following build errors: [auto build test ERROR on ca185770db914869ff9fe773bac5e0e5e4165b83] url: https://github.com/intel-lab-lkp/linux/commits/Vincent-Donnefort/ring-buffer-Zero-ring-buffer-sub-buffers/20240213-195302 base: ca185770db914869ff9fe773bac5e0e5e4165b83 patch link: https://lore.kernel.org/r/20240213114945.3528801-3-vdonnefort%40google.com patch subject: [PATCH v17 2/6] ring-buffer: Introducing ring-buffer mapping functions config: x86_64-randconfig-161-20240214 (https://download.01.org/0day-ci/archive/20240214/202402141856.fvl4pchi-...@intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240214/202402141856.fvl4pchi-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202402141856.fvl4pchi-...@intel.com/ All errors (new ones prefixed by >>): In file included from arch/x86/include/asm/bug.h:87, from include/linux/bug.h:5, from include/linux/jump_label.h:256, from arch/x86/include/asm/string_64.h:6, from arch/x86/include/asm/string.h:5, from include/linux/string.h:61, from include/linux/bitmap.h:12, from include/linux/cpumask.h:12, from include/linux/interrupt.h:8, from include/linux/trace_recursion.h:5, from kernel/trace/ring_buffer.c:7: kernel/trace/ring_buffer.c: In function '__rb_inc_dec_mapped': >> include/linux/lockdep.h:234:52: error: invalid type argument of '->' (have >> 'struct mutex') 234 | #define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map) |^~ include/asm-generic/bug.h:123:25: note: in definition of macro 'WARN_ON' 123 | int __ret_warn_on = !!(condition);\ | ^ include/linux/lockdep.h:267:2: note: in expansion of macro 'lockdep_assert' 267 | lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD) | ^~ include/linux/lockdep.h:267:17: note: in expansion of macro 'lockdep_is_held' 267 | lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD) | ^~~ kernel/trace/ring_buffer.c:6185:2: note: in expansion of macro 'lockdep_assert_held' 6185 | lockdep_assert_held(cpu_buffer->mapping_lock); | ^~~ vim +234 include/linux/lockdep.h f607c668577481 Peter Zijlstra 2009-07-20 233 f8319483f57f1c Peter Zijlstra 2016-11-30 @234 #define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map) f8319483f57f1c Peter Zijlstra 2016-11-30 235 #define lockdep_is_held_type(lock, r)lock_is_held_type(&(lock)->dep_map, (r)) f607c668577481 Peter Zijlstra 2009-07-20 236 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH v17 2/6] ring-buffer: Introducing ring-buffer mapping functions
Hi Vincent, kernel test robot noticed the following build errors: [auto build test ERROR on ca185770db914869ff9fe773bac5e0e5e4165b83] url: https://github.com/intel-lab-lkp/linux/commits/Vincent-Donnefort/ring-buffer-Zero-ring-buffer-sub-buffers/20240213-195302 base: ca185770db914869ff9fe773bac5e0e5e4165b83 patch link: https://lore.kernel.org/r/20240213114945.3528801-3-vdonnefort%40google.com patch subject: [PATCH v17 2/6] ring-buffer: Introducing ring-buffer mapping functions config: i386-buildonly-randconfig-001-20240214 (https://download.01.org/0day-ci/archive/20240214/202402140910.tfs9k0yr-...@intel.com/config) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240214/202402140910.tfs9k0yr-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202402140910.tfs9k0yr-...@intel.com/ All errors (new ones prefixed by >>): >> kernel/trace/ring_buffer.c:6185:2: error: member reference type 'struct >> mutex' is not a pointer; did you mean to use '.'? 6185 | lockdep_assert_held(cpu_buffer->mapping_lock); | ^ include/linux/lockdep.h:267:17: note: expanded from macro 'lockdep_assert_held' 267 | lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD) | ~~~^~ include/linux/lockdep.h:234:52: note: expanded from macro 'lockdep_is_held' 234 | #define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map) | ^ include/linux/lockdep.h:261:32: note: expanded from macro 'lockdep_assert' 261 | do { WARN_ON(debug_locks && !(cond)); } while (0) | ~^~ include/asm-generic/bug.h:123:25: note: expanded from macro 'WARN_ON' 123 | int __ret_warn_on = !!(condition); \ |^ >> kernel/trace/ring_buffer.c:6185:2: error: cannot take the address of an >> rvalue of type 'struct lockdep_map' 6185 | lockdep_assert_held(cpu_buffer->mapping_lock); | ^ include/linux/lockdep.h:267:17: note: expanded from macro 'lockdep_assert_held' 267 | lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD) | ~~~^~ include/linux/lockdep.h:234:45: note: expanded from macro 'lockdep_is_held' 234 | #define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map) | ^ include/linux/lockdep.h:261:32: note: expanded from macro 'lockdep_assert' 261 | do { WARN_ON(debug_locks && !(cond)); } while (0) | ~^~ include/asm-generic/bug.h:123:25: note: expanded from macro 'WARN_ON' 123 | int __ret_warn_on = !!(condition); \ |^ 2 errors generated. vim +6185 kernel/trace/ring_buffer.c 6174 6175 /* 6176 * Fast-path for rb_buffer_(un)map(). Called whenever the meta-page doesn't need 6177 * to be set-up or torn-down. 6178 */ 6179 static int __rb_inc_dec_mapped(struct trace_buffer *buffer, 6180 struct ring_buffer_per_cpu *cpu_buffer, 6181 bool inc) 6182 { 6183 unsigned long flags; 6184 > 6185 lockdep_assert_held(cpu_buffer->mapping_lock); 6186 6187 if (inc && cpu_buffer->mapped == UINT_MAX) 6188 return -EBUSY; 6189 6190 if (WARN_ON(!inc && cpu_buffer->mapped == 0)) 6191 return -EINVAL; 6192 6193 mutex_lock(>mutex); 6194 raw_spin_lock_irqsave(_buffer->reader_lock, flags); 6195 6196 if (inc) 6197 cpu_buffer->mapped++; 6198 else 6199 cpu_buffer->mapped--; 6200 6201 raw_spin_unlock_irqrestore(_buffer->reader_lock, flags); 6202 mutex_unlock(>mutex); 6203 6204 return 0; 6205 } 6206 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH v17 2/6] ring-buffer: Introducing ring-buffer mapping functions
On Tue, 13 Feb 2024 15:53:09 -0500 Steven Rostedt wrote: > On Tue, 13 Feb 2024 11:49:41 + > Vincent Donnefort 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(_buffer->mapping_lock); If this is the only issue with this series, I may just fix up the patch myself.
Re: [PATCH v17 2/6] ring-buffer: Introducing ring-buffer mapping functions
On Tue, 13 Feb 2024 11:49:41 + Vincent Donnefort 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(_buffer->mapping_lock); -- Steve > + > + if (inc && cpu_buffer->mapped == UINT_MAX) > + return -EBUSY; > + > + if (WARN_ON(!inc && cpu_buffer->mapped == 0)) > + return -EINVAL; > + > + mutex_lock(>mutex); > + raw_spin_lock_irqsave(_buffer->reader_lock, flags); > + > + if (inc) > + cpu_buffer->mapped++; > + else > + cpu_buffer->mapped--; > + > + raw_spin_unlock_irqrestore(_buffer->reader_lock, flags); > + mutex_unlock(>mutex); > + > + return 0; > +}