From owner-freebsd-net@FreeBSD.ORG Wed Oct 22 21:32:39 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 206B03E0; Wed, 22 Oct 2014 21:32:39 +0000 (UTC) Received: from mail-yh0-x22c.google.com (mail-yh0-x22c.google.com [IPv6:2607:f8b0:4002:c01::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C7A22814; Wed, 22 Oct 2014 21:32:38 +0000 (UTC) Received: by mail-yh0-f44.google.com with SMTP id i57so4266393yha.17 for ; Wed, 22 Oct 2014 14:32:38 -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:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=BExGQ+n3bWGz3T/01iK2ojH4SPAL5PxJELn6lEJNYBY=; b=hG57gxHu6+4d3gfv9LSt7dz4OBUyTvNqp/QdNaYE5vgkGr9KDpRW/u3R/vKpqCI1LW fHeYrWvNmz1CvYTGlUHX8HCdBz7SRD6761fEe0Irg8Hq8IJU/aAT086rwWVHeuQ3nXyA 9ADhLzWGrdz7DfkIQeuZ9mpX8iuvpBGQXG7LsIYZhCX2sYzPh0AJP1x+4F5EeM8eKDzs A2nFH951O/Vb9cl+45Pt3z/BMyaGuZrABq58hbl3875q3DZMPe2c613qKAXWGqYA5nxU wa765lcKaLkGEa1QeZIXy6TY/bDWno59eyVPoWWZ8alcjuyb8kFY+GmLKB18QCniCKZm mWqQ== MIME-Version: 1.0 X-Received: by 10.236.16.230 with SMTP id h66mr672605yhh.145.1414013557879; Wed, 22 Oct 2014 14:32:37 -0700 (PDT) Sender: kmacybsd@gmail.com Received: by 10.170.82.197 with HTTP; Wed, 22 Oct 2014 14:32:37 -0700 (PDT) In-Reply-To: References: <20131226175410.GA15332@lath.rinet.ru> Date: Wed, 22 Oct 2014 14:32:37 -0700 X-Google-Sender-Auth: PRBMr1ywrOa4oZzcKg-ftLRUzNE Message-ID: Subject: Re: buf_ring in HEAD is racy From: "K. Macy" To: "De La Gueronniere, Marc" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Ryan Stone , Oleg Bulyzhin , "Charbon, Julien" , freebsd-net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 21:32:39 -0000 > Hi Oleg and Ryan, > > We have run into the spurious drop issue too. I could not make sense of > seeing a single drop at a time every few seconds i.e. if a queue of 4k > element fills, likely more than one packet is going to be dropped once th= e > queue full condition is reached. So we investigated and came to the same > conclusion on buf_ring_enqueue being broken, at which point I found this > thread. > > Are there any pending patches/investigations beside Oleg=C2=B9s patch ? W= e are > definitely interested in helping with this, I just want to make sure that > we are not duplicating efforts. > > I also suspect there are further problems with buf_ring. A full wrap > around of the atomically swapped value is possible. I.e. the code thinks > it just atomically updated a head/tail index when in fact a full wrap > around occurred leading to undefined land. A relatively simple way to > avoid this is to only mask on ring array access, and to let the > head/tail/prod/cons indices overflow the array. I'll have 40GigE hardware to test with in a week or two. I'll look in to it then. Cheers. -K