From: Vivek Goyal <vgoyal@in.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, fastboot@lists.osdl.org
Subject: Re: [PATCH] i386 kdump boot cpu physical apicid fix
Date: Thu, 18 May 2006 16:57:26 -0400 [thread overview]
Message-ID: <20060518205726.GC20121@in.ibm.com> (raw)
In-Reply-To: <20060518123655.7057e20e.akpm@osdl.org>
On Thu, May 18, 2006 at 12:36:55PM -0700, Andrew Morton wrote:
> >
> > diff -puN arch/i386/kernel/apic.c~kdump-i386-boot-cpu-physical-apicid-fix arch/i386/kernel/apic.c
> > --- linux-2.6.17-rc4-16M/arch/i386/kernel/apic.c~kdump-i386-boot-cpu-physical-apicid-fix 2006-05-17 13:27:44.000000000 -0400
> > +++ linux-2.6.17-rc4-16M-root/arch/i386/kernel/apic.c 2006-05-18 05:11:44.000000000 -0400
> > @@ -860,12 +860,7 @@ void __init init_apic_mappings(void)
> > printk(KERN_DEBUG "mapped APIC to %08lx (%08lx)\n", APIC_BASE,
> > apic_phys);
> >
> > - /*
> > - * Fetch the APIC ID of the BSP in case we have a
> > - * default configuration (or the MP table is broken).
> > - */
> > - if (boot_cpu_physical_apicid == -1U)
> > - boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
> > + boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
> >
>
> I just don't think we can do this sort of thing. The workaround for broken
> MP tables is one of those nasty things we've gained through many years of
> hard-won real-world experience.
>
> If we just go and toss it away like this, all those machines which used to
> work will break and there'll be a sad little dribble of regression reports
> which everyone cheerily ignores as usual.
>
> So, sorry, nope. Please find a way to fix kdump while retaining the
> broken-MP-table workaround.
Ok. I thought if overriding MP tables works in SMP case then it should work
in UP case too. But anyway, here is the take2. This one is little ugly and
hackish but limits the impact to only UP kernels and that too if CRASH_DUMP
is enabled.
o Kdump second kernel boot fails after a system crash if second kernel
is UP and acpi=off and if crash occurred on a non-boot cpu.
o Issue here is that MP tables report boot cpu lapic id as 0 but second
kernel is booting on a different processor and MP table data is stale
in this context. Hence apic_id_registered() check fails in setup_local_APIC()
when called from APIC_init_uniprocessor().
o Problem is not seen if ACPI is enabled as in that case
boot_cpu_physical_apicid is read from the LAPIC.
o Problem is not seen with SMP kernels as well because in this case also
boot_cpu_physical_apicid is read from LAPIC. (smp_boot_cpus()).
o The problem is fixed by reading boot_cpu_physical_apicid from LAPIC
if it is a UP kernel and CRASH_DUMP is enabled.
Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
---
arch/i386/kernel/apic.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff -puN arch/i386/kernel/apic.c~kdump-i386-boot-cpu-physical-apicid-fix-take2 arch/i386/kernel/apic.c
--- linux-2.6.17-rc4-16M/arch/i386/kernel/apic.c~kdump-i386-boot-cpu-physical-apicid-fix-take2 2006-05-18 11:26:45.000000000 -0400
+++ linux-2.6.17-rc4-16M-root/arch/i386/kernel/apic.c 2006-05-18 11:26:45.000000000 -0400
@@ -1341,6 +1341,14 @@ int __init APIC_init_uniprocessor (void)
connect_bsp_APIC();
+ /*
+ * Hack: In case of kdump, after a crash, kernel might be booting
+ * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid
+ * might be zero if read from MP tables. Get it from LAPIC.
+ */
+#ifdef CONFIG_CRASH_DUMP
+ boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
+#endif
phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
setup_local_APIC();
_
prev parent reply other threads:[~2006-05-18 20:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-18 16:35 [PATCH] i386 kdump boot cpu physical apicid fix Vivek Goyal
2006-05-18 19:36 ` Andrew Morton
2006-05-18 20:57 ` Vivek Goyal [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=20060518205726.GC20121@in.ibm.com \
--to=vgoyal@in.ibm.com \
--cc=akpm@osdl.org \
--cc=fastboot@lists.osdl.org \
--cc=linux-kernel@vger.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.