Commit 279a811e authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Will Deacon
Browse files

arm64: perf: Only advertise cap_user_time for arch_timer



When sched_clock is running on anything other than arch_timer, don't
advertise cap_user_time*.

Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
Link: https://lore.kernel.org/r/20200716051130.4359-5-leo.yan@linaro.org


Requested-by: default avatarWill Deacon <will@kernel.org>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 950b74dd
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@
#include <asm/sysreg.h>
#include <asm/virt.h>

#include <clocksource/arm_arch_timer.h>

#include <linux/acpi.h>
#include <linux/clocksource.h>
#include <linux/kvm_host.h>
@@ -1173,16 +1175,15 @@ void arch_perf_update_userpage(struct perf_event *event,
	unsigned int seq;
	u64 ns;

	/*
	 * Internal timekeeping for enabled/running/stopped times
	 * is always computed with the sched_clock.
	 */
	userpg->cap_user_time = 1;
	userpg->cap_user_time_zero = 1;
	userpg->cap_user_time = 0;
	userpg->cap_user_time_zero = 0;

	do {
		rd = sched_clock_read_begin(&seq);

		if (rd->read_sched_clock != arch_timer_read_counter)
			return;

		userpg->time_mult = rd->mult;
		userpg->time_shift = rd->shift;
		userpg->time_zero = rd->epoch_ns;
@@ -1212,4 +1213,10 @@ void arch_perf_update_userpage(struct perf_event *event,
		userpg->time_mult >>= 1;
	}

	/*
	 * Internal timekeeping for enabled/running/stopped times
	 * is always computed with the sched_clock.
	 */
	userpg->cap_user_time = 1;
	userpg->cap_user_time_zero = 1;
}