2022-07-01 03:59:35

by Yupeng Li

[permalink] [raw]
Subject: [PATCH 1/1] timers/nohz: fix build with CONFIG_NO_HZ_FULL warnning.

When CONFIG_NO_HZ_FULL was enabled,build kernel with Section mismatch
warnnings.Fixed this by removing the __init annotation according to
the prompt of compilation information ,some build messages as followed:
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
AR init/built-in.a
LD vmlinux.o
MODPOST vmlinux.symvers
WARNING: modpost: vmlinux.o(___ksymtab_gpl+tick_nohz_full_setup+0x0): Section mismatch in reference from the variable __ksymtab_tick_nohz_full_setup to the function .init.text:tick_nohz_full_setup()
The symbol tick_nohz_full_setup is exported and annotated __init
Fix this by removing the __init annotation of tick_nohz_full_setup or drop the export.

MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1

Signed-off-by: Yupeng Li <[email protected]>
Reviewed-by: Caicai <[email protected]>
---
include/linux/tick.h | 2 +-
kernel/time/tick-sched.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/tick.h b/include/linux/tick.h
index bfd571f18cfd..63fe21c6a55c 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -272,7 +272,7 @@ static inline void tick_dep_clear_signal(struct signal_struct *signal,

extern void tick_nohz_full_kick_cpu(int cpu);
extern void __tick_nohz_task_switch(void);
-extern void __init tick_nohz_full_setup(cpumask_var_t cpumask);
+extern void tick_nohz_full_setup(cpumask_var_t cpumask);
#else
static inline bool tick_nohz_full_enabled(void) { return false; }
static inline bool tick_nohz_full_cpu(int cpu) { return false; }
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 58a11f859ac7..f8641c66f0d8 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -520,7 +520,7 @@ void __tick_nohz_task_switch(void)
}

/* Get the boot-time nohz CPU list from the kernel parameters. */
-void __init tick_nohz_full_setup(cpumask_var_t cpumask)
+void tick_nohz_full_setup(cpumask_var_t cpumask)
{
alloc_bootmem_cpumask_var(&tick_nohz_full_mask);
cpumask_copy(tick_nohz_full_mask, cpumask);
--
2.34.1


2022-07-01 17:36:47

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/1] timers/nohz: fix build with CONFIG_NO_HZ_FULL warnning.

Hi Yupeng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/timers/nohz]
[also build test WARNING on linus/master v5.19-rc4 next-20220701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/intel-lab-lkp/linux/commits/Yupeng-Li/timers-nohz-fix-build-with-CONFIG_NO_HZ_FULL-warnning/20220701-114723
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 09fe880ed7a160ebbffb84a0a9096a075e314d2f
config: x86_64-randconfig-k001 (https://download.01.org/0day-ci/archive/20220702/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a9119143a2d1f4d0d0bc1fe0d819e5351b4e0deb)
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/intel-lab-lkp/linux/commit/d7397dd311be292d170c1fbd0f3bdc5104c06849
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Yupeng-Li/timers-nohz-fix-build-with-CONFIG_NO_HZ_FULL-warnning/20220701-114723
git checkout d7397dd311be292d170c1fbd0f3bdc5104c06849
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

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

>> WARNING: modpost: vmlinux.o(.text+0x19a091): Section mismatch in reference from the function tick_nohz_full_setup() to the function .init.text:alloc_bootmem_cpumask_var()
The function tick_nohz_full_setup() references
the function __init alloc_bootmem_cpumask_var().
This is often because tick_nohz_full_setup lacks a __init
annotation or the annotation of alloc_bootmem_cpumask_var is wrong.

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-07-01 19:19:59

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/1] timers/nohz: fix build with CONFIG_NO_HZ_FULL warnning.

Hi Yupeng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/timers/nohz]
[also build test WARNING on linus/master v5.19-rc4 next-20220701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/intel-lab-lkp/linux/commits/Yupeng-Li/timers-nohz-fix-build-with-CONFIG_NO_HZ_FULL-warnning/20220701-114723
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 09fe880ed7a160ebbffb84a0a9096a075e314d2f
config: x86_64-rhel-8.3-kselftests (https://download.01.org/0day-ci/archive/20220702/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/d7397dd311be292d170c1fbd0f3bdc5104c06849
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Yupeng-Li/timers-nohz-fix-build-with-CONFIG_NO_HZ_FULL-warnning/20220701-114723
git checkout d7397dd311be292d170c1fbd0f3bdc5104c06849
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

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

>> WARNING: modpost: vmlinux.o(.text+0x5b7f13): Section mismatch in reference from the function tick_nohz_full_setup() to the function .init.text:alloc_bootmem_cpumask_var()
The function tick_nohz_full_setup() references
the function __init alloc_bootmem_cpumask_var().
This is often because tick_nohz_full_setup lacks a __init
annotation or the annotation of alloc_bootmem_cpumask_var is wrong.

--
0-DAY CI Kernel Test Service
https://01.org/lkp