[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250619145044.GL1613376@noisy.programming.kicks-ass.net>
Date: Thu, 19 Jun 2025 16:50:44 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Nicolas Frattaroli <nicolas.frattaroli@...labora.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>, kernel@...labora.com,
Jonathan Corbet <corbet@....net>, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf/headers: Document PERF_PMU_CAP capability flags
Mark just linked this thread from another thread:
https://lkml.kernel.org/r/20250619144254.GK1613376@noisy.programming.kicks-ass.net
On Wed, Jun 18, 2025 at 09:08:34PM +0200, Nicolas Frattaroli wrote:
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index ec9d96025683958e909bb2463439dc69634f4ceb..7d749fd5225be12543df6e475277563bf16c05b1 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -294,16 +294,90 @@ struct perf_event_pmu_context;
> /**
> * pmu::capabilities flags
> */
> +
> +/**
> + * define PERF_PMU_CAP_NO_INTERRUPT - \
> + * PMU is incapable of generating hardware interrupts
> + */
> #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.
> +/**
> + * define PERF_PMU_CAP_NO_NMI - \
> + * PMU is guaranteed to not generate non-maskable interrupts
> + */
> #define PERF_PMU_CAP_NO_NMI 0x0002
> +/**
> + * define PERF_PMU_CAP_AUX_NO_SG - \
> + * PMU does not support using scatter-gather as the output
> + *
> + * The PERF_PMU_CAP_AUX_NO_SG flag indicates that the PMU does not support
> + * scatter-gather for its output buffer, and needs a larger contiguous buffer
> + * to output to.
> + */
> #define PERF_PMU_CAP_AUX_NO_SG 0x0004
> +/**
> + * define PERF_PMU_CAP_EXTENDED_REGS - \
> + * PMU is capable of sampling extended registers
> + *
> + * Some architectures have a concept of extended registers, e.g. XMM0 on x86
> + * or VG on arm64. If the PMU is capable of sampling these registers, then the
> + * flag PERF_PMU_CAP_EXTENDED_REGS should be set.
> + */
> #define PERF_PMU_CAP_EXTENDED_REGS 0x0008
> +/**
> + * define PERF_PMU_CAP_EXCLUSIVE - \
> + * PMU can only have one scheduled event at a time
> + *
> + * Certain PMU hardware cannot track several events at the same time. Such
> + * hardware must set PERF_PMU_CAP_EXCLUSIVE in order to avoid conflicts.
> + */
> #define PERF_PMU_CAP_EXCLUSIVE 0x0010
> +/**
> + * define PERF_PMU_CAP_ITRACE - PMU traces instructions
> + *
> + * Some PMU hardware does instruction tracing, in that it traces execution of
> + * each instruction. Setting this capability flag makes the perf core generate
> + * a %PERF_RECORD_ITRACE_START event, recording the profiled task's PID and TID,
> + * to allow tools to properly decode such traces.
> + */
> #define PERF_PMU_CAP_ITRACE 0x0020
> +/**
> + * define PERF_PMU_CAP_NO_EXCLUDE - \
> + * PMU is incapable of excluding events based on context
> + *
> + * Some PMU hardware will count events regardless of context, including e.g.
> + * idle, kernel and guest. Drivers for such hardware should set the
> + * PERF_PMU_CAP_NO_EXCLUDE flag to explicitly advertise that they're unable to
> + * help themselves, so that the perf core can reject requests to exclude events
> + * based on context.
> + */
> #define PERF_PMU_CAP_NO_EXCLUDE 0x0040
More to the point might be saying that it will reject any event that
has: perf_event_attr::exclude_{user,kernel,hv,idle,host,guest} set.
> +/**
> + * define PERF_PMU_CAP_AUX_OUTPUT - PMU non-AUX events generate AUX data
> + *
> + * Drivers for PMU hardware that supports non-AUX events which generate data for
> + * AUX events should set PERF_PMU_CAP_AUX_OUTPUT. This flag tells the perf core
> + * to schedule non-AUX events together with AUX events, so that this data isn't
> + * lost.
> + */
> #define PERF_PMU_CAP_AUX_OUTPUT 0x0080
> +/**
> + * define PERF_PMU_CAP_EXTENDED_HW_TYPE - \
> + * PMU supports PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE
> + */
> #define PERF_PMU_CAP_EXTENDED_HW_TYPE 0x0100
> +/**
> + * define PERF_PMU_CAP_AUX_PAUSE - \
> + * PMU can pause and resume AUX area traces based on events
> + */
> #define PERF_PMU_CAP_AUX_PAUSE 0x0200
> +/**
> + * define PERF_PMU_CAP_AUX_PREFER_LARGE - PMU prefers contiguous output buffers
> + *
> + * The PERF_PMU_CAP_AUX_PREFER_LARGE capability flag is a less strict variant of
> + * %PERF_PMU_CAP_AUX_NO_SG. PMU drivers for hardware that doesn't strictly
> + * require contiguous output buffers, but find the benefits outweigh the
> + * downside of increased memory fragmentation, may set this capability flag.
> + */
> #define PERF_PMU_CAP_AUX_PREFER_LARGE 0x0400
>
> /**
>
> ---
> base-commit: 31d56636e10e92ced06ead14b7541867f955e41d
> change-id: 20250618-perf-pmu-cap-docs-a13e4ae939ac
>
> Best regards,
> --
> Nicolas Frattaroli <nicolas.frattaroli@...labora.com>
>
Powered by blists - more mailing lists