svn commit: r206878 - head/sys/kern

Attilio Rao attilio at freebsd.org
Sun May 9 22:27:42 UTC 2010


2010/5/9 Marius Strobl <marius at 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:
>>   Fix a deadlock in the shutdown code:
>>   When performing a smp_rendezvous() or more likely, on amd64 and i386,
>>   a smp_tlb_shootdown() the caller will end up with the smp_ipi_mtx
>>   spinlock held, busy-waiting for other CPUs to acknowledge the operation.
>>   As long as CPUs are suspended (via cpu_reset()) between the active mask
>>   read and IPI sending there can be a deadlock where the caller will wait
>>   forever for a dead CPU to acknowledge the operation.
>>   Please note that on CPU0 that is going to be someway heavier because of
>>   the spinlocks being disabled earlier than quitting the machine.
>>
>>   Fix this bug by calling cpu_reset() with the smp_ipi_mtx held.
>>   Note that it is very likely that a saner offline/online CPUs mechanism
>>   will help heavilly in fixing similar cases as it is likely more bugs
>>   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


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


More information about the svn-src-all mailing list