lkml.org 
[lkml]   [2020]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 2/6] perf tsc: Add rdtsc() for Arm64
Hi Peter,

On Wed, Sep 02, 2020 at 03:48:05PM +0200, Peter Zijlstra wrote:
> On Wed, Sep 02, 2020 at 02:21:27PM +0100, Leo Yan wrote:
> > The system register CNTVCT_EL0 can be used to retrieve the counter from
> > user space. Add rdtsc() for Arm64.
>
> > +u64 rdtsc(void)
> > +{
> > + u64 val;
>
> Would it make sense to put a comment in that this counter is/could-be
> 'short' ? Because unlike x86-TSC, this thing isn't architecturally
> specified to be 64bits wide.

Will add below comments:

According to ARM DDI 0487F.c, from Armv8.0 to Armv8.5 inclusive, the
system counter is at least 56 bits wide; from Armv8.6, the counter must
be 64 bits wide. So the system counter could be less than 64 bits wide
and it is attributed with the flag 'cap_user_time_short' is true.

Thanks for reviewing,
Leo

>
> > + asm volatile("mrs %0, cntvct_el0" : "=r" (val));
> > +
> > + return val;
> > +}
> > --
> > 2.17.1
> >

\
 
 \ /
  Last update: 2020-09-03 04:25    [W:0.825 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site