From owner-svn-src-head@FreeBSD.ORG Wed Feb 11 08:27:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36290106566C; Wed, 11 Feb 2009 08:27:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id 1F0138FC14; Wed, 11 Feb 2009 08:27:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) X-Spam-Flag: SKIP X-Spam-Yversion: Spamooborona-2.1.0 Received: from orphanage.alkar.net (account mav@alkar.net [212.86.226.11] verified) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPA id 234242706; Wed, 11 Feb 2009 10:27:31 +0200 Message-ID: <49928BF2.1010009@FreeBSD.org> Date: Wed, 11 Feb 2009 10:27:30 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.14 (X11/20080612) MIME-Version: 1.0 To: "M. Warner Losh" References: <200902110848450000@442211619> <20090211.005524.-1889955595.imp@bsdimp.com> In-Reply-To: <20090211.005524.-1889955595.imp@bsdimp.com> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r188464 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 11 Feb 2009 08:27:33 -0000 M. Warner Losh wrote: > In message: <200902110848450000@442211619> > "Alexander Motin" writes: > : > Alexander Motin writes: > : > : Author: mav > : > : Date: Tue Feb 10 23:22:29 2009 > : > : New Revision: 188464 > : > : URL: http://svn.freebsd.org/changeset/base/188464 > : > : > : > : Log: > : > : Check for device_set_devclass() errors and skip driver probe/attach if any. > : > : Attach call without devclass set crashes the system. > : > : > : > : On resume AHCI driver sometimes tries to create duplicate adX device. > : > : It is surely his own problem, but IMHO it is not a reason to crash here. > : > : Other reasons are also possible. > : > : > : > : Modified: > : > : head/sys/kern/subr_bus.c > : > : > : > : Modified: head/sys/kern/subr_bus.c > : > : ============================================================================== > : > : --- head/sys/kern/subr_bus.c Tue Feb 10 23:17:20 2009 (r188463) > : > : +++ head/sys/kern/subr_bus.c Tue Feb 10 23:22:29 2009 (r188464) > : > : @@ -1756,8 +1756,13 @@ device_probe_child(device_t dev, device_ > : > : dl = next_matching_driver(dc, child, dl)) { > : > : PDEBUG(("Trying %s", DRIVERNAME(dl->driver))); > : > : device_set_driver(child, dl->driver); > : > : - if (!hasclass) > : > : - device_set_devclass(child, dl->driver->name); > : > : + if (!hasclass) { > : > : + if (device_set_devclass(child, dl->driver->name)) { > : > : + PDEBUG(("Unable to set device class")); > : > : + device_set_driver(child, NULL); > : > : + continue; > : > : + } > : > : + } > : > : > : > : /* Fetch any flags for the device before probing. */ > : > : resource_int_value(dl->driver->name, child->unit, > : > > : > I'd prefer applying this patch to make it whine louder so we don't > : > forget about it: > : > : device_set_devclass() itself already complains about driver problem (but only with verbose messages). At this point the only thing we should do is not to crash. As I have said, there also can be other failure reasons except driver bugs, for example, low memory. > > Low memory in this path is extremely rare, but we should report the > reason... The most likely cause is a driver bug, and one we should > complain about... I will not argue, let it be if you wish. Just DEVICENAME(child) will probably give only something like "unknown" here without class set, and will be not very informative. Same time devclass_alloc_unit() called deeply inside device_set_driver() already prints "ad: ad4 already exists; skipping it" message. We can just remove 'if (bootverbose)' there. Actually there is some your "XXX". -- Alexander Motin