Re: [PATCH] i386 kdump boot cpu physical apicid fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
---

 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();
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux