[PATCH] arch/x86: Don't try to poke disabled/non-existent APIC

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Fri Oct 21 19:18:04 PDT 2016


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Apparently trying to poke a disabled or non-existent APIC
leads to a box that doesn't even boot. Let's not do that.

No real clue if this is the right fix, but at least my
P3 machine boots again.

Cc: stable at vger.kernel.org
Cc: Ingo Molnar <mingo at redhat.com>
Cc: "H. Peter Anvin" <hpa at zytor.com>
Cc: x86 at kernel.org
Cc: Prarit Bhargava <prarit at redhat.com>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Len Brown <len.brown at intel.com>
Cc: Borislav Petkov <bp at suse.de>
Cc: Andi Kleen <ak at linux.intel.com>
Cc: Jiri Olsa <jolsa at redhat.com>
Cc: Juergen Gross <jgross at suse.com>
Cc: dyoung at redhat.com
Cc: Eric Biederman <ebiederm at xmission.com>
Cc: kexec at lists.infradead.org
Cc: Thomas Gleixner <tglx at linutronix.de>
Fixes: 2a51fe083eba ("arch/x86: Handle non enumerated CPU after physical hotplug")
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 arch/x86/kernel/smpboot.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 951f093a96fe..42f5eb7b4f6c 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1409,15 +1409,17 @@ __init void prefill_possible_map(void)
 
 	/* No boot processor was found in mptable or ACPI MADT */
 	if (!num_processors) {
-		int apicid = boot_cpu_physical_apicid;
-		int cpu = hard_smp_processor_id();
+		if (boot_cpu_has(X86_FEATURE_APIC)) {
+			int apicid = boot_cpu_physical_apicid;
+			int cpu = hard_smp_processor_id();
 
-		pr_warn("Boot CPU (id %d) not listed by BIOS\n", cpu);
+			pr_warn("Boot CPU (id %d) not listed by BIOS\n", cpu);
 
-		/* Make sure boot cpu is enumerated */
-		if (apic->cpu_present_to_apicid(0) == BAD_APICID &&
-		    apic->apic_id_valid(apicid))
-			generic_processor_info(apicid, boot_cpu_apic_version);
+			/* Make sure boot cpu is enumerated */
+			if (apic->cpu_present_to_apicid(0) == BAD_APICID &&
+			    apic->apic_id_valid(apicid))
+				generic_processor_info(apicid, boot_cpu_apic_version);
+		}
 
 		if (!num_processors)
 			num_processors = 1;
-- 
2.7.4




More information about the kexec mailing list