From owner-svn-src-head@freebsd.org Tue Feb 20 22:49:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77118F0D41E; Tue, 20 Feb 2018 22:49:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C113B75756; Tue, 20 Feb 2018 22:49:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 0AF6B10AFAD; Tue, 20 Feb 2018 17:49:54 -0500 (EST) From: John Baldwin To: Warner Losh Cc: Hans Petter Selasky , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329458 - head/sbin/devmatch Date: Tue, 20 Feb 2018 12:02:20 -0800 Message-ID: <7557197.0Wg7M2OxNi@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201802171434.w1HEYl8I063603@repo.freebsd.org> <90001804-e025-4981-6b77-350930310ceb@selasky.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 20 Feb 2018 17:49:54 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 22:49:55 -0000 On Saturday, February 17, 2018 08:12:22 AM Warner Losh wrote: > On Sat, Feb 17, 2018 at 8:04 AM, Hans Petter Selasky > 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