LKML Archive on lore.kernel.org
 help / 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ messages in thread

* Re: 4.8.2 not booting in 32-bit VM without I/O-APIC
  2016-11-10 14:21 ` Michael Thayer
@ 2016-11-10 17:18   ` Thomas Gleixner
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Gleixner @ 2016-11-10 17:18 UTC (permalink / raw)
  To: Michael Thayer
  Cc: Michal Necasek, prarit, ville.syrjala, frank.mehnert,
	knut.osmundsen, linux-kernel

On Thu, 10 Nov 2016, Michael Thayer wrote:
> On 03.11.2016 21:02, Michal Necasek wrote:
> > Sorry for the delay. I can confirm that the problem is fixed in
> > 4.9.0-rc3 and prefill_possible_map no longer crashes (as it did in
> > 4.9.0-rc2). Thank you!
> > 
> > Just a side question, is the previous fix in commit ff8560512b
> > (x86/boot/smp: Don't try to poke disabled/non-existent APIC) actually
> > still required or would the no-op APIC driver take care of it?
> 
> Sorry for the delay too (holiday-related).  I tested 4.9.0rc4 on a 32-bit

No problem. I hope you enjoyed your well earned vacation :)

> VirtualBox virtual machine without I/O-APIC and can confirm that it now boots.
> Since I am at it, the OHCI timer wheel-related problems are also no longer
> reproducible.

Thanks for reporting back!

       tglx

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

* Re: 4.8.2 not booting in 32-bit VM without I/O-APIC
  2016-11-03 20:02 4.8.2 not booting in 32-bit VM without I/O-APIC Michal Necasek
@ 2016-11-10 14:21 ` Michael Thayer
  2016-11-10 17:18   ` Thomas Gleixner
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Thayer @ 2016-11-10 14:21 UTC (permalink / raw)
  To: tglx
  Cc: Michal Necasek, prarit, ville.syrjala, frank.mehnert,
	knut.osmundsen, linux-kernel

Hello,

