From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0408AA00C5; Mon, 6 Jul 2020 05:05:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 038AD1D6C9; Mon, 6 Jul 2020 05:05:56 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 6B7331C1A4 for ; Mon, 6 Jul 2020 05:05:54 +0200 (CEST) IronPort-SDR: 4dmkyjdviE1t5qw+AehRd7/aqLCdmBfv3cYaezSzpnEui0904zCFwMKozxwoHjSA1qF8+l2c8X jDVsPOZzXtjw== X-IronPort-AV: E=McAfee;i="6000,8403,9673"; a="134808818" X-IronPort-AV: E=Sophos;i="5.75,318,1589266800"; d="scan'208";a="134808818" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2020 20:05:53 -0700 IronPort-SDR: QKOBaIDYBGu6XCIUO4b4yGbVm+eI7E9C3opy6A1MX0+KEn5ho5pJyL9OhadpCoLlsoIhvUg3Kg eaKDyc6SANwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,318,1589266800"; d="scan'208";a="296863510" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga002.jf.intel.com with ESMTP; 05 Jul 2020 20:05:53 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 5 Jul 2020 20:05:52 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.22]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.22]) with mapi id 14.03.0439.000; Mon, 6 Jul 2020 11:05:50 +0800 From: "Liu, Yong" To: "Fu, Patrick" , "dev@dpdk.org" , "maxime.coquelin@redhat.com" , "Xia, Chenbo" , "Wang, Zhihong" CC: "Fu, Patrick" , "Wang, Yinan" , "Jiang, Cheng1" , "Liang, Cunming" Thread-Topic: [dpdk-dev] [PATCH v4 1/2] vhost: introduce async enqueue registration API Thread-Index: AQHWUTZIQgalYMqosEm4jhi7Hf9pyqj54ASA Date: Mon, 6 Jul 2020 03:05:49 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E63616C54@SHSMSX103.ccr.corp.intel.com> References: <1591869725-13331-1-git-send-email-patrick.fu@intel.com> <1593778906-47832-1-git-send-email-patrick.fu@intel.com> <1593778906-47832-2-git-send-email-patrick.fu@intel.com> In-Reply-To: <1593778906-47832-2-git-send-email-patrick.fu@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action 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 v4 1/2] vhost: introduce async enqueue registration API 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" Hi Patrick, Few comments are inline, others are fine to me. Regards, Marvin > diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c > index 0d822d6..58ee3ef 100644 > --- a/lib/librte_vhost/vhost.c > +++ b/lib/librte_vhost/vhost.c > @@ -332,8 +332,13 @@ > { > if (vq_is_packed(dev)) > rte_free(vq->shadow_used_packed); > - else > + else { > rte_free(vq->shadow_used_split); > + if (vq->async_pkts_pending) > + rte_free(vq->async_pkts_pending); > + if (vq->async_pending_info) > + rte_free(vq->async_pending_info); Missed pointer set and feature set to 0.=20 > +int rte_vhost_async_channel_unregister(int vid, uint16_t queue_id) > +{ > + struct vhost_virtqueue *vq; > + struct virtio_net *dev =3D get_device(vid); > + int ret =3D -1; > + > + if (dev =3D=3D NULL) > + return ret; > + > + vq =3D dev->virtqueue[queue_id]; > + > + if (vq =3D=3D NULL) > + return ret; > + > + ret =3D 0; > + rte_spinlock_lock(&vq->access_lock); > + > + if (!vq->async_registered) > + goto out; > + > + if (vq->async_pkts_inflight_n) { > + VHOST_LOG_CONFIG(ERR, "Failed to unregister async > channel. " > + "async inflight packets must be completed before > unregistration.\n"); > + ret =3D -1; > + goto out; > + } > + > + if (vq->async_pkts_pending) { > + rte_free(vq->async_pkts_pending); > + vq->async_pkts_pending =3D 0; > + } > + > + if (vq->async_pending_info) { > + rte_free(vq->async_pending_info); > + vq->async_pending_info =3D 0; > + } > + Please unify the async pending pointer check and free logic and pointer sho= uld be set to NULL. > + vq->async_ops.transfer_data =3D NULL; > + vq->async_ops.check_completed_copies =3D NULL; > + vq->async_registered =3D false; > + > +out: > + rte_spinlock_unlock(&vq->access_lock); > + > + return ret; > +} > +