From owner-freebsd-current@FreeBSD.ORG Thu Aug 8 17:29:01 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D9E8BC25 for ; Thu, 8 Aug 2013 17:29:01 +0000 (UTC) (envelope-from scott4long@yahoo.com) Received: from nm49-vm4.bullet.mail.gq1.yahoo.com (nm49-vm4.bullet.mail.gq1.yahoo.com [67.195.87.234]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A6AB226B5 for ; Thu, 8 Aug 2013 17:29:01 +0000 (UTC) Received: from [216.39.60.181] by nm49.bullet.mail.gq1.yahoo.com with NNFMP; 08 Aug 2013 17:23:21 -0000 Received: from [98.136.164.77] by tm17.bullet.mail.gq1.yahoo.com with NNFMP; 08 Aug 2013 17:23:21 -0000 Received: from [127.0.0.1] by smtp239.mail.gq1.yahoo.com with NNFMP; 08 Aug 2013 17:23:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1375982601; bh=HHyIreysPKOMyVa85kxfnCcsv9XcN3hRbm0UAG49ri0=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=R5MySjQhs9Ba95g/0Ofay/MYPmB89ldB85S09S4F87AbrE7f9BsMRxSKW3UltBTsPlFqtSPG1k6tZG2+OpMKckVfiydRjyhjKH8BStu6vrFL2FZ03+hPU0dnHDvrqdRr/Q+e+MUQcUEOUgAHdm7ujwFy1YDX2K/xR+KsVyf6eIg= X-Yahoo-Newman-Id: 124328.76621.bm@smtp239.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: icbtmfQVM1mMOJGwJdkQUTE60iZh8Je.6qTqkqCu1WxdEU. z8Wtun6FiHsxHJJ.VaTGXgLxFASl7Y3WoRNjql4J1W9tkn4oSMTZlEpvcBhh eDtdEY6CObvHdQ6EAnNI6Kqq62k9bdz80jLB3PrWYWGbmPFyDDGjJURWdUGt t8jEAJSOmOQOYh9YJfjHWPiQAetWIWMOg6IbyMtpD5Y1jz6BxxsECLAre1Ig 7Vru5b0Lg5cPCucicZCA4q8bCnXIxCy2jB7S63u.WsuhdQtv8laxhwf9iCBC N5pIzdt50YOHu8RmsQUGLHVdqjJKt83ArkBd_egL4itdnrEYxC2hMmkOt9MM TDXaezsQEaWvYZkZT3dKJetJe7WGCF25y8HIqqgaqVg1AzSu4a4Vr.E65cPj 0KkTdnkZXrZ9bHy5BUxQ8.eoCpxSnAKA3e_Tq7KW_EsNlaUL9PONStjq4Udp ploME_ZEwCycv5UPmGRmWy7FJDa.41D5wHq2R841U64gKECYeEfRJvH_SgSh FM35hpLpYXkjrUcEK6mn69aqFo_UnXvm4FD8GHKhrWlYZyI.f8WHruBEdbfK j X-Yahoo-SMTP: clhABp.swBB7fs.LwIJpv3jkWgo2NU8- X-Rocket-Received: from phobos.corp.netflix.com (scott4long@69.53.237.66 with ) by smtp239.mail.gq1.yahoo.com with SMTP; 08 Aug 2013 17:23:20 +0000 UTC Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: [net] protecting interfaces from races between control and data ? From: Scott Long In-Reply-To: Date: Thu, 8 Aug 2013 10:23:20 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <3BFB5B13-78C5-47E0-81B8-29A03A0136DF@yahoo.com> References: <20130805082307.GA35162@onelab2.iet.unipi.it> <2034715395.855.1375714772487.JavaMail.root@daemoninthecloset.org> <51FFDD1E.1000206@FreeBSD.org> To: Warner Losh X-Mailer: Apple Mail (2.1508) X-Mailman-Approved-At: Thu, 08 Aug 2013 18:58:24 +0000 Cc: Adrian Chadd , current@freebsd.org, Bryan Venteicher , Navdeep Parhar , net@freebsd.org, Giuseppe Lettieri , Luigi Rizzo X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2013 17:29:02 -0000 On Aug 7, 2013, at 10:16 PM, Warner Losh 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