Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Aug 2019 20:27:05 -0700
From:      Conrad Meyer <cem@freebsd.org>
To:        Yuri Pankov <yuripv@yuripv.net>
Cc:        Warner Losh <imp@bsdimp.com>, FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: ichsmb(4) and msleep()
Message-ID:  <CAG6CVpW1kYqg7NgK5WfOFRBcsb0WbM1G8A5PPfeTDpsZ8Cxw3A@mail.gmail.com>
In-Reply-To: <4201916c-0f7f-0bf6-2d17-e9f6a1879ba7@yuripv.net>
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> <4201916c-0f7f-0bf6-2d17-e9f6a1879ba7@yuripv.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 28, 2019 at 6:35 AM Yuri Pankov <yuripv@yuripv.net> wrote:
>
> Warner Losh wrote:
> > 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?

I think pretty much all drivers attach when interrupts are enabled
(not the same as !cold)?  At least x86 enables interrupts on BSP at
SI_SUB_INTR, and DRIVER_MODULE drivers *load* at SI_SUB_DRIVERS, and
the INTR one is ordered before the other.  My skim read is that
drivers do not actually attach until SI_SUB_CONFIGURE.

I think the panic / test in sleepq_set_timeout_sbt is maybe overly
strong?  !cold indicates the entire autoconfigure process has
concluded.  But interrupts are available long before that.  Seems like
hardclock is started at ~SI_SUB_CLOCKS?  Which is admittedly after
DRIVERS, but still long before !cold.  I'm not sure what set of
interrupt/timer functionality is needed for sleepq, but likely that
condition can be relaxed.

If it cannot be relaxed enough for your driver, you could expand your
DRIVER_MODULE() into the expanded macro, replacing SI_SUB_DRIVERS with
a later stage.

Best,
Conrad



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