Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 May 2010 00:27:40 +0200
From:      Attilio Rao <attilio@freebsd.org>
To:        Marius Strobl <marius@alchemy.franken.de>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r206878 - head/sys/kern
Message-ID:  <l2v3bbf2fe11005091527r7651564eq1b2bdf3e1096b32b@mail.gmail.com>
In-Reply-To: <20100509170414.GA35602@alchemy.franken.de>
References:  <201004192327.o3JNRsK4047856@svn.freebsd.org> <20100509170414.GA35602@alchemy.franken.de>

next in thread | previous in thread | raw e-mail | index | archive | help
2010/5/9 Marius Strobl <marius@alchemy.franken.de>:
> On Mon, Apr 19, 2010 at 11:27:54PM +0000, Attilio Rao wrote:
>> Author: attilio
>> Date: Mon Apr 19 23:27:54 2010
>> New Revision: 206878
>> URL: http://svn.freebsd.org/changeset/base/206878
>>
>> Log:
>> =C2=A0 Fix a deadlock in the shutdown code:
>> =C2=A0 When performing a smp_rendezvous() or more likely, on amd64 and i=
386,
>> =C2=A0 a smp_tlb_shootdown() the caller will end up with the smp_ipi_mtx
>> =C2=A0 spinlock held, busy-waiting for other CPUs to acknowledge the ope=
ration.
>> =C2=A0 As long as CPUs are suspended (via cpu_reset()) between the activ=
e mask
>> =C2=A0 read and IPI sending there can be a deadlock where the caller wil=
l wait
>> =C2=A0 forever for a dead CPU to acknowledge the operation.
>> =C2=A0 Please note that on CPU0 that is going to be someway heavier beca=
use of
>> =C2=A0 the spinlocks being disabled earlier than quitting the machine.
>>
>> =C2=A0 Fix this bug by calling cpu_reset() with the smp_ipi_mtx held.
>> =C2=A0 Note that it is very likely that a saner offline/online CPUs mech=
anism
>> =C2=A0 will help heavilly in fixing similar cases as it is likely more b=
ugs
>> =C2=A0 of this type may arise in the future.
>>
>
> This change causes a hang for me when running an SMP kernel on an
> UP machine or an MP machine with SMP disabled as in these cases
> smp_ipi_mtx isn't initialized (see mp_start()). The below patch
> fixes this for me.

Marius,
thanks a lot for reporting this.
However, I think that a better fix is to always initialize the mutex.
Do you think the following patch is fine for you?:
http://www.freebsd.org/~attilio/smpipi_fixup.diff

Thanks,
Attilio


--=20
Peace can only be achieved by understanding - A. Einstein



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?l2v3bbf2fe11005091527r7651564eq1b2bdf3e1096b32b>