Skip to contentSkip to conversation

power: vm power manager should respect core mask

PATCH In review David Hunt 2 participants 2 messages Jan 15, 2021 – Jan 28, 2021

lore
Share & tools
lore

David Hunt

author
#0 lore raw

PATCH 1/1 power: vm power manager should respect core mask

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.

---
 examples/vm_power_manager/channel_manager.c | 8 ++++++++
 examples/vm_power_manager/power_manager.c   | 6 ++++++
 2 files changed, 14 insertions(+)
examples/vm_power_manager/channel_manager.c +8 -0
index a26315051..9dca6f686 100644
@@ -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;
 
examples/vm_power_manager/power_manager.c +6 -0
index c5cf6bffa..739372d9b 100644
@@ -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 "
Signature · 1 line
2.17.1
#1 lore raw

15/01/2021 13:52, David Hunt:

Quoted 7 lines

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.

Applied with title "examples/vm_power: respect core mask", thanks