All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Gleb Natapov <gleb@redhat.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@sophos.com>,
	Yinghai Lu <yinghai@kernel.org>, Avi Kivity <avi@redhat.com>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	KVM list <kvm@vger.kernel.org>
Subject: Re: 2.6.35 hangs on early boot in KVM
Date: Wed, 04 Aug 2010 03:37:43 -0700	[thread overview]
Message-ID: <m1fwyuacjs.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <20100804093623.GE10499@redhat.com> (Gleb Natapov's message of "Wed\, 4 Aug 2010 12\:36\:23 +0300")

Gleb Natapov <gleb@redhat.com> writes:

> On Wed, Aug 04, 2010 at 10:16:08AM +0100, Tvrtko Ursulin wrote:
>> 
>> Not the tip but 2.6.35 with earlyprintk=ttyS0,115200:
>> 
>> [    0.000000] Processor #0 (Bootup-CPU)
>> [    0.000000] I/O APIC #1 Version 17 at 0xFEC00000.
>> [    0.000000] BUG: unable to handle kernel paging request at ffffb030
>> [    0.000000] IP: [<c011d136>] native_apic_mem_read+0x16/0x20
>> [    0.000000] *pde = 00832067 *pte = 00000000
> Accessing APIC version register before APIC is mapped.

Yep. I see it now.  We have some of the silliest code.  We only
go down this path for certain revs of Intel cpus, and I double checked
this change on an AMD cpu which explains why I missed hitting this
case.

The call path that is new in they bisected commit is:
MP_ioapic_info()
  mp_register_ioapic()
   io_apic_unique_id()
     io_apic_get_unique_id()
       get_physical_broadcast()
         modern_apic()
           lapic_get_version()
             apic_read(APIC_LVR)
  

Tvrtko can you test this patch and verify it fixes the kvm booting
issue?

This patch just maps the lapic early in the mmparse.c just like we
do in acpi/boot.c when parsing the acpi tables.

Eric


---

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index a96489e..c07e513 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1606,7 +1606,7 @@ void __init init_apic_mappings(void)
 		 * acpi lapic path already maps that address in
 		 * acpi_register_lapic_address()
 		 */
-		if (!acpi_lapic)
+		if (!acpi_lapic && !smp_found_config)
 			set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
 
 		apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n",
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index d86dbf7..d7b6f7f 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -274,6 +274,18 @@ static void __init smp_dump_mptable(struct mpc_table *mpc, unsigned char *mpt)
 
 void __init default_smp_read_mpc_oem(struct mpc_table *mpc) { }
 
+static void __init smp_register_lapic_address(unsigned long address)
+{
+	mp_lapic_addr = address;
+
+	set_fixmap_nocache(FIX_APIC_BASE, address);
+	if (boot_cpu_physical_apicid == -1U) {
+		boot_cpu_physical_apicid  = read_apic_id();
+		apic_version[boot_cpu_physical_apicid] =
+			 GET_APIC_VERSION(apic_read(APIC_LVR));
+	}
+}
+
 static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
 {
 	char str[16];
@@ -295,6 +307,10 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
 	if (early)
 		return 1;
 
+	/* Initialize the lapic mapping */
+	if (!acpi_lapic)
+		smp_register_lapic_address(mpc->lapic);
+
 	if (mpc->oemptr)
 		x86_init.mpparse.smp_read_mpc_oem(mpc);
 


  reply	other threads:[~2010-08-04 10:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03  9:28 2.6.35 hangs on early boot in KVM Tvrtko Ursulin
2010-08-03  9:45 ` Tvrtko Ursulin
2010-08-03 13:53   ` Tvrtko Ursulin
2010-08-03 14:51 ` Avi Kivity
2010-08-03 14:57   ` Tvrtko Ursulin
2010-08-03 15:17     ` Tvrtko Ursulin
2010-08-03 15:31       ` Tvrtko Ursulin
2010-08-03 15:49         ` Borislav Petkov
2010-08-03 16:01           ` Tvrtko Ursulin
2010-08-03 15:59       ` Tvrtko Ursulin
2010-08-03 20:37         ` Eric W. Biederman
2010-08-04  8:09           ` Tvrtko Ursulin
2010-08-03 20:57         ` Yinghai Lu
2010-08-04  8:18           ` Tvrtko Ursulin
2010-08-04  9:05             ` Yinghai Lu
2010-08-04  9:16               ` Tvrtko Ursulin
2010-08-04  9:19                 ` Tvrtko Ursulin
2010-08-04  9:34                 ` Yinghai Lu
2010-08-04  9:44                   ` Tvrtko Ursulin
2010-08-04  9:36                 ` Gleb Natapov
2010-08-04 10:37                   ` Eric W. Biederman [this message]
2010-08-04 10:46                     ` Tvrtko Ursulin
2010-08-04 20:30                       ` [PATCH] x86/apic: Map the local apic when parsing the MP table Eric W. Biederman
2010-08-04 21:49                         ` Yinghai Lu
2010-08-04 21:58                         ` [PATCH 1/2] x86, acpi: merge two register_lapic_address() Yinghai Lu
2010-08-04 22:00                           ` [PATCH 2/2] x86: remove early_init_lapic_mapping Yinghai Lu
2010-08-06  0:15                         ` [tip:x86/urgent] x86, apic: Map the local apic when parsing the MP table tip-bot for Eric W. Biederman
2010-08-07  0:08                           ` Yinghai Lu
2010-08-07  0:15                             ` H. Peter Anvin
2010-08-07  0:51                               ` Yinghai Lu
2010-08-07  1:08                               ` Eric W. Biederman
2010-08-07  1:21                                 ` H. Peter Anvin
2010-08-07  1:30                                   ` Yinghai Lu
2010-08-07  2:49                                     ` Eric W. Biederman
  -- strict thread matches above, loose matches on Subject: below --
2010-08-03 22:28 2.6.35 hangs on early boot in KVM Donald Parsons

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=m1fwyuacjs.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tvrtko.ursulin@sophos.com \
    --cc=yinghai@kernel.org \
    /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 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.