From owner-freebsd-current@FreeBSD.ORG Mon Aug 5 17:13:06 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3EC73660; Mon, 5 Aug 2013 17:13:06 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pd0-x22d.google.com (mail-pd0-x22d.google.com [IPv6:2607:f8b0:400e:c02::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0419B28FB; Mon, 5 Aug 2013 17:13:05 +0000 (UTC) Received: by mail-pd0-f173.google.com with SMTP id p11so3487338pdj.32 for ; Mon, 05 Aug 2013 10:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=A6dgrK6zlFFan2PwgEg8Zx3im9qX+MeYm0qKZqwqixM=; b=l+uJEts6N3ktFpMtF3evI3UU3SelqeTx70qqu2lEXYF6JS6JeSKycuiSQ1D1JVK2SE QWGYv/n2uVjEas3BSdJ6wQ+fGJCAM/E+Z5ZOkXo+0gc4u+A1JMHgzYA0o2lG4P+T/2cJ vl8owDLacwtCu5Y8eh9Iz7AkYpwji7bUGFm+GGI7GJv7iPzsrZLJvW6FS7Z2Xo6E1yPx IDFU3/DJJsVcCm1s9nnh3fkfg6IRtTbm3vjJPLN1T6QGtzdA0M//NoSdU+2f5LeDRjvU zH3yyIJ4Yod+8HTibQ7a3idjvxClzp6njBiZ+nMwXuyTWhboHCSSypvxCZDcYywgs7Wu 4bYg== X-Received: by 10.68.169.97 with SMTP id ad1mr23138366pbc.84.1375722785646; Mon, 05 Aug 2013 10:13:05 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id qc5sm99574pbc.31.2013.08.05.10.13.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 Aug 2013 10:13:04 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <51FFDD1E.1000206@FreeBSD.org> Date: Mon, 05 Aug 2013 10:13:02 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130731 Thunderbird/17.0.7 MIME-Version: 1.0 To: Luigi Rizzo Subject: Re: [net] protecting interfaces from races between control and data ? References: <20130805082307.GA35162@onelab2.iet.unipi.it> <2034715395.855.1375714772487.JavaMail.root@daemoninthecloset.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Adrian Chadd , net@freebsd.org, Bryan Venteicher , Giuseppe Lettieri , current@freebsd.org 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: Mon, 05 Aug 2013 17:13:06 -0000 On 08/05/13 09:15, Luigi Rizzo wrote: > On Mon, Aug 5, 2013 at 5:46 PM, Adrian Chadd wrote: > >> On 5 August 2013 07:59, Bryan Venteicher >> wrote: >> >>> What I've done in my drivers is: >>> * Lock the core mutex >>> * Clear IFF_DRV_RUNNING >>> * Lock/unlock each queue's lock >> >> .. and I think that's the only sane way of doing it. >> > > yeah, this was also the solution we had in mind, i was surprised > not find this pattern in the drivers i have looked at. > > Also there are drivers (chelsio ?) which do not seem to have locks on the > receive interrupt handlers ? This is correct. cxgbe(4) does not have any locks on rx, just a "state" for each rx queue that's maintained with atomic ops. Regards, Navdeep > > Does anyone know how linux copes with the same problem ? > > They seem to have an rtnl_lock() which is a global lock for all > configuration > of netdevices (would replace our per-interface 'core lock' above), > but i am totally unclear on how individual tx threads and interrupt handlers > acknowledge that they have read the change in status. > > cheers > luigi > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >