svn commit: r188464 - head/sys/kern

M. Warner Losh imp at bsdimp.com
Tue Feb 10 23:57:28 PST 2009


In message: <200902110848450000 at 442211619>
            "Alexander Motin" <mav at FreeBSD.org> writes:
: >             Alexander Motin <mav at freebsd.org> 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...

Warner


More information about the svn-src-head mailing list