[tip:x86/mm 1/23] arch/x86/mm/init.c:75:6: warning: no previous prototype for function 'x86_has_pat_wp'

2 views
Skip to first unread message

kbuild test robot

unread,
May 19, 2020, 1:52:43 PM5/19/20
to Christoph Hellwig, kbuil...@lists.01.org, clang-bu...@googlegroups.com, linux-...@vger.kernel.org, x...@kernel.org, Borislav Petkov
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/mm
head: bd1de2a7aace4d1d312fb1be264b8fafdb706208
commit: 1f6f655e01adebf5bd5e6c3da2e843c104ded051 [1/23] x86/mm: Add a x86_has_pat_wp() helper
config: x86_64-randconfig-r012-20200519 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 135b877874fae96b4372c8a3fbfaa8ff44ff86e3)
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout 1f6f655e01adebf5bd5e6c3da2e843c104ded051
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <l...@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> arch/x86/mm/init.c:75:6: warning: no previous prototype for function 'x86_has_pat_wp' [-Wmissing-prototypes]
bool x86_has_pat_wp(void)
^
arch/x86/mm/init.c:75:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
bool x86_has_pat_wp(void)
^
static
arch/x86/mm/init.c:866:13: warning: no previous prototype for function 'mem_encrypt_free_decrypted_mem' [-Wmissing-prototypes]
void __weak mem_encrypt_free_decrypted_mem(void) { }
^
arch/x86/mm/init.c:866:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __weak mem_encrypt_free_decrypted_mem(void) { }
^
static
2 warnings generated.

vim +/x86_has_pat_wp +75 arch/x86/mm/init.c

73
74 /* Check that the write-protect PAT entry is set for write-protect */
> 75 bool x86_has_pat_wp(void)
76 {
77 return __pte2cachemode_tbl[_PAGE_CACHE_MODE_WP] == _PAGE_CACHE_MODE_WP;
78 }
79

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuil...@lists.01.org
.config.gz

Borislav Petkov

unread,
May 19, 2020, 4:55:14 PM5/19/20
to kbuild test robot, Christoph Hellwig, kbuil...@lists.01.org, clang-bu...@googlegroups.com, linux-...@vger.kernel.org, x...@kernel.org, Benjamin Thiel
On Wed, May 20, 2020 at 01:51:25AM +0800, kbuild test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/mm
> head: bd1de2a7aace4d1d312fb1be264b8fafdb706208
> commit: 1f6f655e01adebf5bd5e6c3da2e843c104ded051 [1/23] x86/mm: Add a x86_has_pat_wp() helper
> config: x86_64-randconfig-r012-20200519 (attached as .config)
> compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 135b877874fae96b4372c8a3fbfaa8ff44ff86e3)
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install x86_64 cross compiling tool for clang build
> # apt-get install binutils-x86-64-linux-gnu
> git checkout 1f6f655e01adebf5bd5e6c3da2e843c104ded051
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <l...@intel.com>
>
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
>
> >> arch/x86/mm/init.c:75:6: warning: no previous prototype for function 'x86_has_pat_wp' [-Wmissing-prototypes]
> bool x86_has_pat_wp(void)
> ^

Triggers with gcc too:

make W=1 arch/x86/mm/init.o

...

arch/x86/mm/init.c:81:6: warning: no previous prototype for ‘x86_has_pat_wp’ [-Wmissing-prototypes]
81 | bool x86_has_pat_wp(void)
| ^~~~~~~~~~~~~~


-Wmissing-prototypes is default off, though, dunno why clang 11 has it
on.

Anyway, something for Benni to fix. CCed and leaving the rest for him as
reference.

> arch/x86/mm/init.c:75:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
> bool x86_has_pat_wp(void)
> ^
> static
> arch/x86/mm/init.c:866:13: warning: no previous prototype for function 'mem_encrypt_free_decrypted_mem' [-Wmissing-prototypes]
> void __weak mem_encrypt_free_decrypted_mem(void) { }
> ^
> arch/x86/mm/init.c:866:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
> void __weak mem_encrypt_free_decrypted_mem(void) { }
> ^
> static
> 2 warnings generated.
>
> vim +/x86_has_pat_wp +75 arch/x86/mm/init.c
>
> 73
> 74 /* Check that the write-protect PAT entry is set for write-protect */
> > 75 bool x86_has_pat_wp(void)
> 76 {
> 77 return __pte2cachemode_tbl[_PAGE_CACHE_MODE_WP] == _PAGE_CACHE_MODE_WP;
> 78 }
> 79
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuil...@lists.01.org



--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Nathan Chancellor

unread,
May 19, 2020, 5:25:44 PM5/19/20
to Borislav Petkov, kbuild test robot, Christoph Hellwig, kbuil...@lists.01.org, clang-bu...@googlegroups.com, linux-...@vger.kernel.org, x...@kernel.org, Benjamin Thiel
It doesn't: https://godbolt.org/z/rU5_5H

