From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyrill Gorcunov Subject: Re: [PATCH] kvm tools: Support virtio indirect buffers Date: Tue, 29 Nov 2011 10:31:05 +0400 Message-ID: <20111129063105.GR1775@moon> References: <1322502867-28812-1-git-send-email-levinsasha928@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: penberg@kernel.org, kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com To: Sasha Levin Return-path: Received: from mail-bw0-f46.google.com ([209.85.214.46]:56741 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751430Ab1K2GbK (ORCPT ); Tue, 29 Nov 2011 01:31:10 -0500 Received: by bkas6 with SMTP id s6so39758bka.19 for ; Mon, 28 Nov 2011 22:31:09 -0800 (PST) Content-Disposition: inline In-Reply-To: <1322502867-28812-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: 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?