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 81AB6A057B; Mon, 30 Mar 2020 16:34:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5A96F2C15; Mon, 30 Mar 2020 16:34:46 +0200 (CEST) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id 26FA32BEA for ; Mon, 30 Mar 2020 16:34:44 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id c81so20170580wmd.4 for ; Mon, 30 Mar 2020 07:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/ceabdhOlFIJD6puxPwSMi9cNpBq8REU6Wd23bSws0g=; b=TAe89aPJWCdbOgqgp48SW7/8xvL6b44A5rLiENX+Cant5oc3LKwpotUuRzk2K0RLkX VVu+AyCWPCBp9BQMtHOwxK+zpnOun2ViTZVOyOl1yvArf6eRTp3VlLWfCqPE2//ENHrn 6GcIRl7T/qhs6hF60qmUYOW8lXGEVXG7rT6fb34+U9ioLWZByACyP9JfJ3x//9PVhNbb FgLMGhoVU5/0EpOVx9Dq3LuojGzPQpuSSiwKwvmesX/YlVWu08LhNZqhjcZyWjiXaSbC nPF4NzUMdmrTgyzuQIo1mRqpb6jK8t3YECNzyf1kt575/hls+y9Q6fn17BF3Qd5QH1ks 1PNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/ceabdhOlFIJD6puxPwSMi9cNpBq8REU6Wd23bSws0g=; b=j6ZnqTm3Apjr4qMDFYGvQoTQs1eh6PuHdL/mhdmIUcIb2vSXO1CBOzybsYG26lPOmS w+oxabEu+oq0uHU98FDiIBdPHCw/ZRZb+XyegRw2FTznEIOXgdLNkeE6OMMJKaJdiQHE dsJ3FzqkX92D0rCI7gty4T2y0IFETQA5eOKNuACLG9s9hxwQswtbPINbPm6UnZ6WrNoZ vkTjr5cANXNQyTKL2okTvGIXkMUbDTwh6nZe40TEmyCznBMGKG/Yrr0luCfmmGoonzNH sQdz0jRgRA8STJN0ZSQ/0IfwTUL+iWYkXcJS2uR20IVij3ZwOCrmKHe6NGaJ9eXJuudZ gf0A== X-Gm-Message-State: ANhLgQ0lZplFcY1c8uUaQEKzctHAaoipwwCqZzsqQXwtVGEAf1s6+8Pf dCvZM6y+VL+YaJi2bJ7JcHg72I4j7yg= X-Google-Smtp-Source: ADFU+vsyR7Vzceh968AcjWK3KJltuI7quikmGx6AFVd3m0xlK8jjlSjUBAnboY1dVNdVRMIqBBtQvQ== X-Received: by 2002:a1c:8108:: with SMTP id c8mr13232415wmd.50.1585578883434; Mon, 30 Mar 2020 07:34:43 -0700 (PDT) Received: from sphinx.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id b67sm21310237wmh.29.2020.03.30.07.34.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 07:34:42 -0700 (PDT) From: Laurent Hardy To: dev@dpdk.org, xiaolong.ye@intel.com, qi.z.zhang@intel.com Cc: olivier.matz@6wind.com, david.marchand@redhat.com Date: Mon, 30 Mar 2020 16:33:30 +0200 Message-Id: <20200330143330.7427-1-laurent.hardy@6wind.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [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" 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 and rte_eth_xstats_get) called periodically via an application control thread. This is due to the polling mechanism to handle communication between VF and PF introduced for x710 (eg: VSI and virtual channel). 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 use system sleep and will not block the CPU core. Signed-off-by: Olivier Matz Signed-off-by: Laurent Hardy --- 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 and dataplane threads) ? 2)Another alternative to this patch could be to modify at librte_eal layer the function rte_eal_delay to put the thread to sleep in case of application control plane thread (by looking at the coreid). --- a/lib/librte_eal/common/include/generic/rte_cycles.h +++ b/lib/librte_eal/common/include/generic/rte_cycles.h @@ -13,9 +13,11 @@ */ #include +#include #include #include #include +#include #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() == LCORE_ID_ANY) + usleep(ms * 1000); + else + rte_delay_us(ms * 1000); } regards, Laurent --- drivers/net/i40e/i40e_ethdev_vf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) #define MAX_TRY_TIMES 200 #define ASQ_DELAY_MS 10 +#define DELAY_MS(x) DELAY(x * 1000) 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 == 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 == 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 = 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