From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [RFC PATCH v2 6/9] perf pmu: Probe registers, memory events, rdpmc, and branch skid
Date: Sat, 17 Oct 2026 19:15:38 +0000 [thread overview]
Message-ID: <sashiko-outbox-175775@kernel.org> (raw)
In-Reply-To: <20261017185442.2137623-7-irogers@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] perf pmu: 64-bit operand in rv32 asm constraint in run_skid_branch_loop()
--
commit 1d20e4dd9d51fee9a24330f6bf13bda0cca94b25
Author: Ian Rogers <irogers@google.com>
perf pmu: Probe registers, memory events, rdpmc, and branch skid
This commit extends perf_pmu__probe() in tools/perf/util/pmu.c to probe
supported user and interrupt sampling register masks, memory profiling
events and sample formats, user-space mmap counter reading (rdpmc) and PMC
bit-width, and empirically measured branch instruction skid across
precision levels.
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 83c8d6f392ba9..15a21f8c65ed4 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -3356,6 +3356,739 @@ static void probe_sample_types(struct perf_pmu *pmu,
[ ... ]
> +static noinline bool run_skid_branch_loop(u64 iters, uintptr_t *out_s_ip,
> + uintptr_t *out_b_ip,
> + uintptr_t *out_e_ip,
> + int *out_insn_sz, int *out_nop_cnt)
> +{
[ ... ]
> +#elif defined(__riscv)
> + uintptr_t s_ip, b_ip, e_ip;
> +
> + asm volatile(
> + ".option push\n\t"
> + ".option norvc\n\t"
> + "la %[s_ip], 1f\n\t"
> + "la %[b_ip], 2f\n\t"
> + "la %[e_ip], 3f\n\t"
> + ".balign 64\n"
> + "1:\n\t"
> + ".rept 512\n\t"
> + "nop\n\t"
> + ".endr\n\t"
> + "addi %[cnt], %[cnt], -1\n\t"
> + "2:\n\t"
> + "bnez %[cnt], 1b\n"
> + "3:\n\t"
> + ".option pop\n\t"
> + : [cnt] "+r" (iters),
[Severity: Low]
Will this fail to build on 32-bit RISC-V (__riscv_xlen == 32) when
compiling with Clang?
In run_skid_branch_loop(), the loop counter parameter iters is declared as
a 64-bit u64. Unlike the x86 and ARM blocks which are guarded by 64-bit
target macros (__x86_64__ and __aarch64__), #elif defined(__riscv) matches
both 32-bit and 64-bit RISC-V targets.
On 32-bit RISC-V, general-purpose registers are 32 bits wide, so binding
the 64-bit u64 variable iters to the single-register constraint "+r"
causes Clang to reject the inline assembly with a register size mismatch
error.
Should iters be changed to unsigned long (or uintptr_t), or should the
preprocessor guard check defined(__riscv) && __riscv_xlen == 64?
> + [s_ip] "=&r" (s_ip),
> + [b_ip] "=&r" (b_ip),
> + [e_ip] "=&r" (e_ip)
> + :
> + : "memory"
> + );
[ ... ]
> +}
[ ... ]
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261017185442.2137623-1-irogers@google.com?part=6
next prev parent reply other threads:[~2026-10-17 19:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 21:32 [RFC PATCH v1 0/2] perf sysinfo: Add subcommand to probe and summarize PMU capabilities Ian Rogers
2026-10-16 21:32 ` [RFC PATCH v1 1/2] perf pmus: Add PMU environment loading and live capability probing Ian Rogers
2026-10-16 21:56 ` sashiko-bot
2026-10-16 21:32 ` [RFC PATCH v1 2/2] perf sysinfo: Add sysinfo subcommand, documentation, and test Ian Rogers
2026-10-16 21:45 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 0/9] perf sysinfo: Add subcommand to probe and summarize PMU capabilities Ian Rogers
2026-10-17 18:54 ` [RFC PATCH v2 1/9] perf pmu: Add from_env parameter to perf_pmu__init() Ian Rogers
2026-10-17 19:06 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 2/9] perf pmus: Add perf_pmus__read_from_env() Ian Rogers
2026-10-17 19:15 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 3/9] perf pmus: Expose duplicate uncore PMU scanning helpers Ian Rogers
2026-10-17 18:58 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 4/9] perf mem-events: Expose PMU init and name formatting helpers Ian Rogers
2026-10-17 18:58 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 5/9] perf pmu: Add perf_pmu__probe() for live capability probing Ian Rogers
2026-10-17 19:18 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 6/9] perf pmu: Probe registers, memory events, rdpmc, and branch skid Ian Rogers
2026-10-17 19:15 ` sashiko-bot [this message]
2026-10-17 18:54 ` [RFC PATCH v2 7/9] perf sysinfo: Add sysinfo subcommand Ian Rogers
2026-10-17 19:14 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 8/9] perf docs: Add perf-sysinfo man page Ian Rogers
2026-10-17 18:57 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 9/9] perf test: Add perf sysinfo shell test Ian Rogers
2026-10-17 18:58 ` sashiko-bot
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-175775@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=irogers@google.com \
--cc=linux-perf-users@vger.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 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.