From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 20 Jun 2016 04:45:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,498,1459839600"; d="scan'208";a="125248936" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by fmsmga004.fm.intel.com with ESMTP; 20 Jun 2016 04:45:53 -0700 Date: Mon, 20 Jun 2016 19:46:49 +0800 From: Yuanhan Liu To: Huawei Xie 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 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 Content-Disposition: inline In-Reply-To: <1466358532-101416-1-git-send-email-huawei.xie@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v2] virtio: fix idx in used ring retrieved only once X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 11:45:56 -0000 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