Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Nov 2004 19:28:06 +0100
From:      devet@devet.org (Arjan de Vet)
To:        peadar.edwards@gmail.com
Cc:        current@freebsd.org
Subject:   Re: if_sk patch to get more info from people with problems
Message-ID:  <20041103182806.GA1040@adv.devet.org>
In-Reply-To: <34cb7c8404110209563fc01498@mail.gmail.com>
References:  <Pine.BSF.4.53.0411011123190.90940@e0-0.zab2.int.zabbadoz.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <34cb7c8404110209563fc01498@mail.gmail.com> you write:

>Ok, I don't have this hardware, but dumb question:
>
>A (very) quick look at the source reveals that buffers are allocated
>via  sk_rxeof()->sk_newbuf()->sk_jalloc() in the interrupt receive
>function, with the softc lock held in sk_rxeof().
>
>They're freed by the mbuf system via a call to sk_jfree(), but that
>doesn't hold the SK_LOCK. Is this possibly the source of the
>corruption problems? What am I missing?
>This compiles, anyway :-)
>
>--- /tmp/if_sk.c        Tue Nov  2 17:49:26 2004
>+++ if_sk.c     Tue Nov  2 17:52:20 2004
>@@ -1115,12 +1115,14 @@
>        if ((i < 0) || (i >= SK_JSLOTS))
>                panic("sk_jfree: asked to free buffer that we don't manage!");
> 
>+       SK_LOCK(sc_if->sk_softc);
>        entry = SLIST_FIRST(&sc_if->sk_jinuse_listhead);
>        if (entry == NULL)
>                panic("sk_jfree: buffer not in use!");
>        entry->slot = i;
>        SLIST_REMOVE_HEAD(&sc_if->sk_jinuse_listhead, jpool_entries);
>        SLIST_INSERT_HEAD(&sc_if->sk_jfree_listhead, entry, jpool_entries);
>+       SK_UNLOCK(sc_if->sk_softc);
> 
>        return;
> }

Thank you very much! This patch seems to fix the network corruption
problems I have reported in kern/73038. I'll do some more testing,
because sometimes the problems only appear after some time. But for now,
I can use if_sk.c without debug.mpsafenet="0" on 5.3-RC2.

Arjan

-- 
Arjan de Vet, Eindhoven, The Netherlands               <devet@devet.org>
URL : http://www.devet.org/                     <Arjan.deVet@adv.iae.nl>
Work: http://www.madison-gurkha.com/  (Security, Open Source, Education)



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