All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net/smc: fix compile warning for smc_sysctl
@ 2022-03-02  3:43 Dust Li
  2022-03-02  5:49 ` Tony Lu
  2022-03-02 15:02 ` kernel test robot
  0 siblings, 2 replies; 7+ messages in thread
From: Dust Li @ 2022-03-02  3:43 UTC (permalink / raw)
  To: Karsten Graul, Tony Lu, davem, kuba; +Cc: netdev, linux-s390, linux-rdma

Fix build:

   In file included from net/smc/smc_sysctl.c:17:
>> net/smc/smc_sysctl.h:23:5: warning: no previous prototype \
	for function 'smc_sysctl_init' [-Wmissing-prototypes]
   int smc_sysctl_init(void)
       ^

and

>> WARNING: modpost: vmlinux.o(.text+0x12ced2d): Section mismatch \
in reference from the function smc_sysctl_exit() to the variable
.init.data:smc_sysctl_ops
The function smc_sysctl_exit() references
the variable __initdata smc_sysctl_ops.
This is often because smc_sysctl_exit lacks a __initdata
annotation or the annotation of smc_sysctl_ops is wrong.

Fixes: 462791bbfa35 ("net/smc: add sysctl interface for SMC")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
---
 net/smc/smc_sysctl.c | 4 ++--
 net/smc/smc_sysctl.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c
index 3b59876aaac9..e6f926757ecb 100644
--- a/net/smc/smc_sysctl.c
+++ b/net/smc/smc_sysctl.c
@@ -69,12 +69,12 @@ static struct pernet_operations smc_sysctl_ops __net_initdata = {
 	.exit = smc_sysctl_exit_net,
 };
 
-int __init smc_sysctl_init(void)
+int __net_init smc_sysctl_init(void)
 {
 	return register_pernet_subsys(&smc_sysctl_ops);
 }
 
-void smc_sysctl_exit(void)
+void __net_exit smc_sysctl_exit(void)
 {
 	unregister_pernet_subsys(&smc_sysctl_ops);
 }
diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
index 49553ac236b6..8914278ac870 100644
--- a/net/smc/smc_sysctl.h
+++ b/net/smc/smc_sysctl.h
@@ -20,12 +20,12 @@ void smc_sysctl_exit(void);
 
 #else
 
-int smc_sysctl_init(void)
+static inline int smc_sysctl_init(void)
 {
 	return 0;
 }
 
-void smc_sysctl_exit(void) { }
+static inline void smc_sysctl_exit(void) { }
 
 #endif /* CONFIG_SYSCTL */
 
-- 
2.19.1.3.ge56e4f7


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] net/smc: fix compile warning for smc_sysctl
  2022-03-02  3:43 [PATCH net-next] net/smc: fix compile warning for smc_sysctl Dust Li
@ 2022-03-02  5:49 ` Tony Lu
  2022-03-02 15:02 ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: Tony Lu @ 2022-03-02  5:49 UTC (permalink / raw)
  To: Dust Li; +Cc: Karsten Graul, davem, kuba, netdev, linux-s390, linux-rdma

On Wed, Mar 02, 2022 at 11:43:12AM +0800, Dust Li wrote:
> Fix build:
> 
>    In file included from net/smc/smc_sysctl.c:17:
> >> net/smc/smc_sysctl.h:23:5: warning: no previous prototype \
> 	for function 'smc_sysctl_init' [-Wmissing-prototypes]
>    int smc_sysctl_init(void)
>        ^
> 
> and
> 
> >> WARNING: modpost: vmlinux.o(.text+0x12ced2d): Section mismatch \
> in reference from the function smc_sysctl_exit() to the variable
> .init.data:smc_sysctl_ops
> The function smc_sysctl_exit() references
> the variable __initdata smc_sysctl_ops.
> This is often because smc_sysctl_exit lacks a __initdata
> annotation or the annotation of smc_sysctl_ops is wrong.
> 
> Fixes: 462791bbfa35 ("net/smc: add sysctl interface for SMC")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Dust Li <dust.li@linux.alibaba.com>

Thanks for the fixing.

Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] net/smc: fix compile warning for smc_sysctl
  2022-03-02  3:43 [PATCH net-next] net/smc: fix compile warning for smc_sysctl Dust Li
  2022-03-02  5:49 ` Tony Lu
@ 2022-03-02 15:02 ` kernel test robot
  2022-03-02 19:45     ` Jakub Kicinski
  1 sibling, 1 reply; 7+ messages in thread
From: kernel test robot @ 2022-03-02 15:02 UTC (permalink / raw)
  To: Dust Li, Karsten Graul, Tony Lu, davem, kuba
  Cc: kbuild-all, netdev, linux-s390, linux-rdma

