Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Aug 2019 14:41:07 +0300
From:      Yuri Pankov <yuripv@yuripv.net>
To:        Hans Petter Selasky <hps@selasky.org>, freebsd-hackers@freebsd.org
Subject:   Re: ichsmb(4) and msleep()
Message-ID:  <311a21e3-ed61-8679-b416-b2a4c255c6e7@yuripv.net>
In-Reply-To: <7f6de96d-8b56-e242-8950-04a20b197bce@selasky.org>
References:  <7dfebbd3-85d6-c7b7-b83b-fae8b644649e@yuripv.net> <478965aa-5256-e356-5339-de6fb82c3459@selasky.org> <63daa36a-5c22-6b08-3cd7-562fa961ab61@yuripv.net> <7f6de96d-8b56-e242-8950-04a20b197bce@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------DC60AD2380EEEBE0278B6A9E
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Hans Petter Selasky wrote:
> On 2019-08-28 11:44, Yuri Pankov wrote:
>> Hans Petter Selasky wrote:
>>> On 2019-08-28 11:07, Yuri Pankov wrote:
>>>> I have a "timed sleep before timers are working" panic in ichsmb_readb()
>>>> calling ichsmb_wait() which uses msleep().  That is trying to
>>>> jedec_dimm(4) module so it's trying to attach pretty early in boot.
>>>> What would be the correct replacement for msleep() here?
>>>>
>>>
>>> If you only need a sleep-delay, pause() is the right one. It handles
>>> cold-boot.
>>
>> I guess that won't work here as we need to be waked up by interrupt
>> handler on command completion, and pause() seems to sleep
>> unconditionally for the given time in 'cold' case (if I'm reading the
>> code correctly).
> 
> If you are too early inside a SYSINIT() path, then you cannot use 
> sleeping. You will have to use polling in a loop with a fixed DELAY() to 
> know the timeout.

Thanks for the help.

Something like the following (it seems to work)?



--------------DC60AD2380EEEBE0278B6A9E
Content-Type: text/plain; charset=UTF-8;
 name="ichsmb.diff.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="ichsmb.diff.txt"

ZGlmZiAtLWdpdCBhL3N5cy9kZXYvaWNoc21iL2lj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CW10eF9sb2NrKCZzYy0+bXV0ZXgpOworCQkJaWYgKHNjLT5p
Y2hfY21kID09IC0xKSB7CisJCQkJZXJyb3IgPSAwOworCQkJCWJyZWFrOworCQkJfQorCQl9
CisJfSBlbHNlIHsKKwkJZXJyb3IgPSBtc2xlZXAoc2MsICZzYy0+bXV0ZXgsIFBaRVJPLCAi
aWNoc21iIiwgaHogLyA0KTsKKwkJREJHKCJtc2xlZXAgLT4gJWRcbiIsIGVycm9yKTsKKwl9
CiAJc3dpdGNoIChlcnJvcikgewogCWNhc2UgMDoKIAkJc21iX2Vycm9yID0gc2MtPnNtYl9l
cnJvcjsK
--------------DC60AD2380EEEBE0278B6A9E--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?311a21e3-ed61-8679-b416-b2a4c255c6e7>