[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f83be3c5b582d1d25a4d3337e1d2971b48e9a83d.camel@redhat.com>
Date: Fri, 19 Nov 2021 14:26:03 +0100
From: Nicolas Saenz Julienne <nsaenzju@...hat.com>
To: Marc Zyngier <maz@...nel.org>,
Marcelo Tosatti <mtosatti@...hat.com>
Cc: linux-arm-kernel@...ts.infradead.org, rostedt@...dmis.org,
james.morse@....com, alexandru.elisei@....com,
suzuki.poulose@....com, catalin.marinas@....com, will@...nel.org,
linux-kernel@...r.kernel.org, kvmarm@...ts.cs.columbia.edu,
mingo@...hat.com, nilal@...hat.com
Subject: Re: [RFC PATCH 1/2] arm64/tracing: add cntvct based trace clock
On Fri, 2021-11-19 at 12:00 +0000, Marc Zyngier wrote:
> On Fri, 19 Nov 2021 11:26:24 +0000,
> Marcelo Tosatti <mtosatti@...hat.com> wrote:
> >
> > On Fri, Nov 19, 2021 at 11:21:17AM +0100, Nicolas Saenz Julienne wrote:
> > > Add a new arm64-specific trace clock using the cntvct register, similar
> > > to x64-tsc. This gives us:
> > > - A clock that is relatively fast (1GHz on armv8.6, 1-50MHz otherwise),
> > > monotonic, and resilient to low power modes.
> > > - It can be used to correlate events across cpus as well as across
> > > hypervisor and guests.
> > >
> > > By using arch_timer_read_counter() we make sure that armv8.6 cpus use
> > > the less expensive CNTVCTSS_EL0, which cannot be accessed speculatively.
> >
> > Can this register be read by userspace ? (otherwise it won't be possible
> > to correlate userspace events).
>
> Yes. That's part of the userspace ABI. Although this particular
> accessor is only available from ARMv8.6 and is advertised via a hwcap
> to userspace.
>
> For currently existing implementations, userspace will use the
> CNTVCT_EL0 accessor, which requires extra synchronisation as it can be
> speculated.
To complete Marc's reply, here's an example of how CNTVCT_EL0 is being used in
rt-tests' oslat:
https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/tree/src/oslat/oslat.c#n87
--
Nicolás Sáenz
Powered by blists - more mailing lists