From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH] kvm tools: Support virtio indirect buffers Date: Tue, 29 Nov 2011 09:45:49 +0200 Message-ID: <1322552749.3644.3.camel@lappy> References: <1322502867-28812-1-git-send-email-levinsasha928@gmail.com> <20111129063105.GR1775@moon> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: penberg@kernel.org, kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com To: Cyrill Gorcunov Return-path: Received: from mail-ey0-f174.google.com ([209.85.215.174]:38805 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752440Ab1K2HqA (ORCPT ); Tue, 29 Nov 2011 02:46:00 -0500 Received: by eaak14 with SMTP id k14so2701617eaa.19 for ; Mon, 28 Nov 2011 23:45:58 -0800 (PST) In-Reply-To: <20111129063105.GR1775@moon> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 2011-11-29 at 10:31 +0400, Cyrill Gorcunov wrote: > On Mon, Nov 28, 2011 at 07:54:27PM +0200, Sasha Levin wrote: > > > > +/* > > + * Each buffer in the virtqueues is actually a chain of descriptors. This > > + * function returns the next descriptor in the chain, or vq->vring.num if we're > > + * at the end. > > + */ > > +static unsigned next_desc(struct vring_desc *desc, > > + unsigned int i, unsigned int max) > > +{ > > + unsigned int next; > > + > > + /* If this descriptor says it doesn't chain, we're done. */ > > + if (!(desc[i].flags & VRING_DESC_F_NEXT)) > > + return max; > > + > > + /* Check they're not leading us off end of descriptors. */ > > + next = desc[i].next; > > + /* Make sure compiler knows to grab that: we don't want it changing! */ > > + wmb(); > > + > > + return next; > > +} > > + > > Hi Sasha, where the rmb() then? Or maybe you wanted plain barrier() here? On the kernel side. Theres a mb there which happens there during the kick. -- Sasha.