Skip to content

Commit 279a811

Browse files
Peter Zijlstrawilldeacon
authored andcommitted
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: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Leo Yan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Requested-by: Will Deacon <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent 950b74d commit 279a811

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

arch/arm64/kernel/perf_event.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <asm/sysreg.h>
1414
#include <asm/virt.h>
1515

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

1176-
/*
1177-
* Internal timekeeping for enabled/running/stopped times
1178-
* is always computed with the sched_clock.
1179-
*/
1180-
userpg->cap_user_time = 1;
1181-
userpg->cap_user_time_zero = 1;
1178+
userpg->cap_user_time = 0;
1179+
userpg->cap_user_time_zero = 0;
11821180

11831181
do {
11841182
rd = sched_clock_read_begin(&seq);
11851183

1184+
if (rd->read_sched_clock != arch_timer_read_counter)
1185+
return;
1186+
11861187
userpg->time_mult = rd->mult;
11871188
userpg->time_shift = rd->shift;
11881189
userpg->time_zero = rd->epoch_ns;
@@ -1212,4 +1213,10 @@ void arch_perf_update_userpage(struct perf_event *event,
12121213
userpg->time_mult >>= 1;
12131214
}
12141215

1216+
/*
1217+
* Internal timekeeping for enabled/running/stopped times
1218+
* is always computed with the sched_clock.
1219+
*/
1220+
userpg->cap_user_time = 1;
1221+
userpg->cap_user_time_zero = 1;
12151222
}

0 commit comments

Comments
 (0)