From: Qiming Chen Date: Sat, 11 Sep 2021 04:02:21 +0000 (+0800) Subject: net/iavf: fix high CPU usage on frequent command X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=de5bef335eeac3a0b1e29eb2c5fabbcadb9549eb;p=dpdk.git net/iavf: fix high CPU usage on frequent command 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 Acked-by: Qi Zhang --- diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 050e5f7232..3275687927 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -182,7 +182,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) { @@ -208,7 +208,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 || @@ -226,7 +226,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);