Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "base: arch_topology: fix section mismatch build warnings"

This reverts commit 452562abb5b7 ("base: arch_topology: fix section
mismatch build warnings"). It causes the notifier call hangs in some
use-cases.

In some cases with using maxcpus, some of cpus are booted first and
then the remaining cpus are booted. As an example, some users who want
to realize fast boot up often use the following procedure.

1) Define all CPUs on device tree (CA57x4 + CA53x4)
2) Add "maxcpus=4" in bootargs
3) Kernel boot up with CA57x4
4) After kernel boot up, CA53x4 is booted from user

When kernel init was finished, CPUFREQ_POLICY_NOTIFIER was not still
unregisterd. This means that "__init init_cpu_capacity_callback()"
will be called after kernel init sequence. To avoid this problem,
it needs to remove __init{,data} annotations by reverting this commit.

Also, this commit was needed to fix kernel compile issue below.
However, this issue was also fixed by another patch: commit 82d8ba717ccb
("arch_topology: Fix section miss match warning due to
free_raw_capacity()") in v4.15 as well.
Whereas commit 452562abb5b7 added all the missing __init annotations,
commit 82d8ba717ccb removed it from free_raw_capacity().

WARNING: vmlinux.o(.text+0x548f24): Section mismatch in reference
from the function init_cpu_capacity_callback() to the variable
.init.text:$x
The function init_cpu_capacity_callback() references
the variable __init $x.
This is often because init_cpu_capacity_callback lacks a __init
annotation or the annotation of $x is wrong.

Fixes: 82d8ba717ccb ("arch_topology: Fix section miss match warning due to free_raw_capacity()")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Gaku Inami <gaku.inami.xh@renesas.com>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Gaku Inami and committed by
Greg Kroah-Hartman
9de9a449 ad4365f1

+6 -6
+6 -6
drivers/base/arch_topology.c
··· 169 169 } 170 170 171 171 #ifdef CONFIG_CPU_FREQ 172 - static cpumask_var_t cpus_to_visit __initdata; 173 - static void __init parsing_done_workfn(struct work_struct *work); 174 - static __initdata DECLARE_WORK(parsing_done_work, parsing_done_workfn); 172 + static cpumask_var_t cpus_to_visit; 173 + static void parsing_done_workfn(struct work_struct *work); 174 + static DECLARE_WORK(parsing_done_work, parsing_done_workfn); 175 175 176 - static int __init 176 + static int 177 177 init_cpu_capacity_callback(struct notifier_block *nb, 178 178 unsigned long val, 179 179 void *data) ··· 209 209 return 0; 210 210 } 211 211 212 - static struct notifier_block init_cpu_capacity_notifier __initdata = { 212 + static struct notifier_block init_cpu_capacity_notifier = { 213 213 .notifier_call = init_cpu_capacity_callback, 214 214 }; 215 215 ··· 242 242 } 243 243 core_initcall(register_cpufreq_notifier); 244 244 245 - static void __init parsing_done_workfn(struct work_struct *work) 245 + static void parsing_done_workfn(struct work_struct *work) 246 246 { 247 247 cpufreq_unregister_notifier(&init_cpu_capacity_notifier, 248 248 CPUFREQ_POLICY_NOTIFIER);