From: Rory Sexton Date: Tue, 14 Jul 2020 16:01:59 +0000 (+0100) Subject: examples/vm_power: allow managing idle cores X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3cb46d40d35960ca0478704d1e84e8d96b5676cd;p=dpdk.git examples/vm_power: allow managing idle cores This change is required to allow the branch ratio algorithm to power manage cores with no workload running on them. This is useful both when idle cores don't use C-states and for a number of hyperthreading scenarios. Signed-off-by: Rory Sexton Reviewed-by: David Hunt Acked-by: Reshma Pattan --- diff --git a/doc/guides/sample_app_ug/vm_power_management.rst b/doc/guides/sample_app_ug/vm_power_management.rst index 24eb5675e8..1b6de8e936 100644 --- a/doc/guides/sample_app_ug/vm_power_management.rst +++ b/doc/guides/sample_app_ug/vm_power_management.rst @@ -423,6 +423,8 @@ described below: 0.01 but will need adjustment for different workloads This parameter can be used multiple times for different sets of cores. + The branch ratio mechanism can also be useful for non-PMD cores and + hyper-threaded environments where C-States are disabled. Compiling and Running the Guest Applications diff --git a/examples/vm_power_manager/oob_monitor_x86.c b/examples/vm_power_manager/oob_monitor_x86.c index 3c514475f1..a5b1c168c3 100644 --- a/examples/vm_power_manager/oob_monitor_x86.c +++ b/examples/vm_power_manager/oob_monitor_x86.c @@ -96,12 +96,12 @@ apply_policy(int core) g_branch_misses = miss_diff; if (hits_diff < (INTERVAL*100)) { - /* Likely no workload running on this core. Skip. */ - return -1.0; + /* Likely no workload running on this core. */ + ratio = 0.0; + } else { + ratio = (float)miss_diff * (float)100 / (float)hits_diff; } - ratio = (float)miss_diff * (float)100 / (float)hits_diff; - /* * Store the last few directions that the ratio indicates * we should take. If there's on 'up', then we scale up