I assume this is caused by some sort of internal change to the 0day
infrastructure (testing W=1?)

I cannot see this without adding W=1 to make at the listed commit with
the provided config.

Cheers,
Nathan

Nick Desaulniers

unread,
May 19, 2020, 6:12:38 PM5/19/20
to Masahiro Yamada, Philip Li, Borislav Petkov, kbuild test robot, Christoph Hellwig, kbuil...@lists.01.org, clang-built-linux, LKML, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Benjamin Thiel, Nathan Chancellor
Masahiro and Philip,
We're seeing a bunch of -Wmissing-prototypes warnings from 0day bot
suddenly today. Did something change on the Kbuild or 0day bot side?
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-li...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200519212541.GA3580016%40ubuntu-s3-xlarge-x86.



--
Thanks,
~Nick Desaulniers

Li, Philip

unread,
May 19, 2020, 7:49:19 PM5/19/20
to Nick Desaulniers, Masahiro Yamada, Borislav Petkov, lkp, Christoph Hellwig, kbuil...@lists.01.org, clang-built-linux, LKML, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Benjamin Thiel, Nathan Chancellor
> Subject: Re: [tip:x86/mm 1/23] arch/x86/mm/init.c:75:6: warning: no previous
> prototype for function 'x86_has_pat_wp'
>
> Masahiro and Philip,
> We're seeing a bunch of -Wmissing-prototypes warnings from 0day bot
> suddenly today. Did something change on the Kbuild or 0day bot side?
Hi Nick, W=1 was added to make. This leads to extra warnings.

Nick Desaulniers

unread,
May 19, 2020, 8:26:31 PM5/19/20
to Li, Philip, Masahiro Yamada, Borislav Petkov, lkp, Christoph Hellwig, kbuil...@lists.01.org, clang-built-linux, LKML, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Benjamin Thiel, Nathan Chancellor
On Tue, May 19, 2020 at 4:49 PM Li, Philip <phil...@intel.com> wrote:
>
> > Subject: Re: [tip:x86/mm 1/23] arch/x86/mm/init.c:75:6: warning: no previous
> > prototype for function 'x86_has_pat_wp'
> >
> > Masahiro and Philip,
> > We're seeing a bunch of -Wmissing-prototypes warnings from 0day bot
> > suddenly today. Did something change on the Kbuild or 0day bot side?
> Hi Nick, W=1 was added to make. This leads to extra warnings.

Ah, ok. Good to know the change is in 0day bot which rules out
changes to Kbuild and Clang.

It might be helpful to note in the email that this is a W=1 build,
since it's non obvious and cannot be set via config.

Generally, the kernel is not W=1 clean. I realize that 0day bot can
filter old vs new. Why -Wmissing-prototypes is a problem is that:
1. there are already many instances of it throughout the kernel;
references without forward declarations or correct includes.
2. it's easy for someone to call a function like code that already
exists in the translation unit they're touching.

So by adding another implicit call, they get warned for the whole
file. Generally, the fix is trivial; just include the correct header.
If that leads to tangly-sphagetti-limbo/circular includes, then raw
forward declarations can be used (though it's easy for those to get
out of sync, which can lead to spooky bugs).

I think having in the top of the warning that this is a W=1 build will
make it more obvious.

I get that -Wmissing-prototypes can be noisy, but it's trivial to fix.
I do worry what other warnings lurk in W=1 though...
--
Thanks,
~Nick Desaulniers

Philip Li

unread,
May 19, 2020, 8:53:41 PM5/19/20
to Nick Desaulniers, Masahiro Yamada, Borislav Petkov, lkp, Christoph Hellwig, kbuil...@lists.01.org, clang-built-linux, LKML, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Benjamin Thiel, Nathan Chancellor
On Tue, May 19, 2020 at 05:26:18PM -0700, Nick Desaulniers wrote:
> On Tue, May 19, 2020 at 4:49 PM Li, Philip <phil...@intel.com> wrote:
> >
> > > Subject: Re: [tip:x86/mm 1/23] arch/x86/mm/init.c:75:6: warning: no previous
> > > prototype for function 'x86_has_pat_wp'
> > >
> > > Masahiro and Philip,
> > > We're seeing a bunch of -Wmissing-prototypes warnings from 0day bot
> > > suddenly today. Did something change on the Kbuild or 0day bot side?
> > Hi Nick, W=1 was added to make. This leads to extra warnings.
>
> Ah, ok. Good to know the change is in 0day bot which rules out
> changes to Kbuild and Clang.
>
> It might be helpful to note in the email that this is a W=1 build,
> since it's non obvious and cannot be set via config.
thanks for reminding this, we will update the report info to reflect
this, e.g. part of reproduce step.

>
> Generally, the kernel is not W=1 clean. I realize that 0day bot can
got it, we have logic to limit that not to report too old error, so
the idea is to scan recent submitted patches.

