All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
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>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	kernel@collabora.com, Jonathan Corbet <corbet@lwn.net>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf/headers: Document PERF_PMU_CAP capability flags
Date: Fri, 20 Jun 2025 10:04:26 +0200	[thread overview]
Message-ID: <20250620080426.GO1613376@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <2518748.tdWV9SEqCh@workhorse>

On Thu, Jun 19, 2025 at 06:06:50PM +0200, Nicolas Frattaroli wrote:

> > >  #define PERF_PMU_CAP_NO_INTERRUPT	0x0001
> > 
> > This is not quite right; CAP_NO_INTERRUPT means it is not able to
> > generate samples.
> > 
> > While not being able to generate interrupts and not being able to
> > generate sample is more or less the same for CPU PMU drivers, this is
> > not true for uncore drivers. Even if an uncore driver has interrupt
> > capacility to help with counter overflow, it cannot generate samples.
> 
> I'll send a follow-up v2 to fix this, though just to make sure I
> understand this right, I have some questions for clarification.
> 
> Does "uncore" in this context mean PMU drivers for counters that are not
> tied to the CPU instruction flow, but are counting other things like
> interconnect statistics?

Correct.

> Also, am I correct in assuming "sample" in this context means the
> concept represented by struct perf_sample_data, i.e. what appears to be
> a snapshot of current process context, including registers and stack
> information? 

Right; perf_event_attr::sample_type, filled out with bits from
perf_event_sample_format.

> Which would then mean going by my understanding of uncore
> that basically every uncore driver should set this capability flag, as
> they're not performance counter registers on a CPU that are intimately
> tied to the ISAs execution state.

Correct again. There is interconnect, memory and even GPU drivers out
there these days.

> To further my understanding: does this mean that
> drivers/devfreq/event/rockchip-dfi.c (used for measuring memory
> bandwidth) should set PERF_PMU_CAP_NO_INTERRUPT, since it's not a CPU
> but a memory controller monitor?

Yup, that would indeed seem to be so.

> In a more general sense, if anyone has any written resources on writing
> PMU drivers, rather than perf from a userspace perspective, I'd be very
> happy to get some pointers in their direction.

I'm afraid not :/ The best we have is the comments in struct pmu.


  reply	other threads:[~2025-06-20  8:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18 19:08 [PATCH] perf/headers: Document PERF_PMU_CAP capability flags Nicolas Frattaroli
2025-06-18 20:14 ` Ian Rogers
2025-06-19 14:50 ` Peter Zijlstra
2025-06-19 16:06   ` Nicolas Frattaroli
2025-06-20  8:04     ` Peter Zijlstra [this message]
2025-06-20  9:14 ` James Clark

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=20250620080426.GO1613376@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=nicolas.frattaroli@collabora.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 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.