Hi Martin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on trace/for-next]
[also build test WARNING on linus/master v7.2-rc6 next-20260806]
[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/Martin-Weiss/trace_branch-use-per-cpu-counters-for-correct-incorrect-stats/20260806-093445
base:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace 
for-next
patch link:    
https://lore.kernel.org/r/20260629095838.601926-1-Martin.weiss2410%40gmail.com
patch subject: [PATCH] trace_branch: use per-cpu counters for correct/incorrect 
stats
config: arm64-randconfig-r062-20260806 
(https://download.01.org/0day-ci/archive/20260807/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 13.4.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20260807/[email protected]/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 <[email protected]>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   kernel/trace/trace_branch.c: In function 'ftrace_likely_update':
>> kernel/trace/trace_branch.c:198:6: warning: infinite recursion detected 
>> [-Winfinite-recursion]
     198 | void ftrace_likely_update(struct ftrace_likely_data *f, int val,
         |      ^~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/array_size.h:5,
                    from include/linux/kernel.h:16,
                    from include/linux/kallsyms.h:11,
                    from kernel/trace/trace_branch.c:7:
   include/linux/compiler.h:33:25: note: recursive call
      33 |                         ftrace_likely_update(&______f, ______r,      
   \
         |                         
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      34 |                                              expect, is_constant);   
   \
         |                                              ~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:68:10: note: in definition of macro 
'__trace_if_value'
      68 |         (cond) ?                                        \
         |          ^~~~
   include/linux/compiler.h:55:28: note: in expansion of macro '__trace_if_var'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) 
) )
         |                            ^~~~~~~~~~~~~~
   include/linux/preempt.h:238:9: note: in expansion of macro 'if'
     238 |         if (unlikely(__preempt_count_dec_and_test())) \
         |         ^~
   include/linux/compiler.h:47:26: note: in expansion of macro 
'__branch_check__'
      47 | #  define unlikely(x)   (__branch_check__(x, 0, 
__builtin_constant_p(x)))
         |                          ^~~~~~~~~~~~~~~~
   include/linux/preempt.h:238:13: note: in expansion of macro 'unlikely'
     238 |         if (unlikely(__preempt_count_dec_and_test())) \
         |             ^~~~~~~~
   arch/arm64/include/asm/percpu.h:160:9: note: in expansion of macro 
'preempt_enable_notrace'
     160 |         preempt_enable_notrace();                                    
   \
         |         ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/percpu.h:197:9: note: in expansion of macro 
'_pcp_protect'
     197 |         _pcp_protect(__percpu_add_case_64, pcp, val)
         |         ^~~~~~~~~~~~
   include/linux/percpu-defs.h:372:25: note: in expansion of macro 
'this_cpu_add_8'
     372 |                 case 8: stem##8(variable, __VA_ARGS__);break;        
   \
         |                         ^~~~
   include/linux/percpu-defs.h:501:41: note: in expansion of macro 
'__pcpu_size_call'
     501 | #define this_cpu_add(pcp, val)          
__pcpu_size_call(this_cpu_add_, pcp, val)
         |                                         ^~~~~~~~~~~~~~~~
   include/linux/percpu-defs.h:511:41: note: in expansion of macro 
'this_cpu_add'
     511 | #define this_cpu_inc(pcp)               this_cpu_add(pcp, 1)
         |                                         ^~~~~~~~~~~~
   kernel/trace/trace_branch.c:218:17: note: in expansion of macro 
'this_cpu_inc'
     218 |                 this_cpu_inc(f->data.correct);
         |                 ^~~~~~~~~~~~
   include/linux/compiler.h:33:25: note: recursive call
      33 |                         ftrace_likely_update(&______f, ______r,      
   \
         |                         
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      34 |                                              expect, is_constant);   
   \
         |                                              ~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:68:10: note: in definition of macro 
'__trace_if_value'
      68 |         (cond) ?                                        \
         |          ^~~~
   include/linux/compiler.h:55:28: note: in expansion of macro '__trace_if_var'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) 
) )
         |                            ^~~~~~~~~~~~~~
   include/linux/preempt.h:238:9: note: in expansion of macro 'if'
     238 |         if (unlikely(__preempt_count_dec_and_test())) \
         |         ^~
   include/linux/compiler.h:47:26: note: in expansion of macro 
'__branch_check__'
      47 | #  define unlikely(x)   (__branch_check__(x, 0, 
