From: sashiko-bot@kernel.org
To: "Robin Murphy" <robin.murphy@arm.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 2/4] perf/arm_cspmu: Improve APMT-based PMU naming
Date: Thu, 16 Jul 2026 15:15:19 +0000 [thread overview]
Message-ID: <20260716151520.505091F000E9@smtp.kernel.org> (raw)
In-Reply-To: <8f260d150da4fd8acbe0a070033c9b9e045fced2.1784213435.git.robin.murphy@arm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Naming PMUs based solely on their target component's instance ID can cause sysfs name collisions if a single hardware component has multiple independent PMUs.
--
--- Patch [2]: [PATCH v2 2/4] perf/arm_cspmu: Improve APMT-based PMU naming ---
commit c464ddb014cc8172e2e952ddcc892f142c6f5839
Author: Robin Murphy <robin.murphy@arm.com>
perf/arm_cspmu: Improve APMT-based PMU naming
This commit tweaks the PMU devices to substitute the arbitrary number with a
more meaningful one based on the APMT definitions. On ACPI systems, it associates
the actual APMT unique ID rather than relying on arbitrarily-numbered platform
devices.
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
> index e6292021f653e..e3aaf587e6e54 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
[ ... ]
> @@ -250,38 +250,43 @@ static const char *arm_cspmu_get_name(const struct arm_cspmu *cspmu)
> struct device *dev;
> struct acpi_apmt_node *apmt_node;
> u8 pmu_type;
> - char *name;
> char acpi_hid_string[ACPI_ID_LEN] = { 0 };
> - static atomic_t pmu_idx[ACPI_APMT_NODE_TYPE_COUNT] = { 0 };
> + static atomic_t pmu_idx;
> + u32 id;
[ ... ]
> + 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;
> + break;
[Severity: Medium]
Will this lead to a sysfs name collision if a single hardware component has
multiple independent PMUs?
If multiple PMUs target the same component (like separate PMUs for an SMMU TCU
and TBUs), they will get identical names since apmt_node->inst_secondary is
ignored here. This could cause perf_pmu_register() to fail with -EEXIST during
device probe, preventing all but the first PMU on the hardware component from
being registered.
> + 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], id);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784213435.git.robin.murphy@arm.com?part=2
next prev parent reply other threads:[~2026-07-16 15:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 14:56 [PATCH v2 0/4] perf/arm_cspmu: Miscellaneous improvements Robin Murphy
2026-07-16 14:56 ` [PATCH v2 1/4] ACPI/APMT: Use stable device ID Robin Murphy
2026-07-16 15:17 ` sashiko-bot
2026-07-16 15:33 ` Robin Murphy
2026-07-16 14:56 ` [PATCH v2 2/4] perf/arm_cspmu: Improve APMT-based PMU naming Robin Murphy
2026-07-16 15:15 ` sashiko-bot [this message]
2026-07-16 21:13 ` Ilkka Koskinen
2026-07-16 14:56 ` [PATCH v2 3/4] perf/arm_cspmu: Improve sub-module error reporting Robin Murphy
2026-07-16 14:56 ` [PATCH v2 4/4] perf/arm_cspmu: Make IRQ more optional Robin Murphy
2026-07-16 15:11 ` sashiko-bot
2026-07-16 15:27 ` Robin Murphy
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=20260716151520.505091F000E9@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