mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Will Deacon <will@kernel.org>, Shouping Wang <allen.wang@hj-micro.com>
Cc: mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, andy.xu@hj-micro.com,
	peter.du@hj-micro.com
Subject: Re: [PATCH 1/2] perf/arm-ni: rename PMU device name
Date: Mon, 24 Nov 2025 18:01:10 +0000	[thread overview]
Message-ID: <0bea885c-6647-4552-a7f7-4fef260ef97c@arm.com> (raw)
In-Reply-To: <aSR-Lu-nkSJl0V-x@willie-the-truck>

On 2025-11-24 3:47 pm, Will Deacon wrote:
> On Fri, Nov 07, 2025 at 04:43:18PM +0800, Shouping Wang wrote:
>> The PMU device names are arm_ni_1_*,arm_ni_2_*, etc.
>> The device names change based on the order of registration
>> for multiple NI instances. By naming the PMU device using
>> its address, the device name can be made independent of
>> the registration order.
>>
>> Signed-off-by: Shouping Wang <allen.wang@hj-micro.com>
>> ---
>>   drivers/perf/arm-ni.c | 6 ++----
>>   1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/perf/arm-ni.c b/drivers/perf/arm-ni.c
>> index 1615a0564031..32eabdbe877a 100644
>> --- a/drivers/perf/arm-ni.c
>> +++ b/drivers/perf/arm-ni.c
>> @@ -53,6 +53,7 @@
>>   
>>   #define NI_NUM_COUNTERS		8
>>   #define NI_CCNT_IDX		31
>> +#define NI_PMU_PA_SHIFT		12
>>   
>>   /* Event attributes */
>>   #define NI_CONFIG_TYPE		GENMASK_ULL(15, 0)
>> @@ -115,7 +116,6 @@ struct arm_ni {
>>   	struct device *dev;
>>   	void __iomem *base;
>>   	enum ni_part part;
>> -	int id;
>>   	int cpu;
>>   	int num_cds;
>>   	struct hlist_node cpuhp_node;
>> @@ -560,7 +560,7 @@ static int arm_ni_init_cd(struct arm_ni *ni, struct arm_ni_node *node, u64 res_s
>>   		.read = arm_ni_event_read,
>>   	};
>>   
>> -	name = devm_kasprintf(ni->dev, GFP_KERNEL, "arm_ni_%d_cd_%d", ni->id, cd->id);
>> +	name = devm_kasprintf(ni->dev, GFP_KERNEL, "arm_ni_%llx", res_start >> NI_PMU_PA_SHIFT);
> 
> Doesn't this have the potential to break userspace (e.g. scripts) that
> expect the current naming to be stable?

Certainly on platforms where only arm_ni_0 ever exists. For 
multi-instance cases it's always been documented that this ID is 
arbitrary, and users should look at the platform device that is the 
sysfs parent of the PMU device(s) in order to disambiguate - from there 
they already have the freedom to use whatever information they like, 
including MMIO resources, but also interrupt numbers, ACPI _UIDs or 
whatever. So although changing one arbitrary value to a different 
arbitrary value is in theory something well-behaved users should be OK 
with, in practice changing it from a small decimal integer to a massive 
hex number may well still break parsing expectations.

Thanks,
Robin.

> 
> Either way, I'll need Robin's acks for these changes.
> 
> Will

  reply	other threads:[~2025-11-24 18:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07  8:43 [PATCH 0/2] perf/arm-ni: Optimize codes Shouping Wang
2025-11-07  8:43 ` [PATCH 1/2] perf/arm-ni: rename PMU device name Shouping Wang
2025-11-24 15:47   ` Will Deacon
2025-11-24 18:01     ` Robin Murphy [this message]
2025-11-07  8:43 ` [PATCH 2/2] perf: arm-ni: add topology debug info for the clock domain Shouping Wang
2025-11-24 18:28   ` 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=0bea885c-6647-4552-a7f7-4fef260ef97c@arm.com \
    --to=robin.murphy@arm.com \
    --cc=allen.wang@hj-micro.com \
    --cc=andy.xu@hj-micro.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=peter.du@hj-micro.com \
    --cc=will@kernel.org \
    /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

all inboxes | Powered by JetHome®