Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Aug 2019 16:34:47 +0300
From:      Yuri Pankov <yuripv@yuripv.net>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Hans Petter Selasky <hps@selasky.org>, FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: ichsmb(4) and msleep()
Message-ID:  <4201916c-0f7f-0bf6-2d17-e9f6a1879ba7@yuripv.net>
In-Reply-To: <CANCZdfpevZ2PyLa9yai6cA5JYgNybgyHp0=1=er%2BeuJGcu9hew@mail.gmail.com>
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> <311a21e3-ed61-8679-b416-b2a4c255c6e7@yuripv.net> <1f91f7a6-050d-d690-d374-6b06950d2ce2@yuripv.net> <CANCZdfpevZ2PyLa9yai6cA5JYgNybgyHp0=1=er%2BeuJGcu9hew@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Warner Losh wrote:
> On Wed, Aug 28, 2019, 7:01 AM Yuri Pankov <yuripv@yuripv.net> wrote:
> 
>> Yuri Pankov wrote:
>>> 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)?
>>
>> Here's a review with the nit you mentioned fixed, thanks!
>>
>> https://reviews.freebsd.org/D21452
> 
> 
> 
> What's the advantages of doing this instead of deferring attach until the
> interrupts are running?

None that I can think of, just going with what was suggested and seeing
other drivers doing the same.  Could you please name a driver that
defers attach until !cold?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4201916c-0f7f-0bf6-2d17-e9f6a1879ba7>