Skip to contentSkip to conversation

KVM: arm64: remove incorrect __init annotation

PATCH In review Arnd Bergmann 2 participants 3 messages Jan 3, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: arm64: remove incorrect __init annotation

From: Arnd Bergmann <[email protected]>

When hyp_cpu_pm_exit() is not inlined, it causes a link time warning:

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

This is not only called at boot time, so remove the annotation to prevent undefined behavior in case it gets called after being freed.

---
 arch/arm64/kvm/arm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kvm/arm.c +2 -2
index 6e637d2b4cfb..71a49eae9ea0 100644
@@ -1574,12 +1574,12 @@ static struct notifier_block hyp_init_cpu_pm_nb = {
 	.notifier_call = hyp_init_cpu_pm_notifier,
 };
 
-static void __init hyp_cpu_pm_init(void)
+static void hyp_cpu_pm_init(void)
 {
 	if (!is_protected_kvm_enabled())
 		cpu_pm_register_notifier(&hyp_init_cpu_pm_nb);
 }
-static void __init hyp_cpu_pm_exit(void)
+static void hyp_cpu_pm_exit(void)
 {
 	if (!is_protected_kvm_enabled())
 		cpu_pm_unregister_notifier(&hyp_init_cpu_pm_nb);
Signature · 1 line
2.29.2
maintainer
#1 lore raw
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

When hyp_cpu_pm_exit() is not inlined, it causes a link time warning:

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

Quoted 3 lines

This is not only called at boot time, so remove the annotation to prevent undefined behavior in case it gets called after being freed.

It *is* only called at boot time (despite these functions being called from module_init(), KVM cannot be built as a module on arm64).

The annotations are wrong nonetheless.

Quoted 2 lines

Posted here [1], and queued for the next batch of fixes.

	M.

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]

Signature · 5 lines
Without deviation from the norm, progress is not possible.
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
#2 lore raw
Quoted 14 lines · Marc Zyngier
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

When hyp_cpu_pm_exit() is not inlined, it causes a link time warning:

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

Quoted 6 lines
Quoted 3 lines

This is not only called at boot time, so remove the annotation to prevent undefined behavior in case it gets called after being freed.

It *is* only called at boot time (despite these functions being called from module_init(), KVM cannot be built as a module on arm64).

Ah, I see where I went wrong: I looked at the callers of kvm_arch_init_vm() instead of kvm_arch_init().

Arnd