* [saeed:net-next 154/185] net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init'
@ 2022-03-08 2:43 kernel test robot
2022-03-08 5:16 ` dust.li
0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2022-03-08 2:43 UTC (permalink / raw)
To: Dust Li; +Cc: kbuild-all, linux-kernel
tree: https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git net-next
head: 03200f4a126b1a08c0f16dea7f67e6bff9c83c90
commit: 7de8eb0d9039f16e1122d7aa524a1502a160c4ff [154/185] net/smc: fix compile warning for smc_sysctl
config: arc-randconfig-r016-20220308 (https://download.01.org/0day-ci/archive/20220308/202203081012.KgONXWsS-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.0
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
# https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git/commit/?id=7de8eb0d9039f16e1122d7aa524a1502a160c4ff
git remote add saeed https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git
git fetch --no-tags saeed net-next
git checkout 7de8eb0d9039f16e1122d7aa524a1502a160c4ff
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash net/
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 >>):
In file included from net/smc/af_smc.c:54:
>> net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init' [-Wmissing-prototypes]
23 | int __net_init smc_sysctl_net_init(struct net *net)
| ^~~~~~~~~~~~~~~~~~~
>> net/smc/smc_sysctl.h:29:17: warning: no previous prototype for 'smc_sysctl_net_exit' [-Wmissing-prototypes]
29 | void __net_exit smc_sysctl_net_exit(struct net *net) { }
| ^~~~~~~~~~~~~~~~~~~
vim +/smc_sysctl_net_init +23 net/smc/smc_sysctl.h
22
> 23 int __net_init smc_sysctl_net_init(struct net *net)
24 {
25 net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
26 return 0;
27 }
28
> 29 void __net_exit smc_sysctl_net_exit(struct net *net) { }
30
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [saeed:net-next 154/185] net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init'
2022-03-08 2:43 [saeed:net-next 154/185] net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init' kernel test robot
@ 2022-03-08 5:16 ` dust.li
2022-03-08 5:25 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: dust.li @ 2022-03-08 5:16 UTC (permalink / raw)
To: kernel test robot, kuba; +Cc: kbuild-all, linux-kernel
On Tue, Mar 08, 2022 at 10:43:56AM +0800, kernel test robot wrote:
>tree: https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git net-next
>head: 03200f4a126b1a08c0f16dea7f67e6bff9c83c90
>commit: 7de8eb0d9039f16e1122d7aa524a1502a160c4ff [154/185] net/smc: fix compile warning for smc_sysctl
>config: arc-randconfig-r016-20220308 (https://download.01.org/0day-ci/archive/20220308/202203081012.KgONXWsS-lkp@intel.com/config)
>compiler: arceb-elf-gcc (GCC) 11.2.0
>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
> # https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git/commit/?id=7de8eb0d9039f16e1122d7aa524a1502a160c4ff
> git remote add saeed https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git
> git fetch --no-tags saeed net-next
> git checkout 7de8eb0d9039f16e1122d7aa524a1502a160c4ff
> # save the config file to linux build tree
> mkdir build_dir
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash net/
>
>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 >>):
>
> In file included from net/smc/af_smc.c:54:
>>> net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init' [-Wmissing-prototypes]
> 23 | int __net_init smc_sysctl_net_init(struct net *net)
> | ^~~~~~~~~~~~~~~~~~~
>>> net/smc/smc_sysctl.h:29:17: warning: no previous prototype for 'smc_sysctl_net_exit' [-Wmissing-prototypes]
> 29 | void __net_exit smc_sysctl_net_exit(struct net *net) { }
> | ^~~~~~~~~~~~~~~~~~~
I found this -Wmissing-prototypes is added to the compiler if W=1 is set.
I didn't check W=1 before because I found there are lots of warnings with
the current code.
I will add this W=1 to my checking script and make sure no warnings introduced
by my patch next time.
>
>
>vim +/smc_sysctl_net_init +23 net/smc/smc_sysctl.h
>
> 22
> > 23 int __net_init smc_sysctl_net_init(struct net *net)
> 24 {
> 25 net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
> 26 return 0;
> 27 }
> 28
> > 29 void __net_exit smc_sysctl_net_exit(struct net *net) { }
> 30
Hi Jakub:
Sorry to bother again on this !
Looks like we still need to add 'static inline' or add an extra
declaration for these 2 functions if we want to get rid of these warnings.
What do you think ?
Thanks
>
>---
>0-DAY CI Kernel Test Service, Intel Corporation
>https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [saeed:net-next 154/185] net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init'
2022-03-08 5:16 ` dust.li
@ 2022-03-08 5:25 ` Jakub Kicinski
2022-03-08 6:24 ` dust.li
2022-03-09 3:30 ` dust.li
0 siblings, 2 replies; 5+ messages in thread
From: Jakub Kicinski @ 2022-03-08 5:25 UTC (permalink / raw)
To: dust.li; +Cc: kernel test robot, kbuild-all, linux-kernel
On Tue, 8 Mar 2022 13:16:55 +0800 dust.li wrote:
> >vim +/smc_sysctl_net_init +23 net/smc/smc_sysctl.h
> >
> > 22
> > > 23 int __net_init smc_sysctl_net_init(struct net *net)
> > 24 {
> > 25 net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
> > 26 return 0;
> > 27 }
> > 28
> > > 29 void __net_exit smc_sysctl_net_exit(struct net *net) { }
> > 30
>
> Hi Jakub:
>
> Sorry to bother again on this !
> Looks like we still need to add 'static inline' or add an extra
> declaration for these 2 functions if we want to get rid of these warnings.
> What do you think ?
Sorry my comment was pretty unclear an unnecessary.
I meant that you don't need the __net_init annotation, it still
needs to be a static inline. So this is what I meant:
diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
index 1d554300604d..0becc11bd2f4 100644
--- a/net/smc/smc_sysctl.h
+++ b/net/smc/smc_sysctl.h
@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net);
#else
-int __net_init smc_sysctl_net_init(struct net *net)
+static inline int smc_sysctl_net_init(struct net *net)
{
net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
return 0;
}
-void __net_exit smc_sysctl_net_exit(struct net *net) { }
+static inline void smc_sysctl_net_exit(struct net *net) { }
#endif /* CONFIG_SYSCTL */
But really it does not matter if the __net_init / exit is there,
so this works too:
diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
index 1d554300604d..6979e7173669 100644
--- a/net/smc/smc_sysctl.h
+++ b/net/smc/smc_sysctl.h
@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net);
#else
-int __net_init smc_sysctl_net_init(struct net *net)
+static inline int __net_init smc_sysctl_net_init(struct net *net)
{
net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
return 0;
}
-void __net_exit smc_sysctl_net_exit(struct net *net) { }
+static inline void __net_exit smc_sysctl_net_exit(struct net *net) { }
#endif /* CONFIG_SYSCTL */
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [saeed:net-next 154/185] net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init'
2022-03-08 5:25 ` Jakub Kicinski
@ 2022-03-08 6:24 ` dust.li
2022-03-09 3:30 ` dust.li
1 sibling, 0 replies; 5+ messages in thread
From: dust.li @ 2022-03-08 6:24 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: kernel test robot, kbuild-all, linux-kernel
On Mon, Mar 07, 2022 at 09:25:20PM -0800, Jakub Kicinski wrote:
>On Tue, 8 Mar 2022 13:16:55 +0800 dust.li wrote:
>> >vim +/smc_sysctl_net_init +23 net/smc/smc_sysctl.h
>> >
>> > 22
>> > > 23 int __net_init smc_sysctl_net_init(struct net *net)
>> > 24 {
>> > 25 net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
>> > 26 return 0;
>> > 27 }
>> > 28
>> > > 29 void __net_exit smc_sysctl_net_exit(struct net *net) { }
>> > 30
>>
>> Hi Jakub:
>>
>> Sorry to bother again on this !
>> Looks like we still need to add 'static inline' or add an extra
>> declaration for these 2 functions if we want to get rid of these warnings.
>> What do you think ?
>
>Sorry my comment was pretty unclear an unnecessary.
>
>I meant that you don't need the __net_init annotation, it still
>needs to be a static inline. So this is what I meant:
Ah, I see. Thanks for your detailed explanation.
I will post another fix.
>
>diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
>index 1d554300604d..0becc11bd2f4 100644
>--- a/net/smc/smc_sysctl.h
>+++ b/net/smc/smc_sysctl.h
>@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net);
>
> #else
>
>-int __net_init smc_sysctl_net_init(struct net *net)
>+static inline int smc_sysctl_net_init(struct net *net)
> {
> net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
> return 0;
> }
>
>-void __net_exit smc_sysctl_net_exit(struct net *net) { }
>+static inline void smc_sysctl_net_exit(struct net *net) { }
>
> #endif /* CONFIG_SYSCTL */
>
>
>
>But really it does not matter if the __net_init / exit is there,
>so this works too:
>
>diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
>index 1d554300604d..6979e7173669 100644
>--- a/net/smc/smc_sysctl.h
>+++ b/net/smc/smc_sysctl.h
>@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net);
>
> #else
>
>-int __net_init smc_sysctl_net_init(struct net *net)
>+static inline int __net_init smc_sysctl_net_init(struct net *net)
> {
> net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
> return 0;
> }
>
>-void __net_exit smc_sysctl_net_exit(struct net *net) { }
>+static inline void __net_exit smc_sysctl_net_exit(struct net *net) { }
>
> #endif /* CONFIG_SYSCTL */
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [saeed:net-next 154/185] net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init'
2022-03-08 5:25 ` Jakub Kicinski
2022-03-08 6:24 ` dust.li
@ 2022-03-09 3:30 ` dust.li
1 sibling, 0 replies; 5+ messages in thread
From: dust.li @ 2022-03-09 3:30 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: kernel test robot, kbuild-all, linux-kernel
On Mon, Mar 07, 2022 at 09:25:20PM -0800, Jakub Kicinski wrote:
>On Tue, 8 Mar 2022 13:16:55 +0800 dust.li wrote:
>> >vim +/smc_sysctl_net_init +23 net/smc/smc_sysctl.h
>> >
>> > 22
>> > > 23 int __net_init smc_sysctl_net_init(struct net *net)
>> > 24 {
>> > 25 net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
>> > 26 return 0;
>> > 27 }
>> > 28
>> > > 29 void __net_exit smc_sysctl_net_exit(struct net *net) { }
>> > 30
>>
>> Hi Jakub:
>>
>> Sorry to bother again on this !
>> Looks like we still need to add 'static inline' or add an extra
>> declaration for these 2 functions if we want to get rid of these warnings.
>> What do you think ?
>
>Sorry my comment was pretty unclear an unnecessary.
>
>I meant that you don't need the __net_init annotation, it still
>needs to be a static inline. So this is what I meant:
>
>diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
>index 1d554300604d..0becc11bd2f4 100644
>--- a/net/smc/smc_sysctl.h
>+++ b/net/smc/smc_sysctl.h
>@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net);
>
> #else
>
>-int __net_init smc_sysctl_net_init(struct net *net)
>+static inline int smc_sysctl_net_init(struct net *net)
> {
> net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
> return 0;
> }
>
>-void __net_exit smc_sysctl_net_exit(struct net *net) { }
>+static inline void smc_sysctl_net_exit(struct net *net) { }
>
> #endif /* CONFIG_SYSCTL */
>
>
>
>But really it does not matter if the __net_init / exit is there,
>so this works too:
Another small comment:
When re-compile with the W=1, I found '__net_exit' has noinline
annotation when CONFIG_NET_NS not set:
#define __net_exit __ref
#define __ref __section(".ref.text") noinline
If '__net_exit' is used together with 'static inline', the compiler
would give another warning:
net/smc/smc_sysctl.h:29:58: warning: ignoring attribute ‘gnu_inline’
because it conflicts with attribute ‘noinline’ [-Wattributes]
29 | static inline void __net_exit smc_sysctl_net_exit(struct net
*net) { }
So I think your first version would be good.
Thanks.
>
>diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
>index 1d554300604d..6979e7173669 100644
>--- a/net/smc/smc_sysctl.h
>+++ b/net/smc/smc_sysctl.h
>@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net);
>
> #else
>
>-int __net_init smc_sysctl_net_init(struct net *net)
>+static inline int __net_init smc_sysctl_net_init(struct net *net)
> {
> net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
> return 0;
> }
>
>-void __net_exit smc_sysctl_net_exit(struct net *net) { }
>+static inline void __net_exit smc_sysctl_net_exit(struct net *net) { }
>
> #endif /* CONFIG_SYSCTL */
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-09 3:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 2:43 [saeed:net-next 154/185] net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init' kernel test robot
2022-03-08 5:16 ` dust.li
2022-03-08 5:25 ` Jakub Kicinski
2022-03-08 6:24 ` dust.li
2022-03-09 3:30 ` dust.li
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).