linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Thomas Gleixner <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: bp@alien8.de, michal.necasek@oracle.com,
	linux-kernel@vger.kernel.org, mingo@kernel.org, wbauer@tmo.at,
	tglx@linutronix.de, hpa@zytor.com
Subject: [tip:x86/urgent] x86/smpboot: Init apic mapping before usage
Date: Sat, 29 Oct 2016 05:06:52 -0700	[thread overview]
Message-ID: <tip-1e90a13d0c3dc94512af1ccb2b6563e8297838fa@git.kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.20.1610282114380.5053@nanos>

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();

      parent reply	other threads:[~2016-10-29 12:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-1e90a13d0c3dc94512af1ccb2b6563e8297838fa@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=michal.necasek@oracle.com \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wbauer@tmo.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).