Hi Dust,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Dust-Li/net-smc-fix-compile-warning-for-smc_sysctl/20220302-114411
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 7282c126f7688f697d33f3b965c29bba67fb4eba
config: sparc-buildonly-randconfig-r005-20220302 (https://download.01.org/0day-ci/archive/20220302/202203022234.AMB3WcyJ-lkp@intel.com/config)
compiler: sparc64-linux-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://github.com/0day-ci/linux/commit/4b16b08f4709ad49412ee1df69b6922a370dad46
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Dust-Li/net-smc-fix-compile-warning-for-smc_sysctl/20220302-114411
        git checkout 4b16b08f4709ad49412ee1df69b6922a370dad46
        # 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=sparc SHELL=/bin/bash net/smc/

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 >>):

   net/smc/smc_sysctl.c: In function 'smc_sysctl_init_net':
   net/smc/smc_sysctl.c:47:17: error: 'struct netns_smc' has no member named 'smc_hdr'
      47 |         net->smc.smc_hdr = register_net_sysctl(net, "net/smc", table);
         |                 ^
   net/smc/smc_sysctl.c:48:22: error: 'struct netns_smc' has no member named 'smc_hdr'
      48 |         if (!net->smc.smc_hdr)
         |                      ^
   net/smc/smc_sysctl.c: In function 'smc_sysctl_exit_net':
   net/smc/smc_sysctl.c:64:45: error: 'struct netns_smc' has no member named 'smc_hdr'
      64 |         unregister_net_sysctl_table(net->smc.smc_hdr);
         |                                             ^
   net/smc/smc_sysctl.c: At top level:
   net/smc/smc_sysctl.c:72:16: error: redefinition of 'smc_sysctl_init'
      72 | int __net_init smc_sysctl_init(void)
         |                ^~~~~~~~~~~~~~~
   In file included from net/smc/smc_sysctl.c:18:
   net/smc/smc_sysctl.h:23:19: note: previous definition of 'smc_sysctl_init' with type 'int(void)'
      23 | static inline int smc_sysctl_init(void)
         |                   ^~~~~~~~~~~~~~~