> filter old vs new. Why -Wmissing-prototypes is a problem is that:
> 1. there are already many instances of it throughout the kernel;
> references without forward declarations or correct includes.
> 2. it's easy for someone to call a function like code that already
> exists in the translation unit they're touching.
>
> So by adding another implicit call, they get warned for the whole
> file. Generally, the fix is trivial; just include the correct header.
> If that leads to tangly-sphagetti-limbo/circular includes, then raw
> forward declarations can be used (though it's easy for those to get
> out of sync, which can lead to spooky bugs).
>
> I think having in the top of the warning that this is a W=1 build will
> make it more obvious.
>
> I get that -Wmissing-prototypes can be noisy, but it's trivial to fix.
> I do worry what other warnings lurk in W=1 though...
with some monitoring, so far, issue like unused-but-set-variable is quite
helpful. We will keep monitor for other issues and feedbacks.

Nick Desaulniers

unread,
May 19, 2020, 9:07:27 PM5/19/20
to Philip Li, Masahiro Yamada, Borislav Petkov, lkp, Christoph Hellwig, kbuil...@lists.01.org, clang-built-linux, LKML, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Benjamin Thiel, Nathan Chancellor
On Tue, May 19, 2020 at 5:53 PM Philip Li <phil...@intel.com> wrote:
>
> On Tue, May 19, 2020 at 05:26:18PM -0700, Nick Desaulniers wrote:
> > I think having in the top of the warning that this is a W=1 build will
> > make it more obvious.
> >
> > I get that -Wmissing-prototypes can be noisy, but it's trivial to fix.
> > I do worry what other warnings lurk in W=1 though...
> with some monitoring, so far, issue like unused-but-set-variable is quite
> helpful. We will keep monitor for other issues and feedbacks.

Hey, I'm always happy to see more warnings turned on. In our
experience, we had to get a sense of how many instances of a newly
enabled warning there are, and estimate how much time it would take to
fix them all. It's further complicated by the fix going into
different maintainers' trees and reaching mainline at different points
in time, while regressions continue to sneak in until the warning is
enabled.

It may be time to consider "promoting" some warnings from W=1 to be on
by default. But that takes careful manual review and estimation of
the work involved. Turning on W=1 may be blasting people with a lot
of new warnings, but if developers treat them with the same respect as
the default enabled ones for Kbuild then I'm not complaining.
--
Thanks,
~Nick Desaulniers

Philip Li

unread,
May 19, 2020, 9:25:30 PM5/19/20
to Nick Desaulniers, Masahiro Yamada, Borislav Petkov, lkp, Christoph Hellwig, kbuil...@lists.01.org, clang-built-linux, LKML, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Benjamin Thiel, Nathan Chancellor
On Tue, May 19, 2020 at 06:07:14PM -0700, Nick Desaulniers wrote:
> On Tue, May 19, 2020 at 5:53 PM Philip Li <phil...@intel.com> wrote:
> >
> > On Tue, May 19, 2020 at 05:26:18PM -0700, Nick Desaulniers wrote:
> > > I think having in the top of the warning that this is a W=1 build will
> > > make it more obvious.
> > >
> > > I get that -Wmissing-prototypes can be noisy, but it's trivial to fix.
> > > I do worry what other warnings lurk in W=1 though...
> > with some monitoring, so far, issue like unused-but-set-variable is quite
> > helpful. We will keep monitor for other issues and feedbacks.
>
> Hey, I'm always happy to see more warnings turned on. In our
> experience, we had to get a sense of how many instances of a newly
> enabled warning there are, and estimate how much time it would take to
> fix them all. It's further complicated by the fix going into
> different maintainers' trees and reaching mainline at different points
> in time, while regressions continue to sneak in until the warning is
> enabled.
thanks and agree all the thinking here. For the 0-day ci side, we will
be very careful, since the mechanism for us is to notify newly introduced
problems from developer's patch, this can allow relatively min effort
to solve the new problems.

The other consideration is we test a lot of developer's tree and mailing
list before they are upstream, we also hope such shift left testing can
expose these warnings in new patches before maintainer's trees. Of course,
there're extra reports due to W=1 against stable or mainline, while the
number is small comparing to developer and mailing list part.

Borislav Petkov

unread,
May 20, 2020, 1:19:30 PM5/20/20
to Nick Desaulniers, Philip Li, Masahiro Yamada, lkp, Christoph Hellwig, kbuil...@lists.01.org, clang-built-linux, LKML, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Benjamin Thiel, Nathan Chancellor
On Tue, May 19, 2020 at 06:07:14PM -0700, Nick Desaulniers wrote:
> It may be time to consider "promoting" some warnings from W=1 to be on
> by default.

That's the end goal with -Wmissing-prototypes for arch/x86/ at least.
We'll turn that on once all current warnings are fixed and won't allow
any more patches with it.

This is where the 0day bot would help with testing this but it really
should say that it is a W=1 build and should tone down the message
frequency as we're still very noisy.

Thx.
Reply all
Reply to author
Forward
0 new messages