All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: 4.8.2 not booting in 32-bit VM without I/O-APIC
@ 2016-10-28 18:52 Michal Necasek
  2016-10-28 19:00 ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Necasek @ 2016-10-28 18:52 UTC (permalink / raw)
  To: tglx
  Cc: prarit, ville.syrjala, michael.thayer, knut.osmundsen,
	frank.mehnert, linux-kernel


     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: tglx@linutronix.de
To: michal.necasek@oracle.com
Cc: linux-kernel@vger.kernel.org, prarit@redhat.com, ville.syrjala@linux.intel.com, michael.thayer@oracle.com, frank.mehnert@oracle.com, knut.osmundsen@oracle.com
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

On Fri, 28 Oct 2016, Michal Necasek wrote: 

> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 4.8.2 not booting in 32-bit VM without I/O-APIC
  2016-10-28 18:52 4.8.2 not booting in 32-bit VM without I/O-APIC Michal Necasek
@ 2016-10-28 19:00 ` Thomas Gleixner
  2016-10-28 19:34   ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2016-10-28 19:00 UTC (permalink / raw)
  To: Michal Necasek
  Cc: prarit, ville.syrjala, michael.thayer, knut.osmundsen,
	frank.mehnert, linux-kernel

On Fri, 28 Oct 2016, Michal Necasek wrote:
> 
>  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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 4.8.2 not booting in 32-bit VM without I/O-APIC
  2016-10-28 19:00 ` Thomas Gleixner
@ 2016-10-28 19:34   ` Thomas Gleixner
  2016-10-29 10:18     ` Borislav Petkov
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Thomas Gleixner @ 2016-10-28 19:34 UTC (permalink / raw)
  To: Michal Necasek
  Cc: prarit, ville.syrjala, michael.thayer, knut.osmundsen,
	frank.mehnert, linux-kernel

On Fri, 28 Oct 2016, Thomas Gleixner wrote:

> On Fri, 28 Oct 2016, Michal Necasek wrote:
> > 
> >  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

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index bbfbca5fea0c..b59fdba3cbdf 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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();

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 4.8.2 not booting in 32-bit VM without I/O-APIC
  2016-10-28 19:34   ` Thomas Gleixner
@ 2016-10-29 10:18     ` Borislav Petkov
  2016-10-29 12:04     ` [tip:x86/urgent] x86/smpboot: Init apic mapping before usage tip-bot for Thomas Gleixner
  2016-10-29 12:06     ` tip-bot for Thomas Gleixner
  2 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2016-10-29 10:18 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Michal Necasek, prarit, ville.syrjala, michael.thayer,
	knut.osmundsen, frank.mehnert, linux-kernel, wbauer

On Fri, Oct 28, 2016 at 09:34:53PM +0200, Thomas Gleixner wrote:
> 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().

> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index bbfbca5fea0c..b59fdba3cbdf 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -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();

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.

-- 
Regards/Gruss,
    Boris.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:x86/urgent] x86/smpboot: Init apic mapping before usage
  2016-10-28 19:34   ` Thomas Gleixner
  2016-10-29 10:18     ` Borislav Petkov
@ 2016-10-29 12:04     ` tip-bot for Thomas Gleixner
  2016-10-29 12:06     ` tip-bot for Thomas Gleixner
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Thomas Gleixner @ 2016-10-29 12:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: bp, wbauer, mingo, linux-kernel, hpa, michal.necasek, tglx

Commit-ID:  0c524f819683e9f1c165d571256a9023b56f1f0c
Gitweb:     http://git.kernel.org/tip/0c524f819683e9f1c165d571256a9023b56f1f0c
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 29 Oct 2016 13:42:42 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
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)!

Fixes: ff8560512b8d ("x86/boot/smp: Don't try to poke disabled/non-existent APIC")
Reported-and-debugged-by: Michal Necasek <michal.necasek@oracle.com>
Reported-and-tested-by: Wolfgang Bauer <wbauer@tmo.at>
Cc: prarit@redhat.com
Cc: ville.syrjala@linux.intel.com
Cc: michael.thayer@oracle.com
Cc: knut.osmundsen@oracle.com
Cc: frank.mehnert@oracle.com
Cc: Borislav Petkov <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1610282114380.5053@nanos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/setup.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index bbfbca5..7be097e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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();

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:x86/urgent] x86/smpboot: Init apic mapping before usage
  2016-10-28 19:34   ` Thomas Gleixner
  2016-10-29 10:18     ` Borislav Petkov
  2016-10-29 12:04     ` [tip:x86/urgent] x86/smpboot: Init apic mapping before usage tip-bot for Thomas Gleixner
@ 2016-10-29 12:06     ` tip-bot for Thomas Gleixner
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Thomas Gleixner @ 2016-10-29 12:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: bp, michal.necasek, linux-kernel, mingo, wbauer, tglx, hpa

Commit-ID:  1e90a13d0c3dc94512af1ccb2b6563e8297838fa
Gitweb:     http://git.kernel.org/tip/1e90a13d0c3dc94512af1ccb2b6563e8297838fa
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 29 Oct 2016 13:42:42 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
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)!

Fixes: ff8560512b8d ("x86/boot/smp: Don't try to poke disabled/non-existent APIC")
Reported-and-debugged-by: Michal Necasek <michal.necasek@oracle.com>
Reported-and-tested-by: Wolfgang Bauer <wbauer@tmo.at>
Cc: prarit@redhat.com
Cc: ville.syrjala@linux.intel.com
Cc: michael.thayer@oracle.com
Cc: knut.osmundsen@oracle.com
Cc: frank.mehnert@oracle.com
Cc: Borislav Petkov <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1610282114380.5053@nanos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/setup.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index bbfbca5..9c337b0 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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();

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-29 12:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-28 18:52 4.8.2 not booting in 32-bit VM without I/O-APIC Michal Necasek
2016-10-28 19:00 ` Thomas Gleixner
2016-10-28 19:34   ` Thomas Gleixner
2016-10-29 10:18     ` Borislav Petkov
2016-10-29 12:04     ` [tip:x86/urgent] x86/smpboot: Init apic mapping before usage tip-bot for Thomas Gleixner
2016-10-29 12:06     ` tip-bot for Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.