tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b81b1829e7e39f6cebdf6e4d5484eacbceda8554
commit: 172f7ba9772cae12f099fc563352e905dc9a1921 ftrace: Make ftrace_profile_pages_init static
date: 4 months ago
config: arm-randconfig-r001-20220213 (https://download.01.org/0day-ci/archive/20220213/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 478c237e21b2c3a83e46f26fcbeb3876682f9b14)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=172f7ba9772cae12f099fc563352e905dc9a1921
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 172f7ba9772cae12f099fc563352e905dc9a1921
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/gpu/drm/ kernel/trace/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
>> kernel/trace/ftrace.c:7157:20: error: unused function 'ftrace_startup_enable' [-Werror,-Wunused-function]
static inline void ftrace_startup_enable(int command) { }
^
1 error generated.
vim +/ftrace_startup_enable +7157 kernel/trace/ftrace.c
0b6e4d56bf7186 Frederic Weisbecker 2008-10-28 7155
8434dc9340cd2e Steven Rostedt (Red Hat 2015-01-20 7156) static inline int ftrace_init_dyn_tracefs(struct dentry *d_tracer) { return 0; }
df4fc31558dd2a Steven Rostedt 2008-11-26 @7157 static inline void ftrace_startup_enable(int command) { }
e1effa0144a1dd Steven Rostedt (Red Hat 2014-08-05 7158) static inline void ftrace_startup_all(int command) { }
8a56d7761d2d04 Steven Rostedt (Red Hat 2013-11-25 7159)
:::::: The code at line 7157 was first introduced by commit
:::::: df4fc31558dd2a3a30292ddb3a64c2a5befcec73 ftrace: add function tracing to single thread
:::::: TO: Steven Rostedt <[email protected]>
:::::: CC: Ingo Molnar <[email protected]>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
On Tue, Feb 15, 2022 at 01:28:53AM +0900, Masahiro Yamada wrote:
> On Tue, Feb 15, 2022 at 12:53 AM Nathan Chancellor <[email protected]> wrote:
> >
> > Hi Steve,
> >
> > On Mon, Feb 14, 2022 at 10:20:00AM -0500, Steven Rostedt wrote:
> > > On Sun, 13 Feb 2022 21:03:29 +0800
> > > kernel test robot <[email protected]> wrote:
> > >
> > > > All errors (new ones prefixed by >>):
> > > >
> > > > >> kernel/trace/ftrace.c:7157:20: error: unused function 'ftrace_startup_enable' [-Werror,-Wunused-function]
> > > > static inline void ftrace_startup_enable(int command) { }
> > > > ^
> > > > 1 error generated.
> > >
> > > Strange. I always thought that static inline functions do not cause
> > > warnings when not used? Especially, since they are often in headers when
> > > things are turned off. Or is it because this is in a C file?
> >
> > With -Wunused-function, clang will warn about unused static inline
> > functions within a .c file (but not .h), whereas GCC will not warn for
> > either. The unused attribute was added to the definition of inline to
> > make clang's behavior match GCC's.
> >
> > > Is this a new warning caused by a commit, or is it a new warning because
> > > the compiler now complains about it?
> >
> > However, in commit 6863f5643dd7 ("kbuild: allow Clang to find unused
> > static inline functions for W=1 build"), Masahiro made it so that the
> > unused attribute does not get added at W=1 so that instances of unused
> > static inline functions can be caught and eliminated (or put into use,
> > if the function should have been used), hence this report.
>
> BTW, my hope was to move this warning to W=0 someday.
> (that is, remove __inline_maybe_unused entirely).
>
> I do not know how many warnings are still remaining, though.
> Is it now more difficult due to CONFIG_WERROR?
I have not done an audit in quite a while and I do not remember the
results of the last one. I don't think -Werror makes it more difficult,
it is more so just finding the time to sit down and work on it :) I
agree that it would be nice to make this the default behavior for
cleaner code, perhaps we can use this as a "good first issue" for
working with clang.
Cheers,
Nathan
On Sun, 13 Feb 2022 21:03:29 +0800
kernel test robot <[email protected]> wrote:
> All errors (new ones prefixed by >>):
>
> >> kernel/trace/ftrace.c:7157:20: error: unused function 'ftrace_startup_enable' [-Werror,-Wunused-function]
> static inline void ftrace_startup_enable(int command) { }
> ^
> 1 error generated.
Strange. I always thought that static inline functions do not cause
warnings when not used? Especially, since they are often in headers when
things are turned off. Or is it because this is in a C file?
Is this a new warning caused by a commit, or is it a new warning because
the compiler now complains about it?
-- Steve
>
>
> vim +/ftrace_startup_enable +7157 kernel/trace/ftrace.c
Hi Steve,
On Mon, Feb 14, 2022 at 10:20:00AM -0500, Steven Rostedt wrote:
> On Sun, 13 Feb 2022 21:03:29 +0800
> kernel test robot <[email protected]> wrote:
>
> > All errors (new ones prefixed by >>):
> >
> > >> kernel/trace/ftrace.c:7157:20: error: unused function 'ftrace_startup_enable' [-Werror,-Wunused-function]
> > static inline void ftrace_startup_enable(int command) { }
> > ^
> > 1 error generated.
>
> Strange. I always thought that static inline functions do not cause
> warnings when not used? Especially, since they are often in headers when
> things are turned off. Or is it because this is in a C file?
With -Wunused-function, clang will warn about unused static inline
functions within a .c file (but not .h), whereas GCC will not warn for
either. The unused attribute was added to the definition of inline to
make clang's behavior match GCC's.
> Is this a new warning caused by a commit, or is it a new warning because
> the compiler now complains about it?
However, in commit 6863f5643dd7 ("kbuild: allow Clang to find unused
static inline functions for W=1 build"), Masahiro made it so that the
unused attribute does not get added at W=1 so that instances of unused
static inline functions can be caught and eliminated (or put into use,
if the function should have been used), hence this report.
I will be honest, I don't know why the robot flagged 172f7ba9772c as the
commit that introduced this warning but it seems legitimate if
CONFIG_DYNAMIC_FTRACE is not enabled, since ftrace_startup_enable() is
only ever used within an '#ifdef CONFIG_DYNAMIC_FTRACE' block so I guess
the stub is unnecessary?
Cheers,
Nathan
On Tue, Feb 15, 2022 at 12:53 AM Nathan Chancellor <[email protected]> wrote:
>
> Hi Steve,
>
> On Mon, Feb 14, 2022 at 10:20:00AM -0500, Steven Rostedt wrote:
> > On Sun, 13 Feb 2022 21:03:29 +0800
> > kernel test robot <[email protected]> wrote:
> >
> > > All errors (new ones prefixed by >>):
> > >
> > > >> kernel/trace/ftrace.c:7157:20: error: unused function 'ftrace_startup_enable' [-Werror,-Wunused-function]
> > > static inline void ftrace_startup_enable(int command) { }
> > > ^
> > > 1 error generated.
> >
> > Strange. I always thought that static inline functions do not cause
> > warnings when not used? Especially, since they are often in headers when
> > things are turned off. Or is it because this is in a C file?
>
> With -Wunused-function, clang will warn about unused static inline
> functions within a .c file (but not .h), whereas GCC will not warn for
> either. The unused attribute was added to the definition of inline to
> make clang's behavior match GCC's.
>
> > Is this a new warning caused by a commit, or is it a new warning because
> > the compiler now complains about it?
>
> However, in commit 6863f5643dd7 ("kbuild: allow Clang to find unused
> static inline functions for W=1 build"), Masahiro made it so that the
> unused attribute does not get added at W=1 so that instances of unused
> static inline functions can be caught and eliminated (or put into use,
> if the function should have been used), hence this report.
BTW, my hope was to move this warning to W=0 someday.
(that is, remove __inline_maybe_unused entirely).
I do not know how many warnings are still remaining, though.
Is it now more difficult due to CONFIG_WERROR?
> I will be honest, I don't know why the robot flagged 172f7ba9772c as the
> commit that introduced this warning but it seems legitimate if
> CONFIG_DYNAMIC_FTRACE is not enabled, since ftrace_startup_enable() is
> only ever used within an '#ifdef CONFIG_DYNAMIC_FTRACE' block so I guess
> the stub is unnecessary?
>
> Cheers,
> Nathan
--
Best Regards
Masahiro Yamada
On Mon, 14 Feb 2022 08:53:04 -0700
Nathan Chancellor <[email protected]> wrote:
> I will be honest, I don't know why the robot flagged 172f7ba9772c as the
> commit that introduced this warning but it seems legitimate if
> CONFIG_DYNAMIC_FTRACE is not enabled, since ftrace_startup_enable() is
> only ever used within an '#ifdef CONFIG_DYNAMIC_FTRACE' block so I guess
> the stub is unnecessary?
I'm all fine for clean up patches, but I don't like "new warning" message
reports for things that use to be OK, but now are a warning.
In other words, if a bot updates its warnings, it should do a full pass of
the kernel before it starts on new commits, to flag all existing warnings
as OK (but possibly work for someone to clean up), but should not ever send
as a new warning message to the authors.
So, I'm going to ignore this. If someone wants to send me a clean up patch,
I'll test it and take it, but I do not have the time to clean up new
warnings that use to be OK unless they uncovered a real bug.
-- Steve