From patchwork Fri Nov 11 10:20:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feifei Wang X-Patchwork-Id: 119803 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6719A0542; Fri, 11 Nov 2022 11:21:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E7CC42D25; Fri, 11 Nov 2022 11:21:01 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 42F5642D28 for ; Fri, 11 Nov 2022 11:21:00 +0100 (CET) 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 F39451FB; Fri, 11 Nov 2022 02:21:05 -0800 (PST) Received: from net-x86-dell-8268.shanghai.arm.com (net-x86-dell-8268.shanghai.arm.com [10.169.210.116]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 344E23F73D; Fri, 11 Nov 2022 02:20:56 -0800 (PST) From: Feifei Wang To: David Hunt Cc: dev@dpdk.org, david.marchand@redhat.com, thomas@monjalon.net, stephen@networkplumber.org, nd@arm.com, Feifei Wang , Ruifeng Wang Subject: [PATCH v4 4/4] examples/l3fwd-power: add power monitor wake up API Date: Fri, 11 Nov 2022 18:20:39 +0800 Message-Id: <20221111102039.3567666-5-feifei.wang2@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111102039.3567666-1-feifei.wang2@arm.com> References: <20220825064251.2637274-1-feifei.wang2@arm.com> <20221111102039.3567666-1-feifei.wang2@arm.com> MIME-Version: 1.0 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. For other aarch, 'rte_power_monitor_wakeup' API can also make sure all lcores wake up from sleeping state. Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang Acked-by: David Hunt --- examples/l3fwd-power/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index fd3ade330f..a47a91ce6f 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -3113,6 +3113,19 @@ main(int argc, char **argv) if (app_mode == APP_MODE_EMPTY_POLL || app_mode == APP_MODE_TELEMETRY) launch_timer(rte_lcore_id()); + /* wake up all worker cores from sleeping state */ + if (pmgmt_type == RTE_POWER_MGMT_TYPE_MONITOR) { + for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { + if (rte_lcore_is_enabled(lcore_id) == 0) + continue; + + if (lcore_id == rte_get_main_lcore()) + continue; + + rte_power_monitor_wakeup(lcore_id); + } + } + RTE_LCORE_FOREACH_WORKER(lcore_id) { if (rte_eal_wait_lcore(lcore_id) < 0) return -1;