Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Jan 2015 13:36:31 +0100
From:      Hans Petter Selasky <hps@selasky.org>
To:        Ivan Klymenko <fidaj@ukr.net>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>, freebsd-arch@freebsd.org
Subject:   Re: [RFC] kern/kern_timeout.c rewrite in progress
Message-ID:  <54A53F4F.2000003@selasky.org>
In-Reply-To: <54A4A002.8010802@selasky.org>
References:  <54A1B38C.1000709@selasky.org> <20150101005613.4f788b0c@nonamehost.local> <54A49CA5.2060801@selasky.org> <54A4A002.8010802@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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



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