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

From: kernel test robot
Date: Tue Feb 13 2024 - 20:27:49 EST


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-lkp@xxxxxxxxx/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-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402140910.TFs9k0YR-lkp@xxxxxxxxx/

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(&buffer->mutex);
6194 raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
6195
6196 if (inc)
6197 cpu_buffer->mapped++;
6198 else
6199 cpu_buffer->mapped--;
6200
6201 raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
6202 mutex_unlock(&buffer->mutex);
6203
6204 return 0;
6205 }
6206

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki