From: sashiko-bot@kernel.org
To: "Mayuresh Chitale" <mayuresh.chitale@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 12/14] perf tools: Add RISC-V trace PMU record capabilities
Date: Thu, 26 Nov 2026 10:19:13 +0000 [thread overview]
Message-ID: <sashiko-outbox-235269@kernel.org> (raw)
In-Reply-To: <4755b47e4613daa764d2c50af1a1840afa2622b4.1795512532.git.mayuresh.chitale@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] perf riscv: gtrace PMU never sets pmu->auxtrace or
pmu->selectable
- [Medium] perf riscv: rvtrace_recording_options() omits PERF_SAMPLE_CPU
on gtrace evsel
--
commit 0c55086ce4e6f736821fda4e6c6b8b310252b04f
Author: Mayuresh Chitale <mayuresh.chitale@oss.qualcomm.com>
perf tools: Add RISC-V trace PMU record capabilities
This commit adds auxtrace recording callbacks and event definitions for
the RISC-V gtrace PMU in perf tools.
> diff --git a/tools/perf/arch/riscv/util/auxtrace.c b/tools/perf/arch/riscv/util/auxtrace.c
> new file mode 100644
> index 0000000000000..6331161dff7b0
> --- /dev/null
> +++ b/tools/perf/arch/riscv/util/auxtrace.c
> @@ -0,0 +1,220 @@
[ ... ]
> +static int rvtrace_recording_options(struct auxtrace_record *itr, struct evlist *evlist,
> + struct record_opts *opts)
> +{
> + struct rvtrace_recording *ptr = container_of(itr, struct rvtrace_recording, itr);
> + struct perf_pmu *rvtrace_pmu = ptr->rvtrace_pmu;
> + struct evsel *evsel, *rvtrace_evsel = NULL;
> + struct evsel *tracking_evsel;
> + int err;
> +
> + ptr->evlist = evlist;
> + evlist__for_each_entry(evlist, evsel) {
> + if (evsel->core.attr.type == rvtrace_pmu->type) {
> + if (rvtrace_evsel) {
> + pr_err("There may be only one " GTRACE_PMU_NAME " event\n");
> + return -EINVAL;
> + }
> + evsel->core.attr.freq = 0;
> + evsel->core.attr.sample_period = 1;
> + evsel->needs_auxtrace_mmap = true;
> + rvtrace_evsel = evsel;
> + opts->full_auxtrace = true;
> + }
> + }
> +
> + err = rvtrace_set_auxtrace_mmap_page(opts);
> + if (err)
> + return err;
> + /*
> + * To obtain the auxtrace buffer file descriptor, the auxtrace event
> + * must come first.
> + */
> + evlist__to_front(evlist, rvtrace_evsel);
> + evsel__set_sample_bit(rvtrace_evsel, TIME);
[Severity: Medium]
Should rvtrace_recording_options() also set PERF_SAMPLE_CPU on
rvtrace_evsel?
The gtrace kernel driver calls perf_report_aux_output_id(event,
path->trace_id) per CPU in gtrace_event_start(), which relies on
PERF_SAMPLE_CPU in the event's sample_id to associate each hardware
trace_id with its CPU. Without evsel__set_sample_bit(rvtrace_evsel,
CPU), per-thread recording (perf record -e gtrace// <workload> without
-a, -C or --sample-cpu) leaves PERF_SAMPLE_CPU unset, so
PERF_RECORD_AUX_OUTPUT_HW_ID and PERF_RECORD_AUX records have
sample.cpu == -1 and cannot be matched to the CPU that produced the
trace.
[ ... ]
> +struct auxtrace_record *auxtrace_record__init(struct evlist *evlist, int *err)
> +{
> + struct perf_pmu *rvtrace_pmu = NULL;
> + struct perf_pmu *found_pmu = NULL;
> + struct evsel *evsel;
> +
> + if (!evlist)
> + return NULL;
> +
> + rvtrace_pmu = perf_pmus__find(GTRACE_PMU_NAME);
[Severity: Medium]
Does RISC-V need a perf_pmu__arch_init() implementation to set
pmu->auxtrace = true and pmu->selectable = true on the gtrace PMU?
evsel__is_aux_event() checks evsel->needs_auxtrace_mmap ||
pmu->auxtrace, and both parse_options() (for event grouping) and
record__auxtrace_init() (for auxtrace_parse_sample_options() and
auxtrace_parse_aux_action()) run before auxtrace_record__options() calls
rvtrace_recording_options() to set needs_auxtrace_mmap. Because
pmu->auxtrace and pmu->selectable are never set for gtrace, event groups
led by gtrace// are split during parsing, --aux-sample and aux-action
terms fail validation, and gtrace// is omitted from perf list.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795512532.git.mayuresh.chitale@oss.qualcomm.com?part=12
next prev parent reply other threads:[~2026-11-26 10:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 9:55 [PATCH v7 00/14] Linux RISC-V trace framework and drivers Mayuresh Chitale
2026-11-26 9:55 ` [PATCH v7 01/14] dt-bindings: Add RISC-V trace component bindings Mayuresh Chitale
2026-11-26 10:07 ` sashiko-bot
2026-11-26 9:55 ` [PATCH v7 02/14] hwtracing: gtrace: Initial implementation of gtrace framework Mayuresh Chitale
2026-11-26 10:15 ` sashiko-bot
2026-11-26 9:55 ` [PATCH v7 03/14] gtrace: Add RISC-V platform driver for the " Mayuresh Chitale
2026-11-26 10:12 ` sashiko-bot
2026-11-26 9:55 ` [PATCH v7 04/14] gtrace: Add functions to create/destroy a trace component path Mayuresh Chitale
2026-11-26 10:07 ` sashiko-bot
2026-11-26 9:55 ` [PATCH v7 05/14] gtrace: Add functions to start/stop tracing on a " Mayuresh Chitale
2026-11-26 10:05 ` sashiko-bot
2026-11-26 9:55 ` [PATCH v7 06/14] gtrace: Add RISC-V Trace encoder driver Mayuresh Chitale
2026-11-26 10:09 ` sashiko-bot
2026-11-26 9:55 ` [PATCH v7 07/14] gtrace: Add function to copy into perf AUX buffer Mayuresh Chitale
2026-11-26 10:05 ` sashiko-bot
2026-11-26 9:55 ` [PATCH v7 08/14] perf: Add gtrace AUX buffer trace format type Mayuresh Chitale
2026-11-26 9:55 ` [PATCH v7 09/14] gtrace: Add RISC-V Trace ramsink driver Mayuresh Chitale
2026-11-26 10:13 ` sashiko-bot
2026-11-26 9:55 ` [PATCH v7 10/14] riscv: Enable DMA_RESTRICTED_POOL in defconfig Mayuresh Chitale
2026-11-26 9:55 ` [PATCH v7 11/14] gtrace: Add perf driver for tracing using perf tool Mayuresh Chitale
2026-11-26 10:23 ` sashiko-bot
2026-11-26 9:55 ` [PATCH v7 12/14] perf tools: Add RISC-V trace PMU record capabilities Mayuresh Chitale
2026-11-26 10:19 ` sashiko-bot [this message]
2026-11-26 9:55 ` [PATCH v7 13/14] perf tools: Initial support for gtrace decoder Mayuresh Chitale
2026-11-26 10:17 ` sashiko-bot
2026-11-26 9:55 ` [PATCH v7 14/14] MAINTAINERS: Add entry for RISC-V trace framework Mayuresh Chitale
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=sashiko-outbox-235269@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=mayuresh.chitale@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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