Re: [PATCH 5/8] ring-buffer: Add ring_buffer_meta data

From: kernel test robot
Date: Fri Mar 08 2024 - 05:44:07 EST


Hi Steven,

kernel test robot noticed the following build warnings:

[auto build test WARNING on next-20240305]
[cannot apply to tip/x86/core akpm-mm/mm-everything linus/master v6.8-rc7 v6.8-rc6 v6.8-rc5 v6.8-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Steven-Rostedt/ring-buffer-Allow-mapped-field-to-be-set-without-mapping/20240306-100047
base: next-20240305
patch link: https://lore.kernel.org/r/20240306020006.100449500%40goodmis.org
patch subject: [PATCH 5/8] ring-buffer: Add ring_buffer_meta data
config: sh-defconfig (https://download.01.org/0day-ci/archive/20240308/202403081831.EWSQPo2a-lkp@xxxxxxxxx/config)
compiler: sh4-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240308/202403081831.EWSQPo2a-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/202403081831.EWSQPo2a-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

kernel/trace/ring_buffer.c: In function 'rb_set_commit_to_write':
>> kernel/trace/ring_buffer.c:3224:45: warning: assignment to 'long unsigned int' from 'struct buffer_data_page *' makes integer from pointer without a cast [-Wint-conversion]
3224 | meta->commit_buffer = cpu_buffer->commit_page->page;
| ^


vim +3224 kernel/trace/ring_buffer.c

3192
3193 static __always_inline void
3194 rb_set_commit_to_write(struct ring_buffer_per_cpu *cpu_buffer)
3195 {
3196 unsigned long max_count;
3197
3198 /*
3199 * We only race with interrupts and NMIs on this CPU.
3200 * If we own the commit event, then we can commit
3201 * all others that interrupted us, since the interruptions
3202 * are in stack format (they finish before they come
3203 * back to us). This allows us to do a simple loop to
3204 * assign the commit to the tail.
3205 */
3206 again:
3207 max_count = cpu_buffer->nr_pages * 100;
3208
3209 while (cpu_buffer->commit_page != READ_ONCE(cpu_buffer->tail_page)) {
3210 if (RB_WARN_ON(cpu_buffer, !(--max_count)))
3211 return;
3212 if (RB_WARN_ON(cpu_buffer,
3213 rb_is_reader_page(cpu_buffer->tail_page)))
3214 return;
3215 /*
3216 * No need for a memory barrier here, as the update
3217 * of the tail_page did it for this page.
3218 */
3219 local_set(&cpu_buffer->commit_page->page->commit,
3220 rb_page_write(cpu_buffer->commit_page));
3221 rb_inc_page(&cpu_buffer->commit_page);
3222 if (cpu_buffer->ring_meta) {
3223 struct ring_buffer_meta *meta = cpu_buffer->ring_meta;
> 3224 meta->commit_buffer = cpu_buffer->commit_page->page;
3225 }
3226 /* add barrier to keep gcc from optimizing too much */
3227 barrier();
3228 }
3229 while (rb_commit_index(cpu_buffer) !=
3230 rb_page_write(cpu_buffer->commit_page)) {
3231
3232 /* Make sure the readers see the content of what is committed. */
3233 smp_wmb();
3234 local_set(&cpu_buffer->commit_page->page->commit,
3235 rb_page_write(cpu_buffer->commit_page));
3236 RB_WARN_ON(cpu_buffer,
3237 local_read(&cpu_buffer->commit_page->page->commit) &
3238 ~RB_WRITE_MASK);
3239 barrier();
3240 }
3241
3242 /* again, keep gcc from optimizing */
3243 barrier();
3244
3245 /*
3246 * If an interrupt came in just after the first while loop
3247 * and pushed the tail page forward, we will be left with
3248 * a dangling commit that will never go forward.
3249 */
3250 if (unlikely(cpu_buffer->commit_page != READ_ONCE(cpu_buffer->tail_page)))
3251 goto again;
3252 }
3253

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