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 07B74A0542; Fri, 11 Nov 2022 11:21:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4B08942D1E; Fri, 11 Nov 2022 11:20:58 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 176FD42D1E for ; Fri, 11 Nov 2022 11:20:57 +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 CA8C61FB; Fri, 11 Nov 2022 02:21:02 -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 0A77F3F73D; Fri, 11 Nov 2022 02:20:53 -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 3/4] power: add power monitor support check Date: Fri, 11 Nov 2022 18:20:38 +0800 Message-Id: <20221111102039.3567666-4-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 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 On ARM, WFE instruction, which is used to power monitor, has no timeout wake-up mechanism, and if users want to exit power monitor actively, the main lcore is needed to send SEV instruction to wake up other lcores. So it is necessary to ensure the main lcore does not enter the power-monitor state. To solve this, main core support check on ARM is added. Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang --- lib/power/rte_power_pmd_mgmt.c | 12 ++++++++++++ lib/power/rte_power_pmd_mgmt.h | 1 + 2 files changed, 13 insertions(+) diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c index ca1840387c..3f3478b2c1 100644 --- a/lib/power/rte_power_pmd_mgmt.c +++ b/lib/power/rte_power_pmd_mgmt.c @@ -490,6 +490,18 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id, rte_rx_callback_fn clb; int ret; +#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. + */ + if (lcore_id == rte_get_main_lcore() && + mode == RTE_POWER_MGMT_TYPE_MONITOR) + return EPERM; +#endif + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); if (queue_id >= RTE_MAX_QUEUES_PER_PORT || lcore_id >= RTE_MAX_LCORE) { diff --git a/lib/power/rte_power_pmd_mgmt.h b/lib/power/rte_power_pmd_mgmt.h index 7ae6ef2d32..b1a0989b88 100644 --- a/lib/power/rte_power_pmd_mgmt.h +++ b/lib/power/rte_power_pmd_mgmt.h @@ -52,6 +52,7 @@ enum rte_power_pmd_mgmt_type { * The power management scheme to use for specified Rx queue. * @return * 0 on success + * EPERM main core cannot be supported on ARM * <0 on error */ __rte_experimental -- 2.25.1