Re: [RFC] kern/kern_timeout.c rewrite in progress

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Thu, 01 Jan 2015 13:36:31 +0100
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
Received on Thu Jan 01 2015 - 11:35:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:54 UTC