From: Gautam Menghani <gautam@linux.ibm.com>
To: mpe@ellerman.id.au, npiggin@gmail.com,
christophe.leroy@csgroup.eu, naveen@kernel.org,
maddy@linux.ibm.com
Cc: Gautam Menghani <gautam@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH] arch/powerpc/pseries: Fix KVM guest detection for disabling hardlockup detector
Date: Tue, 5 Nov 2024 18:57:33 +0530 [thread overview]
Message-ID: <20241105132734.499506-1-gautam@linux.ibm.com> (raw)
As per the kernel documentation[1], hardlockup detector should be
disabled in KVM guests as it may give false positives. On PPC, hardlockup
detector is broken inside KVM guests because disable_hardlockup_detector()
is marked as early_initcall and it uses is_kvm_guest(), which is
initialized by check_kvm_guest() later during boot as it is a
core_initcall. check_kvm_guest() is also called in pSeries_smp_probe(),
which is called before initcalls, but it is skipped if KVM guest does
not have doorbell support or if the guest is launched with SMT=1.
Move the check_kvm_guest() call in pSeries_smp_probe() to the initial
part of function before doorbell/SMT checks so that "kvm_guest" static
key is initialized by the time disable_hardlockup_detector() runs.
[1]: Documentation/admin-guide/sysctl/kernel.rst
Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
---
arch/powerpc/platforms/pseries/smp.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index c597711ef20a..516c7bfec933 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -199,6 +199,13 @@ static __init void pSeries_smp_probe(void)
else
xics_smp_probe();
+ /*
+ * Make sure this is called regardless of doorbell/SMT status, as
+ * we disable hardlockup detector in an early_initcall where we need to
+ * know KVM status for disabling hardlockup detector in KVM guests.
+ */
+ check_kvm_guest();
+
/* No doorbell facility, must use the interrupt controller for IPIs */
if (!cpu_has_feature(CPU_FTR_DBELL))
return;
@@ -207,8 +214,6 @@ static __init void pSeries_smp_probe(void)
if (!cpu_has_feature(CPU_FTR_SMT))
return;
- check_kvm_guest();
-
if (is_kvm_guest()) {
/*
* KVM emulates doorbells by disabling FSCR[MSGP] so msgsndp
--
2.47.0
next reply other threads:[~2024-11-05 13:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 13:27 Gautam Menghani [this message]
2024-11-07 11:54 ` [PATCH] arch/powerpc/pseries: Fix KVM guest detection for disabling hardlockup detector Michael Ellerman
2024-11-07 14:12 ` Gautam Menghani
2024-11-07 23:38 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241105132734.499506-1-gautam@linux.ibm.com \
--to=gautam@linux.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).