Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-05-01 Thread Will Deacon
On Sat, May 02, 2020 at 12:10:50AM +0800, Leo Yan wrote: > On Fri, May 01, 2020 at 04:26:09PM +0100, Will Deacon wrote: > > [...] > > > > > > Let me try and understand your particular problem better. > > > > > > > > I think the long and short of it is that userspace needs a way to > > > > conve

Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-05-01 Thread Leo Yan
On Fri, May 01, 2020 at 04:26:09PM +0100, Will Deacon wrote: [...] > > > > Let me try and understand your particular problem better. > > > > > > I think the long and short of it is that userspace needs a way to convert > > > the raw counter cycles into a ns value that can be compared against val

Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-05-01 Thread Marc Zyngier
On 2020-05-01 16:14, Leo Yan wrote: Hi all, On Thu, Apr 30, 2020 at 05:18:15PM +0100, Will Deacon wrote: On Thu, Apr 30, 2020 at 06:04:36PM +0200, Peter Zijlstra wrote: > On Thu, Apr 30, 2020 at 04:29:23PM +0100, Marc Zyngier wrote: > > > I wonder if we could/should make __sched_clock_offset av

Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-05-01 Thread Will Deacon
On Fri, May 01, 2020 at 11:14:48PM +0800, Leo Yan wrote: > On Thu, Apr 30, 2020 at 05:18:15PM +0100, Will Deacon wrote: > > On Thu, Apr 30, 2020 at 06:04:36PM +0200, Peter Zijlstra wrote: > > > On Thu, Apr 30, 2020 at 04:29:23PM +0100, Marc Zyngier wrote: > > > > > > > I wonder if we could/should

Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-05-01 Thread Leo Yan
Hi all, On Thu, Apr 30, 2020 at 05:18:15PM +0100, Will Deacon wrote: > On Thu, Apr 30, 2020 at 06:04:36PM +0200, Peter Zijlstra wrote: > > On Thu, Apr 30, 2020 at 04:29:23PM +0100, Marc Zyngier wrote: > > > > > I wonder if we could/should make __sched_clock_offset available even when > > > CONFIG

Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-04-30 Thread Marc Zyngier
On 2020-04-30 17:18, Will Deacon wrote: On Thu, Apr 30, 2020 at 06:04:36PM +0200, Peter Zijlstra wrote: On Thu, Apr 30, 2020 at 04:29:23PM +0100, Marc Zyngier wrote: > I wonder if we could/should make __sched_clock_offset available even when > CONFIG_HAVE_UNSTABLE_SCHED_CLOCK isn't defined. It

Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-04-30 Thread Will Deacon
On Thu, Apr 30, 2020 at 06:27:50PM +0200, Peter Zijlstra wrote: > On Thu, Apr 30, 2020 at 03:58:24PM +0100, Will Deacon wrote: > > On Fri, Mar 20, 2020 at 05:35:45PM +0800, Leo Yan wrote: > > > + /* > > > + * Since arch timer is enabled ealier than sched clock registration, > > > + * compuate the

Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-04-30 Thread Peter Zijlstra
On Thu, Apr 30, 2020 at 03:58:24PM +0100, Will Deacon wrote: > On Fri, Mar 20, 2020 at 05:35:45PM +0800, Leo Yan wrote: > > @@ -1164,5 +1165,21 @@ void arch_perf_update_userpage(struct perf_event > > *event, > > userpg->time_mult >>= 1; > > } > > userpg->time_shift = (u16)shif

Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-04-30 Thread Will Deacon
On Thu, Apr 30, 2020 at 06:04:36PM +0200, Peter Zijlstra wrote: > On Thu, Apr 30, 2020 at 04:29:23PM +0100, Marc Zyngier wrote: > > > I wonder if we could/should make __sched_clock_offset available even when > > CONFIG_HAVE_UNSTABLE_SCHED_CLOCK isn't defined. It feels like it would > > help with t

Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-04-30 Thread Peter Zijlstra
On Thu, Apr 30, 2020 at 04:29:23PM +0100, Marc Zyngier wrote: > I wonder if we could/should make __sched_clock_offset available even when > CONFIG_HAVE_UNSTABLE_SCHED_CLOCK isn't defined. It feels like it would > help with this particular can or worm... Errrgh. __sched_clock_offset is only needed

Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-04-30 Thread Marc Zyngier
On 2020-04-30 15:58, Will Deacon wrote: Hi Leo, [+Maz and tglx in case I'm barking up the wrong tree] On Fri, Mar 20, 2020 at 05:35:45PM +0800, Leo Yan wrote: Between the system powering on and kernel's sched clock registration, the arch timer usually has been enabled at the early time and its

Re: [PATCH] arm64: perf_event: Fix time_offset for arch timer

2020-04-30 Thread Will Deacon
Hi Leo, [+Maz and tglx in case I'm barking up the wrong tree] On Fri, Mar 20, 2020 at 05:35:45PM +0800, Leo Yan wrote: > Between the system powering on and kernel's sched clock registration, > the arch timer usually has been enabled at the early time and its > counter is incremented during the pe