__builtin_constant_p(x)))
         |                          ^~~~~~~~~~~~~~~~
   include/linux/preempt.h:238:13: note: in expansion of macro 'unlikely'
     238 |         if (unlikely(__preempt_count_dec_and_test())) \
         |             ^~~~~~~~
   arch/arm64/include/asm/percpu.h:160:9: note: in expansion of macro 
'preempt_enable_notrace'
     160 |         preempt_enable_notrace();                                    
   \
         |         ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/percpu.h:197:9: note: in expansion of macro 
'_pcp_protect'
     197 |         _pcp_protect(__percpu_add_case_64, pcp, val)
         |         ^~~~~~~~~~~~
   include/linux/percpu-defs.h:372:25: note: in expansion of macro 
'this_cpu_add_8'
     372 |                 case 8: stem##8(variable, __VA_ARGS__);break;        
   \
         |                         ^~~~
   include/linux/percpu-defs.h:501:41: note: in expansion of macro 
'__pcpu_size_call'
     501 | #define this_cpu_add(pcp, val)          
__pcpu_size_call(this_cpu_add_, pcp, val)
         |                                         ^~~~~~~~~~~~~~~~
   include/linux/percpu-defs.h:511:41: note: in expansion of macro 
'this_cpu_add'
     511 | #define this_cpu_inc(pcp)               this_cpu_add(pcp, 1)
         |                                         ^~~~~~~~~~~~
   kernel/trace/trace_branch.c:220:17: note: in expansion of macro 
'this_cpu_inc'
     220 |                 this_cpu_inc(f->data.incorrect);
         |                 ^~~~~~~~~~~~


vim +198 kernel/trace/trace_branch.c

52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 197  
134e6a034cb004 kernel/trace/trace_branch.c   Steven Rostedt (VMware  2017-01-19 
@198) void ftrace_likely_update(struct ftrace_likely_data *f, int val,
d45ae1f7041ac5 kernel/trace/trace_branch.c   Steven Rostedt (VMware  2017-01-17 
 199)                     int expect, int is_constant)
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 200  {
4a6c91fbdef846 kernel/trace/trace_branch.c   Peter Zijlstra          2019-03-07 
 201    unsigned long flags = user_access_save();
4a6c91fbdef846 kernel/trace/trace_branch.c   Peter Zijlstra          2019-03-07 
 202  
d45ae1f7041ac5 kernel/trace/trace_branch.c   Steven Rostedt (VMware  2017-01-17 
 203)   /* A constant is always correct */
134e6a034cb004 kernel/trace/trace_branch.c   Steven Rostedt (VMware  2017-01-19 
 204)   if (is_constant) {
134e6a034cb004 kernel/trace/trace_branch.c   Steven Rostedt (VMware  2017-01-19 
 205)           f->constant++;
d45ae1f7041ac5 kernel/trace/trace_branch.c   Steven Rostedt (VMware  2017-01-17 
 206)           val = expect;
134e6a034cb004 kernel/trace/trace_branch.c   Steven Rostedt (VMware  2017-01-19 
 207)   }
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 208    /*
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 209     * I would love to have a trace point here instead, but the
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 210     * trace point code is so inundated with unlikely and likely
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 211     * conditions that the recursive nightmare that exists is too
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 212     * much to try to get working. At least for now.
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 213     */
068f530b3f274d kernel/trace/trace_branch.c   Steven Rostedt (VMware  2017-01-19 
 214)   trace_likely_condition(f, val, expect);
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 215  
a53c1587fa9e39 kernel/trace/trace_branch.c   Martin Weiss            2026-06-29 
 216    /* use per-cpu counters to avoid contention */
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 217    if (val == expect)
a53c1587fa9e39 kernel/trace/trace_branch.c   Martin Weiss            2026-06-29 
 218            this_cpu_inc(f->data.correct);
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 219    else
a53c1587fa9e39 kernel/trace/trace_branch.c   Martin Weiss            2026-06-29 
 220            this_cpu_inc(f->data.incorrect);
4a6c91fbdef846 kernel/trace/trace_branch.c   Peter Zijlstra          2019-03-07 
 221  
4a6c91fbdef846 kernel/trace/trace_branch.c   Peter Zijlstra          2019-03-07 
 222    user_access_restore(flags);
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 223  }
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 224  EXPORT_SYMBOL(ftrace_likely_update);
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt          2008-11-12 
 225  

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

Reply via email to