[RFC] kern/kern_timeout.c rewrite in progress

Hans Petter Selasky hps at selasky.org
Thu Jan 1 12:35:50 UTC 2015


On 01/01/15 02:16, Hans Petter Selasky wrote:
> On 01/01/15 02:02, Hans Petter Selasky wrote:
>> On 12/31/14 23:56, Ivan Klymenko wrote:
>>> В Mon, 29 Dec 2014 21:03:24 +0100
>>> Hans Petter Selasky <hps at selasky.org> пишет:
>>>
>>
>> Hi,
>>
>> Is your kernel compiled with Witness? Do you see any lock order reversal
>> warnings?
>>
>> Can you do from kgdb:
>>
>> thread apply all bt
>>
>> And send me the result off-list?
>>
>> I'll have a closer look at this tomorrow.
>>
>>>
>>> panic: spin lock held too long
>>> http://paste.org.ru/?acf7io
>>>
>>
>> Thank you!
>>
>

Hi,

I see what is going on. There is an LOR which is not printed because 
MTX_QUIET is passed when locking inside the callback process routine.

It happens because cv_timedwait() is using callouts() to timeout and 
callout_drain() is using cv_wait() to wait for draining. This was not so 
well documented in the old code.

I'll update my patch and send out a new one later today.

I see a room for doing some improvements too:

callout_init(&td->td_slpcallout, CALLOUT_MPSAFE)

Possibly we could use a so-called "DIRECT" callback from the fast IRQ of 
the timer, when waking up other threads from cv_timedwait(), hence only 
spinlocks are involved? This would save waking up the callout SWI only 
to wakeup another thread !

Thank you for testing!

--HPS


More information about the freebsd-arch mailing list