Re: [PATCH] ftrace: Fix stack trace entry generated by ftrace_pid_func()

From: Google
Date: Sun May 26 2024 - 19:17:30 EST


On Sun, 26 May 2024 22:51:53 +0800
kernel test robot <lkp@xxxxxxxxx> wrote:

> Hi Tatsuya,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on rostedt-trace/for-next v6.9 next-20240523]
> [cannot apply to rostedt-trace/for-next-urgent]
> [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/Tatsuya-S/ftrace-Fix-stack-trace-entry-generated-by-ftrace_pid_func/20240526-193149
> base: linus/master
> patch link: https://lore.kernel.org/r/20240526112658.46740-1-tatsuya.s2862%40gmail.com
> patch subject: [PATCH] ftrace: Fix stack trace entry generated by ftrace_pid_func()
> config: x86_64-buildonly-randconfig-002-20240526 (https://download.01.org/0day-ci/archive/20240526/202405262232.L4XH8q6O-lkp@xxxxxxxxx/config)
> compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240526/202405262232.L4XH8q6O-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/202405262232.L4XH8q6O-lkp@xxxxxxxxx/
>
> All warnings (new ones prefixed by >>):
>
> >> kernel/trace/ftrace.c:102:6: warning: no previous prototype for function 'ftrace_pids_enabled' [-Wmissing-prototypes]
> 102 | bool ftrace_pids_enabled(struct ftrace_ops *ops)
> | ^
> kernel/trace/ftrace.c:102:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
> 102 | bool ftrace_pids_enabled(struct ftrace_ops *ops)
> | ^
> | static
> 1 warning generated.

This is because the prototype in linux/ftrace.h is placed in the
#ifdef CONFIG_DYNAMIC_FTRACE block. The prototype needs to be moved
outside of the block.

Thank you,

>
>
> vim +/ftrace_pids_enabled +102 kernel/trace/ftrace.c
>
> 101
> > 102 bool ftrace_pids_enabled(struct ftrace_ops *ops)
> 103 {
> 104 struct trace_array *tr;
> 105
> 106 if (!(ops->flags & FTRACE_OPS_FL_PID) || !ops->private)
> 107 return false;
> 108
> 109 tr = ops->private;
> 110
> 111 return tr->function_pids != NULL || tr->function_no_pids != NULL;
> 112 }
> 113
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki


--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>