svn commit: r329458 - head/sbin/devmatch

John Baldwin jhb at freebsd.org
Tue Feb 20 22:49:55 UTC 2018


On Saturday, February 17, 2018 08:12:22 AM Warner Losh wrote:
> On Sat, Feb 17, 2018 at 8:04 AM, Hans Petter Selasky <hps at selasky.org>
> wrote:
> 
> > On 02/17/18 15:56, Warner Losh wrote:
> >
> >> The right fix there, I think, is to load them all at once, in one kldload
> >> operation and not loop in /etc/rc.d/devmatch.
> >>
> >
> > Each driver will invoke the driver loaded device method, so this will race
> > aswell!
> >
> > You have a point. But, that means devmatch should read ahead the nomatch
> > events until the end, to make sure the correct driver is loaded.
> >
> 
> We could batch them in the kernel. But that's still unsatisfying since
> there could still be other races because multiple drivers wanting the same
> device is well defined only when all the drivers are there at probe/attach
> time.

I think you will want a way to "freeze" device probing/attaching and then
you can kldload multiple things, then "unfreeze".  During the freeze we
could maintain a linked-list of the bus devices that need to re-probe
children.  You could hook this in bus_generic_driver_added().  It might mean
that we need to not permit custom bus_driver_added methods anymore, or split
it up into two stages, one that is driver-specific (what calls DEVICE_IDENTIFY
now and should probably still happen during a "freeze"), and one that is
bus-wide and should happen after the thaw (the loop around
device_probe_and_attach()).

-- 
John Baldwin


More information about the svn-src-head mailing list