Date: Wed, 8 Aug 2012 17:26:56 -0700 From: "mnln.l4" <mnln.l4@gmail.com> To: John Baldwin <jhb@freebsd.org>, freebsd-stable@freebsd.org Subject: Re: Kernel panic at early boot time Message-ID: <CALOP8J8axm_gTKR7UDLjykkoWdwB-BW-dYLaeXgYO76-TAF3gg@mail.gmail.com> In-Reply-To: <CALOP8J-S=pJWsNVoYSdgN%2BabAN07_fxqTJohFFeM%2BsSrg-cEZg@mail.gmail.com> References: <CALOP8J-2dEkFmmYS8u4sJSaPTbSssYeYxnfqc6N1AMdv88kz3Q@mail.gmail.com> <201206190754.03765.jhb@freebsd.org> <CALOP8J-S=pJWsNVoYSdgN%2BabAN07_fxqTJohFFeM%2BsSrg-cEZg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
I finally have some time to take a closer look at this issue. Yes, it is caused by SMI#. DragonflyBSD has tried to fix the similar problem (see http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/bb467734fc407e2c2de7f8314c63dd9f708f4df4) But Windows and Linux don't cause such problem on my machine. I compared MP initialization code between FreeBSD, Linux and NetBSD. I believe the problem is FreeBSD doesn't wait for 10ms between IPI_INIT assert and IPI_INIT deassert (though FreeBSD waits for 10ms after IPI_INIT deassert). After inserting 10ms wait time, the issue is solved. BTW, Intel's MP spec 1.4 doesn't explain very well either. Patch for AMD64 (similar change for i386 as well) Index: mp_machdep.c =================================================================== --- mp_machdep.c (revision 239120) +++ mp_machdep.c (working copy) @@ -993,6 +993,8 @@ lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE | APIC_LEVEL_ASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, apic_id); + DELAY(10000); /* wait ~10mS */ + /* wait for pending status end */ lapic_ipi_wait(-1); For comparison, 1. FreeBSD's ap_start() method: http://fxr.watson.org/fxr/source/amd64/amd64/mp_machdep.c?v=FREEBSD9#L977 2. Linux's wakeup_secondary_cpu_via_init() method: http://lxr.linux.no/linux+v3.5/arch/x86/kernel/smpboot.c#L527 3. NetBSD's x86_ipi_init() method: http://fxr.watson.org/fxr/source/arch/x86/x86/lapic.c?v=NETBSD5#L507, http://fxr.watson.org/fxr/source/arch/xen/x86/cpu.c?v=NETBSD5;im=bigexcerpts#L858 Best, On Fri, Jun 22, 2012 at 6:55 PM, mnln.l4 <mnln.l4@gmail.com> wrote: > Thanks for explaining the cause! > > > On Tue, Jun 19, 2012 at 4:54 AM, John Baldwin <jhb@freebsd.org> wrote: >> >> On Sunday, June 17, 2012 2:35:14 pm mnln.l4 wrote: >> > I get a kernel panic at early boot time on 9.0-stable (r237150), >> > GENERIC, >> > AMD64. >> > >> > Repro step: >> > 1. Boot, wait for welcome screen. >> > 2. Repeat pressing Enter key rapidly (so kernel is loading, don't stop >> > pressing Enter key). >> > 3. See the following message at early boot >> >> So don't do that. All your key presses are triggering SMI# events that >> are >> interfering with the AP's ability to respond to its startup IPI. There is >> nothing we can do about this in the OS. >> >> -- >> John Baldwin > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALOP8J8axm_gTKR7UDLjykkoWdwB-BW-dYLaeXgYO76-TAF3gg>