diff options
author | Luca Boccassi <luca.boccassi@gmail.com> | 2018-11-12 16:14:45 +0000 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2018-11-12 16:15:06 +0000 |
commit | 88fab00d4402af240c1b7cc2566133aece115488 (patch) | |
tree | 54525f2b8784dd20ce6886b429ef85d24df04532 /examples/vm_power_manager | |
parent | 8d01b9cd70a67cdafd5b965a70420c3bd7fb3f82 (diff) |
New upstream version 18.11-rc2upstream/18.11-rc2
Change-Id: I43ca4edd0747b2dfc38c574ebf3c0aac17d7392c
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'examples/vm_power_manager')
-rw-r--r-- | examples/vm_power_manager/power_manager.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/examples/vm_power_manager/power_manager.c b/examples/vm_power_manager/power_manager.c index b7769c3c..f9e8c0ab 100644 --- a/examples/vm_power_manager/power_manager.c +++ b/examples/vm_power_manager/power_manager.c @@ -95,6 +95,7 @@ power_manager_init(void) unsigned int i, num_cpus = 0, num_freqs = 0; int ret = 0; struct core_info *ci; + unsigned int max_core_num; rte_power_set_env(PM_ENV_ACPI_CPUFREQ); @@ -105,7 +106,12 @@ power_manager_init(void) return -1; } - for (i = 0; i < ci->core_count; i++) { + if (ci->core_count > POWER_MGR_MAX_CPUS) + max_core_num = POWER_MGR_MAX_CPUS; + else + max_core_num = ci->core_count; + + for (i = 0; i < max_core_num; i++) { if (ci->cd[i].global_enabled_cpus) { if (rte_power_init(i) < 0) RTE_LOG(ERR, POWER_MANAGER, @@ -165,6 +171,7 @@ power_manager_exit(void) unsigned int i; int ret = 0; struct core_info *ci; + unsigned int max_core_num; ci = get_core_info(); if (!ci) { @@ -173,7 +180,12 @@ power_manager_exit(void) return -1; } - for (i = 0; i < ci->core_count; i++) { + if (ci->core_count > POWER_MGR_MAX_CPUS) + max_core_num = POWER_MGR_MAX_CPUS; + else + max_core_num = ci->core_count; + + for (i = 0; i < max_core_num; i++) { if (ci->cd[i].global_enabled_cpus) { if (rte_power_exit(i) < 0) { RTE_LOG(ERR, POWER_MANAGER, "Unable to shutdown power manager " |