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 C08F8A00C5; Thu, 25 Aug 2022 08:43:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2DD644280B; Thu, 25 Aug 2022 08:43:08 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id AE9AC4281B for ; Thu, 25 Aug 2022 08:43:06 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B2F17ED1; Wed, 24 Aug 2022 23:43:10 -0700 (PDT) Received: from net-x86-dell-8268.shanghai.arm.com (net-x86-dell-8268.shanghai.arm.com [10.169.210.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DD6333F71A; Wed, 24 Aug 2022 23:43:32 -0700 (PDT) From: Feifei Wang To: David Hunt Cc: dev@dpdk.org, nd@arm.com, Feifei Wang , Ruifeng Wang Subject: [PATCH v1 3/3] examples/l3fwd-power: enable PMD power mgmt on Arm Date: Thu, 25 Aug 2022 14:42:51 +0800 Message-Id: <20220825064251.2637274-4-feifei.wang2@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220825064251.2637274-1-feifei.wang2@arm.com> References: <20220825064251.2637274-1-feifei.wang2@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 For Arm aarch, power monitor uses WFE instruction to enable, which can not exit automatically within the time limit. This means 'rte_power_monitor_wakeup' API needs to be called to wake up sleep cores if there is no store operation to monitored address. Furthermore, we disable power monitor feature on the main core so that it can be used to wake up other sleeping cores when it receives SIGINT siginal. Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang --- examples/l3fwd-power/main.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 887c6eae3f..2bd0d700f0 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -432,8 +432,16 @@ static void signal_exit_now(int sigtype) { - if (sigtype == SIGINT) + if (sigtype == SIGINT) { +#if defined(RTE_ARCH_ARM64) + /** + * wake_up api does not need input parameter on Arm, + * so 0 is meaningless here. + */ + rte_power_monitor_wakeup(0); +#endif quit_signal = true; + } } @@ -2885,6 +2893,25 @@ main(int argc, char **argv) "Error setting scaling freq max: err=%d, lcore %d\n", ret, lcore_id); +#if defined(RTE_ARCH_ARM64) + /* Ensure the main lcore does not enter the power-monitor state, + * so that it can be used to wake up other lcores on ARM. + * This is due to WFE instruction has no timeout wake-up mechanism, + * and if users want to exit actively, the main lcore is needed + * to send SEV instruction to wake up other lcores. + */ + unsigned int main_lcore = rte_get_main_lcore(); + if (lcore_id != main_lcore || + pmgmt_type != RTE_POWER_MGMT_TYPE_MONITOR) { + ret = rte_power_ethdev_pmgmt_queue_enable( + lcore_id, portid, queueid, + pmgmt_type); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "rte_power_ethdev_pmgmt_queue_enable: err=%d, port=%d\n", + ret, portid); + } +#else ret = rte_power_ethdev_pmgmt_queue_enable( lcore_id, portid, queueid, pmgmt_type); @@ -2892,6 +2919,7 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "rte_power_ethdev_pmgmt_queue_enable: err=%d, port=%d\n", ret, portid); +#endif } } } -- 2.25.1