From: sashiko-bot@kernel.org
To: "Robin Murphy" <robin.murphy@arm.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 2/4] perf/arm_cspmu: Improve APMT-based PMU naming
Date: Thu, 09 Jul 2026 14:48:54 +0000 [thread overview]
Message-ID: <20260709144855.0279B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <74b46977582689be3ec7ba456809db89aad92bfe.1783605641.git.robin.murphy@arm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The computed PMU identifier `id` is ignored during string formatting, resulting in incorrect PMU names. Furthermore, `apmt_node->inst_primary` (u64) is truncated when assigned to `id` (u32).
--
--- Patch [2]: [PATCH 2/4] perf/arm_cspmu: Improve APMT-based PMU naming ---
commit a5bff38f664770528aefdc9e26aafbe6dc541317
Author: Robin Murphy <robin.murphy@arm.com>
perf/arm_cspmu: Improve APMT-based PMU naming
This commit attempts to improve APMT-based PMU naming on ACPI systems. It
modifies arm_cspmu_get_name() to substitute arbitrary numbers with more
meaningful identifiers based on APMT definitions by using a switch statement
over the PMU type.
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
> index e6292021f653e..b6565eda8e521 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
> @@ -250,38 +250,44 @@ static const char *arm_cspmu_get_name(const struct arm_cspmu *cspmu)
[ ... ]
> + case ACPI_APMT_NODE_TYPE_MC:
> + id = apmt_node->id;
> + break;
> + case ACPI_APMT_NODE_TYPE_SMMU:
> + case ACPI_APMT_NODE_TYPE_PCIE_ROOT:
> + id = apmt_node->inst_primary;
[Severity: High]
Does this assignment truncate the 64-bit inst_primary value?
Looking at struct acpi_apmt_node, inst_primary is a u64, but the id variable
is defined as a u32. This might cause sysfs name collisions if the upper 32
bits are non-zero.
> + break;
> + case ACPI_APMT_NODE_TYPE_CACHE:
> + id = apmt_node->inst_secondary;
> + break;
> + };
>
> - return name;
> + return devm_kasprintf(dev, GFP_KERNEL, "%s_%s_%u", PMUNAME,
> + arm_cspmu_type_str[pmu_type],
> + apmt_node->id);
[Severity: High]
Is it intentional to use apmt_node->id here instead of the local variable id
we just computed in the switch statement above?
Since the computed id is ignored, multiple PMUs of the same type sharing
the same apmt_node->id might result in identical names being generated.
Will this cause sysfs name collisions and driver registration failures?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1783605641.git.robin.murphy@arm.com?part=2
next prev parent reply other threads:[~2026-07-09 14:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 14:39 [PATCH 0/4] perf/arm_cspmu: Miscellaneous improvements Robin Murphy
2026-07-09 14:39 ` [PATCH 1/4] ACPI/APMT: Use stable device ID Robin Murphy
2026-07-09 14:52 ` sashiko-bot
2026-07-09 15:31 ` Robin Murphy
2026-07-09 14:39 ` [PATCH 2/4] perf/arm_cspmu: Improve APMT-based PMU naming Robin Murphy
2026-07-09 14:48 ` sashiko-bot [this message]
2026-07-09 15:42 ` Robin Murphy
2026-07-09 14:39 ` [PATCH 3/4] perf/arm_cspmu: Improve sub-module error reporting Robin Murphy
2026-07-09 14:39 ` [PATCH 4/4] perf/arm_cspmu: Make IRQ more optional Robin Murphy
2026-07-09 14:49 ` 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=20260709144855.0279B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=robin.murphy@arm.com \
--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