public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Vince Weaver <vincent.weaver@maine.edu>, peterz@infradead.org
Cc: Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: Re: perf: is it possible to userspace rdpmc but only on a certain core type
Date: Mon, 20 Jan 2025 11:44:37 -0500	[thread overview]
Message-ID: <31ad367a-721f-46e7-8e5f-e96b250a8a32@linux.intel.com> (raw)
In-Reply-To: <ac391d4c-af02-f52b-2ac2-be874272f773@maine.edu>



On 2025-01-17 5:04 p.m., Vince Weaver wrote:
> Hello
> 
> so we've been working on PAPI support for Intel Top-Down events, which
> let's say does "exciting" things involving the rdpmc instruction.
> 
> One issue we are having is that on a hybrid machine (Raptor Lake in this 
> case with performance/efficiency cores) there is no top-down support
> for the E-cores, and it will gpf/segfault if you try to rdpmc the top-down 
> events.
> 
> Obviously PAPI would like to avoid this, and somehow only run the rdpmc 
> from userspace if scheduled on a P-core.
> 
> Is there any way to atomically do this?  Somehow detect what core we are 
> on and atomically execute a userspace instruction before a core-reschedule 
> can happen?
> 
> Or barring that, any other way to handle this in a way that won't crash 
> without having to have the users have to bind to a core any time they want 
> to run PAPI?

Can the PAPI rely on the event_idx(), similar to what Andi's pmu-tools
do? For a stopped event, the index is always 0.
https://github.com/andikleen/pmu-tools/blob/master/jevents/rdpmc.c#L117

Thanks,
Kan



  reply	other threads:[~2025-01-20 16:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17 22:04 perf: is it possible to userspace rdpmc but only on a certain core type Vince Weaver
2025-01-20 16:44 ` Liang, Kan [this message]
2025-01-21 12:52   ` Peter Zijlstra
2025-01-21 14:30     ` Mathieu Desnoyers
2025-01-22 21:51     ` Vince Weaver
2025-01-23 18:14       ` Andi Kleen
2025-01-23 19:45         ` Vince Weaver
2025-01-24  5:18           ` Andi Kleen

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=31ad367a-721f-46e7-8e5f-e96b250a8a32@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox