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 3206F1DBD; Wed, 20 Mar 2019 01:45:59 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Mar 2019 17:45:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,246,1549958400"; d="scan'208";a="128447230" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga006.jf.intel.com with ESMTP; 19 Mar 2019 17:45:57 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 19 Mar 2019 17:45:57 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 19 Mar 2019 17:45:57 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.74]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.252]) with mapi id 14.03.0415.000; Wed, 20 Mar 2019 08:45:55 +0800 From: "Wang, Yinan" To: "Hu, Jiayu" , "dev@dpdk.org" CC: "Bie, Tiwei" , "maxime.coquelin@redhat.com" , "stable@dpdk.org" Thread-Topic: [PATCH v2] vhost: fix interrupt suppression for the split ring Thread-Index: AQHU3IvxFJcqp+RB9kGr4i1joLeE/KYTs0EQ Date: Wed, 20 Mar 2019 00:45:55 +0000 Message-ID: References: <1550823230-16809-1-git-send-email-jiayu.hu@intel.com> <1552804712-9973-1-git-send-email-jiayu.hu@intel.com> In-Reply-To: <1552804712-9973-1-git-send-email-jiayu.hu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDVmOTg3MzUtZDk4Yi00ZTM3LWEwZmItYWViMDZkZjMxNzNiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiT2ZUM0cxXC9KaEF1Y2JBSUVVRFlJZ3VnWUI1T255QWJQekRrcjdoR1J4QUlaaUJSZ3BnRUllRTcrSHhRamdPZGUifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] vhost: fix interrupt suppression for the split ring X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 00:45:59 -0000 Test-by: Wang, Yinan Best Wishes, Yinan > -----Original Message----- > From: Hu, Jiayu > Sent: 2019=1B$BG/=1B(B3=1B$B7n=1B(B17=1B$BF|=1B(B 14:39 > To: dev@dpdk.org > Cc: Bie, Tiwei ; maxime.coquelin@redhat.com; Wang, > Yinan ; Hu, Jiayu ; > stable@dpdk.org > Subject: [PATCH v2] vhost: fix interrupt suppression for the split ring >=20 > The VIRTIO_RING_F_EVENT_IDX feature of split ring might be broken, as the > value of signalled_used is invalid after live migration, start up and vir= tio driver > reload. > This patch fixes it by using signalled_used_valid. >=20 > In addition, this patch makes the VIRTIO_RING_F_EVENT_IDX implementation > of split ring match kernel backend to suppress more interrupts. >=20 > Fixes: e37ff954405a ("vhost: support virtqueue interrupt/notification > suppression") > Cc: stable@dpdk.org >=20 > Signed-off-by: Jiayu Hu > --- > change in v2: > - fix virtio-net driver reload >=20 > lib/librte_vhost/vhost.h | 12 ++++++++---- > lib/librte_vhost/vhost_user.c | 2 ++ > 2 files changed, 10 insertions(+), 4 deletions(-) >=20 > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index > f008ec4..e9138df 100644 > --- a/lib/librte_vhost/vhost.h > +++ b/lib/librte_vhost/vhost.h > @@ -633,16 +633,20 @@ vhost_vring_call_split(struct virtio_net *dev, stru= ct > vhost_virtqueue *vq) > if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) { > uint16_t old =3D vq->signalled_used; > uint16_t new =3D vq->last_used_idx; > + bool signalled_used_valid =3D vq->signalled_used_valid; > + > + vq->signalled_used =3D new; > + vq->signalled_used_valid =3D true; >=20 > VHOST_LOG_DEBUG(VHOST_DATA, "%s: used_event_idx=3D%d, > old=3D%d, new=3D%d\n", > __func__, > vhost_used_event(vq), > old, new); > - if (vhost_need_event(vhost_used_event(vq), new, old) > - && (vq->callfd >=3D 0)) { > - vq->signalled_used =3D vq->last_used_idx; > + > + if ((vhost_need_event(vhost_used_event(vq), new, old) && > + (vq->callfd >=3D 0)) || > + unlikely(!signalled_used_valid)) > eventfd_write(vq->callfd, (eventfd_t) 1); > - } > } else { > /* Kick the guest if necessary. */ > if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT) diff --git > a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index > 36c0c67..01a8d80 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -1298,6 +1298,8 @@ vhost_user_get_vring_base(struct virtio_net > **pdev, >=20 > vq->callfd =3D VIRTIO_UNINITIALIZED_EVENTFD; >=20 > + vq->signalled_used_valid =3D false; > + > if (dev->dequeue_zero_copy) > free_zmbufs(vq); > if (vq_is_packed(dev)) { > -- > 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E4D95A00E6 for ; Wed, 20 Mar 2019 01:46:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 09BBD25A1; Wed, 20 Mar 2019 01:46:01 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 3206F1DBD; Wed, 20 Mar 2019 01:45:59 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Mar 2019 17:45:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,246,1549958400"; d="scan'208";a="128447230" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga006.jf.intel.com with ESMTP; 19 Mar 2019 17:45:57 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 19 Mar 2019 17:45:57 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 19 Mar 2019 17:45:57 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.74]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.252]) with mapi id 14.03.0415.000; Wed, 20 Mar 2019 08:45:55 +0800 From: "Wang, Yinan" To: "Hu, Jiayu" , "dev@dpdk.org" CC: "Bie, Tiwei" , "maxime.coquelin@redhat.com" , "stable@dpdk.org" Thread-Topic: [PATCH v2] vhost: fix interrupt suppression for the split ring Thread-Index: AQHU3IvxFJcqp+RB9kGr4i1joLeE/KYTs0EQ Date: Wed, 20 Mar 2019 00:45:55 +0000 Message-ID: References: <1550823230-16809-1-git-send-email-jiayu.hu@intel.com> <1552804712-9973-1-git-send-email-jiayu.hu@intel.com> In-Reply-To: <1552804712-9973-1-git-send-email-jiayu.hu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDVmOTg3MzUtZDk4Yi00ZTM3LWEwZmItYWViMDZkZjMxNzNiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiT2ZUM0cxXC9KaEF1Y2JBSUVVRFlJZ3VnWUI1T255QWJQekRrcjdoR1J4QUlaaUJSZ3BnRUllRTcrSHhRamdPZGUifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] vhost: fix interrupt suppression for the split ring X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190320004555.QFK-R93MTAGNGL9eE6UpLp4o3QiE4nOaNxykhrMjVaM@z> Test-by: Wang, Yinan Best Wishes, Yinan > -----Original Message----- > From: Hu, Jiayu > Sent: 2019=1B$BG/=1B(B3=1B$B7n=1B(B17=1B$BF|=1B(B 14:39 > To: dev@dpdk.org > Cc: Bie, Tiwei ; maxime.coquelin@redhat.com; Wang, > Yinan ; Hu, Jiayu ; > stable@dpdk.org > Subject: [PATCH v2] vhost: fix interrupt suppression for the split ring >=20 > The VIRTIO_RING_F_EVENT_IDX feature of split ring might be broken, as the > value of signalled_used is invalid after live migration, start up and vir= tio driver > reload. > This patch fixes it by using signalled_used_valid. >=20 > In addition, this patch makes the VIRTIO_RING_F_EVENT_IDX implementation > of split ring match kernel backend to suppress more interrupts. >=20 > Fixes: e37ff954405a ("vhost: support virtqueue interrupt/notification > suppression") > Cc: stable@dpdk.org >=20 > Signed-off-by: Jiayu Hu > --- > change in v2: > - fix virtio-net driver reload >=20 > lib/librte_vhost/vhost.h | 12 ++++++++---- > lib/librte_vhost/vhost_user.c | 2 ++ > 2 files changed, 10 insertions(+), 4 deletions(-) >=20 > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index > f008ec4..e9138df 100644 > --- a/lib/librte_vhost/vhost.h > +++ b/lib/librte_vhost/vhost.h > @@ -633,16 +633,20 @@ vhost_vring_call_split(struct virtio_net *dev, stru= ct > vhost_virtqueue *vq) > if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) { > uint16_t old =3D vq->signalled_used; > uint16_t new =3D vq->last_used_idx; > + bool signalled_used_valid =3D vq->signalled_used_valid; > + > + vq->signalled_used =3D new; > + vq->signalled_used_valid =3D true; >=20 > VHOST_LOG_DEBUG(VHOST_DATA, "%s: used_event_idx=3D%d, > old=3D%d, new=3D%d\n", > __func__, > vhost_used_event(vq), > old, new); > - if (vhost_need_event(vhost_used_event(vq), new, old) > - && (vq->callfd >=3D 0)) { > - vq->signalled_used =3D vq->last_used_idx; > + > + if ((vhost_need_event(vhost_used_event(vq), new, old) && > + (vq->callfd >=3D 0)) || > + unlikely(!signalled_used_valid)) > eventfd_write(vq->callfd, (eventfd_t) 1); > - } > } else { > /* Kick the guest if necessary. */ > if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT) diff --git > a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index > 36c0c67..01a8d80 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -1298,6 +1298,8 @@ vhost_user_get_vring_base(struct virtio_net > **pdev, >=20 > vq->callfd =3D VIRTIO_UNINITIALIZED_EVENTFD; >=20 > + vq->signalled_used_valid =3D false; > + > if (dev->dequeue_zero_copy) > free_zmbufs(vq); > if (vq_is_packed(dev)) { > -- > 2.7.4