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 906ECA0551; Wed, 7 Sep 2022 02:41:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2AA2B400D6; Wed, 7 Sep 2022 02:41:55 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 2872A40042 for ; Wed, 7 Sep 2022 02:41:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662511313; x=1694047313; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Vgz2Ti6+jxU30tNX2PEDtKuGhkouMsLSwWhM8MnMO84=; b=WxuuVargIZ2QijYpUIKVAB09HVWW4WQIPhGfs4ljzKzo/3kwoPM+dpmM frrIARLCSksSLuR66DBldqfLqtv+mdSxBg71nc/Au2Usl0MvNbjID9eVM NVuH/WpkqnLEvD/2t7uHc5MBYUeYdqMgH/Zf/jgiA1UWQCrtAGWBwnxpQ 6pyjwDdVNrdsvKU/Q1iL477kIay/7U7iGOCyZdfkxvGcPekBnY4+bsQZw 442iYiBqu7gTFtGU6zH9DHbctSoD3nMsBM7g9ROeUKwtsBq0W2zDaAG7y dk07KSmevKC2Tk8r7y9xNhlYP7E23oTu4U2QRF4QhxLQLr0JxP3RJcNaV A==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="358461784" X-IronPort-AV: E=Sophos;i="5.93,295,1654585200"; d="scan'208";a="358461784" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 17:40:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,295,1654585200"; d="scan'208";a="717922089" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga002.fm.intel.com with ESMTP; 06 Sep 2022 17:40:36 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 6 Sep 2022 17:40:35 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 6 Sep 2022 17:40:34 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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 via Frontend Transport; Tue, 6 Sep 2022 17:40:34 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.177) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Tue, 6 Sep 2022 17:40:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GCoGLg7YjY6WCXDy53WxEW+of5szUxO+r/95hMWlpS62gOdaxylnvFRHl+RNzHOn4pL/sFH+6DCu3aXZQ0UCoUsadwFQd0IflpVkb9RQU5Wq+eDYd/bYI1zH817F+JIXEctEeV27VfG5LFI+2+ezQNFD62gCOQhXWSkKWpm/yLZRWyG8NN1U96q3+JYXchApSFot2YuizjWjhI/RcUiVaMd42nhqDrNaOEM28husBc6tPtONRDSemqdrmkMzVMmzMUNba35Y0uOjPpR1rqsGZKTCafEV4s8JHyfNKr0TFqG1aEmy3BbVrSPRjlMamVbs7NuFJxtcwaZFqjEF4knkew== 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=pGvb2LEwUPoC+QpwCB6C1TaQ6spXL8j6u7KfC1/L5ZA=; b=f8yjed1qJiKx2v07bZpSrcecTe+BMCC4vPSLSaaeFvf6rzc7MFeXatQMoH59sxBOApzNKOGoN0mRGC6iDz7JjKW2jIPZzE42MYXTC/mz6r/ChuhgqJ5nuNtqpSAUXz/i8Aq5/B8BZaZ4e8gf3VnqzySYNG06G0qHrL4eIYTe52dkLRJPjQVsPIV6cyJ42qjY+N9nSCzL9GINDM6hdTV2GTWYFSaj5oMH8nUjtKICUDxyF3ZCRSzKtnSF32LxcGY3FNyfgWeB0lfSmvnZ2AHXzVNzwl2CwdtwAaIc6dBAKzY5pprbUbmLVtdLzlPoJt/ENA3KPeUl7SQTcFd1n+xtew== 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 PH0PR11MB5093.namprd11.prod.outlook.com (2603:10b6:510:3e::23) by SA2PR11MB4794.namprd11.prod.outlook.com (2603:10b6:806:f9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.12; Wed, 7 Sep 2022 00:40:14 +0000 Received: from PH0PR11MB5093.namprd11.prod.outlook.com ([fe80::2055:5d1e:6a0e:28b3]) by PH0PR11MB5093.namprd11.prod.outlook.com ([fe80::2055:5d1e:6a0e:28b3%8]) with mapi id 15.20.5588.018; Wed, 7 Sep 2022 00:40:14 +0000 From: "Liu, Changpeng" To: Stephen Hemminger CC: "dev@dpdk.org" , Maxime Coquelin , "Xia, Chenbo" 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: AQHYwZeRjf3mjtMrEkOd0Zp5P1Nw9a3S6HAAgAA35XA= Date: Wed, 7 Sep 2022 00:40:13 +0000 Message-ID: References: <20220906022225.17215-1-changpeng.liu@intel.com> <20220906141538.7aa0876b@hermes.local> In-Reply-To: <20220906141538.7aa0876b@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.500.17 dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7f4bc637-caa5-4cd8-20f1-08da90698734 x-ms-traffictypediagnostic: SA2PR11MB4794:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ic1JmHKTfmNI9+9piY7bgU2iWKcnoRdIMqdhSYncZdmR5PIVmgwmJ7irR20/oFAn13kiLvRglCTi6iR86yUDk91aOOK95Zk6eRe+YqLtgrNWjao1vjJebTmFpAUzwgc6EsgFq1fM+2LNjHWbvqs52XRel0BWvJIt1OeJhDF/k5FDmalxOIJcnRGC+YzYK7RmbrjZ4vnWUUvpGlD4Onf1EpRwFQuTyW97ekqVTI1PbKRu61I3SaFXzs+6NIWhzdYptVlxa40rSRqt/N79P9qreQx6OKYyPFlqeVQBFWZabUwWdUhOiICgJ337zzgt0yHxiBaW+6PKo8/8qBAdCklUVn4H9IYfRXYKb5Ul3T5YdN+clI84T8VEtW0QxGBaWCIx9/+PFNCMkyUpa0REY1ubKh+EGaLThy8+yE0qkt/XP0kxPXdkuZFCt1LLAhG3/prUPhnl1d1DZPs8nUWii+61XHrKUNaPFQ7271YY47MYEZC4hbulMPoWCIowNH0fQ23s5tv8UPif1UmsTpPmtqqgCoiYTrS15wgGeDQGElMBt9qjEALoWT/phwtcef7So2PR/DznelTOlgll8hS19z8sr74TrpLLyVlpwNsl0aXF2+jOTUadBFPNJhUZWCfs9eL95fsJHGuF5nqz/45bdOHbFmHlAaB4cgMxftRPT+YWGNT2U4Fch+XPsQ6AQVsSBRdYjyKb7uvaB254DFqNnNkTe45W4U91FLeGmvj6Dz1n83ozRQyOx+4BCamE86PWVVPUfO6gzp9EZqvtkfT777slmA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5093.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(346002)(366004)(39860400002)(376002)(396003)(52536014)(38070700005)(2906002)(5660300002)(55016003)(82960400001)(122000001)(53546011)(38100700002)(8936002)(71200400001)(478600001)(6506007)(7696005)(107886003)(316002)(54906003)(6916009)(41300700001)(66446008)(83380400001)(8676002)(66556008)(76116006)(66476007)(66946007)(186003)(4326008)(64756008)(26005)(33656002)(9686003)(86362001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?Av6oe7FQjudVnN+pD+sf0wqeWCBKQ2ph5EYw91So+0+u1sLfK2CZ7rfi?= =?Windows-1252?Q?Rrf0S/tp5YHAVgi98VFmtvpatrVQkDrXEv91DkdWx71PJRz1MAFO2+il?= =?Windows-1252?Q?LjqvAAcnT3NgQIKy4S6pDNKj/LvyqrZSSL+ww98NSC8oVHpkGdKnzAa/?= =?Windows-1252?Q?wpqwopTglBrsCz85nbmGr+WZ6UOYXSiU5OHv6/sVGgs8mtZacZWN9dNF?= =?Windows-1252?Q?PO0HjO7kgWusYQjdRdzr2RSdKMYJYzluRcUDKA8mn1rs7Yyir01/wLLs?= =?Windows-1252?Q?f8CkcPxwpLyZh+He4KdA5xVMlIPF9A+K7Grw606tN4h3b8q2WaiKV9Wl?= =?Windows-1252?Q?ZdNZm0WFGz4wMJuNqcJnFZPFFClEbyFuuzeYMyHGGaU81sTcONd75pLP?= =?Windows-1252?Q?makexwrvipSIwaDtt2t6n0XMgvhoC3JgFt8GCUs3hZIRgctnv+uAjcIk?= =?Windows-1252?Q?j+OEC7KeqhVdevcJjsDtgDbXK3OJW16dY2Mb7Oe54Lco/7jmaL0QtWuL?= =?Windows-1252?Q?eNU1KNCF0PtwJSLkPNfUCjP1v1oe9G70oz36FwV8mrLg0m7EEXEriciU?= =?Windows-1252?Q?Iq76/3WI1uN85T67t2KXAXpegyXOO+vZBsMehhxO6/0kq8+k4GA195Cy?= =?Windows-1252?Q?3NKdh8fjTQTLcGyJY9LBiMIb6wnfx6ytNKqqgDQubGaZVlSa7NRKZSCB?= =?Windows-1252?Q?COcC2boqgtCMEVQRgHqbCBYWScgI4wVjkK6KnxmnKVzO+XIero3RzjoJ?= =?Windows-1252?Q?UkIzTIBjoA4tjhNxCHqhMLXyVfY7Z0xANeM6p9DWlsHha0tawVzeaBXE?= =?Windows-1252?Q?X1YGzdKRTZU8umY4mIdDUxho8qDBIohYBI4Kqw3yZGm6NcD+Em6QgdY3?= =?Windows-1252?Q?7Wcgq1xm6kQ2TFUN7aH/KRg05YFiz5cc7FAU3dabFGD+eVc2svt1SlTn?= =?Windows-1252?Q?211JnI2sXv3Stv3JiesOjqbJy1OBU8TnCM82iZmYnM1cddSKhYCrRHb2?= =?Windows-1252?Q?/2yVRY36VOPOYAOngMAYCjtyzK8YkDZPeZyzYTz200vqyeNT5uBxMf3C?= =?Windows-1252?Q?PsSWbruFjQeMnNvE1c6SzqXsVj8MxxPO7R6tw91RTmGlYc2S2LlNSXtB?= =?Windows-1252?Q?S/rtFLgUykSFlr8c9skgyua+GGECovf+5Vo671P7J2hi9GlJU0mucwZt?= =?Windows-1252?Q?ac/INPojhJPLH7h7lQ0DBDUPqVtfEMGyzZbnaUerl2odpuvS7/Lbzqcf?= =?Windows-1252?Q?NADuisbKeIsYgpnyMaIfLD2XbFFjaqEbNfqeMZ7wcHhFXsrT+8yp8rMB?= =?Windows-1252?Q?RVKmV/3IkW2Ub5XgsMU0+GWaIS3Sf4iIo1DYvMpOALSGCjASotK193fN?= =?Windows-1252?Q?ex+Bo0ibXhZ6ZlL4wz4K18Ckr+qcLel3VoARODHMW1q4eTIcOJ81N5cO?= =?Windows-1252?Q?QY4H16YZ1Tlv2m2heLieNJ4j7sXf2v82jmk8Rz7H064BA4o4TaUW/J2A?= =?Windows-1252?Q?XBmikozX7jgmz/wv96Oz5aDzre+W8SzhbhhT4R6zDKePrkTwqiPy4l/f?= =?Windows-1252?Q?/m88j5if5huDm43NHLMKBvxfo3+z109JL4bsfMgPTd6NH8msD/vP8iEo?= =?Windows-1252?Q?euzFYrSitsWQBk63yYlgb8Ob4msPzz4CbOKrttyPuLYOYVZ8QRcE7Tg7?= =?Windows-1252?Q?VwUZedkoPDDq5Xzs7TpBuw59kaCzarVI?= Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5093.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f4bc637-caa5-4cd8-20f1-08da90698734 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Sep 2022 00:40:14.0038 (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: jFNmXLEsS19I/zMtxNy+HFglZKE0pzGgEj9yc1okb4ey5DHJxd3U9lJL9kGEhGaNPmvv7LZ3O6uROtsTwiSlEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB4794 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: Stephen Hemminger > Sent: Wednesday, September 7, 2022 5:16 AM > To: Liu, Changpeng > Cc: dev@dpdk.org; Maxime Coquelin ; Xia, > Chenbo > Subject: Re: [PATCH] vhost: use try_lock in rte_vhost_vring_call >=20 > On Tue, 6 Sep 2022 10:22:25 +0800 > Changpeng Liu wrote: >=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. > > > > 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, > > + "failed to kick guest, virtqueue busy.\n"); > > + return -1; > > + } > > >=20 > If it is a race, logging a message is not a good idea; the log will fill > with this noise. >=20 > Instead make it statistic that can be seen by xstats. It's a DEBUG log, users can't see it in practice.