From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 53BBAA0545 for ; Mon, 20 Jun 2022 09:01:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2249B40150; Mon, 20 Jun 2022 09:01:57 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2047.outbound.protection.outlook.com [40.107.243.47]) by mails.dpdk.org (Postfix) with ESMTP id AF05540150 for ; Mon, 20 Jun 2022 09:01:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P/tBHM1eL5FqpvdNYcFa2QxTc9ausPeMQMCW70LjmHcqXAmrp6uDi5stFVheUZqiS49fSBKlrLR2lPIt8axljGsZn88qybrwJx7/hdjdJgzL0TzCRqd1/vRnkJqpvfxPOiko+i8zxF1p5BD6hPZRILZLuY9lXDMPbA/DgnMsnjNnYrZAmUlvpciZv4FNahVJpEhgwRIOe7n+X6Mm482ClQ+HAhXHvc1bIvrl5t9iZPkZ+jzE5lAs04cd2gFf4Jj+V4Msu7UOv4pllBT8uFayAu23DOfpm6wN+vLehED3SJbRmkdQNU+aC3NRIYoz5as0xtdRQYlBzkauo5H0F6NrGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z1G9lU86SKaw6yrNbLtw5940ezCxy0AJnEu1fa8DJ0g=; b=iC/vG6lhbxgAc1uVH4seN/lyu0zMQXkUPg9O3r6fk1OLaguAlEhiKfVm1DBb7ELrKF9RvegK2/XAgx9cpz/uTT3yzrEwOopfcI8KVyh1BKswU6J9r2ahDyNUIiVbWjAPYFAUBvn2OvdqiXuT/JEUQvMPFu12YXi+F8PN5o3HejGO0fcQkvlkyO0L8Fv7OUBGcw09jO11+oLJaCkiNvRq4/ecM/1rZQTz61IylmSBcP4ClC2ubuGS/raD4IPtWt1WF/IpCmELUKfiO8qpl1y9ARCwBIwvEczKmOAI0lKVszep48CMpjm7AzdyMYLAMZExc+uZgDtuxxOBZ542k/Y1Fg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z1G9lU86SKaw6yrNbLtw5940ezCxy0AJnEu1fa8DJ0g=; b=X7Y4Od1dZIbFSdcrpbM7ootu5Qtw+vr8K2++EQcNlRzcdtFVuo/I8fxo89edh9yPS8/n8atl7HdrMOtU4ciJT/tmhI8ZqnLyzjcBWQgfgTL61gbp7dRtKpUPVJ7Zm4z4SrLvfkwfrIIHI2twGWyRPBGaizUaGj3kL4S37enN4xW9ntoq+Ee/QMS0wCz+YBpJ6c04xDKXJwQQH/TXkRpK4I+J2+Xwq7iUnpXZ3M7zBGrsn6qpox5Wj20tKD4Q+FoJiPTjyCRiJE/F07tBq7/S6gEcBogEzqa4x6hSR7lumDe6Bo7wacWncdI3OluI+nHreYonLTpGTXaBLS8aPNtV4w== Received: from DM4PR12MB5373.namprd12.prod.outlook.com (2603:10b6:5:39d::14) by SA0PR12MB4463.namprd12.prod.outlook.com (2603:10b6:806:92::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14; Mon, 20 Jun 2022 07:01:54 +0000 Received: from DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::9416:525c:ef8d:6bcd]) by DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::9416:525c:ef8d:6bcd%8]) with mapi id 15.20.5353.022; Mon, 20 Jun 2022 07:01:54 +0000 From: "Xueming(Steven) Li" To: David Marchand , "stable@dpdk.org" CC: Sunil Pai G , Maxime Coquelin , Patrick Fu , Jiayu Hu Subject: RE: [PATCH 20.11] vhost: fix async access Thread-Topic: [PATCH 20.11] vhost: fix async access Thread-Index: AQHYgg50q3GSkTEZ/0GK2tQ2jxxiqa1X4vng Date: Mon, 20 Jun 2022 07:01:53 +0000 Message-ID: References: <20220617055227.1292067-1-david.marchand@redhat.com> In-Reply-To: <20220617055227.1292067-1-david.marchand@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a786e1a5-9a3c-4490-1541-08da528ac1ff x-ms-traffictypediagnostic: SA0PR12MB4463:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZFmHsHRoQAvxu5zF+gzKDDHNt2bejnnS2pi3TTPs27mBtpQEcsi385eu4SFKA27rBEljXwbb5/jUOgi31IDmCU7hSnNEf1eH4hAf09C5V+MOV6jqIq98Pwl/aO7ZXgVogaLFAB2gGUNy4PaHuQQq3Ug505KzgKF1wURzd0mewoRewT/dQdDhmsaG+KWVqw3+MEOTGVp4iW74brksTGikG+Q5nKfweVpiJAYnKTsRUw3mvpi2COe1BxFHWIVMwPbmMUnr6IG1bHnoU7y8F6TioPmnW2bb7sVyeCo9pXM4pkGxc5ZQgi6CH9cbr6+Cp9WjhakBt9zMIDml8HvT2tYAcnWrGpYWacgl0ufCeenoKR/bm4FsWSSEuquUKL0vsM0dZvSRtKWwuEeZ4TEgfx8VvvLmWfMb6zjlK13pgdoNeNF4oPGpGxeFhhxELTRSfheZDfYVh4EDj2gLVkeKlyGedDcm0x9Pf6OoTHtguAMSyhBCpxRMvZyIbjaIzUGTVnRqB8Ew+sTVLRpdYuKdzEGkEBkSxvylnC8PBpTwNByF+YLrM3lrrbqzgY1nz4rkPyOuHfdJA+8nX9BZCaRs+2qOcxYnWXtk/q/7rJn5R2ePB1jyFQafz6X2YPubN6gEw1zh9gS5UeMSoofopaz5rT94wSo+70Ee0Gz278qfjCvU4NlSdFP94TvQbCKUaonYHxPm6gLnWkIJH1AVyiA7sycorg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5373.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(136003)(39860400002)(366004)(346002)(376002)(396003)(5660300002)(8936002)(55016003)(33656002)(71200400001)(122000001)(478600001)(41300700001)(83380400001)(186003)(52536014)(66556008)(66446008)(2906002)(38070700005)(53546011)(64756008)(26005)(9686003)(86362001)(6506007)(7696005)(66476007)(66946007)(54906003)(76116006)(110136005)(8676002)(4326008)(38100700002)(316002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?qpDLF8xXVCJYg1LQJ1/4ysE+Mqy+mFcgk5qR0Xs2HwcGRdvOESi0ZwyTUcsA?= =?us-ascii?Q?G/V4TMSry4YM/yBdy/srHTv/qpl5Tfkncjmm91BKAXlVzA1whlzUugTup3JN?= =?us-ascii?Q?EBfaJtT/DEMbG5QWAv5eepL5MxsDdriT4+5Kh82S8xh6LR3GgzyP3CBT6Tj/?= =?us-ascii?Q?MoAhElb+SdPprp5/h25XBaxnnxLhseonTOtYlwwoZyPAEWi6/DS6l3IpALmy?= =?us-ascii?Q?raNubOlkmGXgpXvZXwdI/HXYTxFGhz9m8ZeSWqi61egfoYeRpXUahf10DuPV?= =?us-ascii?Q?OmTZNgaYni87MVX02aLoT4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QHquaiZahQfQhYVMYus1Slh7rp7J0GlAq/7qwmIEWsOhLa0FEmE7Tu/9yDL8?= =?us-ascii?Q?YIsgPKGkmJlQQTuxTyWycXwiTXZSaSsKM9NrUtaCzpgYyl9uO+C9/wQgOCXv?= =?us-ascii?Q?gpFc13kMmilZwAH0lXeUo348xmwssbEenIhixh0VYDKnFV1La64mVIKGGwE0?= =?us-ascii?Q?dXeYoIK4HujeWJ3IPRhYEnGK8MqmA04aofeGupwzQhcaCWZzmzH/aaoHQ/kC?= =?us-ascii?Q?3meh1nGWL3BvMmVttddJkbQo51f3W7ntiOhpZSgaG+BPfFhba64XjwQDpX9U?= =?us-ascii?Q?332SRdsCYt+Dl5xlYQ2xOtak6FEiGPAWE6HZUNI0WO8Lh1/m4Osnsx4ddzjA?= =?us-ascii?Q?ORdRiF2zviqtpSeFAZJbYjApPBqzSHeUjYLB45JY/sRg1v0JHRdRdwnYbm6i?= =?us-ascii?Q?biyS1UKTIQWsjVsOWzWr+IBSkjxe07sk6SoHi+PDvekSBamRy1cbG9UD1NRv?= =?us-ascii?Q?TKTVscZBQB7iD5lwD1p9ly6IfhRC1wrB9JoEgrPZ+y7zfoqsCf/g/MFUiZjq?= =?us-ascii?Q?Gk925SoRog=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a786e1a5-9a3c-4490-1541-08da528ac1ff X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jun 2022 07:01:53.9562 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: NWALk+RH4IFuWO+g9uVV4OGCGpkz1TCjPZ5o+NiNxYFHivlFQemDJOIo+VO5TxdGd3VB8IFacKSGn8gt5wcevw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4463 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi David, Applied, thanks! > -----Original Message----- > From: David Marchand > Sent: Friday, June 17, 2022 1:52 PM > To: Xueming(Steven) Li ; stable@dpdk.org > Cc: Sunil Pai G ; Maxime Coquelin ; Patrick Fu ; Jiayu Hu > > Subject: [PATCH 20.11] vhost: fix async access >=20 > [ upstream commit 2d47fd3dfb596d266b89d82c2c4b2351c3d6fe20 ] >=20 > vq->async accesses must be protected with vq->access_lock. >=20 > Fixes: eb666d24085f ("vhost: fix async unregister deadlock") > Fixes: 0c0935c5f794 ("vhost: allow to check in-flight packets for async v= host") >=20 > Signed-off-by: David Marchand > Acked-by: Sunil Pai G > Reviewed-by: Maxime Coquelin > --- > lib/librte_vhost/vhost.c | 27 +++++++++++---------------- > 1 file changed, 11 insertions(+), 16 deletions(-) >=20 > diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 1a= 7c240492..40a2554417 100644 > --- a/lib/librte_vhost/vhost.c > +++ b/lib/librte_vhost/vhost.c > @@ -1693,31 +1693,26 @@ int rte_vhost_async_channel_unregister(int vid, u= int16_t queue_id) > if (vq =3D=3D NULL) > return ret; >=20 > - ret =3D 0; > - > - if (!vq->async_registered) > - return ret; > - > if (!rte_spinlock_trylock(&vq->access_lock)) { > VHOST_LOG_CONFIG(ERR, "Failed to unregister async channel. " > "virt queue busy.\n"); > - return -1; > + return ret; > } >=20 > - if (vq->async_pkts_inflight_n) { > + if (!vq->async_registered) { > + ret =3D 0; > + } else 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; > - } > - > - vhost_free_async_mem(vq); > + } else { > + ret =3D 0; > + vhost_free_async_mem(vq); >=20 > - vq->async_ops.transfer_data =3D NULL; > - vq->async_ops.check_completed_copies =3D NULL; > - vq->async_registered =3D false; > + vq->async_ops.transfer_data =3D NULL; > + vq->async_ops.check_completed_copies =3D NULL; > + vq->async_registered =3D false; > + } >=20 > -out: > rte_spinlock_unlock(&vq->access_lock); >=20 > return ret; > -- > 2.36.1