Re: [PATCH v2 2/5] alpha/perf: add sysfs format and event attributes

From: Magnus Lindholm

Date: Sat Oct 31 2026 - 11:19:12 EST


Hi Matt,

On Fri, Oct 30, 2026 at 5:04 AM Matt Turner <mattst88@xxxxxxxxx> wrote:
>
> The Alpha PMU registers with no attribute groups, so the perf tool has no
> way to learn the raw config layout, and the PMU's own events can only be
> named as raw hex numbers.
>
> Describe the event field in format/event and export aliases for the four
> EV67 event types. mbox-replay has no generic hardware event, and can now
> be named as cpu/mbox-replay/.
>
> Signed-off-by: Matt Turner <mattst88@xxxxxxxxx>
> ---
> arch/alpha/kernel/perf_event.c | 39 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
> index 2d9383425357..70840c05d39b 100644
> --- a/arch/alpha/kernel/perf_event.c
> +++ b/arch/alpha/kernel/perf_event.c
> @@ -212,6 +212,44 @@ static int ev67_raw_event_valid(u64 config)
> };
>
>
> +PMU_FORMAT_ATTR(event, "config:0-7");
> +
> +static struct attribute *ev67_format_attrs[] = {
> + &format_attr_event.attr,
> + NULL,
> +};
> +
> +static const struct attribute_group ev67_format_group = {
> + .name = "format",
> + .attrs = ev67_format_attrs,
> +};
> +
> +/* Values must match enum ev67_pmc_event_type. */
> +PMU_EVENT_ATTR_STRING(cycles, ev67_event_cycles, "event=0x01");
> +PMU_EVENT_ATTR_STRING(instructions, ev67_event_instructions, "event=0x02");
> +PMU_EVENT_ATTR_STRING(bcache-misses, ev67_event_bcache_misses, "event=0x03");
> +PMU_EVENT_ATTR_STRING(mbox-replay, ev67_event_mbox_replay, "event=0x04");
> +
> +static struct attribute *ev67_event_attrs[] = {
> + &ev67_event_cycles.attr.attr,
> + &ev67_event_instructions.attr.attr,
> + &ev67_event_bcache_misses.attr.attr,
> + &ev67_event_mbox_replay.attr.attr,
> + NULL,
> +};
> +
> +static const struct attribute_group ev67_events_group = {
> + .name = "events",
> + .attrs = ev67_event_attrs,
> +};
> +
> +static const struct attribute_group *ev67_attr_groups[] = {
> + &ev67_format_group,
> + &ev67_events_group,
> + NULL,
> +};
> +
> +
> static const struct alpha_pmu_t ev67_pmu = {
> .event_map = ev67_perfmon_event_map,
> .max_events = ARRAY_SIZE(ev67_perfmon_event_map),
> @@ -761,6 +799,7 @@ static struct pmu pmu = {
> .start = alpha_pmu_start,
> .stop = alpha_pmu_stop,
> .read = alpha_pmu_read,
> + .attr_groups = ev67_attr_groups,
> .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
> };
>
>
> --
> 2.55.0
>

Tested the PMU event/config interface on my AlphaServer ES40.
The four ProfileMe event selections recorded successfully, with
the expected selectors in the captured status.

Reviewed-by: Magnus Lindholm <linmag7@xxxxxxxxx>
Tested-by: Magnus Lindholm <linmag7@xxxxxxxxx>