The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Martin Weiss <martin.githubacc@gmail.com>, linux-kernel@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev,
	Martin Weiss <Martin.weiss2410@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH] trace_branch: use per-cpu counters for correct/incorrect stats
Date: Fri, 7 Aug 2026 00:53:24 +0800	[thread overview]
Message-ID: <202608070005.js0pMRDK-lkp@intel.com> (raw)
In-Reply-To: <20260629095838.601926-1-Martin.weiss2410@gmail.com>

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/202608070005.js0pMRDK-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260807/202608070005.js0pMRDK-lkp@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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608070005.js0pMRDK-lkp@intel.com/

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

  parent reply	other threads:[~2026-08-06 16:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  9:58 [PATCH] trace_branch: use per-cpu counters for correct/incorrect stats Martin Weiss
2026-06-29 10:47 ` Steven Rostedt
2026-08-06 16:53 ` kernel test robot [this message]
2026-08-06 19:38 ` kernel test robot
2026-08-06 20:04 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202608070005.js0pMRDK-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Martin.weiss2410@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=martin.githubacc@gmail.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox