From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [119.145.14.66]) by dpdk.org (Postfix) with ESMTP id 598C3379E for ; Mon, 23 Mar 2015 03:29:39 +0100 (CET) Received: from 172.24.2.119 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BDM34299; Mon, 23 Mar 2015 10:29:35 +0800 (CST) Received: from [127.0.0.1] (10.177.19.115) by SZXEML429-HUB.china.huawei.com (10.82.67.184) with Microsoft SMTP Server id 14.3.158.1; Mon, 23 Mar 2015 10:29:32 +0800 Message-ID: <550F7A8D.8040202@huawei.com> Date: Mon, 23 Mar 2015 10:29:33 +0800 From: Linhaifeng User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: References: <1426925237-8312-1-git-send-email-haifeng.lin@huawei.com> In-Reply-To: <1426925237-8312-1-git-send-email-haifeng.lin@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.19.115] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.550F7A8F.01A8, ss=1, re=0.001, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ec9c3ed1220b0e0fe86c9649e880ae88 Subject: Re: [dpdk-dev] [PATCH] cast used->idx to volatile 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, 23 Mar 2015 02:29:40 -0000 cc changchun.ouyang@intel.com cc huawei.xie@intel.com On 2015/3/21 16:07, linhaifeng wrote: > From: Linhaifeng > > Same as rte_vhost_enqueue_burst we should cast used->idx > to volatile before notify guest. > > Signed-off-by: Linhaifeng > --- > lib/librte_vhost/vhost_rxtx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c > index 535c7a1..8d674d1 100644 > --- a/lib/librte_vhost/vhost_rxtx.c > +++ b/lib/librte_vhost/vhost_rxtx.c > @@ -722,7 +722,7 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id, > } > > rte_compiler_barrier(); > - vq->used->idx += entry_success; > + *(volatile uint16_t *)&vq->used->idx += entry_success; > /* Kick guest if required. */ > if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) > eventfd_write((int)vq->callfd, 1); > -- Regards, Haifeng