Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jul 2004 11:46:29 +0200
From:      Tomas Randa <lists@hosting50.cz>
To:        freebsd-current@freebsd.org
Subject:   sk0 patch
Message-ID:  <1090316789.788.10.camel@ares.af.czu.cz>

next in thread | raw e-mail | index | archive | help
Hi,

is there available a working patch for current "sk" driver? 

Thanks a lot.

Tomas Randa

On Sun, 2004-07-11 at 00:34, Bjoern A. Zeeb wrote:
> 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.
-- 
Tomas Randa <lists@hosting50.cz>
-- 
Tomas Randa <lists@hosting50.cz>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1090316789.788.10.camel>