[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 5 May 2020 21:55:44 +0800
From: Leo Yan <leo.yan@...aro.org>
To: Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will@...nel.org>, Marc Zyngier <maz@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Allison Randal <allison@...utok.net>,
Alexios Zavras <alexios.zavras@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kate Stewart <kstewart@...uxfoundation.org>,
Enrico Weigelt <info@...ux.net>,
"Ahmed S. Darwish" <a.darwish@...utronix.de>,
Paul Cercueil <paul@...pouillou.net>,
"Ben Dooks (Codethink)" <ben.dooks@...ethink.co.uk>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Cc: Leo Yan <leo.yan@...aro.org>
Subject: [PATCH v2 3/3] arm64: perf_event: Fix time_offset for arch timer
'userpg->time_offset' is assigned to the negative 'now', 'now' if the
value of sched clock and this value cannot reflect the time offset for
arch timer's raw counter prior to sched clock's registration.
To fix this issue, this patch invokes arch_timer_get_epoch_offset() to
read time offset prior to sched clock's registration, and assign its
negative value to 'userpg->time_offset'.
Signed-off-by: Leo Yan <leo.yan@...aro.org>
---
arch/arm64/kernel/perf_event.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index 4d7879484cec..cbad7bd770fb 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -1163,10 +1163,12 @@ static int __init armv8_pmu_driver_init(void)
device_initcall(armv8_pmu_driver_init)
void arch_perf_update_userpage(struct perf_event *event,
- struct perf_event_mmap_page *userpg, u64 now)
+ struct perf_event_mmap_page *userpg,
+ u64 __maybe_unused now)
{
u32 freq;
u32 shift;
+ u64 offset;
/*
* Internal timekeeping for enabled/running/stopped times
@@ -1188,5 +1190,7 @@ void arch_perf_update_userpage(struct perf_event *event,
userpg->time_mult >>= 1;
}
userpg->time_shift = (u16)shift;
- userpg->time_offset = -now;
+
+ offset = arch_timer_get_epoch_offset();
+ userpg->time_offset = -offset;
}
--
2.17.1
Powered by blists - more mailing lists