From owner-freebsd-current@FreeBSD.ORG Mon Aug 5 16:15:03 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 5B4354AF; Mon, 5 Aug 2013 16:15:03 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com [IPv6:2a00:1450:4010:c03::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7591525C2; Mon, 5 Aug 2013 16:15:02 +0000 (UTC) Received: by mail-la0-f42.google.com with SMTP id mf11so2250829lab.15 for ; Mon, 05 Aug 2013 09:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=IJksw33/x2N791vbphuUxZFdCSsyAGGfakfCm7Zm1ZM=; b=G5yyLzkkK27DPQds8L9nO+pLwGpJ2CvPfINDIwkoazj8QaoUeeO6ji2TZII5VyxGPO 00O3NKADwIAexY7Q1nhCLiDm3fRycEbDF1UznUVCF6JV9PQA79GiHFglQ3UiDA7jeS1H xD9EoaA/B+iCEK4HXm8QwGNUPJKfDkCasjEgaxQQmRrq8lnvDNmQCwGjSAW7+xJFIRAF kle3tiPyIV2EKjdWIbwVit6uy/x3vaoO3lv12VcCj0ERW5yA0KHN3SaB0UeAnq3A+vk/ J7XCZmkyGNfVpfCNVuXm1WoSU951o9OaG7Qe/LvRxK00EVFkHSupg5KpRTh+NtYMszCM otyg== MIME-Version: 1.0 X-Received: by 10.152.87.42 with SMTP id u10mr1630303laz.43.1375719300456; Mon, 05 Aug 2013 09:15:00 -0700 (PDT) Sender: rizzo.unipi@gmail.com Received: by 10.114.200.165 with HTTP; Mon, 5 Aug 2013 09:15:00 -0700 (PDT) In-Reply-To: References: <20130805082307.GA35162@onelab2.iet.unipi.it> <2034715395.855.1375714772487.JavaMail.root@daemoninthecloset.org> Date: Mon, 5 Aug 2013 18:15:00 +0200 X-Google-Sender-Auth: k8hbls4GhIGp5BnB4loRnZejBkY Message-ID: Subject: Re: [net] protecting interfaces from races between control and data ? From: Luigi Rizzo To: Adrian Chadd Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Giuseppe Lettieri , Bryan Venteicher , current@freebsd.org, net@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 16:15:03 -0000 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 ? 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