]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpupower: revise is_valid flag handling for idle_monitor
authorwangfushuai <wangfushuai@baidu.com>
Wed, 4 Dec 2024 07:02:47 +0000 (15:02 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 10 Dec 2024 00:52:03 +0000 (17:52 -0700)
The is_valid flag should reflect the validity state of both
the XXX_start and XXX_stop functions. But the use of '=' in
XXX_stop overwrites the validity state set by XXX_start. This
commit changes '=' to '|=' in XXX_stop to preserve and combine
the validity state of XXX_start and XXX_stop.

Signed-off-by: wangfushuai <wangfushuai@baidu.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c
tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
tools/power/cpupower/utils/idle_monitor/nhm_idle.c
tools/power/cpupower/utils/idle_monitor/snb_idle.c

index 55e55b6b42f9edd3a16498ce9bd6afc9fba77215..f5a2a326b1b7f58d1f999fe1ffe0698fe0f9b520 100644 (file)
@@ -117,7 +117,7 @@ static int hsw_ext_start(void)
 
        for (num = 0; num < HSW_EXT_CSTATE_COUNT; num++) {
                for (cpu = 0; cpu < cpu_count; cpu++) {
-                       hsw_ext_get_count(num, &val, cpu);
+                       is_valid[cpu] = !hsw_ext_get_count(num, &val, cpu);
                        previous_count[num][cpu] = val;
                }
        }
@@ -134,7 +134,7 @@ static int hsw_ext_stop(void)
 
        for (num = 0; num < HSW_EXT_CSTATE_COUNT; num++) {
                for (cpu = 0; cpu < cpu_count; cpu++) {
-                       is_valid[cpu] = !hsw_ext_get_count(num, &val, cpu);
+                       is_valid[cpu] |= !hsw_ext_get_count(num, &val, cpu);
                        current_count[num][cpu] = val;
                }
        }
index ae6af354a81db518dc779a20094f406ef4e948db..0a03573ebcc27fd6fec11ecce1d2d3acd72e12ea 100644 (file)
@@ -148,7 +148,7 @@ static int mperf_measure_stats(unsigned int cpu)
        ret = get_aperf_mperf(cpu, &aval, &mval);
        aperf_current_count[cpu] = aval;
        mperf_current_count[cpu] = mval;
-       is_valid[cpu] = !ret;
+       is_valid[cpu] |= !ret;
 
        return 0;
 }
index 16eaf006f61f28b3dbd519ab923e5f0a059d385b..6b1733782ffa86664ea3ff9bbaa5f5fe849de741 100644 (file)
@@ -151,7 +151,7 @@ static int nhm_stop(void)
 
        for (num = 0; num < NHM_CSTATE_COUNT; num++) {
                for (cpu = 0; cpu < cpu_count; cpu++) {
-                       is_valid[cpu] = !nhm_get_count(num, &val, cpu);
+                       is_valid[cpu] |= !nhm_get_count(num, &val, cpu);
                        current_count[num][cpu] = val;
                }
        }
index 811d63ab17a769ef053cb288f8510d8ea161692d..5969b88a85b4d78cbc9156c8592cd112c4c08dbf 100644 (file)
@@ -115,7 +115,7 @@ static int snb_start(void)
 
        for (num = 0; num < SNB_CSTATE_COUNT; num++) {
                for (cpu = 0; cpu < cpu_count; cpu++) {
-                       snb_get_count(num, &val, cpu);
+                       is_valid[cpu] = !snb_get_count(num, &val, cpu);
                        previous_count[num][cpu] = val;
                }
        }
@@ -132,7 +132,7 @@ static int snb_stop(void)
 
        for (num = 0; num < SNB_CSTATE_COUNT; num++) {
                for (cpu = 0; cpu < cpu_count; cpu++) {
-                       is_valid[cpu] = !snb_get_count(num, &val, cpu);
+                       is_valid[cpu] |= !snb_get_count(num, &val, cpu);
                        current_count[num][cpu] = val;
                }
        }