From 4e1df53c240ddbf17d7c5378ad8c5994d4763b68 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 17 Feb 2017 02:42:17 +0000 Subject: [PATCH] [x86] xen: Fix APIC id mismatch warning on Intel (Closes: #853193) --- debian/changelog | 1 + ...ix-apic-id-mismatch-warning-on-intel.patch | 57 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 59 insertions(+) create mode 100644 debian/patches/bugfix/x86/x86-xen-fix-apic-id-mismatch-warning-on-intel.patch diff --git a/debian/changelog b/debian/changelog index bde2abb4d..c20b2f018 100644 --- a/debian/changelog +++ b/debian/changelog @@ -257,6 +257,7 @@ linux (4.9.10-1) UNRELEASED; urgency=medium * udeb: Add bcache to md-modules (Closes: #718548) * [x86] platform: acer-wmi: setup accelerometer when machine has appropriate notify event (Closes: #853067) + * [x86] xen: Fix APIC id mismatch warning on Intel (Closes: #853193) [ Roger Shimizu ] * [armel] ARM: dts: orion5x-lschl: Fix model name diff --git a/debian/patches/bugfix/x86/x86-xen-fix-apic-id-mismatch-warning-on-intel.patch b/debian/patches/bugfix/x86/x86-xen-fix-apic-id-mismatch-warning-on-intel.patch new file mode 100644 index 000000000..93830d110 --- /dev/null +++ b/debian/patches/bugfix/x86/x86-xen-fix-apic-id-mismatch-warning-on-intel.patch @@ -0,0 +1,57 @@ +From: Mohit Gambhir +Date: Thu, 26 Jan 2017 13:12:27 -0500 +Subject: x86/xen: Fix APIC id mismatch warning on Intel +Origin: https://git.kernel.org/linus/cc272163ea554a97dac180fa8dd6cd54c2810bd1 +Bug-Debian: https://bugs.debian.org/853193 + +This patch fixes the following warning message seen when booting the +kernel as Dom0 with Xen on Intel machines. + +[0.003000] [Firmware Bug]: CPU1: APIC id mismatch. Firmware: 0 APIC: 1] + +The code generating the warning in validate_apic_and_package_id() matches +cpu_data(cpu).apicid (initialized in init_intel()-> +detect_extended_topology() using cpuid) against the apicid returned from +xen_apic_read(). Now, xen_apic_read() makes a hypercall to retrieve apicid +for the boot cpu but returns 0 otherwise. Hence the warning gets thrown +for all but the boot cpu. + +The idea behind xen_apic_read() returning 0 for apicid is that the +guests (even Dom0) should not need to know what physical processor their +vcpus are running on. This is because we currently do not have topology +information in Xen and also because xen allows more vcpus than physical +processors. However, boot cpu's apicid is required for loading +xen-acpi-processor driver on AMD machines. Look at following patch for +details: + +commit 558daa289a40 ("xen/apic: Return the APIC ID (and version) for CPU +0.") + +So to get rid of the warning, this patch modifies +xen_cpu_present_to_apicid() to return cpu_data(cpu).apicid instead of +calling xen_apic_read(). + +The warning is not seen on AMD machines because init_amd() populates +cpu_data(cpu).apicid by calling hard_smp_processor_id()->xen_apic_read() +as opposed to using apicid from cpuid as is done on Intel machines. + +Signed-off-by: Mohit Gambhir +Reviewed-by: Juergen Gross +Signed-off-by: Boris Ostrovsky +--- + arch/x86/xen/apic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c +index 44c88ad1841a..bcea81f36fc5 100644 +--- a/arch/x86/xen/apic.c ++++ b/arch/x86/xen/apic.c +@@ -145,7 +145,7 @@ static void xen_silent_inquire(int apicid) + static int xen_cpu_present_to_apicid(int cpu) + { + if (cpu_present(cpu)) +- return xen_get_apic_id(xen_apic_read(APIC_ID)); ++ return cpu_data(cpu).apicid; + else + return BAD_APICID; + } diff --git a/debian/patches/series b/debian/patches/series index 4afea7e48..be8372ca1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -49,6 +49,7 @@ debian/fanotify-taint-on-use-of-fanotify_access_permissions.patch # Arch bug fixes bugfix/x86/asoc-intel-select-dw_dmac_core-since-it-s-mandatory.patch bugfix/x86/platform-x86-acer-wmi-setup-accelerometer-when-machi.patch +bugfix/x86/x86-xen-fix-apic-id-mismatch-warning-on-intel.patch # Arch features features/mips/MIPS-increase-MAX-PHYSMEM-BITS-on-Loongson-3-only.patch