From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linhaifeng Subject: Re: [PATCH] cast used->idx to volatile Date: Mon, 23 Mar 2015 10:29:33 +0800 Message-ID: <550F7A8D.8040202@huawei.com> References: <1426925237-8312-1-git-send-email-haifeng.lin@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit To: Return-path: In-Reply-To: <1426925237-8312-1-git-send-email-haifeng.lin-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" cc changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org cc huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org 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