From: Dexuan Cui <decui@microsoft.com>
To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
hpa@zytor.com, x86@kernel.org, peterz@infradead.org,
allison@lohutok.net, alexios.zavras@intel.com,
gregkh@linuxfoundation.org, decui@microsoft.com,
namit@vmware.com, mikelley@microsoft.com, longli@microsoft.com
Cc: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org
Subject: [PATCH] x86/apic/flat64: Add back the early_param("apic", parse_apic)
Date: Thu, 28 May 2020 23:37:29 -0700 [thread overview]
Message-ID: <20200529063729.22047-1-decui@microsoft.com> (raw)
parse_apic() allows the user to try a different apic driver than the
default one that's automatically chosen. It works for x86_32, but
doesn't work for x86_64 becauase it was removed in 2009 for x86_64 by:
commit 7b38725318f4 ("x86: remove subarchitecture support code"),
whose changelog doesn't explicitly describe the removal for x86_64.
The patch adds back the functionality for x86_64. The intent is mainly
to work around an APIC emulation bug in Hyper-V in the case of kdump:
currently Hyper-V does not honor the disabled state of the local APICs,
and all the IOAPIC-based interrupts may not be delivered to the correct
virtual CPU, if the logical-mode APIC driver is used (the kdump
kernel usually uses the logical-mode APIC driver, since typically
only 1 CPU is active). Luckily the kdump issue can be worked around by
forcing the kdump kernel to use physical mode, before the fix to Hyper-V
becomes widely available.
IMHO the patch is safe because the current default algorithm to choose
the apic driver is unchanged; the patch makes a difference only when
the user specifies the apic= kernel parameter, e.g. "apic=physical flat".
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
arch/x86/kernel/apic/apic_flat_64.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index 7862b152a052..efbec63bb01f 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -23,9 +23,34 @@ static struct apic apic_flat;
struct apic *apic __ro_after_init = &apic_flat;
EXPORT_SYMBOL_GPL(apic);
+static int cmdline_apic __initdata;
+static int __init parse_apic(char *arg)
+{
+ struct apic **drv;
+
+ if (!arg)
+ return -EINVAL;
+
+ for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) {
+ if (!strcmp((*drv)->name, arg)) {
+ apic = *drv;
+ cmdline_apic = 1;
+ return 0;
+ }
+ }
+
+ /* Parsed again by __setup for debug/verbose */
+ return 0;
+}
+early_param("apic", parse_apic);
+
+
static int flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
{
- return 1;
+ if (!cmdline_apic)
+ return 1;
+
+ return apic == &apic_flat;
}
/*
--
2.25.1
next reply other threads:[~2020-05-29 6:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-29 6:37 Dexuan Cui [this message]
2020-05-29 13:33 ` [PATCH] x86/apic/flat64: Add back the early_param("apic", parse_apic) Randy Dunlap
2020-05-30 22:40 ` Dexuan Cui
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=20200529063729.22047-1-decui@microsoft.com \
--to=decui@microsoft.com \
--cc=alexios.zavras@intel.com \
--cc=allison@lohutok.net \
--cc=bp@alien8.de \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=mikelley@microsoft.com \
--cc=mingo@redhat.com \
--cc=namit@vmware.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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).