> -----Original Message----- > From: Maxime Coquelin [mailto:maxime.coquelin at redhat.com] > Sent: Tuesday, September 13, 2016 12:27 AM > To: Wang, Zhihong <zhihong.wang at intel.com>; dev at dpdk.org > Cc: yuanhan.liu at linux.intel.com; thomas.monjalon at 6wind.com > Subject: Re: [PATCH v5 2/6] vhost: rewrite enqueue > > > > On 09/09/2016 05:39 AM, Zhihong Wang wrote: > > > > +static inline void __attribute__((always_inline)) > > +notify_guest(struct virtio_net *dev, struct vhost_virtqueue *vq) > > +{ > > rte_smp_wmb(); > > - > > - *(volatile uint16_t *)&vq->used->idx += count; > > - vq->last_used_idx += count; > > - vhost_log_used_vring(dev, vq, > > - offsetof(struct vring_used, idx), > > - sizeof(vq->used->idx)); > > - > > - /* flush used->idx update before we read avail->flags. */ > Please don't remove comments if not justified. > Here the comment is important, as it explains why the barrier is needed.
Okay. > > + *(volatile uint16_t *)&vq->used->idx = vq->last_used_idx; > > + vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx), > > + sizeof(vq->used->idx)); > > rte_mb(); > > - > > - /* Kick the guest if necessary. */ > > if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT) > > && (vq->callfd >= 0)) > > eventfd_write(vq->callfd, (eventfd_t)1); > > - return count; > > }