All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Ian Rogers <irogers@google.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>,
	"Liang, Kan" <kan.liang@linux.intel.com>,
	linux-perf-users@vger.kernel.org
Subject: Re: perf_event: avoiding gpf on rdpmc for top-down-events on hybrid
Date: Tue, 17 Jun 2025 20:17:38 +0200	[thread overview]
Message-ID: <20250617181738.GD1613376@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <CAP-5=fWYfMe8y-xcZkkEnppA11+H0r33Xnn0Mn2d4_y3dortmQ@mail.gmail.com>

On Tue, Jun 17, 2025 at 09:37:39AM -0700, Ian Rogers wrote:

> To answer my own question, the sequence number will vary after the
> counter is read and so the read loop will be retried with a different
> index value loaded on the next loop. Perhaps this is the right fix for
> hybrid, if you have a hybrid system a per-thread event with
> cap_user_rdpmc and the thread is rescheduled (say p-core to e-core),
> then the sequence number needs changing in the user page mmap. This
> will trigger a second loop where when the index is loaded it will be 0
> for disabled.

It does; migrating the counter will change the sequence number. But this
is not sufficient, because meanwhile you will have executed the RDPMC --
which comes before double-checking the sequence number.

Issuing the RDPMC on a wrong index will cause fail.

RSEQ is more strict, it will abort and redirect the instruction stream
on preemption/migration and ensure the RDPMC instruction will not be
issued.

  reply	other threads:[~2025-06-17 18:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-04 21:20 perf_event: avoiding gpf on rdpmc for top-down-events on hybrid Vince Weaver
2024-12-05  0:57 ` Ian Rogers
2025-06-15 23:23   ` Ian Rogers
2025-06-16 19:34     ` Vince Weaver
2025-06-17  4:36       ` Ian Rogers
2025-06-17 16:37         ` Ian Rogers
2025-06-17 18:17           ` Peter Zijlstra [this message]
2025-06-17 20:36             ` Ian Rogers
2025-06-18  8:45               ` Peter Zijlstra
2025-06-18 11:55                 ` Peter Zijlstra
2025-06-18 13:57                 ` Vince Weaver
2026-11-05  6:17                 ` Mi, Dapeng
2026-11-30 18:39                   ` Ian Rogers
2026-12-01  5:22                     ` Mi, Dapeng
2026-12-01  6:38                       ` Ian Rogers
2026-12-01 10:19                         ` Mi, Dapeng

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=20250617181738.GD1613376@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=irogers@google.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=vincent.weaver@maine.edu \
    /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 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.