[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200716051130.4359-5-leo.yan@linaro.org>
Date: Thu, 16 Jul 2020 13:11:27 +0800
From: Leo Yan <leo.yan@...aro.org>
To: Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Thomas Gleixner <tglx@...utronix.de>,
"Ahmed S. Darwish" <a.darwish@...utronix.de>,
"Ben Dooks (Codethink)" <ben.dooks@...ethink.co.uk>,
Paul Cercueil <paul@...pouillou.net>,
Adrian Hunter <adrian.hunter@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Cc: Leo Yan <leo.yan@...aro.org>
Subject: [PATCH v3 4/7] arm64: perf: Only advertise cap_user_time for arch_timer
From: Peter Zijlstra <peterz@...radead.org>
When sched_clock is running on anything other than arch_timer, don't
advertise cap_user_time*.
Requested-by: Will Deacon <will@...nel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Signed-off-by: Leo Yan <leo.yan@...aro.org>
---
arch/arm64/kernel/perf_event.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index 47db6c7cae6a..c016b116ae33 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -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>
@@ -1170,16 +1172,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;
@@ -1209,4 +1210,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;
}
--
2.17.1
Powered by blists - more mailing lists