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 _at_ /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 _at__at_ -1332,7 +1332,9 _at__at_ 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); _at__at_ -1472,7 +1474,9 _at__at_ 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 NeTReceived on Sat Jul 10 2004 - 20:39:01 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:01 UTC