amd64/120202: [panic] kernel panic at start_all_aps, AP not starts

John Baldwin jhb at freebsd.org
Mon Feb 11 12:46:41 PST 2008


On Sunday 10 February 2008 02:10:02 am FUCHIGAMI Masachika wrote:
> The following reply was made to PR amd64/120202; it has been noted by GNATS.
> 
> From: masatic at mbs.sphere.ne.jp (FUCHIGAMI Masachika)
> To: bug-followup at FreeBSD.org
> Cc:  
> Subject: Re: amd64/120202: [panic] kernel panic at start_all_aps, AP not 
starts
> Date: Sun, 10 Feb 2008 16:04:04 +0900
> 
>  I found following patch works well.
>  IMHO, AP does not accept SIPI because the core shutdowns or send SIPI to 
itself in BIOS bootup code.
>  So, i modify the code to send SIPI before AP closes its ears.
>  
>  -- 
>  *** mp_machdep.c.orig	Mon Oct  8 21:51:01 2007
>  --- mp_machdep.c	Fri Feb  8 22:34:41 2008
>  ***************
>  *** 788,796 ****
>  --- 788,798 ----
>    	lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL |
>    	    APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, 0);
>    
>    	/* wait for pending status end */
>  + #if 0
>    	DELAY(10000);		/* wait ~10mS */
>  + #endif
>    	lapic_ipi_wait(-1);
>    
>    	/*
>    	 * next we do a STARTUP IPI: the previous INIT IPI might still be

Removing the wait seems very odd, the pending status should still be there 
even if we wait.  However, this particular IPI is only for older CPUs anyway.  
Try this patch instead perhaps:

Index: amd64/amd64/mp_machdep.c
===================================================================
RCS file: /usr/cvs/src/sys/amd64/amd64/mp_machdep.c,v
retrieving revision 1.287
diff -u -r1.287 mp_machdep.c
--- amd64/amd64/mp_machdep.c	2 Aug 2007 21:17:58 -0000	1.287
+++ amd64/amd64/mp_machdep.c	24 Sep 2007 15:09:43 -0000
@@ -783,13 +783,20 @@
 	/* wait for pending status end */
 	lapic_ipi_wait(-1);
 
-	/* do an INIT IPI: deassert RESET */
-	lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL |
-	    APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, 0);
-
-	/* wait for pending status end */
-	DELAY(10000);		/* wait ~10mS */
-	lapic_ipi_wait(-1);
+	/*
+	 * do an INIT IPI: deassert RESET on older systems to reset APIC ID
+	 * arbitration.  XXX: Should we only do this once?
+	 */
+	if (strcmp(cpu_vendor, "GenuineIntel") != 0 ||
+	    (cpu_id & 0xf00) != 0xf00) {
+		lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL |
+		    APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT,
+		    0);
+
+		/* wait for pending status end */
+		DELAY(10000);		/* wait ~10mS */
+		lapic_ipi_wait(-1);
+	}
 
 	/*
 	 * next we do a STARTUP IPI: the previous INIT IPI might still be
Index: i386/i386/mp_machdep.c
===================================================================
RCS file: /usr/cvs/src/sys/i386/i386/mp_machdep.c,v
retrieving revision 1.282
diff -u -r1.282 mp_machdep.c
--- i386/i386/mp_machdep.c	13 Nov 2007 23:00:24 -0000	1.282
+++ i386/i386/mp_machdep.c	26 Nov 2007 19:09:12 -0000
@@ -907,13 +907,20 @@
 	/* wait for pending status end */
 	lapic_ipi_wait(-1);
 
-	/* do an INIT IPI: deassert RESET */
-	lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL |
-	    APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, 0);
-
-	/* wait for pending status end */
-	DELAY(10000);		/* wait ~10mS */
-	lapic_ipi_wait(-1);
+	/*
+	 * do an INIT IPI: deassert RESET on older systems to reset APIC ID
+	 * arbitration.  XXX: Should we only do this once?
+	 */
+	if (strcmp(cpu_vendor, "GenuineIntel") != 0 ||
+	    (cpu_id & 0xf00) != 0xf00) {
+		lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL |
+		    APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT,
+		    0);
+
+		/* wait for pending status end */
+		DELAY(10000);		/* wait ~10mS */
+		lapic_ipi_wait(-1);
+	}
 
 	/*
 	 * next we do a STARTUP IPI: the previous INIT IPI might still be

-- 
John Baldwin


More information about the freebsd-amd64 mailing list