DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Hunt <david.hunt@intel.com>
To: dev@dpdk.org
Cc: david.hunt@intel.com, bruce.richardson@intel.com
Subject: [dpdk-dev] [PATCH v1] power: vm power manager should respect core mask
Date: Fri, 15 Jan 2021 12:52:50 +0000
Message-ID: <20210115125250.22416-1-david.hunt@intel.com> (raw)

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 <david.hunt@intel.com>
---
 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 "
-- 
2.17.1


             reply	other threads:[~2021-01-15 12:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 12:52 David Hunt [this message]
2021-01-28 22:19 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210115125250.22416-1-david.hunt@intel.com \
    --to=david.hunt@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git