perf: Add perf_event_mmap_page::cap_user_time_short ABI
authorPeter Zijlstra <peterz@infradead.org>
Thu, 16 Jul 2020 05:11:28 +0000 (13:11 +0800)
committerWill Deacon <will@kernel.org>
Mon, 20 Jul 2020 10:50:47 +0000 (11:50 +0100)
commit6c0246a4588d418f72acd40a7b7601be403d80a9
tree31fa7d85271948a94ca2b845485dc5371797bebc
parent279a811eb520594fac3cd3a541e6c7ea50072ac9
perf: Add perf_event_mmap_page::cap_user_time_short ABI

In order to support short clock counters, provide an ABI extension.

As a whole:

    u64 time, delta, cyc = read_cycle_counter();

+   if (cap_user_time_short)
+ cyc = time_cycle + ((cyc - time_cycle) & time_mask);

    delta = mul_u64_u32_shr(cyc, time_mult, time_shift);

    if (cap_user_time_zero)
time = time_zero + delta;

    delta += time_offset;

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Link: https://lore.kernel.org/r/20200716051130.4359-6-leo.yan@linaro.org
Signed-off-by: Will Deacon <will@kernel.org>
include/uapi/linux/perf_event.h