From: Will Deacon <will@kernel.org>
To: Peter Collingbourne <pcc@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Marc Zyngier <maz@kernel.org>,
linux-arm-kernel@lists.infradead.org,
Yichao Yu <yyc1992@gmail.com>,
Robert O'Callahan <robert@ocallahan.org>,
Keno Fischer <keno@juliacomputing.com>
Subject: Re: [PATCH v2] arm64: Implement prctl(PR_{G,S}ET_TSC)
Date: Fri, 23 Aug 2024 13:02:51 +0100 [thread overview]
Message-ID: <20240823120247.GC32020@willie-the-truck> (raw)
In-Reply-To: <CAMn1gO5g6OSnOtba57hFoWb+KuQWm7dEoyGizGH_ZmQUmQhSxw@mail.gmail.com>
On Fri, Aug 16, 2024 at 12:04:14PM -0700, Peter Collingbourne wrote:
> On Fri, Aug 16, 2024 at 3:20 AM Will Deacon <will@kernel.org> wrote:
> >
> > Hi Peter,
> >
> > On Mon, Jun 10, 2024 at 01:24:51PM -0700, Peter Collingbourne wrote:
> > > On Fri, May 17, 2024 at 2:25 PM Peter Collingbourne <pcc@google.com> wrote:
> > > >
> > > > On arm64, this prctl controls access to CNTVCT_EL0, CNTVCTSS_EL0 and
> > > > CNTFRQ_EL0 via CNTKCTL_EL1.EL0VCTEN. Since this bit is also used to
> > > > implement various erratum workarounds, check whether the CPU needs
> > > > a workaround whenever we potentially need to change it.
> > >
> > > Ping.
> >
> > Chatting with Marc and Catalin about this, we're a little uneasy about
> > exposing a prctl() for this. Ptrace does seem like a much better fit.
>
> I still disagree for the consistency and ease of use reasons
> previously mentioned. But I suppose that a ptrace() API would be
> better than nothing.
>
> > Can you add a new regset for the counter instead?
>
> Is your idea that setting the regset to a specific CNTVCT_EL0 value
> will cause the kernel to trap and automatically return the previously
> set CNTVCT_EL0 without notifying the tracer? I don't think it is
> suitable for rr. This would force rr to set CNTVCT_EL0 to a specific
> value and keep it constant (or at least it can change it when the
> process is stopped for some other reason), whereas what rr wants to do
> is handle a CNTVCT_EL0 read at record time by reading CNTVCT_EL0 and
> recording the value that was read, and replaying those values at
> replay time. To give one example of where a constant CNTVCT_EL0 can
> cause problems, imagine that we have a program such as a delay loop
> that reads CNTVCT_EL0 repeatedly and compares its value to a
> previously read one and only makes progress if the value changes. Such
> a program will not make progress if there is no way to make CNTVCT_EL0
> change between reads. So if it has to be a ptrace() API, then I think
> it needs to be an opt-in to putting the process into a stopped state
> upon reading CNTVCT_EL0.
Thanks, makes sense. I replied on the main patch.
Will
next prev parent reply other threads:[~2024-08-23 12:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-17 21:25 [PATCH v2] arm64: Implement prctl(PR_{G,S}ET_TSC) Peter Collingbourne
2024-06-10 20:24 ` Peter Collingbourne
2024-08-16 10:20 ` Will Deacon
2024-08-16 19:04 ` Peter Collingbourne
2024-08-16 22:07 ` Robert O'Callahan
2024-08-23 12:02 ` Will Deacon [this message]
2024-08-23 12:01 ` Will Deacon
2024-08-24 1:54 ` Peter Collingbourne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240823120247.GC32020@willie-the-truck \
--to=will@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=keno@juliacomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=pcc@google.com \
--cc=robert@ocallahan.org \
--cc=yyc1992@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).