[dpdk-dev] [PATCH] cast used->idx to volatile

Xie, Huawei huawei.xie at intel.com
Mon Mar 23 13:54:35 CET 2015



> -----Original Message-----
> From: Linhaifeng [mailto:haifeng.lin at huawei.com]
> Sent: Monday, March 23, 2015 8:24 PM
> To: dev at dpdk.org
> Cc: Ouyang, Changchun; Xie, Huawei
> Subject: Re: [dpdk-dev] [PATCH] cast used->idx to volatile
> 
> 
> 
> On 2015/3/21 16:07, linhaifeng wrote:
> > From: Linhaifeng <haifeng.lin at huawei.com>
> >
> > Same as rte_vhost_enqueue_burst we should cast used->idx
> > to volatile before notify guest.
> >
> > Signed-off-by: Linhaifeng <haifeng.lin at huawei.com>
> > ---
> >  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;


Haifeng:
We have compiler barrier before and an external function call behind, so we don't need volatile  here.
Do you meet issue?

> >  	/* Kick guest if required. */
> >  	if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
> >  		eventfd_write((int)vq->callfd, 1);
> >
> 
> --
> Regards,
> Haifeng



More information about the dev mailing list