From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 15 18:50:51 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A92E106566B for ; Thu, 15 Sep 2011 18:50:51 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: from mail-vw0-f45.google.com (mail-vw0-f45.google.com [209.85.212.45]) by mx1.freebsd.org (Postfix) with ESMTP id 0689F8FC0A for ; Thu, 15 Sep 2011 18:50:50 +0000 (UTC) Received: by vws17 with SMTP id 17so4968047vws.18 for ; Thu, 15 Sep 2011 11:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=a41S7+WOKFpLjo1SkmJTYmEr3zc3AJwj82sXDzv3+XI=; b=w2zEbFCvwy2FPsERFmTcHtOTGVRuJypvjXhJQ7LTHNKnZqfRdvUGAJvRmQt1P+Clei Ht6AG2gVSTVIVGYY5HuW3l7n6s3j3tkx7wab7Dvd0axBRQihIpZS6DeydxwhkovSKl5x NSBG/JaMpgQr03ZSdadqFNrsQXvAUCebYQyHA= MIME-Version: 1.0 Received: by 10.52.36.101 with SMTP id p5mr228859vdj.278.1316112650312; Thu, 15 Sep 2011 11:50:50 -0700 (PDT) Sender: kmacybsd@gmail.com Received: by 10.52.113.225 with HTTP; Thu, 15 Sep 2011 11:50:50 -0700 (PDT) In-Reply-To: References: Date: Thu, 15 Sep 2011 20:50:50 +0200 X-Google-Sender-Auth: WHFOvWp2ZUP0DB6qIujC0cIh3VA Message-ID: From: "K. Macy" To: Arnaud Lacombe Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Hackers Subject: Re: buf_ring(9) API precisions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 18:50:51 -0000 On Thu, Sep 15, 2011 at 4:53 AM, Arnaud Lacombe wrote: > Hi Kip, > > I've got a few question about the buf_ring(9) API. > > 1) what means the 'drbr_' prefix. I can guess the two last letter, 'b' > and 'r', for Buffer Ring, but what about 'd' and 'r' ? DRiver BufRing > 2) in `sys/sys/buf_ring.h', you defined 'struct buf_ring' as: > > struct buf_ring { > =A0 =A0 =A0 =A0volatile uint32_t =A0 =A0 =A0 br_prod_head; > =A0 =A0 =A0 =A0volatile uint32_t =A0 =A0 =A0 br_prod_tail; > =A0 =A0 =A0 =A0int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 br_prod_size; > =A0 =A0 =A0 =A0int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 br_prod_mask; > =A0 =A0 =A0 =A0uint64_t =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0br_drops; > =A0 =A0 =A0 =A0uint64_t =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0br_prod_bufs; > =A0 =A0 =A0 =A0uint64_t =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0br_prod_bytes; > =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 * Pad out to next L2 cache line > =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0uint64_t =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0_pad0[11]; > > =A0 =A0 =A0 =A0volatile uint32_t =A0 =A0 =A0 br_cons_head; > =A0 =A0 =A0 =A0volatile uint32_t =A0 =A0 =A0 br_cons_tail; > =A0 =A0 =A0 =A0int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 br_cons_size; > =A0 =A0 =A0 =A0int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 br_cons_mask; > > =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 * Pad out to next L2 cache line > =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0uint64_t =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0_pad1[14]; > #ifdef DEBUG_BUFRING > =A0 =A0 =A0 =A0struct mtx =A0 =A0 =A0 =A0 =A0 =A0 =A0*br_lock; > #endif > =A0 =A0 =A0 =A0void =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*br_ring[0]; > }; > > Why are you making an MD guess, the amount of padding to fit the size > of a cache line, in MI API ? Strangely enough, you did not make this > assumption in, say r205488 (picked randomly). It has been several years, and I haven't done any work in svn in over a year, I don't remember. I probably meant to refine it in a later iteration. If you would like to send me a patch addressing this I'd be more than happy to apply it if appropriate. Otherwise, I will deal with it some time after 9 settles. Thanks for pointing this out. Cheers