Message ID | 20220204233809.3082403-1-eric.dumazet@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] net: initialize init_net earlier | expand |
Hi Eric, I love your patch! Yet something to improve: [auto build test ERROR on net-next/master] url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/net-initialize-init_net-earlier/20220205-073957 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git c531adaf884d313df2729ca94228317a52e46b83 config: arm-randconfig-r031-20220131 (https://download.01.org/0day-ci/archive/20220205/202202051344.7VoLsgix-lkp@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a73e4ce6a59b01f0e37037761c1e6889d539d233) 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://github.com/0day-ci/linux/commit/0d2a51961bd19173f1d7cfa779b9cf82c48e4499 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Eric-Dumazet/net-initialize-init_net-earlier/20220205-073957 git checkout 0d2a51961bd19173f1d7cfa779b9cf82c48e4499 # 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 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from kernel/events/core.c:46: In file included from include/linux/filter.h:20: In file included from include/linux/if_vlan.h:10: In file included from include/linux/netdevice.h:37: >> include/net/net_namespace.h:519:34: error: non-void function does not return a value [-Werror,-Wreturn-type] static inline net_ns_init(void) {} ^ 1 error generated. -- In file included from init/main.c:102: >> include/net/net_namespace.h:519:34: error: non-void function does not return a value [-Werror,-Wreturn-type] static inline net_ns_init(void) {} ^ init/main.c:769:20: warning: no previous prototype for function 'arch_post_acpi_subsys_init' [-Wmissing-prototypes] void __init __weak arch_post_acpi_subsys_init(void) { } ^ init/main.c:769:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __init __weak arch_post_acpi_subsys_init(void) { } ^ static init/main.c:781:20: warning: no previous prototype for function 'mem_encrypt_init' [-Wmissing-prototypes] void __init __weak mem_encrypt_init(void) { } ^ init/main.c:781:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __init __weak mem_encrypt_init(void) { } ^ static init/main.c:783:20: warning: no previous prototype for function 'poking_init' [-Wmissing-prototypes] void __init __weak poking_init(void) { } ^ init/main.c:783:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __init __weak poking_init(void) { } ^ static 3 warnings and 1 error generated. -- kernel/fork.c:162:13: warning: no previous prototype for function 'arch_release_task_struct' [-Wmissing-prototypes] void __weak arch_release_task_struct(struct task_struct *tsk) ^ kernel/fork.c:162:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __weak arch_release_task_struct(struct task_struct *tsk) ^ static kernel/fork.c:764:20: warning: no previous prototype for function 'arch_task_cache_init' [-Wmissing-prototypes] void __init __weak arch_task_cache_init(void) { } ^ kernel/fork.c:764:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __init __weak arch_task_cache_init(void) { } ^ static kernel/fork.c:859:12: warning: no previous prototype for function 'arch_dup_task_struct' [-Wmissing-prototypes] int __weak arch_dup_task_struct(struct task_struct *dst, ^ kernel/fork.c:859:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __weak arch_dup_task_struct(struct task_struct *dst, ^ static In file included from kernel/fork.c:996: In file included from include/linux/init_task.h:18: >> include/net/net_namespace.h:519:34: error: non-void function does not return a value [-Werror,-Wreturn-type] static inline net_ns_init(void) {} ^ 3 warnings and 1 error generated. -- In file included from kernel/kallsyms.c:25: In file included from include/linux/filter.h:20: In file included from include/linux/if_vlan.h:10: In file included from include/linux/netdevice.h:37: >> include/net/net_namespace.h:519:34: error: non-void function does not return a value [-Werror,-Wreturn-type] static inline net_ns_init(void) {} ^ kernel/kallsyms.c:587:12: warning: no previous prototype for function 'arch_get_kallsym' [-Wmissing-prototypes] int __weak arch_get_kallsym(unsigned int symnum, unsigned long *value, ^ kernel/kallsyms.c:587:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __weak arch_get_kallsym(unsigned int symnum, unsigned long *value, ^ static 1 warning and 1 error generated. -- In file included from kernel/sched/core.c:13: In file included from kernel/sched/sched.h:49: In file included from include/linux/init_task.h:18: >> include/net/net_namespace.h:519:34: error: non-void function does not return a value [-Werror,-Wreturn-type] static inline net_ns_init(void) {} ^ kernel/sched/core.c:6401:35: warning: no previous prototype for function 'schedule_user' [-Wmissing-prototypes] asmlinkage __visible void __sched schedule_user(void) ^ kernel/sched/core.c:6401:22: note: declare 'static' if the function is not intended to be used outside of this translation unit asmlinkage __visible void __sched schedule_user(void) ^ static 1 warning and 1 error generated. -- In file included from kernel/sched/fair.c:23: In file included from kernel/sched/sched.h:49: In file included from include/linux/init_task.h:18: >> include/net/net_namespace.h:519:34: error: non-void function does not return a value [-Werror,-Wreturn-type] static inline net_ns_init(void) {} ^ kernel/sched/fair.c:5477:6: warning: no previous prototype for function 'init_cfs_bandwidth' [-Wmissing-prototypes] void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {} ^ kernel/sched/fair.c:5477:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {} ^ static kernel/sched/fair.c:11703:6: warning: no previous prototype for function 'free_fair_sched_group' [-Wmissing-prototypes] void free_fair_sched_group(struct task_group *tg) { } ^ kernel/sched/fair.c:11703:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void free_fair_sched_group(struct task_group *tg) { } ^ static kernel/sched/fair.c:11705:5: warning: no previous prototype for function 'alloc_fair_sched_group' [-Wmissing-prototypes] int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent) ^ kernel/sched/fair.c:11705:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent) ^ static kernel/sched/fair.c:11710:6: warning: no previous prototype for function 'online_fair_sched_group' [-Wmissing-prototypes] void online_fair_sched_group(struct task_group *tg) { } ^ kernel/sched/fair.c:11710:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void online_fair_sched_group(struct task_group *tg) { } ^ static kernel/sched/fair.c:11712:6: warning: no previous prototype for function 'unregister_fair_sched_group' [-Wmissing-prototypes] void unregister_fair_sched_group(struct task_group *tg) { } ^ kernel/sched/fair.c:11712:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void unregister_fair_sched_group(struct task_group *tg) { } ^ static 5 warnings and 1 error generated. -- In file included from kernel/sched/rt.c:6: In file included from kernel/sched/sched.h:49: In file included from include/linux/init_task.h:18: >> include/net/net_namespace.h:519:34: error: non-void function does not return a value [-Werror,-Wreturn-type] static inline net_ns_init(void) {} ^ kernel/sched/rt.c:262:6: warning: no previous prototype for function 'unregister_rt_sched_group' [-Wmissing-prototypes] void unregister_rt_sched_group(struct task_group *tg) { } ^ kernel/sched/rt.c:262:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void unregister_rt_sched_group(struct task_group *tg) { } ^ static kernel/sched/rt.c:264:6: warning: no previous prototype for function 'free_rt_sched_group' [-Wmissing-prototypes] void free_rt_sched_group(struct task_group *tg) { } ^ kernel/sched/rt.c:264:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void free_rt_sched_group(struct task_group *tg) { } ^ static kernel/sched/rt.c:266:5: warning: no previous prototype for function 'alloc_rt_sched_group' [-Wmissing-prototypes] int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent) ^ kernel/sched/rt.c:266:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent) ^ static kernel/sched/rt.c:680:6: warning: no previous prototype for function 'sched_rt_bandwidth_account' [-Wmissing-prototypes] bool sched_rt_bandwidth_account(struct rt_rq *rt_rq) ^ kernel/sched/rt.c:680:1: note: declare 'static' if the function is not intended to be used outside of this translation unit bool sched_rt_bandwidth_account(struct rt_rq *rt_rq) ^ static 4 warnings and 1 error generated. vim +519 include/net/net_namespace.h 515 516 #ifdef CONFIG_NET 517 void net_ns_init(void); 518 #else > 519 static inline net_ns_init(void) {} 520 #endif 521 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 5b61c462e534be468c81d2b0f4ef586b209dd4b8..2ecbd7c11c88e016b1a6a450f07ee2cd94048f62 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -513,4 +513,10 @@ static inline void fnhe_genid_bump(struct net *net) atomic_inc(&net->fnhe_genid); } +#ifdef CONFIG_NET +void net_ns_init(void); +#else +static inline net_ns_init(void) {} +#endif + #endif /* __NET_NET_NAMESPACE_H */ diff --git a/init/main.c b/init/main.c index 65fa2e41a9c0904131525d504f3ec86add44f141..ada50f5a15e4397e45b0e5c06bab051b1ce193d9 100644 --- a/init/main.c +++ b/init/main.c @@ -99,6 +99,7 @@ #include <linux/kcsan.h> #include <linux/init_syscalls.h> #include <linux/stackdepot.h> +#include <net/net_namespace.h> #include <asm/io.h> #include <asm/bugs.h> @@ -1116,6 +1117,7 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void) key_init(); security_init(); dbg_late_init(); + net_ns_init(); vfs_caches_init(); pagecache_init(); signals_init(); diff --git a/net/core/dev.c b/net/core/dev.c index 1eaa0b88e3ba5d800484656f2c3420af57050294..f662c6a7d7b49b836a05efc74aeffc7fc9e4e147 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -10732,8 +10732,7 @@ static int __net_init netdev_init(struct net *net) BUILD_BUG_ON(GRO_HASH_BUCKETS > 8 * sizeof_field(struct napi_struct, gro_bitmask)); - if (net != &init_net) - INIT_LIST_HEAD(&net->dev_base_head); + INIT_LIST_HEAD(&net->dev_base_head); net->dev_name_head = netdev_create_hash(); if (net->dev_name_head == NULL) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 8711350085d6b55a4f3da19bc69e521f9efb7861..0ec2f5906a27c7f930e832835682d69a32e3c8e1 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -44,13 +44,7 @@ EXPORT_SYMBOL_GPL(net_rwsem); static struct key_tag init_net_key_domain = { .usage = REFCOUNT_INIT(1) }; #endif -struct net init_net = { - .ns.count = REFCOUNT_INIT(1), - .dev_base_head = LIST_HEAD_INIT(init_net.dev_base_head), -#ifdef CONFIG_KEYS - .key_domain = &init_net_key_domain, -#endif -}; +struct net init_net; EXPORT_SYMBOL(init_net); static bool init_net_initialized; @@ -1087,7 +1081,7 @@ static void rtnl_net_notifyid(struct net *net, int cmd, int id, u32 portid, rtnl_set_sk_err(net, RTNLGRP_NSID, err); } -static int __init net_ns_init(void) +void __init net_ns_init(void) { struct net_generic *ng; @@ -1108,6 +1102,9 @@ static int __init net_ns_init(void) rcu_assign_pointer(init_net.gen, ng); +#ifdef CONFIG_KEYS + init_net.key_domain = &init_net_key_domain; +#endif down_write(&pernet_ops_rwsem); if (setup_net(&init_net, &init_user_ns)) panic("Could not setup the initial network namespace"); @@ -1122,12 +1119,8 @@ static int __init net_ns_init(void) RTNL_FLAG_DOIT_UNLOCKED); rtnl_register(PF_UNSPEC, RTM_GETNSID, rtnl_net_getid, rtnl_net_dumpid, RTNL_FLAG_DOIT_UNLOCKED); - - return 0; } -pure_initcall(net_ns_init); - static void free_exit_list(struct pernet_operations *ops, struct list_head *net_exit_list) { ops_pre_exit_list(ops, net_exit_list);