Date: Thu, 8 Aug 2013 10:23:20 -0700 From: Scott Long <scott4long@yahoo.com> To: Warner Losh <imp@bsdimp.com> Cc: Adrian Chadd <adrian@FreeBSD.org>, current@freebsd.org, Bryan Venteicher <bryanv@daemoninthecloset.org>, Navdeep Parhar <np@freebsd.org>, net@freebsd.org, Giuseppe Lettieri <g.lettieri@iet.unipi.it>, Luigi Rizzo <rizzo@iet.unipi.it> Subject: Re: [net] protecting interfaces from races between control and data ? Message-ID: <3BFB5B13-78C5-47E0-81B8-29A03A0136DF@yahoo.com> In-Reply-To: <CCB7CD35-4D48-449B-8DFE-FC63F7F26ED9@bsdimp.com> References: <20130805082307.GA35162@onelab2.iet.unipi.it> <2034715395.855.1375714772487.JavaMail.root@daemoninthecloset.org> <CAJ-VmokT6YKPR7CXsoCavEmWv3W8urZu4eBVgKWaj9iMaVJFZg@mail.gmail.com> <CA%2BhQ2%2BhuoCCweq7fjoYmH3nyhmhb5DzukEdPSMtaJEWa8Ft0JQ@mail.gmail.com> <51FFDD1E.1000206@FreeBSD.org> <CAJ-Vmo=Q9AqdBJ0%2B4AiX4%2BWreYuZx6VGGYw=MZ4XhMB1P2yMww@mail.gmail.com> <CAJ-Vmomd9bD9cXJtOWnuL_yuM%2BF%2Bt6zaaEgq2PxiT_wxQi%2Bejg@mail.gmail.com> <CCB7CD35-4D48-449B-8DFE-FC63F7F26ED9@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Aug 7, 2013, at 10:16 PM, Warner Losh <imp@bsdimp.com> wrote: >=20 > On Aug 5, 2013, at 11:20 AM, Adrian Chadd wrote: >=20 >> .. and I bet it's not a design pattern, and this is total conjecture = on my part: >>=20 >> * the original drivers weren't SMP safe; >> * noone really sat down and figured out how to correctly synchronise >> all of this stuff; >> * people did the minimum amount of work to keep the driver from >> immediately crashing, but didn't really think things through at a >> larger scale. >>=20 >> Almost every driver is this way Luigi. :-) >=20 > Most of the drivers in the three don't support hardware that performs = well enough for this to be a problem. :) Any driver that's still around = from the pre-locking days can easily saturate the lines (or the = hardware) on today's (and even yesterday's hardware). >=20 > All the rest have come up with different ways to cope=85 >=20 Not really. So the typical pattern is: foo_rxeof() { =85. FOO_UNLOCK(sc); ifp->if_input(ifp, m); FOO_LOCK(sc); =85. } Grepping for an approximation of this pattern: [nflx1] ~/svn/head/sys/dev% grep -r -B 5 if_input * | grep -i UNLOCK | = cut -d '/' -f 1 ae age alc ale an an bce bfe bge bm cadence cas cas dc de e1000 e1000 e1000 ed ep et ex fe fxp gem gxemul hme ie ixgb ixgbe ixgbe jme le le lge mge msk msk my nfe nfe nge nve pcn pdq re sbni sf sge sis sk sk sn snc ste stge ti tl tsec tx txp usb usb vge virtio vr vte vx wb wl xe xl Sure a lot of these are very legacy. But there's a lot in here's that = are not. bge, bce, e1000, ixgbe, virtio, etc, probably more that I'm = not catching in this quick pass. Scott
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BFB5B13-78C5-47E0-81B8-29A03A0136DF>