Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jul 2014 17:19:24 -0700
From:      Navdeep Parhar <np@FreeBSD.org>
To:        Luigi Rizzo <rizzo@iet.unipi.it>
Cc:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   Re: change netmap global lock to sx?
Message-ID:  <53C7168C.3050702@FreeBSD.org>
In-Reply-To: <CA%2BhQ2%2BgBypQa3KiSdZZS9ytW4dqE5jMNkuTK2FYwRtDGQAxtPA@mail.gmail.com>
References:  <5385249D.9050501@FreeBSD.org> <CA%2BhQ2%2BgBypQa3KiSdZZS9ytW4dqE5jMNkuTK2FYwRtDGQAxtPA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 05/27/14 17:32, Luigi Rizzo wrote:
>=20
>=20
>=20
> On Wed, May 28, 2014 at 1:49 AM, Navdeep Parhar wrote:
>=20
>     I'd like to change the netmap global lock from a mutex into a sleep=
able
>     shared/exclusive lock.  This will allow a driver's nm_register hook=

>     (which is called with the global lock held) to sleep if it has to. =
 I've
>     casually used pkt-gen after this conversion (patch attached) and th=
e
>     witness hasn't complained about it.
>=20
>=20
> =E2=80=8Bno objections, let me give this a try on stable/10
> stable/9 to make sure we can use the same code there as well


Any updates?  I'm considering what to have in cxgbe(4) in time for 10.1
and this needs to be sorted out before cxgbe's netmap support gets MFC'd
to any stable branch.

Regards,
Navdeep


>=20
> cheers
> luigi
> =E2=80=8B
>=20
>     Thoughts?
>=20
>     Regards,
>     Navdeep
>=20
>=20
>     diff -r 0300d80260f4 sys/dev/netmap/netmap_kern.h
>     --- a/sys/dev/netmap/netmap_kern.h      Fri May 23 19:00:56 2014 -0=
700
>     +++ b/sys/dev/netmap/netmap_kern.h      Sat May 24 12:49:15 2014 -0=
700
>     @@ -43,13 +43,13 @@
>      #define unlikely(x)    __builtin_expect((long)!!(x), 0L)
>=20
>      #define        NM_LOCK_T       struct mtx
>     -#define        NMG_LOCK_T      struct mtx
>     -#define NMG_LOCK_INIT()        mtx_init(&netmap_global_lock, \
>     -                               "netmap global lock", NULL, MTX_DEF=
)
>     -#define NMG_LOCK_DESTROY()     mtx_destroy(&netmap_global_lock)
>     -#define NMG_LOCK()     mtx_lock(&netmap_global_lock)
>     -#define NMG_UNLOCK()   mtx_unlock(&netmap_global_lock)
>     -#define NMG_LOCK_ASSERT()      mtx_assert(&netmap_global_lock,
>     MA_OWNED)
>     +#define        NMG_LOCK_T      struct sx
>     +#define NMG_LOCK_INIT()        sx_init(&netmap_global_lock, \
>     +                               "netmap global lock")
>     +#define NMG_LOCK_DESTROY()     sx_destroy(&netmap_global_lock)
>     +#define NMG_LOCK()     sx_xlock(&netmap_global_lock)
>     +#define NMG_UNLOCK()   sx_xunlock(&netmap_global_lock)
>     +#define NMG_LOCK_ASSERT()      sx_assert(&netmap_global_lock,
>     SA_XLOCKED)
>=20
>      #define        NM_SELINFO_T    struct selinfo
>      #define        MBUF_LEN(m)     ((m)->m_pkthdr.len)
>=20
>=20





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