From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id EBC7268F5 for ; Wed, 14 Sep 2016 10:22:43 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP; 14 Sep 2016 01:22:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,333,1470726000"; d="scan'208";a="1055748443" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 14 Sep 2016 01:22:42 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 14 Sep 2016 01:22:42 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 14 Sep 2016 01:22:42 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.102]) by shsmsx102.ccr.corp.intel.com ([169.254.2.109]) with mapi id 14.03.0248.002; Wed, 14 Sep 2016 16:22:40 +0800 From: "Wang, Zhihong" To: Maxime Coquelin , "dev@dpdk.org" CC: "yuanhan.liu@linux.intel.com" , "thomas.monjalon@6wind.com" Thread-Topic: [PATCH v5 2/6] vhost: rewrite enqueue Thread-Index: AQHSCoeNcn9kbXCHkk+YuIauq+7H46B1ibMAgAMjfYA= Date: Wed, 14 Sep 2016 08:22:39 +0000 Message-ID: <8F6C2BD409508844A0EFC19955BE09414E70FB34@SHSMSX103.ccr.corp.intel.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> <09efe45a-16b6-aa0c-f68c-b64dfefd4087@redhat.com> In-Reply-To: <09efe45a-16b6-aa0c-f68c-b64dfefd4087@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Wed, 14 Sep 2016 08:22:44 -0000 > -----Original Message----- > From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com] > Sent: Tuesday, September 13, 2016 12:27 AM > To: Wang, Zhihong ; dev@dpdk.org > Cc: yuanhan.liu@linux.intel.com; thomas.monjalon@6wind.com > Subject: Re: [PATCH v5 2/6] vhost: rewrite enqueue >=20 >=20 >=20 > 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 +=3D count; > > - vq->last_used_idx +=3D 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 =3D 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 >=3D 0)) > > eventfd_write(vq->callfd, (eventfd_t)1); > > - return count; > > }