From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v2] virtio: fix idx in used ring retrieved only once Date: Mon, 20 Jun 2016 19:46:49 +0800 Message-ID: <20160620114649.GH23111@yliu-dev.sh.intel.com> References: <1466015437-36809-1-git-send-email-huawei.xie@intel.com> <1466358532-101416-1-git-send-email-huawei.xie@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, yuanhan.liu@intel.com, thomas.monjalon@6wind.com, mst@redhat.com, jianfeng.tan@intel.com, stephen@networkplumber.org, konstantin.ananyev@intel.com, bruce.richardson@intel.com To: Huawei Xie Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id DFB759612 for ; Mon, 20 Jun 2016 13:45:55 +0200 (CEST) Content-Disposition: inline In-Reply-To: <1466358532-101416-1-git-send-email-huawei.xie@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, Jun 20, 2016 at 01:48:52AM +0800, Huawei Xie wrote: > In the following loop: > while (vq->vq_used_cons_idx != vq->vq_ring.used->idx) { > ... > } > There is no external function call or any explict memory barrier > in the loop, the re-read of used->idx would be optimized and would > only be retrieved once. > > use of voaltile normally should be prohibited, and access_once > is Linux kernel's style to handle this issue; Once we have that > macro in DPDK, we could change to that style. > > virtio_recv_mergable_pkts might have the same issue, so will be fixed. > > Fixes: 823ad647950a ("virtio: support multiple queues") > Fixes: 13ce5e7eb94f ("virtio: mergeable buffers") > > Signed-off-by: Huawei Xie Applied to dpdk-next-virtio. Thanks. --yliu