All of lore.kernel.org
 help / color / mirror / Atom feed
* Prevent Kernel from resetting cycle counter
@ 2017-09-07  0:36 Jason Teplitz
  2017-09-09  0:07   ` Kim Phillips
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Teplitz @ 2017-09-07  0:36 UTC (permalink / raw)
  To: linux-perf-users

I'm reading the armv8 PMU cycle counter from userspace and noticing
that it gets periodically reset by something. Does anything inside the
kernel reset these counters? I am not using perf, so I'm not sure why
anything else would be touching them.

-Jason

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Prevent Kernel from resetting cycle counter
  2017-09-07  0:36 Prevent Kernel from resetting cycle counter Jason Teplitz
@ 2017-09-09  0:07   ` Kim Phillips
  0 siblings, 0 replies; 5+ messages in thread
From: Kim Phillips @ 2017-09-09  0:07 UTC (permalink / raw)
  To: Jason Teplitz; +Cc: linux-perf-users, linux-arm-kernel

On Wed, 6 Sep 2017 17:36:36 -0700
Jason Teplitz <jason@tensyr.com> wrote:

[adding linux-arm-kernel]

> I'm reading the armv8 PMU cycle counter from userspace and noticing
> that it gets periodically reset by something. Does anything inside the
> kernel reset these counters? I am not using perf, so I'm not sure why
> anything else would be touching them.

PMCCNTR only shows up in kernel perf/PMU and KVM code, so yes, no
reason for it to be reset, esp. if no arm-pmu interrupts are triggered.

Is the period constant, as if to suggest a wraparound?  Can you use
CNTVCT instead?

Thanks,

Kim

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Prevent Kernel from resetting cycle counter
@ 2017-09-09  0:07   ` Kim Phillips
  0 siblings, 0 replies; 5+ messages in thread
From: Kim Phillips @ 2017-09-09  0:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 6 Sep 2017 17:36:36 -0700
Jason Teplitz <jason@tensyr.com> wrote:

[adding linux-arm-kernel]

> I'm reading the armv8 PMU cycle counter from userspace and noticing
> that it gets periodically reset by something. Does anything inside the
> kernel reset these counters? I am not using perf, so I'm not sure why
> anything else would be touching them.

PMCCNTR only shows up in kernel perf/PMU and KVM code, so yes, no
reason for it to be reset, esp. if no arm-pmu interrupts are triggered.

Is the period constant, as if to suggest a wraparound?  Can you use
CNTVCT instead?

Thanks,

Kim

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Prevent Kernel from resetting cycle counter
  2017-09-09  0:07   ` Kim Phillips
@ 2017-09-12 18:57     ` Jason Teplitz
  -1 siblings, 0 replies; 5+ messages in thread
From: Jason Teplitz @ 2017-09-12 18:57 UTC (permalink / raw)
  To: Kim Phillips; +Cc: linux-perf-users, linux-arm-kernel

Hi Kim,

Thanks for your response.
I talked a bit with Mark Rutland from Arm about this. He told me that
perf can reset or modify the cycle counter from kernelspace as it
pleases even if the user is not using perf. Reading the cycle counter
directly from userspace is not supported. The only supported way to
read the cycle counter is to go through the VDSO.

On Fri, Sep 8, 2017 at 5:07 PM, Kim Phillips <kim.phillips@arm.com> wrote:
> On Wed, 6 Sep 2017 17:36:36 -0700
> Jason Teplitz <jason@tensyr.com> wrote:
>
> [adding linux-arm-kernel]
>
>> I'm reading the armv8 PMU cycle counter from userspace and noticing
>> that it gets periodically reset by something. Does anything inside the
>> kernel reset these counters? I am not using perf, so I'm not sure why
>> anything else would be touching them.
>
> PMCCNTR only shows up in kernel perf/PMU and KVM code, so yes, no
> reason for it to be reset, esp. if no arm-pmu interrupts are triggered.
>
> Is the period constant, as if to suggest a wraparound?  Can you use
> CNTVCT instead?
>
> Thanks,
>
> Kim

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Prevent Kernel from resetting cycle counter
@ 2017-09-12 18:57     ` Jason Teplitz
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Teplitz @ 2017-09-12 18:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kim,

Thanks for your response.
I talked a bit with Mark Rutland from Arm about this. He told me that
perf can reset or modify the cycle counter from kernelspace as it
pleases even if the user is not using perf. Reading the cycle counter
directly from userspace is not supported. The only supported way to
read the cycle counter is to go through the VDSO.

On Fri, Sep 8, 2017 at 5:07 PM, Kim Phillips <kim.phillips@arm.com> wrote:
> On Wed, 6 Sep 2017 17:36:36 -0700
> Jason Teplitz <jason@tensyr.com> wrote:
>
> [adding linux-arm-kernel]
>
>> I'm reading the armv8 PMU cycle counter from userspace and noticing
>> that it gets periodically reset by something. Does anything inside the
>> kernel reset these counters? I am not using perf, so I'm not sure why
>> anything else would be touching them.
>
> PMCCNTR only shows up in kernel perf/PMU and KVM code, so yes, no
> reason for it to be reset, esp. if no arm-pmu interrupts are triggered.
>
> Is the period constant, as if to suggest a wraparound?  Can you use
> CNTVCT instead?
>
> Thanks,
>
> Kim

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-12 18:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-07  0:36 Prevent Kernel from resetting cycle counter Jason Teplitz
2017-09-09  0:07 ` Kim Phillips
2017-09-09  0:07   ` Kim Phillips
2017-09-12 18:57   ` Jason Teplitz
2017-09-12 18:57     ` Jason Teplitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.