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 4F23FA0562; Sat, 4 Apr 2020 03:51:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B5F7C2BA2; Sat, 4 Apr 2020 03:51:49 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6ACD02B89 for ; Sat, 4 Apr 2020 03:51:48 +0200 (CEST) IronPort-SDR: 5ZALXEtmDs3pNHOKuoMkRarkoPQ+hJ9hqNRKLkF492QGm2VcPYuycMe/Wb3oBGKsMXerL/Xmcy x3daUCEnPUdg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2020 18:51:47 -0700 IronPort-SDR: NI+vm+APEBCC1AkCshkQLG44ED8ATdzS8XHQIKLSE8QsqocrfuoqtJbrJTWuIAjllK78zi7QsT ooA9/9VgRa5A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,342,1580803200"; d="scan'208";a="360696378" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga001.fm.intel.com with ESMTP; 03 Apr 2020 18:51:47 -0700 Received: from fmsmsx163.amr.corp.intel.com (10.18.125.72) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Apr 2020 18:51:47 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx163.amr.corp.intel.com (10.18.125.72) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Apr 2020 18:51:46 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.146]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.7]) with mapi id 14.03.0439.000; Sat, 4 Apr 2020 09:51:44 +0800 From: "Zhang, Qi Z" To: Laurent Hardy , "dev@dpdk.org" , "Ye, Xiaolong" CC: "olivier.matz@6wind.com" , "david.marchand@redhat.com" Thread-Topic: [PATCH] i40evf: use non spinning delay when issuing AQ request to PF Thread-Index: AQHWBqBiL8LcAHmlo0OFBaSV2fHGpKhoNZCg Date: Sat, 4 Apr 2020 01:51:43 +0000 Message-ID: <039ED4275CED7440929022BC67E70611547F30A3@SHSMSX103.ccr.corp.intel.com> References: <20200330143330.7427-1-laurent.hardy@6wind.com> In-Reply-To: <20200330143330.7427-1-laurent.hardy@6wind.com> Accept-Language: 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] i40evf: use non spinning delay when issuing AQ request to PF 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" > -----Original Message----- > From: Laurent Hardy > Sent: Monday, March 30, 2020 10:34 PM > To: dev@dpdk.org; Ye, Xiaolong ; Zhang, Qi Z > > Cc: olivier.matz@6wind.com; david.marchand@redhat.com > Subject: [PATCH] i40evf: use non spinning delay when issuing AQ request t= o > PF >=20 > When a port is handled by the i40evf dpdk pmd we could observe a cpu > usage around 70% in case of rte eth stats functions (rte_eth_stats_get an= d > rte_eth_xstats_get) called periodically via an application control thread= . >=20 > This is due to the polling mechanism to handle communication between VF > and PF introduced for x710 (eg: VSI and virtual channel). >=20 > After issuing any request to the PF, the VF will wait in a blocking mode = until > it gets a response from the PF or until timeout (2sec). > Instead, uses rte_delay_us_sleep to sleep for ASQ_DELAY_MS, which will us= e > system sleep and will not block the CPU core. >=20 > Signed-off-by: Olivier Matz > Signed-off-by: Laurent Hardy >=20 > --- > Hi all, > Some question coming along with this patch: > 1)Is there any downside to use the rte_eal_delay_us_sleep which will put = the > thread to sleep instead of the rte_eal_delay_ms (for both control plane a= nd > dataplane threads) ? Do we already have API rte_delay_us_callback_register, so user can decide i= f block or non-block delay they want? >=20 > 2)Another alternative to this patch could be to modify at librte_eal laye= r the > function rte_eal_delay to put the thread to sleep in case of application > control plane thread (by looking at the coreid). >=20 > --- a/lib/librte_eal/common/include/generic/rte_cycles.h > +++ b/lib/librte_eal/common/include/generic/rte_cycles.h > @@ -13,9 +13,11 @@ > */ >=20 > #include > +#include > #include > #include > #include > +#include >=20 > #define MS_PER_S 1000 > #define US_PER_S 1000000 > @@ -147,7 +149,10 @@ extern void > static inline void > rte_delay_ms(unsigned ms) > { > - rte_delay_us(ms * 1000); > + if (rte_lcore_id() =3D=3D LCORE_ID_ANY) > + usleep(ms * 1000); > + else > + rte_delay_us(ms * 1000); > } >=20 > regards, > Laurent > --- > drivers/net/i40e/i40e_ethdev_vf.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c > b/drivers/net/i40e/i40e_ethdev_vf.c > index 244397e0e..c700c66fd 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -315,6 +315,7 @@ _atomic_set_cmd(struct i40e_vf *vf, enum > virtchnl_ops ops) >=20 > #define MAX_TRY_TIMES 200 > #define ASQ_DELAY_MS 10 > +#define DELAY_MS(x) DELAY(x * 1000) Ideally the macros in base/i40e_osdep.h should only be consumed by base cod= e itself. The pmd driver that adapt to ethdev should take rte_xxx APIs. >=20 > static int > i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args) > @@ -358,7 +359,7 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, > struct vf_cmd_info *args) > break; > } else if (ret =3D=3D I40EVF_MSG_ERR) > break; > - rte_delay_ms(ASQ_DELAY_MS); > + DELAY_MS(ASQ_DELAY_MS); > /* If don't read msg or read sys event, continue */ > } while (i++ < MAX_TRY_TIMES); > _clear_cmd(vf); > @@ -380,7 +381,7 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, > struct vf_cmd_info *args) > ret =3D=3D I40EVF_MSG_CMD) { > break; > } > - rte_delay_ms(ASQ_DELAY_MS); > + DELAY_MS(ASQ_DELAY_MS); > /* If don't read msg or read sys event, continue */ > } while (i++ < MAX_TRY_TIMES); > _clear_cmd(vf); > @@ -394,7 +395,7 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, > struct vf_cmd_info *args) > err =3D 0; > break; > } > - rte_delay_ms(ASQ_DELAY_MS); > + DELAY_MS(ASQ_DELAY_MS); > /* If don't read msg or read sys event, continue */ > } while (i++ < MAX_TRY_TIMES); > /* If there's no response is received, clear command */ > -- > 2.24.1