From patchwork Fri Jan 15 12:52:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hunt, David" X-Patchwork-Id: 86687 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 CE936A0A02; Fri, 15 Jan 2021 13:53:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4FB00141048; Fri, 15 Jan 2021 13:53:40 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id DAE3A141047 for ; Fri, 15 Jan 2021 13:53:38 +0100 (CET) IronPort-SDR: 3U3LPML2Y3XIyKZrS6ZnZK8/ce7hBFkG8oJ/2f8FsK2q80Z2qFX6YvTOvPJpWGZ2eWlBhFDk/Y 6kXH+S+ivkQQ== X-IronPort-AV: E=McAfee;i="6000,8403,9864"; a="175962940" X-IronPort-AV: E=Sophos;i="5.79,349,1602572400"; d="scan'208";a="175962940" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2021 04:53:37 -0800 IronPort-SDR: gNoDp4bulwzUC+r/ibS6ypwlbY2/UhTglShiIzCGO5IMXTEyH7DD/uDHdO1Ey7B04yzD5S+qXB zfvH5NqyWmNw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,349,1602572400"; d="scan'208";a="364573147" Received: from silpixa00399952.ir.intel.com (HELO silpixa00399952.ger.corp.intel.com) ([10.237.222.38]) by orsmga002.jf.intel.com with ESMTP; 15 Jan 2021 04:53:36 -0800 From: David Hunt To: dev@dpdk.org Cc: david.hunt@intel.com, bruce.richardson@intel.com Date: Fri, 15 Jan 2021 12:52:50 +0000 Message-Id: <20210115125250.22416-1-david.hunt@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH v1] power: vm power manager should respect core mask 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" when vm_power_manager is started, it takes over power management on all cores. This should be limited to cores defined in the core mask. When initialising, if a core is not on the coremask, skip it. Applies to both initialisation and exit. Signed-off-by: David Hunt --- examples/vm_power_manager/channel_manager.c | 8 ++++++++ examples/vm_power_manager/power_manager.c | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c index a26315051..9dca6f686 100644 --- a/examples/vm_power_manager/channel_manager.c +++ b/examples/vm_power_manager/channel_manager.c @@ -455,6 +455,9 @@ add_all_channels(const char *vm_name) CHANNEL_MGR_SOCKET_PATH, dir->d_name); continue; } + if (rte_lcore_index(channel_num) == -1) + continue; + /* if channel has not been added previously */ if (channel_exists(vm_info, channel_num)) continue; @@ -512,6 +515,8 @@ add_channels(const char *vm_name, unsigned *channel_list, } for (i = 0; i < len_channel_list; i++) { + if (rte_lcore_index(i) == -1) + continue; if (channel_list[i] >= RTE_MAX_LCORE) { RTE_LOG(INFO, CHANNEL_MANAGER, "Channel(%u) is out of range " @@ -574,6 +579,9 @@ add_host_channels(void) } for (i = 0; i < ci->core_count; i++) { + if (rte_lcore_index(i) == -1) + continue; + if (ci->cd[i].global_enabled_cpus == 0) continue; diff --git a/examples/vm_power_manager/power_manager.c b/examples/vm_power_manager/power_manager.c index c5cf6bffa..739372d9b 100644 --- a/examples/vm_power_manager/power_manager.c +++ b/examples/vm_power_manager/power_manager.c @@ -96,6 +96,9 @@ power_manager_init(void) max_core_num = ci->core_count; for (i = 0; i < max_core_num; i++) { + if (rte_lcore_index(i) == -1) + continue; + if (ci->cd[i].global_enabled_cpus) { if (rte_power_init(i) < 0) RTE_LOG(ERR, POWER_MANAGER, @@ -170,6 +173,9 @@ power_manager_exit(void) max_core_num = ci->core_count; for (i = 0; i < max_core_num; i++) { + if (rte_lcore_index(i) == -1) + continue; + if (ci->cd[i].global_enabled_cpus) { if (rte_power_exit(i) < 0) { RTE_LOG(ERR, POWER_MANAGER, "Unable to shutdown power manager "