From: sashiko-bot@kernel.org
To: "Puranjay Mohan" <puranjay@kernel.org>
Cc: bpf@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v6 2/3] perf/arm64: Add BRBE support for bpf_get_branch_snapshot()
Date: Mon, 10 Aug 2026 16:56:31 +0000 [thread overview]
Message-ID: <20260810165631.DE96A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260810164622.1829843-3-puranjay@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing `isb()` context synchronization barrier after writing to the `PMCR_EL0` system register in `brbe_snapshot_branch_stack`.
--
--- Patch [2]: [PATCH v6 2/3] perf/arm64: Add BRBE support for bpf_get_branch_snapshot() ---
commit a7708fa08fe97675c17bb6e7a2098acd91d49bfb
Author: Puranjay Mohan <puranjay@kernel.org>
perf/arm64: Add BRBE support for bpf_get_branch_snapshot()
This commit implements the perf_snapshot_branch_stack static call for BRBE,
allowing bpf_get_branch_snapshot() to capture hardware branch records. It
manages BRBE state by pausing it during the snapshot, freezing the counters,
and handling buffer invalidation to avoid data corruption.
> diff --git a/drivers/perf/arm_brbe.c b/drivers/perf/arm_brbe.c
> index ba554e0c846c4..9e7e69c43b17d 100644
> --- a/drivers/perf/arm_brbe.c
> +++ b/drivers/perf/arm_brbe.c
[ ... ]
> +int brbe_snapshot_branch_stack(struct perf_branch_entry *entries, unsigned int cnt)
> +{
[ ... ]
> + if (paused_here) {
> + /* Branches were missed, so discard rather than leave a hole. */
> + brbe_invalidate();
> +
> + /* Unpause first; a paused BRBE cannot freeze on overflow. */
> + write_sysreg_s(brbfcr, SYS_BRBFCR_EL1);
> + isb();
> + write_pmcr(pmcr);
[Severity: Medium]
Is a context synchronization barrier missing after this write to PMCR_EL0?
Architecture invariants for ARM64 usually require writes to control-plane
system registers to be immediately followed by an isb() to ensure the CPU
pipeline observes the new configuration.
Could the lack of an isb() here allow the CPU to continue operating under a
stale PMU configuration for several cycles, potentially missing performance
counter and BRBE branch events immediately following the unpause?
> + }
> +
> + local_daif_restore(flags);
> +
> + return nr_copied;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260810164622.1829843-1-puranjay@kernel.org?part=2
next prev parent reply other threads:[~2026-08-10 16:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 16:46 [PATCH v6 0/3] arm64: Add BRBE support for bpf_get_branch_snapshot() Puranjay Mohan
2026-08-10 16:46 ` [PATCH v6 1/3] arm64: Add raw variants of local_daif_save() and local_daif_restore() Puranjay Mohan
2026-08-10 16:46 ` [PATCH v6 2/3] perf/arm64: Add BRBE support for bpf_get_branch_snapshot() Puranjay Mohan
2026-08-10 16:56 ` sashiko-bot [this message]
2026-08-10 16:46 ` [PATCH v6 3/3] selftests/bpf: Adjust entry thresholds for ARM64 BRBE Puranjay Mohan
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=20260810165631.DE96A1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=puranjay@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.