Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Feb 2018 12:02:20 -0800
From:      John Baldwin <jhb@freebsd.org>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Hans Petter Selasky <hps@selasky.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r329458 - head/sbin/devmatch
Message-ID:  <7557197.0Wg7M2OxNi@ralph.baldwin.cx>
In-Reply-To: <CANCZdfqJV8YG1c6K8SCKZBTgHEP_OTZLBs8Ju_E_tqYsirMSXQ@mail.gmail.com>
References:  <201802171434.w1HEYl8I063603@repo.freebsd.org> <90001804-e025-4981-6b77-350930310ceb@selasky.org> <CANCZdfqJV8YG1c6K8SCKZBTgHEP_OTZLBs8Ju_E_tqYsirMSXQ@mail.gmail.com>

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



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