* [linux-next:master 9529/10007] mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index'
@ 2021-06-15 15:58 kernel test robot
2021-06-15 16:03 ` Matthew Wilcox
0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2021-06-15 15:58 UTC (permalink / raw)
To: Hugh Dickins
Cc: kbuild-all, clang-built-linux, Linux Memory Management List,
Matthew Wilcox (Oracle), Andrew Morton
[-- Attachment #1: Type: text/plain, Size: 2506 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 19ae1f2bd9c091059f80646604ccef8a1e614f57
commit: 1878ae46bd82ef0403393aee4935f29c07d5848b [9529/10007] mm, futex: fix shared futex pgoff on shmem huge page
config: arm64-randconfig-r014-20210615 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 64720f57bea6a6bf033feef4a5751ab9c0c3b401)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=1878ae46bd82ef0403393aee4935f29c07d5848b
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 1878ae46bd82ef0403393aee4935f29c07d5848b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' [-Wmissing-prototypes]
pgoff_t hugetlb_basepage_index(struct page *page)
^
mm/hugetlb.c:1591:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
pgoff_t hugetlb_basepage_index(struct page *page)
^
static
include/linux/types.h:131:17: note: expanded from macro 'pgoff_t'
#define pgoff_t unsigned long
^
1 warning generated.
vim +/hugetlb_basepage_index +1591 mm/hugetlb.c
1590
> 1591 pgoff_t hugetlb_basepage_index(struct page *page)
1592 {
1593 struct page *page_head = compound_head(page);
1594 pgoff_t index = page_index(page_head);
1595 unsigned long compound_idx;
1596
1597 if (compound_order(page_head) >= MAX_ORDER)
1598 compound_idx = page_to_pfn(page) - page_to_pfn(page_head);
1599 else
1600 compound_idx = page - page_head;
1601
1602 return (index << compound_order(page_head)) + compound_idx;
1603 }
1604
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39030 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [linux-next:master 9529/10007] mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' 2021-06-15 15:58 [linux-next:master 9529/10007] mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' kernel test robot @ 2021-06-15 16:03 ` Matthew Wilcox 2021-06-15 18:32 ` Nathan Chancellor 0 siblings, 1 reply; 6+ messages in thread From: Matthew Wilcox @ 2021-06-15 16:03 UTC (permalink / raw) To: kernel test robot Cc: Hugh Dickins, kbuild-all, clang-built-linux, Linux Memory Management List, Andrew Morton On Tue, Jun 15, 2021 at 11:58:36PM +0800, kernel test robot wrote: > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > >> mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' [-Wmissing-prototypes] > pgoff_t hugetlb_basepage_index(struct page *page) So clang requires the prototype to still be in scope, while gcc doesn't. Does one of our clangers want to file a bug about that? ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [linux-next:master 9529/10007] mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' 2021-06-15 16:03 ` Matthew Wilcox @ 2021-06-15 18:32 ` Nathan Chancellor 2021-06-15 18:50 ` Nick Desaulniers 0 siblings, 1 reply; 6+ messages in thread From: Nathan Chancellor @ 2021-06-15 18:32 UTC (permalink / raw) To: Matthew Wilcox Cc: kernel test robot, Hugh Dickins, kbuild-all, clang-built-linux, Linux Memory Management List, Andrew Morton On Tue, Jun 15, 2021 at 05:03:40PM +0100, Matthew Wilcox wrote: > On Tue, Jun 15, 2021 at 11:58:36PM +0800, kernel test robot wrote: > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > > > If you fix the issue, kindly add following tag as appropriate > > Reported-by: kernel test robot <lkp@intel.com> > > > > All warnings (new ones prefixed by >>): > > > > >> mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' [-Wmissing-prototypes] > > pgoff_t hugetlb_basepage_index(struct page *page) > > So clang requires the prototype to still be in scope, while gcc doesn't. > Does one of our clangers want to file a bug about that? I see the exact same warning with GCC 11.1.0: $ curl -LSs https://lore.kernel.org/linux-mm/202106152328.Mh5S48hE-lkp@intel.com/2-a.bin | gzip -d > .config $ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux- W=1 olddefconfig mm/hugetlb.c mm/hugetlb.c:1591:9: warning: no previous prototype for 'hugetlb_basepage_index' [-Wmissing-prototypes] 1591 | pgoff_t hugetlb_basepage_index(struct page *page) | ^~~~~~~~~~~~~~~~~~~~~~ Cheers, Nathan ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [linux-next:master 9529/10007] mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' 2021-06-15 18:32 ` Nathan Chancellor @ 2021-06-15 18:50 ` Nick Desaulniers 2021-06-15 19:01 ` Matthew Wilcox 0 siblings, 1 reply; 6+ messages in thread From: Nick Desaulniers @ 2021-06-15 18:50 UTC (permalink / raw) To: Nathan Chancellor Cc: Matthew Wilcox, kernel test robot, Hugh Dickins, kbuild-all, clang-built-linux, Linux Memory Management List, Andrew Morton On Tue, Jun 15, 2021 at 11:32 AM Nathan Chancellor <nathan@kernel.org> wrote: > > On Tue, Jun 15, 2021 at 05:03:40PM +0100, Matthew Wilcox wrote: > > On Tue, Jun 15, 2021 at 11:58:36PM +0800, kernel test robot wrote: > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > > > > > If you fix the issue, kindly add following tag as appropriate > > > Reported-by: kernel test robot <lkp@intel.com> > > > > > > All warnings (new ones prefixed by >>): > > > > > > >> mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' [-Wmissing-prototypes] > > > pgoff_t hugetlb_basepage_index(struct page *page) > > > > So clang requires the prototype to still be in scope, while gcc doesn't. > > Does one of our clangers want to file a bug about that? > > I see the exact same warning with GCC 11.1.0: > > $ curl -LSs https://lore.kernel.org/linux-mm/202106152328.Mh5S48hE-lkp@intel.com/2-a.bin | gzip -d > .config > > $ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux- W=1 olddefconfig mm/hugetlb.c > mm/hugetlb.c:1591:9: warning: no previous prototype for 'hugetlb_basepage_index' [-Wmissing-prototypes] > 1591 | pgoff_t hugetlb_basepage_index(struct page *page) > | ^~~~~~~~~~~~~~~~~~~~~~ Since this is a commonly recurring warning for W=1 builds, then this function either should be declared as having static linkage if its uses are local to the same file, or a prototype should be declared in a header so that callers and callee agree on function signature. -- Thanks, ~Nick Desaulniers ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [linux-next:master 9529/10007] mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' 2021-06-15 18:50 ` Nick Desaulniers @ 2021-06-15 19:01 ` Matthew Wilcox 2021-06-15 23:37 ` Hugh Dickins 0 siblings, 1 reply; 6+ messages in thread From: Matthew Wilcox @ 2021-06-15 19:01 UTC (permalink / raw) To: Nick Desaulniers Cc: Nathan Chancellor, kernel test robot, Hugh Dickins, kbuild-all, clang-built-linux, Linux Memory Management List, Andrew Morton On Tue, Jun 15, 2021 at 11:50:40AM -0700, Nick Desaulniers wrote: > On Tue, Jun 15, 2021 at 11:32 AM Nathan Chancellor <nathan@kernel.org> wrote: > > > > On Tue, Jun 15, 2021 at 05:03:40PM +0100, Matthew Wilcox wrote: > > > On Tue, Jun 15, 2021 at 11:58:36PM +0800, kernel test robot wrote: > > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > > > > > > > If you fix the issue, kindly add following tag as appropriate > > > > Reported-by: kernel test robot <lkp@intel.com> > > > > > > > > All warnings (new ones prefixed by >>): > > > > > > > > >> mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' [-Wmissing-prototypes] > > > > pgoff_t hugetlb_basepage_index(struct page *page) > > > > > > So clang requires the prototype to still be in scope, while gcc doesn't. > > > Does one of our clangers want to file a bug about that? > > > > I see the exact same warning with GCC 11.1.0: > > > > $ curl -LSs https://lore.kernel.org/linux-mm/202106152328.Mh5S48hE-lkp@intel.com/2-a.bin | gzip -d > .config > > > > $ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux- W=1 olddefconfig mm/hugetlb.c > > mm/hugetlb.c:1591:9: warning: no previous prototype for 'hugetlb_basepage_index' [-Wmissing-prototypes] > > 1591 | pgoff_t hugetlb_basepage_index(struct page *page) > > | ^~~~~~~~~~~~~~~~~~~~~~ > > Since this is a commonly recurring warning for W=1 builds, then this > function either should be declared as having static linkage if its > uses are local to the same file, or a prototype should be declared in > a header so that callers and callee agree on function signature. Oh, you haven't understood the problem. static inline int bar(void) { int foo(void); return foo(); } int foo(void) { return 1; } The prototype isn't _missing_. It's just no longer in scope. Since gcc and clang behave the same way here, we should adjust the source to make foo visible outside bar. But this is a case where both compilers are wrong. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [linux-next:master 9529/10007] mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' 2021-06-15 19:01 ` Matthew Wilcox @ 2021-06-15 23:37 ` Hugh Dickins 0 siblings, 0 replies; 6+ messages in thread From: Hugh Dickins @ 2021-06-15 23:37 UTC (permalink / raw) To: Matthew Wilcox Cc: Nick Desaulniers, Nathan Chancellor, kernel test robot, Hugh Dickins, kbuild-all, clang-built-linux, Linux Memory Management List, Andrew Morton [-- Attachment #1: Type: text/plain, Size: 3448 bytes --] On Tue, 15 Jun 2021, Matthew Wilcox wrote: > On Tue, Jun 15, 2021 at 11:50:40AM -0700, Nick Desaulniers wrote: > > On Tue, Jun 15, 2021 at 11:32 AM Nathan Chancellor <nathan@kernel.org> wrote: > > > On Tue, Jun 15, 2021 at 05:03:40PM +0100, Matthew Wilcox wrote: > > > > On Tue, Jun 15, 2021 at 11:58:36PM +0800, kernel test robot wrote: > > > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > > > > > > > > > If you fix the issue, kindly add following tag as appropriate > > > > > Reported-by: kernel test robot <lkp@intel.com> > > > > > > > > > > All warnings (new ones prefixed by >>): > > > > > > > > > > >> mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' [-Wmissing-prototypes] > > > > > pgoff_t hugetlb_basepage_index(struct page *page) > > > > > > > > So clang requires the prototype to still be in scope, while gcc doesn't. > > > > Does one of our clangers want to file a bug about that? > > > > > > I see the exact same warning with GCC 11.1.0: > > > > > > $ curl -LSs https://lore.kernel.org/linux-mm/202106152328.Mh5S48hE-lkp@intel.com/2-a.bin | gzip -d > .config > > > > > > $ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux- W=1 olddefconfig mm/hugetlb.c > > > mm/hugetlb.c:1591:9: warning: no previous prototype for 'hugetlb_basepage_index' [-Wmissing-prototypes] > > > 1591 | pgoff_t hugetlb_basepage_index(struct page *page) > > > | ^~~~~~~~~~~~~~~~~~~~~~ > > > > Since this is a commonly recurring warning for W=1 builds, then this > > function either should be declared as having static linkage if its > > uses are local to the same file, or a prototype should be declared in > > a header so that callers and callee agree on function signature. > > Oh, you haven't understood the problem. > > static inline int bar(void) > { > int foo(void); > > return foo(); > } > > int foo(void) { return 1; } > > The prototype isn't _missing_. It's just no longer in scope. > > Since gcc and clang behave the same way here, we should adjust the source > to make foo visible outside bar. But this is a case where both compilers > are wrong. I guess I'd better start W=1-ing - not my habit before, sorry. I can't tell what's right or wrong for the compiler, but it sure is odd that if I add a bogus ", int flags" to hugetlb_basepage_index() in mm/hugetlb.c, then building with gcc (10) and W=1 says CC mm/hugetlb.o mm/hugetlb.c:1591:9: warning: no previous prototype for ‘hugetlb_basepage_index’ [-Wmissing-prototypes] 1591 | pgoff_t hugetlb_basepage_index(struct page *page, int flags) | ^~~~~~~~~~~~~~~~~~~~~~ mm/hugetlb.c:1591:9: error: conflicting types for ‘hugetlb_basepage_index’ In file included from mm/hugetlb.c:14: ./include/linux/pagemap.h:543:18: note: previous declaration of ‘hugetlb_basepage_index’ was here 543 | extern pgoff_t hugetlb_basepage_index(struct page *page); | ^~~~~~~~~~~~~~~~~~~~~~ So, it manages to conflict with no previous prototype! (I didn't try clang with W=1, presumably similar.) Both gcc and clang with W=0 do issue the conflicting types error, as I hoped and assumed that they would when I put in the prototype. Oh well, thanks for moving it Matthew: whatever the rights and wrongs, neither of us want to be generating unnecessary noise. Hugh ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-06-15 23:37 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-06-15 15:58 [linux-next:master 9529/10007] mm/hugetlb.c:1591:9: warning: no previous prototype for function 'hugetlb_basepage_index' kernel test robot 2021-06-15 16:03 ` Matthew Wilcox 2021-06-15 18:32 ` Nathan Chancellor 2021-06-15 18:50 ` Nick Desaulniers 2021-06-15 19:01 ` Matthew Wilcox 2021-06-15 23:37 ` Hugh Dickins
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).