Skip to content

Commit 46fd8c7

Browse files
wangfushuaishuahkh
authored andcommitted
cpupower: revise is_valid flag handling for idle_monitor
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>
1 parent 3075476 commit 46fd8c7

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static int hsw_ext_start(void)
117117

118118
for (num = 0; num < HSW_EXT_CSTATE_COUNT; num++) {
119119
for (cpu = 0; cpu < cpu_count; cpu++) {
120-
hsw_ext_get_count(num, &val, cpu);
120+
is_valid[cpu] = !hsw_ext_get_count(num, &val, cpu);
121121
previous_count[num][cpu] = val;
122122
}
123123
}
@@ -134,7 +134,7 @@ static int hsw_ext_stop(void)
134134

135135
for (num = 0; num < HSW_EXT_CSTATE_COUNT; num++) {
136136
for (cpu = 0; cpu < cpu_count; cpu++) {
137-
is_valid[cpu] = !hsw_ext_get_count(num, &val, cpu);
137+
is_valid[cpu] |= !hsw_ext_get_count(num, &val, cpu);
138138
current_count[num][cpu] = val;
139139
}
140140
}

tools/power/cpupower/utils/idle_monitor/mperf_monitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static int mperf_measure_stats(unsigned int cpu)
148148
ret = get_aperf_mperf(cpu, &aval, &mval);
149149
aperf_current_count[cpu] = aval;
150150
mperf_current_count[cpu] = mval;
151-
is_valid[cpu] = !ret;
151+
is_valid[cpu] |= !ret;
152152

153153
return 0;
154154
}

tools/power/cpupower/utils/idle_monitor/nhm_idle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static int nhm_stop(void)
151151

152152
for (num = 0; num < NHM_CSTATE_COUNT; num++) {
153153
for (cpu = 0; cpu < cpu_count; cpu++) {
154-
is_valid[cpu] = !nhm_get_count(num, &val, cpu);
154+
is_valid[cpu] |= !nhm_get_count(num, &val, cpu);
155155
current_count[num][cpu] = val;
156156
}
157157
}

tools/power/cpupower/utils/idle_monitor/snb_idle.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static int snb_start(void)
115115

116116
for (num = 0; num < SNB_CSTATE_COUNT; num++) {
117117
for (cpu = 0; cpu < cpu_count; cpu++) {
118-
snb_get_count(num, &val, cpu);
118+
is_valid[cpu] = !snb_get_count(num, &val, cpu);
119119
previous_count[num][cpu] = val;
120120
}
121121
}
@@ -132,7 +132,7 @@ static int snb_stop(void)
132132

133133
for (num = 0; num < SNB_CSTATE_COUNT; num++) {
134134
for (cpu = 0; cpu < cpu_count; cpu++) {
135-
is_valid[cpu] = !snb_get_count(num, &val, cpu);
135+
is_valid[cpu] |= !snb_get_count(num, &val, cpu);
136136
current_count[num][cpu] = val;
137137
}
138138
}

0 commit comments

Comments
 (0)