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 2C4FFA00C3; Tue, 20 Sep 2022 04:54:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BAA214069B; Tue, 20 Sep 2022 04:54:34 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id D4B944021D for ; Tue, 20 Sep 2022 04:54:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663642473; x=1695178473; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=u9oNrHfrZ/HCOMLhE2ws5WKBIi49GIS709fDPjH/6GU=; b=Jw+hms3uKT/z96iA6hHCh+oT4Mhv2dZhmyrIncmp8nx1nG1g4a7Q9u6W 3vUbk6VOdwB98XdxrVfE+9px7AZP+608l6fgAxasdXOdKc2wDeISQZdE+ phOkYKDiQTazLsKXasjcWOykXdHmOLalEx2wBllwdHZen03eVOr1sN9sD oJxkcD9zxTFyMIoZJLkIjgEBHjhzYVZbJV29Kl1mCtQXnKDQoTlnEELjq jtPRR3UYNaTdcy0e1yzJ7GKo5Bqr6HT2TgfKWg82ho5KOWILfRt0KDG21 Hbs8qTCcNkCWRwlMOB66aaWsVauSxoVmH+n4FEbKt/tFSpQ2M9/8WJUZu Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10475"; a="325878466" X-IronPort-AV: E=Sophos;i="5.93,329,1654585200"; d="scan'208";a="325878466" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 19:53:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,329,1654585200"; d="scan'208";a="596336842" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga006.jf.intel.com with ESMTP; 19 Sep 2022 19:53:57 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 19 Sep 2022 19:53:57 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 19 Sep 2022 19:53:57 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Mon, 19 Sep 2022 19:53:57 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.176) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Mon, 19 Sep 2022 19:53:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PuO49eL708rqgZGUlTu1Ysz7uvdvDzwyRo2onX0uff3yNS4t6tNtQfxh9O7aX2BGb8io/vcnQRGX7UhkxYg32K6qbzyJlI/SFIBwP7jWXCsmWc1ad3t0HAhWv/odyOFHSwqoyOrnAXbYRKqZDg+tmPy8xgNvST2sGleCPQI+3NUhqhRTdiO/3/gu+je8QX8SY46dhLObxi3LnhTYIxnLlcEIBu0ycY/lEX0I4AiaVdbxw1sn1paECSV+iJ3ZQgIKahqaQcTDdrUCEWuvqRp4A5TFtj7aBpsBXSccL7dCEDp0zF0fTLruZd76OByURyvqrPt8ytMm0awnL86nnmIBWQ== 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=yC7oiLgH8gZLR90h21RX6lMFuIqEi05g1arEDdWK/ic=; b=MennaP+bWsoR2FFi5a3PVMiDXPaBioNkPpDlb9kHbxURCBJliKOrEQJ2Up3NgPmAsf1qKpdJ/3alqbKu3Gm6+ENw3gyvkiDw/NmN2JIRIv5VCfomQsNxMbqDmi+0EYXqOi4tj7lQlKC3A8/qea11tv7jEDtyzXcY2NYQ5lfWRtBzZENwgy+Vx6Mq+p0mG2ZAvzdXezMGvG59HWAhFUm03/45aStC9WLuX7K8ja7peCy2qN3F0LXBW3OqaO2yIJRCgSfOLNjnYgdftAb1K4F6oVBsqGfPycOgMbF/IvZIA8aHGsUyXNWMDVWqJ0cnxMoZi056ulog05/R4eEmUIMYMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SN6PR11MB3504.namprd11.prod.outlook.com (2603:10b6:805:d0::17) by CO1PR11MB4818.namprd11.prod.outlook.com (2603:10b6:303:93::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.21; Tue, 20 Sep 2022 02:53:55 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::408e:79cb:b715:b8ac]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::408e:79cb:b715:b8ac%4]) with mapi id 15.20.5632.021; Tue, 20 Sep 2022 02:53:55 +0000 From: "Xia, Chenbo" To: "Liu, Changpeng" , "dev@dpdk.org" CC: Maxime Coquelin Subject: RE: [PATCH] vhost: use try_lock in rte_vhost_vring_call Thread-Topic: [PATCH] vhost: use try_lock in rte_vhost_vring_call Thread-Index: AQHYwZeRKzLltSYe2Ei3E8IaCvc93a3nqwQggAAEuICAAAF5cA== Date: Tue, 20 Sep 2022 02:53:55 +0000 Message-ID: References: <20220906022225.17215-1-changpeng.liu@intel.com> In-Reply-To: Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR11MB3504:EE_|CO1PR11MB4818:EE_ x-ms-office365-filtering-correlation-id: 8b0b3be1-4439-4f76-9391-08da9ab35bbe x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: cojOLar63z8603txujIke/K80LxEcOAig+3taVhu8o/k54TLfv3RqnTvgKQuggL8/TE87W877qBXj5R+exHywywey9gcsTM1O2vcecT/N2EFUp1iHQyemYY9ToGc5I5t39/MJNDMu9z1FpNxvM0ESmXmYysn8jpg8BB6LiqtEtQRHNunX12XEqinoNxFcKLnafv1zlH1btUUU8SF3oJlbg4rLmNWQtRg2GEkBL1N8cFdm/iy6U8jPhbjwuTR7HHtuYEz6hxQa52eSgDOJgXjfGBS/vi36Wv50KvVDImh5O1I4Q2wWRfaE7dJd8CRPHvTKjHyTamxsXP7nngY1mv39DyCaWU3SoHll5c1DmsqFZOGSgK/fS5wK39Q///8ZiUPPMcsmbJovEfzxqAFqQf0VIHkyVuripnyGY23W4uDaKfWq+2v8HJcs9NGOAYICIS6iL76/dj7g3Gw3SXtbt3XgUoVKIcbFaQwzBeIc1veJrYw4GPEBPTVIN1KmeK40zsclJWcGMDL3KMRQzTEbVcCV/QrLItmQHem2zW/s3rVxD8DfpFpDEtARPBM2WF4kpeUXP+U4UKc0+9QcJ+RgBqgpueSk99a30sYqTmeZRjz9HexVZpBCxzC9a76Ouj8bqHiijskZmMgAbC20KnMZg0UGdcJU7zrbxV1f3oqARq5+R90lNM45nLynYhP3DmxsNI9HRtfPIudmrsBt28LhLW4N6MTiwTcrGH+iFpcVZ68lYVIlE3vZ5oNxYbwE/ecHjve76Dd4w7MsEUUPldFGjnqlw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3504.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(39860400002)(136003)(376002)(346002)(396003)(366004)(451199015)(478600001)(86362001)(71200400001)(8936002)(41300700001)(5660300002)(52536014)(8676002)(110136005)(316002)(66556008)(66476007)(66446008)(64756008)(4326008)(33656002)(66946007)(76116006)(38070700005)(122000001)(82960400001)(55016003)(38100700002)(186003)(53546011)(7696005)(6506007)(9686003)(26005)(83380400001)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ElAj15Uh/92bMHU0YSw9VjYbV9TEnRn8MjdPBVLcwiv4U1s8/XIbO4QNJ3bd?= =?us-ascii?Q?IgGdvY4Nsth9spcsann/PGVBW9+nCX76bjVsCIwVn9+5i4iIAJwZnTWlPXzS?= =?us-ascii?Q?MO9jdiNGeg9v1dqZsWUNsE1h0dqT1FVGxjdYPSu5GE7E2cLmb1EKw5r7di9v?= =?us-ascii?Q?C+zKcKvgg3aQ7V4/aZTuCjstqQ3uFjH4AJC5UP1TQN/E+hHxvBgAOGHgFDEG?= =?us-ascii?Q?as7hFjFu396E7L3HOcJUlZhqchajZVXGCI2yJArDrFW7+S1i8QzCWWc6jNnK?= =?us-ascii?Q?TMibuXeb8NP9feJd6FLye5KkBMyABcGqhO0RMH02z5YcUim+TQ+F1otIX5Nx?= =?us-ascii?Q?xWuSReT47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omISOz84M?= =?us-ascii?Q?aCKf10dxT+9gvgjZrpu6OVZLHVoGg+iXWg5Q/G/j/wGCsqwRKYrHBIPSS62k?= =?us-ascii?Q?QNMipC7MMqcO6rIFaZcTmUS7c6rmRLwbRtnlyzfCIwBiOnE6oRdhBuhn1pmj?= =?us-ascii?Q?gSrjLIstNl5zDztFmQHf+neYvGiNraitr95fsxp7NhiGuIYJ55MeHNbhztlP?= =?us-ascii?Q?bhsPIzKHFPVV07iXfu0PBmIv7WFyT2FQyvOFrV7iV8izzpb0tyVL4a68usw4?= =?us-ascii?Q?skrMsaH3GbqWnWm8kOjaw167NPgPK9eaCbXrh24Qz83k/gq+L0WoMW6XDcZ3?= =?us-ascii?Q?hrjlH8Nt5SKSBJq476NilvtfIQaatCxfBI+vOBJf?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB3504.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b0b3be1-4439-4f76-9391-08da9ab35bbe X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2022 02:53:55.5073 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: NdYdTK6rprl11na5sPBBVZTlMovhUngJ+g9T4NP+hKeb2j7+LYb8q2whCqaV/FoQm8KwLR0fDaPQRyhkXqEQqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB4818 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: Liu, Changpeng > Sent: Tuesday, September 20, 2022 10:34 AM > To: Xia, Chenbo ; dev@dpdk.org > Cc: Maxime Coquelin > Subject: RE: [PATCH] vhost: use try_lock in rte_vhost_vring_call >=20 > Hi Bo, >=20 > > -----Original Message----- > > From: Xia, Chenbo > > Sent: Tuesday, September 20, 2022 10:25 AM > > To: Liu, Changpeng ; dev@dpdk.org > > Cc: Maxime Coquelin > > Subject: RE: [PATCH] vhost: use try_lock in rte_vhost_vring_call > > > > Hi Changpeng, > > > > > -----Original Message----- > > > From: Liu, Changpeng > > > Sent: Tuesday, September 6, 2022 10:22 AM > > > To: dev@dpdk.org > > > Cc: Liu, Changpeng ; Maxime Coquelin > > > ; Xia, Chenbo > > > Subject: [PATCH] vhost: use try_lock in rte_vhost_vring_call > > > > > > Note that this function is in data path, so the thread context > > > may not same as socket messages processing context, by using > > > try_lock here, users can have another try in case of VQ's access > > > lock is held by `vhost-events` thread. > > > > Better to describe the issue this patch wants to fix and how does > > it fix. > > > > I remember it's a bz issue, do you want to backport? And it has > > some bz ID, we need to add it in commit message. > Actually it's my intention not to add bz ID, as I think for this bz ID, > It's better not to lock all VQ's access lock for KICK/CALLFD messages, Do you plan to add this change? I think that may be an improvement to curre= nt locking implementation. Maxime, what do you think of this idea about only locking specific queue wh= en handling vring related message (not global config like mem table)? > What do you think? If this is identified as a fix, I can backport it to > 22.05. You can decide, if this is planned to be the fix, just backport. I am just thinking if this is not the fix for the bz, do we still need this? Thanks, Chenbo > > > > > > > > Signed-off-by: Changpeng Liu > > > --- > > > lib/vhost/vhost.c | 6 +++++- > > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > > > diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c > > > index 60cb05a0ff..072d2acb7b 100644 > > > --- a/lib/vhost/vhost.c > > > +++ b/lib/vhost/vhost.c > > > @@ -1329,7 +1329,11 @@ rte_vhost_vring_call(int vid, uint16_t > vring_idx) > > > if (!vq) > > > return -1; > > > > > > - rte_spinlock_lock(&vq->access_lock); > > > + if (!rte_spinlock_trylock(&vq->access_lock)) { > > > + VHOST_LOG_CONFIG(dev->ifname, DEBUG, > > > > Should use VHOST_LOG_DATA > OK. > > > > Thanks, > > Chenbo > > > > > + "failed to kick guest, virtqueue busy.\n"); > > > + return -1; > > > + } > > > > > > if (vq_is_packed(dev)) > > > vhost_vring_call_packed(dev, vq); > > > -- > > > 2.21.3