From owner-freebsd-current@FreeBSD.ORG Sat Jul 10 22:39:01 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8F91A16A4CE for ; Sat, 10 Jul 2004 22:39:01 +0000 (GMT) Received: from transport.cksoft.de (transport.cksoft.de [62.111.66.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5822843D46 for ; Sat, 10 Jul 2004 22:39:01 +0000 (GMT) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from transport.cksoft.de (localhost [127.0.0.1]) by transport.cksoft.de (Postfix) with ESMTP id 802C81FFDD8 for ; Sun, 11 Jul 2004 00:39:00 +0200 (CEST) Received: by transport.cksoft.de (Postfix, from userid 66) id 6A1B81FF931; Sun, 11 Jul 2004 00:38:58 +0200 (CEST) Received: by mail.int.zabbadoz.net (Postfix, from userid 1060) id 67CAF154BC; Sat, 10 Jul 2004 22:34:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.int.zabbadoz.net (Postfix) with ESMTP id 5CD1915329 for ; Sat, 10 Jul 2004 22:34:28 +0000 (UTC) Date: Sat, 10 Jul 2004 22:34:28 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@e0-0.zab2.int.zabbadoz.net To: FreeBSD current mailing list Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS cksoft-s20020300-20031204bz on transport.cksoft.de Subject: is_sk locking in sk_attach X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2004 22:39:01 -0000 Hi, there had been some discussion lately about if_sk and attach locking. compiled if_sk as module on amd64 and kldloading started a race with follwoing output: --- very short part of console log --- [some hundred more of the following lines] (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 malloc(M_WAITOK) of "64", forcing M_NOWAIT with the following non-sleepable locks held: exclusive sleep mutex skc0 (network driver) r = 0 (0xffffff003000b670) locked @ /u1/src/HEAD/src/sys/pci/if_sk.c:1335 Stack backtrace: witness_warn() at witness_warn+0x1a7 uma_zalloc_arg() at uma_zalloc_arg+0x4c malloc() at malloc+0x9f scope6_ifattach() at scope6_ifattach+0x20 in6_domifattach() at in6_domifattach+0x91 if_attachdomain1() at if_attachdomain1+0xb9 if_attach() at if_attach+0x465 ether_ifattach() at ether_ifattach+0x27 sk_attach() at sk_attach+0x334 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 (null)() at 0 [some hundred more of these lines] --- end --- I solved this problem without further investigation of possible bad impacts with this patch: Index: if_sk.c =================================================================== RCS file: /u2/src/CVS/prefixes/src/sys/pci/if_sk.c,v retrieving revision 1.83 diff -u -p -r1.83 if_sk.c --- if_sk.c 28 Jun 2004 20:07:03 -0000 1.83 +++ if_sk.c 10 Jul 2004 21:44:53 -0000 @@ -1332,7 +1332,9 @@ sk_attach(dev) error = 0; sc_if = device_get_softc(dev); sc = device_get_softc(device_get_parent(dev)); +#if 0 SK_LOCK(sc); +#endif port = *(int *)device_get_ivars(dev); free(device_get_ivars(dev), M_DEVBUF); device_set_ivars(dev, NULL); @@ -1472,7 +1474,9 @@ sk_attach(dev) } fail: +#if 0 SK_UNLOCK(sc); +#endif if (error) { /* Access should be ok even though lock has been dropped */ sc->sk_if[port] = NULL; --- end --- can someone with some more knowledge about this driver and general locking of if_* please review this. TIA. -- Bjoern A. Zeeb bzeeb at Zabbadoz dot NeT