Commit 46fd8c70 authored by wangfushuai's avatar wangfushuai Committed by Shuah Khan
Browse files

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: default avatarwangfushuai <wangfushuai@baidu.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 3075476a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
		}
	}
+1 −1
Original line number Diff line number Diff line
@@ -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;
}
+1 −1
Original line number Diff line number Diff line
@@ -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;
		}
	}
+2 −2
Original line number Diff line number Diff line
@@ -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;
		}
	}