On 03.11.2016 21:02, Michal Necasek wrote:
> Sorry for the delay. I can confirm that the problem is fixed in
> 4.9.0-rc3 and prefill_possible_map no longer crashes (as it did in
> 4.9.0-rc2). Thank you!
>
> Just a side question, is the previous fix in commit ff8560512b
> (x86/boot/smp: Don't try to poke disabled/non-existent APIC) actually
> still required or would the no-op APIC driver take care of it?

Sorry for the delay too (holiday-related).  I tested 4.9.0rc4 on a 
32-bit VirtualBox virtual machine without I/O-APIC and can confirm that 
it now boots.  Since I am at it, the OHCI timer wheel-related problems 
are also no longer reproducible.

Regards and thanks,

Michael

>
> Regards, Michal
>
> ----- Original Message ----- From: tglx@linutronix.de To:
> michal.necasek@oracle.com Cc: prarit@redhat.com,
> ville.syrjala@linux.intel.com, michael.thayer@oracle.com,
> knut.osmundsen@oracle.com, frank.mehnert@oracle.com,
> linux-kernel@vger.kernel.org Sent: Friday, October 28, 2016 9:37:31
> 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, 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();
>

-- 
Michael Thayer | VirtualBox engineer
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | D-71384 Weinstadt

ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstraße 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister
der Handelskammer Midden-Nederland, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher

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

* Re: 4.8.2 not booting in 32-bit VM without I/O-APIC
@ 2016-11-03 20:02 Michal Necasek
  2016-11-10 14:21 ` Michael Thayer
  0 siblings, 1 reply; 11+ messages in thread
From: Michal Necasek @ 2016-11-03 20:02 UTC (permalink / raw)
  To: tglx
  Cc: prarit, ville.syrjala, michael.thayer, frank.mehnert,
	knut.osmundsen, linux-kernel


    Hi Thomas,

 Sorry for the delay. I can confirm that the problem is fixed in 4.9.0-rc3 and prefill_possible_map no longer crashes (as it did in 4.9.0-rc2). Thank you!

 Just a side question, is the previous fix in commit ff8560512b (x86/boot/smp: Don't try to poke disabled/non-existent APIC) actually still required or would the no-op APIC driver take care of it?

    Regards,
      Michal

----- Original Message -----
From: tglx@linutronix.de
To: michal.necasek@oracle.com
Cc: prarit@redhat.com, ville.syrjala@linux.intel.com, michael.thayer@oracle.com, knut.osmundsen@oracle.com, frank.mehnert@oracle.com, linux-kernel@vger.kernel.org
Sent: Friday, October 28, 2016 9:37:31 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, 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] 11+ messages in thread

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

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] 11+ messages in thread

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


   Hi Thomas,

 In case you haven't had a chance to take a look yet... 

 We had to dig a bit because the problem introduced by commit 2a51fe08 (arch/x86: Handle non enumerated CPU after physical hotplug) <1> is not fixed for us by commit ff856051 (arch/x86: Handle non enumerated CPU after physical hotplug) <2>.

 To recap, after the initial commit, systems with no local APIC panicked <4> early during boot. That showed up for us in VirtualBox, but not surprisingly, physical systems are also affected <3>. The second patch fixes systems with no local APIC, but not systems which have no ACPI MADT (or no ACPI), no MP tables, yet do have an APIC.

 The core problem is init ordering. In setup_arch() in arch/x86/kernel/setup.c, prefill_possible_map() is called *before* init_apic_mappings(). On typical modern systems, the local APIC will be set up either through ACPI or MP tables by the time prefill_possible_map() runs, but it is incorrect to assume that the APIC must be initialized by the time prefill_possible_map() is entered. That's why the APIC callbacks aren't no-ops there, they simply haven't been set up yet.

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


     Regards,
        Michal

<1>
https://patchwork.kernel.org/patch/9366095/
<2>
https://patchwork.kernel.org/patch/9390349/
<3> 
https://bugs.archlinux.org/task/51506
<4>
Using APIC driver default
ACPI: PM-Timer IO Port: 0x4008
BUG: unable to handle kernel paging request at ffffc020
IP: [<c8045e0d>] native_apic_mem_read+0xd/0x10
*pde = 08b8a063
*pte = 00000000
Oops: 0000 [#1] SMP
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.9.0-040900rc1-generic
#201610151630
Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox
12/01/2006
task: c89fda80 task.stack: c89f8000
EIP: 0060:[<c8045e0d>] EFLAGS: 00210046 CPU: 0
EIP is at native_apic_mem_read+0xd/0x10
EAX: ffffc020 EBX: ffffffff ECX: c89f9f40 EDX: fffff000
ESI: c8b8d000 EDI: c8b89400 EBP: c89f9f88 ESP: c89f9f84
  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
CR0: 80050033 CR2: ffffc020 CR3: 08b8c000 CR4: 00040690
Stack:
  c8040eb6 c89f9fb8 c8accc5e c89f9fb8 c8b8d000 c8ac424a 33120000 00000000
  35888000 00000000 00033120 00000000 c80ba5f7 00000000 00000000 00000000
  00000000 00174f46 00174f46 0008f800 c8b8d800 08e34003 c8abe7f5 c88f4b62
Call Trace:
  [<c8040eb6>] ? hard_smp_processor_id+0x16/0x30
  [<c8accc5e>] ? prefill_possible_map+0x16/0x137
  [<c8ac424a>] ? setup_arch+0xaf3/0xbdf
  [<c80ba5f7>] ? vprintk_default+0x37/0x40
  [<c8abe7f5>] ? start_kernel+0x8d/0x3d7
Code: a1 d8 89 b9 c8 5d c3 66 90 66 90 66 90 90 8b 0d b0 f5 a0 c8 8d 84
08 00 d0 ff ff 89 10 c3 8b 15 b0 f5 a0 c8 8d 84 10 00 d0 ff ff <8b> 00 c3
8b 15 20 94 9a c8 53 89 c3 b8 30 00 00 00 ff 52 78 3c
EIP: [<c8045e0d>]
native_apic_mem_read+0xd/0x10
  SS:ESP 0068:c89f9f84
CR2: 00000000ffffc020
---[ end trace f68728a0d3053b52 ]---


----- Original Message -----
From: tglx@linutronix.de
To: michal.necasek@oracle.com
Cc: michael.thayer@oracle.com, frank.mehnert@oracle.com, knut.osmundsen@oracle.com
Sent: Monday, October 24, 2016 9:39:45 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 Mon, 24 Oct 2016, Michal Necasek wrote:
> 
>  To explain a bit, disabling the I/O APIC also prevents the MP tables
> from being created in the VirtualBox VM (historical reasons) and there
> will likewise be no ACPI MADT.
>
>  I believe the panic is triggered when neither ACPI nor MPS does any CPU
> discovery. Then the local APIC isn't mapped and prefill_possible_map()
> will page fault and panic because num_processors is zero and it just
> assumes that the local APIC is present and accessible.

> On systems with no MP tables, 'acpi=off' or 'nolapic' kernel arguments
> trigger the same panic. I didn't find a way to prevent Linux from looking
> at the MP tables if they're present.

Hmm. In both cases we should end up with apic == apic_noop() so any access
to the apic should not result in a panic. I'll have a look.

Thanks,

	tglx

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

end of thread, back to index

Thread overview: 11+ 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
  -- strict thread matches above, loose matches on Subject: below --
2016-11-03 20:02 4.8.2 not booting in 32-bit VM without I/O-APIC Michal Necasek
2016-11-10 14:21 ` Michael Thayer
2016-11-10 17:18   ` Thomas Gleixner
2016-10-28 18:30 Michal Necasek
2016-10-28 18:38 ` Thomas Gleixner

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox