From owner-freebsd-net@FreeBSD.ORG Wed Dec 18 20:57:06 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20064FDD; Wed, 18 Dec 2013 20:57:06 +0000 (UTC) Received: from mail-qe0-x22b.google.com (mail-qe0-x22b.google.com [IPv6:2607:f8b0:400d:c02::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BA4C51322; Wed, 18 Dec 2013 20:57:05 +0000 (UTC) Received: by mail-qe0-f43.google.com with SMTP id jy17so200168qeb.30 for ; Wed, 18 Dec 2013 12:57:05 -0800 (PST) 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; bh=rqNJWHvr9j0PldYFzWfBQuG4rlzDVGQDrXFp44+jBz0=; b=C8PHgoc3FjtbBNKr9wcXRC0iRCdOsovQr3xbcE++3uVfx9h5iWBQySb9+MCb+bucjq oBmvIwIKcBk/KDuPLwKRUs2de3IfpzHv1NyGB9XU+GzGMUMat+TWKMOVCgISW7WmSBO2 yqlxN0EMGXNaSfSycIXiN7eUgHHhxOFh8/zCl6/axILxa8HRs7M+UUaSGt3uJR8igisQ 84EKgCCno21iozNfX+YkIf7rdro4+neMNGX9x9W52MncQ0n7PzpZx3QxuX8xZZgwK2WF efiob5Wi/IYNRRTAtpyFJJf+gtZBnjc8KWuZXAfn6PH3mgM+DZ0cs927R5qLxketxP/I 82qQ== MIME-Version: 1.0 X-Received: by 10.49.131.5 with SMTP id oi5mr57629586qeb.38.1387400224954; Wed, 18 Dec 2013 12:57:04 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.53.200 with HTTP; Wed, 18 Dec 2013 12:57:04 -0800 (PST) In-Reply-To: References: Date: Wed, 18 Dec 2013 12:57:04 -0800 X-Google-Sender-Auth: 8IHMCh7QM0asQBoxW89fX57asJo Message-ID: Subject: Re: buf_ring in HEAD is racy From: Adrian Chadd To: Ryan Stone Content-Type: text/plain; charset=ISO-8859-1 Cc: Jack F Vogel , Michael Tuexen , freebsd-net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 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, 18 Dec 2013 20:57:06 -0000 On 17 December 2013 19:37, Ryan Stone wrote: > The trick with this is that if ALTQ is enabled then we will use if_snd > queue instead of the buf ring, and if that queue drops then ifq_drops > will be incremented. With this patch if ALTQ is in use then we will > not count any drops (as you will be overwriting the drop count from > the queue). Right. Well, that means it's a problem for at least the chelsio driver as well. Hm, guess we could save the previous value of the sampled drops counters and add the delta to the send queue? Oh it gets more interesting - ip_output() also increments it if the queue structure itself can't hold it. It doesn't even hold any locks when it does that check so it's racy anyway. Aieee... Let me think about it a bit more. Thanks, -adrian