From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E775D5411E; Mon, 12 Sep 2016 16:26:41 +0000 (UTC) Received: from [10.36.4.241] (vpn1-4-241.ams2.redhat.com [10.36.4.241]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8CGQdEp021348 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 12 Sep 2016 12:26:40 -0400 To: Zhihong Wang , dev@dpdk.org 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> Cc: yuanhan.liu@linux.intel.com, thomas.monjalon@6wind.com From: Maxime Coquelin Message-ID: <09efe45a-16b6-aa0c-f68c-b64dfefd4087@redhat.com> Date: Mon, 12 Sep 2016 18:26:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1473392368-84903-3-git-send-email-zhihong.wang@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 12 Sep 2016 16:26:42 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH v5 2/6] vhost: rewrite enqueue 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, 12 Sep 2016 16:26:44 -0000 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; > }