* [PATCH] KVM: arm64: remove incorrect __init annotation
@ 2021-01-03 14:00 Arnd Bergmann
2021-01-03 16:43 ` Marc Zyngier
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2021-01-03 14:00 UTC (permalink / raw)
To: Marc Zyngier, Catalin Marinas, Will Deacon
Cc: linux-arm-kernel, Arnd Bergmann, Suzuki K Poulose,
Sean Christopherson, linux-kernel, James Morse, Andrew Scull,
Paolo Bonzini, David Brazdil, kvmarm, Julien Thierry
From: Arnd Bergmann <arnd@arndb.de>
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.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm64/kvm/arm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 6e637d2b4cfb..71a49eae9ea0 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -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);
--
2.29.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: arm64: remove incorrect __init annotation
2021-01-03 14:00 [PATCH] KVM: arm64: remove incorrect __init annotation Arnd Bergmann
@ 2021-01-03 16:43 ` Marc Zyngier
2021-01-03 18:38 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2021-01-03 16:43 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-arm-kernel, Arnd Bergmann, Suzuki K Poulose,
Catalin Marinas, linux-kernel, James Morse, Andrew Scull,
Sean Christopherson, Paolo Bonzini, David Brazdil, Will Deacon,
kvmarm, Julien Thierry
On Sun, 03 Jan 2021 14:00:50 +0000,
Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
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.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Posted here [1], and queued for the next batch of fixes.
M.
[1] https://lore.kernel.org/linux-arm-kernel/20201223120854.255347-1-maz@kernel.org
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: arm64: remove incorrect __init annotation
2021-01-03 16:43 ` Marc Zyngier
@ 2021-01-03 18:38 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2021-01-03 18:38 UTC (permalink / raw)
To: Marc Zyngier
Cc: Linux ARM, Arnd Bergmann, Suzuki K Poulose, Catalin Marinas,
linux-kernel@vger.kernel.org, James Morse, Andrew Scull,
Sean Christopherson, Paolo Bonzini, David Brazdil, Will Deacon,
kvmarm, Julien Thierry
On Sun, Jan 3, 2021 at 5:43 PM Marc Zyngier <maz@kernel.org> wrote:
>
> On Sun, 03 Jan 2021 14:00:50 +0000,
> Arnd Bergmann <arnd@kernel.org> wrote:
> >
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > 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.
>
> 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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-03 18:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-03 14:00 [PATCH] KVM: arm64: remove incorrect __init annotation Arnd Bergmann
2021-01-03 16:43 ` Marc Zyngier
2021-01-03 18:38 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).