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 45A5DA034F; Sat, 11 Sep 2021 06:03:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C22A440041; Sat, 11 Sep 2021 06:03:09 +0200 (CEST) Received: from mail-m971.mail.163.com (mail-m971.mail.163.com [123.126.97.1]) by mails.dpdk.org (Postfix) with ESMTP id 26A0B4003E; Sat, 11 Sep 2021 06:03:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=Zlksl vHISmVd7IJvl78tocPkmrFQlQTFIdW/+S+XNRM=; b=hBEhyFRzP47ePWQQR6szv 7hvGamfcoo1MS8o3smWfZ+IWxiOINzTGouuKRkD+AXV1/jkIKLQtBwQs44jcifB1 OFJnBrO27NLHLVYG/Gm/7h+tEaaxVLxD1m9I0tva/HVTRGmNc/sks5QdwfKpZ2hw vkuC9WH3+pD/bkt+j6MNGM= Received: from localhost.localdomain (unknown [124.160.213.250]) by smtp1 (Coremail) with SMTP id GdxpCgCHPbd3KjxhjxR3BA--.2375S2; Sat, 11 Sep 2021 12:03:06 +0800 (CST) From: Qiming Chen To: dev@dpdk.org Cc: beilei.xing@intel.com, jingjing.wu@intel.com, Qiming Chen , stable@dpdk.org Date: Sat, 11 Sep 2021 12:02:21 +0800 Message-Id: <20210911040221.3681-1-chenqiming_huawei@163.com> X-Mailer: git-send-email 2.30.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GdxpCgCHPbd3KjxhjxR3BA--.2375S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tF17KF45Ar47Ww4rWFWfXwb_yoW8tw4Upa y5C34akFy8Xa97G34UGw48Ga43WayrWFWjkFWkAw4rGryrArZYyFy0gr9ayFZ3Zayvya43 ArWjv345Was3JrDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jgZ2-UUUUU= X-Originating-IP: [124.160.213.250] X-CM-SenderInfo: xfkh01xlpl0w5bkxt4lhl6il2tof0z/1tbiQAsLoFSIkCQCFwAAsd Subject: [dpdk-dev] [PATCH] net/iavf: fix frequent command interaction leads to high cpu 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 Sender: "dev" There is currently a scenario test, which will continuously obtain port statistics, causing the CPU usage to soar, which does not meet the demand. After positioning analysis, it is found that the vf and pf command interaction is completed through the iavf_execute_vf_cmd function. After the message is sent, it needs to wait for the interrupt thread to obtain the response from the PF. For the data, the rte_delay_ms interface is used here to wait, but the CPU will not be released during the waiting period of this interface, which will cause the statistics to keep occupying the CPU. This is also the root cause of the soaring cpu. The command interaction should belong to the control plane, and there will not be too high requirements for performance. It is recommended to wait for the interface iavf_msec_delay to complete without taking up the CPU time. Fixes: 22b123a36d07 ("net/avf: initialize PMD") Cc: stable@dpdk.org Signed-off-by: Qiming Chen --- drivers/net/iavf/iavf_vchnl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 06dc663947..2f39c2077c 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -181,7 +181,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) args->out_buffer); if (result == IAVF_MSG_CMD) break; - rte_delay_ms(ASQ_DELAY_MS); + iavf_msec_delay(ASQ_DELAY_MS); } while (i++ < MAX_TRY_TIMES); if (i >= MAX_TRY_TIMES || vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) { @@ -207,7 +207,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) err = -1; break; } - rte_delay_ms(ASQ_DELAY_MS); + iavf_msec_delay(ASQ_DELAY_MS); /* If don't read msg or read sys event, continue */ } while (i++ < MAX_TRY_TIMES); if (i >= MAX_TRY_TIMES || @@ -225,7 +225,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) do { if (vf->pend_cmd == VIRTCHNL_OP_UNKNOWN) break; - rte_delay_ms(ASQ_DELAY_MS); + iavf_msec_delay(ASQ_DELAY_MS); /* If don't read msg or read sys event, continue */ } while (i++ < MAX_TRY_TIMES); -- 2.30.1.windows.1