From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Coquelin Subject: Re: [PATCH v5 2/6] vhost: rewrite enqueue Date: Mon, 12 Sep 2016 18:26:38 +0200 Message-ID: <09efe45a-16b6-aa0c-f68c-b64dfefd4087@redhat.com> References: <1471319402-112998-1-git-send-email-zhihong.wang@intel.com> <1473392368-84903-1-git-send-email-zhihong.wang@intel.com> <1473392368-84903-3-git-send-email-zhihong.wang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: yuanhan.liu@linux.intel.com, thomas.monjalon@6wind.com To: Zhihong Wang , dev@dpdk.org Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id A8F4B532E for ; Mon, 12 Sep 2016 18:26:44 +0200 (CEST) In-Reply-To: <1473392368-84903-3-git-send-email-zhihong.wang@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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. > + *(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; > }