Skip to contentSkip to conversation

4.8.2 not booting in 32-bit VM without I/O-APIC

DISCUSSION Michal Necasek 4 participants 6 messages Oct 28, 2016 – Oct 29, 2016 x86

lore
Share & tools
lore
#0 lore raw

Hi Thomas,

Sorry if I wasn't clear. No, it doesn't work for us. The ff8560512b8d commit fixes the APIC poking on machines where there is no local APIC available (and thus fixes the committer's machine), but it doesn't work in our case, where there is a local APIC but no I/O APIC, no ACPI MADT, and no MP tables.

In other words, for us boot_cpu_has(X86_FEATURE_APIC) is true but the APIC has not been set up yet because init_apic_mappings() hasn't been run.

Regards,
Michal

----- Original Message -----
From: [email protected]
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Sent: Friday, October 28, 2016 8:41:46 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
Subject: Re: 4.8.2 not booting in 32-bit VM without I/O-APIC

Quoted 2 lines · Michal Necasek

I suspect that either init_apic_mappings() needs to be called earlier or the initial fix from commit 2a51fe08 needs to be done later.

Linus tree has a fix for this:

ff8560512b8d x86/boot/smp: Don't try to poke disabled/non-existent APIC

It's on the way to stable as well. Can you try whether that works for you?

Thanks,

tglx

#1 lore raw
Quoted 10 lines · Michal Necasek

Sorry if I wasn't clear. No, it doesn't work for us. The ff8560512b8d
commit fixes the APIC poking on machines where there is no local APIC available (and thus fixes the committer's machine), but it doesn't work in our case, where there is a local APIC but no I/O APIC, no ACPI MADT, and no MP tables.

In other words, for us boot_cpu_has(X86_FEATURE_APIC) is true but the APIC has not been set up yet because init_apic_mappings() hasn't been run.

Gah. Sorry, misunderstood you. Lemme stare in the code.

Thanks,

tglx

#2 lore raw
Quoted 11 lines · Thomas Gleixner
Quoted 10 lines · Michal Necasek

Sorry if I wasn't clear. No, it doesn't work for us. The ff8560512b8d
commit fixes the APIC poking on machines where there is no local APIC available (and thus fixes the committer's machine), but it doesn't work in our case, where there is a local APIC but no I/O APIC, no ACPI MADT, and no MP tables.

In other words, for us boot_cpu_has(X86_FEATURE_APIC) is true but the APIC has not been set up yet because init_apic_mappings() hasn't been run.

Right. That mapping setup is an utter trainwreck as we do it from multiple places, but there is no reason why we can't move it before the call to prefill_possible_map().

Thanks,

tglx

arch/x86/kernel/setup.c +3 -1
index bbfbca5fea0c..b59fdba3cbdf 100644
@@ -1221,11 +1221,13 @@ void __init setup_arch(char **cmdline_p)
 	 */
 	get_smp_config();
 
+	/* Make sure apic is mapped before prefill_possible_map() */
+	init_apic_mappings();
+
 	prefill_possible_map();
 
 	init_cpu_to_node();
 
-	init_apic_mappings();
 	io_apic_init_mappings();
 
 	kvm_guest_init();
maintainer
#3 lore raw
Quoted 13 lines · Thomas Gleixner

Right. That mapping setup is an utter trainwreck as we do it from multiple places, but there is no reason why we can't move it before the call to prefill_possible_map().

arch/x86/kernel/setup.c +1 -0
index bbfbca5fea0c..b59fdba3cbdf 100644
@@ -1221,11 +1221,13 @@ void __init setup_arch(char **cmdline_p)
 	 */
 	get_smp_config();
 
+	/* Make sure apic is mapped before prefill_possible_map() */

arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 1233

Quoted 10 lines
arch/x86/kernel/setup.c +2 -1
+	init_apic_mappings();
+
 	prefill_possible_map();
 
 	init_cpu_to_node();
 
-	init_apic_mappings();
 	io_apic_init_mappings();
 
 	kvm_guest_init();

FWIW, I got another user's confirmation that this works with his virtual box:

https://bugzilla.suse.com/show_bug.cgi?id=1006417#c32
https://bugzilla.suse.com/show_bug.cgi?id=1006417#c33

Thanks.

Signature · 4 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
#4 lore raw

[tip:x86/urgent] x86/smpboot: Init apic mapping before usage

In reply to Thomas Gleixner
x86/smpboot: Init apic mapping before usage
Commit-ID:  0c524f819683e9f1c165d571256a9023b56f1f0c
Gitweb:     http://git.kernel.org/tip/0c524f819683e9f1c165d571256a9023b56f1f0c
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Sat, 29 Oct 2016 13:42:42 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sat, 29 Oct 2016 13:58:07 +0200

x86/smpboot: Init apic mapping before usage

The recent changes, which forced the registration of the boot cpu on UP systems, which do not have ACPI tables, have been fixed for systems w/o local APIC, but left a wreckage for systems which have neither ACPI nor mptables, but the CPU has an APIC, e.g. virtualbox.

The boot process crashes in prefill_possible_map() as it wants to register the boot cpu, which needs to access the local apic, but the local APIC is not yet mapped.

There is no reason why init_apic_mapping() can't be invoked before prefill_possible_map(). So instead of playing another silly early mapping game, as the ACPI/mptables code does, we just move init_apic_mapping() before the call to prefill_possible_map().

In hindsight, I should have noticed that combination earlier.

Sorry for the churn (also in stable)!

---
 arch/x86/kernel/setup.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kernel/setup.c +6 -1
index bbfbca5..7be097e 100644
@@ -1221,11 +1221,16 @@ void __init setup_arch(char **cmdline_p)
 	 */
 	get_smp_config();
 
+	/*
+	 * Systems w/o ACPI and mptables might not have it mapped the local
+	 * APIC yet, but it prefill_possible_map() might need to access it.
+	 */
+	init_apic_mappings();
+
 	prefill_possible_map();
 
 	init_cpu_to_node();
 
-	init_apic_mappings();
 	io_apic_init_mappings();
 
 	kvm_guest_init();
#5 lore raw

[tip:x86/urgent] x86/smpboot: Init apic mapping before usage

In reply to Thomas Gleixner
x86/smpboot: Init apic mapping before usage
Commit-ID:  1e90a13d0c3dc94512af1ccb2b6563e8297838fa
Gitweb:     http://git.kernel.org/tip/1e90a13d0c3dc94512af1ccb2b6563e8297838fa
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Sat, 29 Oct 2016 13:42:42 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sat, 29 Oct 2016 14:00:46 +0200

x86/smpboot: Init apic mapping before usage

The recent changes, which forced the registration of the boot cpu on UP systems, which do not have ACPI tables, have been fixed for systems w/o local APIC, but left a wreckage for systems which have neither ACPI nor mptables, but the CPU has an APIC, e.g. virtualbox.

The boot process crashes in prefill_possible_map() as it wants to register the boot cpu, which needs to access the local apic, but the local APIC is not yet mapped.

There is no reason why init_apic_mapping() can't be invoked before prefill_possible_map(). So instead of playing another silly early mapping game, as the ACPI/mptables code does, we just move init_apic_mapping() before the call to prefill_possible_map().

In hindsight, I should have noticed that combination earlier.

Sorry for the churn (also in stable)!

---
 arch/x86/kernel/setup.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kernel/setup.c +6 -1
index bbfbca5..9c337b0 100644
@@ -1221,11 +1221,16 @@ void __init setup_arch(char **cmdline_p)
 	 */
 	get_smp_config();
 
+	/*
+	 * Systems w/o ACPI and mptables might not have it mapped the local
+	 * APIC yet, but prefill_possible_map() might need to access it.
+	 */
+	init_apic_mappings();
+
 	prefill_possible_map();
 
 	init_cpu_to_node();
 
-	init_apic_mappings();
 	io_apic_init_mappings();
 
 	kvm_guest_init();