From owner-freebsd-bugs@FreeBSD.ORG Tue Jan 10 12:00:24 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DC101065746 for ; Tue, 10 Jan 2012 12:00:24 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7A4448FC28 for ; Tue, 10 Jan 2012 12:00:24 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q0AC0OaP058470 for ; Tue, 10 Jan 2012 12:00:24 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q0AC0OXl058469; Tue, 10 Jan 2012 12:00:24 GMT (envelope-from gnats) Resent-Date: Tue, 10 Jan 2012 12:00:24 GMT Resent-Message-Id: <201201101200.q0AC0OXl058469@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Robert Nagy Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73A35106564A for ; Tue, 10 Jan 2012 11:58:01 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 481068FC08 for ; Tue, 10 Jan 2012 11:58:01 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ABw0E2070167 for ; Tue, 10 Jan 2012 11:58:00 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q0ABw0Ml070166; Tue, 10 Jan 2012 11:58:00 GMT (envelope-from nobody) Message-Id: <201201101158.q0ABw0Ml070166@red.freebsd.org> Date: Tue, 10 Jan 2012 11:58:00 GMT From: Robert Nagy To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/163986: avoid reloading modules in devd for usb devices X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 12:00:24 -0000 >Number: 163986 >Category: misc >Synopsis: avoid reloading modules in devd for usb devices >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Jan 10 12:00:24 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Robert Nagy >Release: FreeBSD 9.0-RC3 amd64 >Organization: >Environment: FreeBSD x200s.humppa.hu 9.0-RC3 FreeBSD 9.0-RC3 #0: Sun Dec 4 08:56:36 UTC 2011 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: devd tries to reload kernel modules which are loaded already because of multiple already-attached devices in a system. e.g.: umodem, ng_ubt. This causes a lot of error messages on boot which is quiet annoying. >How-To-Repeat: boot any machine with multiple usb devices attached to it >Fix: Only try to load the module if it's not loaded already. The attached patch adds a quiet feature to kldstat's -n flag so that we can rely on just the return values of kldstat and load based on that in the action fields of /etc/devd/usb.conf. The diff does not actually include the generated usb.conf because that would have been too big for the attachment. Patch attached with submission follows: Index: sbin/kldstat/kldstat.c =================================================================== --- sbin/kldstat/kldstat.c (revision 229928) +++ sbin/kldstat/kldstat.c (working copy) @@ -146,8 +146,12 @@ } if (filename != NULL) { - if ((fileid = kldfind(filename)) < 0) - err(1, "can't find file %s", filename); + if ((fileid = kldfind(filename)) < 0) { + if (!quiet) + warn("can't find file %s", filename); + return 1; + } else if (quiet) + return 0; } printf("Id Refs Address%*c Size Name\n", POINTER_WIDTH - 7, ' '); Index: sbin/kldstat/kldstat.8 =================================================================== --- sbin/kldstat/kldstat.8 (revision 229928) +++ sbin/kldstat/kldstat.8 (working copy) @@ -35,10 +35,12 @@ .Nm .Op Fl v .Op Fl i Ar id -.Op Fl n Ar filename .Nm .Op Fl q .Op Fl m Ar modname +.Nm +.Op Fl qv +.Op Fl n Ar filename .Sh DESCRIPTION The .Nm Index: tools/tools/bus_autoconf/bus_usb.c =================================================================== --- tools/tools/bus_autoconf/bus_usb.c (revision 229928) +++ tools/tools/bus_autoconf/bus_usb.c (working copy) @@ -317,8 +317,8 @@ printf(" match \"intprotocol\" \"0x%02x\";\n", id->bInterfaceProtocol); } - printf(" action \"kldload %s\";\n" - "};\n\n", id->module_name); + printf(" action \"kldstat -qn %s || kldload %s\";\n" + "};\n\n", id->module_name, id->module_name); return (n); } >Release-Note: >Audit-Trail: >Unformatted: