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 561F4A00C3; Tue, 20 Sep 2022 04:24:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF7EB4069B; Tue, 20 Sep 2022 04:24:39 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 013964021D for ; Tue, 20 Sep 2022 04:24:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663640678; x=1695176678; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=JOHgefrzC5jsLzTbeSxyYpMopFPhmjBUB7814KI3hJ4=; b=YRtRoSWIZTibjzmZkcTaQa2Rcrf2C8x75tna3m8VpZvM0QBoBG1Fox6e tIctQvnuWNIyud6qNFRJbBswc0j1CQVEgsH8YnQ8xMPxjy2jQK4Qufli1 vh/rcq99Scz7sPFZ/GW8jda6uk+4oK95G9QaJ0v3PvxO1sHFTEDd8hK5R mjBQMi0cXP/Gcv+Wy3AYKJnko50I0s+xI2bKrgtmmN0vflmsH/qgMlGis z1l3qHRqoAkAJXSXtD9aZZFSZgB5GLvCWJnW/Ns9SYO6thb2P48BLUH2e bZ0i0tyLSTnraLmMvISA6+Oal2oXXh8MkHJIQdvTxuOf5lTFySGdMdTCx g==; X-IronPort-AV: E=McAfee;i="6500,9779,10475"; a="286621096" X-IronPort-AV: E=Sophos;i="5.93,329,1654585200"; d="scan'208";a="286621096" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 19:24:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,329,1654585200"; d="scan'208";a="722549574" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga002.fm.intel.com with ESMTP; 19 Sep 2022 19:24:36 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX602.amr.corp.intel.com (10.22.229.15) 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:24:35 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX612.amr.corp.intel.com (10.22.229.25) 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:24:35 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx607.amr.corp.intel.com (10.22.229.20) 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:24:35 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.102) by edgegateway.intel.com (134.134.137.102) 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:24:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AaCZGMVnTRaILJ8Ni4Jm7+8aj0pg308t9zNfouTKACBti4dIyMUog9sS7jIRohtiPUwVxpDZVkGg1FrjysdcMXK2aCqexMxZ6hTlT6/agFJudXPgzQeTPO5s2bG1v5V9WeqIwvFFghK8IWMUf4XI6m8rvJ5ndIyy/VfujWxcAExLg/B8820hLvAt0OSWaTC/yLnfeOMlbHFeMB2blL5WHAESp4Uxd5aeytIBTOaNPKYaOZQeWoz1lppsAMfDqsgEVugHQPUePMzXshlXToLcqN7RStRU90V+N5Na7vL5alCp2w+yGT6j7ol29B6AN3DDK6aV2+PfX25fOdDd8c3REw== 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=+vafwCtgJYhbKJVcMy4Uk8vDo8VZDiI5Wo/ebA0H2FA=; b=jAWb8htqJmGcA8Y5Ny/LTMJ/i6ebRhk7Q4b8ezMxYK1n0pQlNtBtPZ1j8PyrIw9kOhcsocjNcpSvPustOR7Kzqk3/9gdIgyX1va4PgHrxhWTOgNDdgUDnPHVcVmP/jL4mUTYtqWliQOKvnlHPSHRMo8K4geBGFo7OVwH6kkQHqJhzYnf4Dsy4wlZrFwgcgJJY5wE5EOgNMvX9aKKpJbVIPrS8u2wk82fiiW29TNGt1iD0HJ9X0aqPY6zTWsmz1JQodqLc6TSwix/k1lbiQHZzAgq0TTVR7ZvXDnKpdzTXEOutgjWrMMSx0ZLW50InPaYsjmUIasP2oHfF1LyfysfYQ== 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 DM4PR11MB6141.namprd11.prod.outlook.com (2603:10b6:8:b3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.15; Tue, 20 Sep 2022 02:24:32 +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:24:32 +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: AQHYwZeRKzLltSYe2Ei3E8IaCvc93a3nqwQg Date: Tue, 20 Sep 2022 02:24:32 +0000 Message-ID: References: <20220906022225.17215-1-changpeng.liu@intel.com> In-Reply-To: <20220906022225.17215-1-changpeng.liu@intel.com> 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_|DM4PR11MB6141:EE_ x-ms-office365-filtering-correlation-id: de31213e-9039-4893-4b05-08da9aaf40e1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RuBuwyl7KjMCiH/w7UNTGVNwgg3Ox6FyZ/H1oIgnv0PtNI/yR5B1E3gDm2qXZvidnwfgZDX7Z2YK+zKx2fzSxh+VDJGF2kKkzXDM7lgwI59PJrL+IOVop7L2Xhc1fIALEEGhyNljEgLojvncC53faJUvphGjdlbBYD9U2MjNrbAXGr500XncjmmYD3HLMPdsQ/MrWWcAi/E2EmNLJ5qovH449y5nW2wNQWM6GlYnKr5w2mMZTpIH9OXUUBF7+9NqABx44+3/EBMemo1fp5IR+DPJLe0wYfnZBg7sLWAj5H8pmNew0xThoiZn4YTLUYMx5+43p59KQ4YMlBjZOqlGPeFzcOt3xBjc/xkZwK9FIROJzb4pTgSHOum6kYX6p2QI2Puce7INLZcFl2A/RgUPuj0iaROPjNLYXsDslsNZkM54bCoZle1a/NJCQsiiGG2DvgeGSB5p0vMrymULAPHbLeJ3mcMKWrcqRtsW9P7U2dtn8j7uQ/duJimVSAoJOgCvGV8dvhANgxmAdzlJXtljGL6xnxw1jsWfRaaVz7/kxdj4SlM0csqELN0S6BLOWSaPl+gHqilSBu8dWmMHABRB5mtMrrds4HWVb5gPatha31kiMxz7wPigYcUqsy2O/nXRmXa0sQBIqDSddCo7uSDV4+s7HnohZQ+0cTGSUhyvMaG7VeagD9evWdl2/Tq87gS/LeBu3kRPhLuhToXxaNGGYgbad+PE7qA6GTKqxAY2CJjlYi+m+OaD+CVY2GwXeGdolrN4o/LsmSq/Edpoe14Q6Q== 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)(366004)(396003)(346002)(376002)(39860400002)(136003)(451199015)(76116006)(82960400001)(316002)(41300700001)(66946007)(478600001)(64756008)(66476007)(66556008)(66446008)(4326008)(83380400001)(38070700005)(122000001)(8676002)(33656002)(55016003)(53546011)(6506007)(2906002)(110136005)(38100700002)(186003)(7696005)(86362001)(5660300002)(9686003)(8936002)(52536014)(71200400001)(26005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?POCpMHhHlMlZfkCeRd2mGLF1RuV9zlQvzvOKHNo0j+YGNZMv38FDUu8W/dSm?= =?us-ascii?Q?EH7+7zk3xPLXmt8jyBcs3EKbrr91IuBp47PsIMfhe6sgFq5S3ewM/iAojnO5?= =?us-ascii?Q?58pr2or62kYg2B2zAKNQINh08523mI9oMf7AtUegaL77R6nUxXyTZpWpGal5?= =?us-ascii?Q?f2X/et/nYUOgcBD/A0/hzkQBuMwLUPWh70hEDnYRksgAV+Gq5sE/wFTlkP0E?= =?us-ascii?Q?4imRmdxEgolA/gi3Kd1+0sqJ9rPbOvFBOGOVzE/GchF76ll6pZtpLkb5MPr0?= =?us-ascii?Q?1lFm5vlLtpkcOLquxsXGPdoynuhVA7fA07kv6SDgNyAaIRJacqY+cZES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Rcn7zK9/0RBaRjX/eOU5Dr3ppMvuzEKbxP?= =?us-ascii?Q?Lho/+M8vOH48VUYwdPfCK8J6THhukr3F/QjOErVS0mspky01O7W7FF45QUzy?= =?us-ascii?Q?CJnit6EzsyLu1uRDjKKDwPXeRWfS4XKTU056+Zzi9KIQB5VwKyU1dDlQCbMO?= =?us-ascii?Q?RLAi+vdtJ9ydFesz4KYrcqBX8XfZP46lqpUstjRAGGSIfFu6r9THEY9MM9fX?= =?us-ascii?Q?SNLWxSL+99A6DXtP66W0am/amjtDu8O9mZOcSAgfab0ZZcRC4qqX3WpLUysG?= =?us-ascii?Q?MaBtq4skqT4MdWXHkHf5C4mvi1dmwPK330qmbVFmQeMIUhWkKCCZg3WWa3Up?= =?us-ascii?Q?SK92y5774wXsQGVJAuAILGd65Wt4FuwT6a5jkqqu?= 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: de31213e-9039-4893-4b05-08da9aaf40e1 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2022 02:24:32.4651 (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: 4fKqsDnFGQ0lI2Svi8NrILm9leEX+q6RXRllUPuU76hxE96X4Z7ltwplsoGAQLkCn3YASyrR3vqjJEao2KELgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB6141 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 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 >=20 > 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. >=20 > Signed-off-by: Changpeng Liu > --- > lib/vhost/vhost.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > 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; >=20 > - rte_spinlock_lock(&vq->access_lock); > + if (!rte_spinlock_trylock(&vq->access_lock)) { > + VHOST_LOG_CONFIG(dev->ifname, DEBUG, Should use VHOST_LOG_DATA Thanks, Chenbo > + "failed to kick guest, virtqueue busy.\n"); > + return -1; > + } >=20 > if (vq_is_packed(dev)) > vhost_vring_call_packed(dev, vq); > -- > 2.21.3