>> net/smc/smc_sysctl.c:78:1: warning: ignoring attribute 'noinline' because it conflicts with attribute 'gnu_inline' [-Wattributes]
      78 | {
         | ^
   In file included from net/smc/smc_sysctl.c:18:
   net/smc/smc_sysctl.h:28:20: note: previous declaration here
      28 | static inline void smc_sysctl_exit(void) { }
         |                    ^~~~~~~~~~~~~~~
   net/smc/smc_sysctl.c:77:17: error: redefinition of 'smc_sysctl_exit'
      77 | void __net_exit smc_sysctl_exit(void)
         |                 ^~~~~~~~~~~~~~~
   In file included from net/smc/smc_sysctl.c:18:
   net/smc/smc_sysctl.h:28:20: note: previous definition of 'smc_sysctl_exit' with type 'void(void)'
      28 | static inline void smc_sysctl_exit(void) { }
         |                    ^~~~~~~~~~~~~~~


vim +78 net/smc/smc_sysctl.c

462791bbfa35018 Dust Li 2022-03-01  76  
4b16b08f4709ad4 Dust Li 2022-03-02  77  void __net_exit smc_sysctl_exit(void)
462791bbfa35018 Dust Li 2022-03-01 @78  {

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] net/smc: fix compile warning for smc_sysctl
  2022-03-02 15:02 ` kernel test robot
@ 2022-03-02 19:45     ` Jakub Kicinski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2022-03-02 19:45 UTC (permalink / raw)
  To: kernel test robot
  Cc: Dust Li, Karsten Graul, Tony Lu, davem, kbuild-all, netdev,
	linux-s390, linux-rdma

On Wed, 2 Mar 2022 23:02:23 +0800 kernel test robot wrote:
>    In file included from net/smc/smc_sysctl.c:18:
>    net/smc/smc_sysctl.h:23:19: note: previous definition of 'smc_sysctl_init' with type 'int(void)'
>       23 | static inline int smc_sysctl_init(void)
>          |                   ^~~~~~~~~~~~~~~
> >> net/smc/smc_sysctl.c:78:1: warning: ignoring attribute 'noinline' because it conflicts with attribute 'gnu_inline' [-Wattributes]  
>       78 | {
>          | ^

The __net_init / __net_exit attr has to go on the prototype as well.

This doesn't look right, tho, why __net_* attrs?  You call those
functions from the module init/exit. __net_ is for namespace code.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] net/smc: fix compile warning for smc_sysctl
@ 2022-03-02 19:45     ` Jakub Kicinski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2022-03-02 19:45 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

On Wed, 2 Mar 2022 23:02:23 +0800 kernel test robot wrote:
>    In file included from net/smc/smc_sysctl.c:18:
>    net/smc/smc_sysctl.h:23:19: note: previous definition of 'smc_sysctl_init' with type 'int(void)'
>       23 | static inline int smc_sysctl_init(void)
>          |                   ^~~~~~~~~~~~~~~
> >> net/smc/smc_sysctl.c:78:1: warning: ignoring attribute 'noinline' because it conflicts with attribute 'gnu_inline' [-Wattributes]  
>       78 | {
>          | ^

The __net_init / __net_exit attr has to go on the prototype as well.

This doesn't look right, tho, why __net_* attrs?  You call those
functions from the module init/exit. __net_ is for namespace code.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] net/smc: fix compile warning for smc_sysctl
  2022-03-02 19:45     ` Jakub Kicinski
@ 2022-03-03  2:35       ` dust.li
  -1 siblings, 0 replies; 7+ messages in thread
From: dust.li @ 2022-03-03  2:35 UTC (permalink / raw)
  To: Jakub Kicinski, kernel test robot
  Cc: Karsten Graul, Tony Lu, davem, kbuild-all, netdev, linux-s390,
	linux-rdma

On Wed, Mar 02, 2022 at 11:45:03AM -0800, Jakub Kicinski wrote:
>On Wed, 2 Mar 2022 23:02:23 +0800 kernel test robot wrote:
>>    In file included from net/smc/smc_sysctl.c:18:
>>    net/smc/smc_sysctl.h:23:19: note: previous definition of 'smc_sysctl_init' with type 'int(void)'
>>       23 | static inline int smc_sysctl_init(void)
>>          |                   ^~~~~~~~~~~~~~~
>> >> net/smc/smc_sysctl.c:78:1: warning: ignoring attribute 'noinline' because it conflicts with attribute 'gnu_inline' [-Wattributes]  
>>       78 | {
>>          | ^
>
>The __net_init / __net_exit attr has to go on the prototype as well.

Thanks a lot for pointing out !

>
>This doesn't look right, tho, why __net_* attrs?  You call those
>functions from the module init/exit. __net_ is for namespace code.

Yes, I made the mistake and mixes up smc_sysctl_{init|exit}() with
smc_sysctl_{init|exit}_net when doing the quick fix...

And my check script with neither allyesconfig/allnoconfig nor defconfig
reproduced this.
This happens when CONFIG_SMC=y|m and CONFIG_SYSCTL is not set.

I will send a v2.

Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] net/smc: fix compile warning for smc_sysctl
@ 2022-03-03  2:35       ` dust.li
  0 siblings, 0 replies; 7+ messages in thread
From: dust.li @ 2022-03-03  2:35 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]

On Wed, Mar 02, 2022 at 11:45:03AM -0800, Jakub Kicinski wrote:
>On Wed, 2 Mar 2022 23:02:23 +0800 kernel test robot wrote:
>>    In file included from net/smc/smc_sysctl.c:18:
>>    net/smc/smc_sysctl.h:23:19: note: previous definition of 'smc_sysctl_init' with type 'int(void)'
>>       23 | static inline int smc_sysctl_init(void)
>>          |                   ^~~~~~~~~~~~~~~
>> >> net/smc/smc_sysctl.c:78:1: warning: ignoring attribute 'noinline' because it conflicts with attribute 'gnu_inline' [-Wattributes]  
>>       78 | {
>>          | ^
>
>The __net_init / __net_exit attr has to go on the prototype as well.

Thanks a lot for pointing out !

>
>This doesn't look right, tho, why __net_* attrs?  You call those
>functions from the module init/exit. __net_ is for namespace code.

Yes, I made the mistake and mixes up smc_sysctl_{init|exit}() with
smc_sysctl_{init|exit}_net when doing the quick fix...

And my check script with neither allyesconfig/allnoconfig nor defconfig
reproduced this.
This happens when CONFIG_SMC=y|m and CONFIG_SYSCTL is not set.

I will send a v2.

Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-03  2:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02  3:43 [PATCH net-next] net/smc: fix compile warning for smc_sysctl Dust Li
2022-03-02  5:49 ` Tony Lu
2022-03-02 15:02 ` kernel test robot
2022-03-02 19:45   ` Jakub Kicinski
2022-03-02 19:45     ` Jakub Kicinski
2022-03-03  2:35     ` dust.li
2022-03-03  2:35       ` dust.li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.