Source-Changes archive

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

Re: CVS commit: src/sys/kern



>>
>> On Mar 12, 2007, at 5:35 PM, Andrew Doran wrote:
>>
>>> Module Name:    src
>>> Committed By:    ad
>>> Date:        Tue Mar 13 00:35:44 UTC 2007
>>>
>>> Modified Files:
>>>    src/sys/kern: kern_fork.c
>>>
>>> Log Message:
>>> Sync with kern_proc.c: make p2->p_rasmutex a spin mutex at IPL_SCHED.
>>
>> Why does this have to be at IPL_SCHED?  Oh, because it's accessed in
>> the guts of cpu_switch()?
>
> Yup. Otherwise, it's not safe.

To elaborate, it can't sleep since it's taken from cpu_switch(), so it
needs to be a spin lock. From kern_ras.c it needs to be taken with the
kernel_lock held, and in cpu_switch() it is taken without the kernel_lock
held. So we need to block any interrupts that could take the kernel_lock
otherwise there is the potential for deadlock. I have the beginnings of a
lock-free version of ras_lookup() somewhere but have not had the time to
finish it or test it further.

Andrew





Home | Main Index | Thread Index | Old Index