From: Pekka Enberg Subject: Re: [PATCH] kvm tools: Support virtio indirect buffers Date: Tue, 29 Nov 2011 15:01:59 +0200 (EET) Message-ID: References: <1322502867-28812-1-git-send-email-levinsasha928@gmail.com> <20111129063105.GR1775@moon> <1322552749.3644.3.camel@lappy> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Cyrill Gorcunov , kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com To: Sasha Levin Return-path: Received: from mail-gx0-f174.google.com ([209.85.161.174]:53254 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753479Ab1K2NCV (ORCPT ); Tue, 29 Nov 2011 08:02:21 -0500 Received: by ggnr5 with SMTP id r5so6379603ggn.19 for ; Tue, 29 Nov 2011 05:02:20 -0800 (PST) In-Reply-To: <1322552749.3644.3.camel@lappy> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 29 Nov 2011, 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. I guess we need to improve the comment in next_desc()?