Message ID | 20240703110741.2668800-1-quic_sibis@quicinc.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | pmdomain: arm: Fix debugfs node creation failure | expand |
On Wed, Jul 03, 2024 at 04:37:41PM +0530, Sibi Sankar wrote: > The domain attributes returned by the perf protocol can end up > reporting identical names across domains, resulting in debugfs > node creation failure. Fix this duplication by appending the > domain-id to the domain name. > > Logs: > debugfs: Directory 'NCC' with parent 'pm_genpd' already present! > debugfs: Directory 'NCC' with parent 'pm_genpd' already present! > If there are 2 perf domains for a device or group of devices, there must be something unique about each of these domains. Why can't the firmware specify the uniqueness or the difference via the name? The example above seems firmware is being just lazy to update it. Also for the user/developer/debugger, the unique name might be more useful than just this number. So please use the name(we must now have extended name if 16bytes are less) to provide unique names. Please stop working around such silly firmware bugs like this, it just makes using debugfs for anything useful harder. -- Regards, Sudeep
On 7/4/24 16:02, Sudeep Holla wrote: > On Wed, Jul 03, 2024 at 04:37:41PM +0530, Sibi Sankar wrote: >> The domain attributes returned by the perf protocol can end up >> reporting identical names across domains, resulting in debugfs >> node creation failure. Fix this duplication by appending the >> domain-id to the domain name. Hey Sudeep, Thanks for taking time to review the patch :) >> >> Logs: >> debugfs: Directory 'NCC' with parent 'pm_genpd' already present! >> debugfs: Directory 'NCC' with parent 'pm_genpd' already present! >> > > If there are 2 perf domains for a device or group of devices, there must > be something unique about each of these domains. Why can't the firmware > specify the uniqueness or the difference via the name? > > The example above seems firmware is being just lazy to update it. Also > for the user/developer/debugger, the unique name might be more useful > than just this number. > > So please use the name(we must now have extended name if 16bytes are less) > to provide unique names. Please stop working around such silly firmware > bugs like this, it just makes using debugfs for anything useful harder. This is just meant to address firmware that are already out in the wild. That being said I don't necessarily agree with the patch either since it's penalizing firmware that actually uses a proper name by appending something inherently less useful to it. Since, the using of an unique domain name isn't required by the spec, the need for it goes under the radar for vendors. Mandating it might be the right thing to do since the kernel seems inherently expect that. -Sibi > > -- > Regards, > Sudeep
On Fri, Jul 05, 2024 at 09:16:29AM +0530, Sibi Sankar wrote: > > On 7/4/24 16:02, Sudeep Holla wrote: > > > > If there are 2 perf domains for a device or group of devices, there must > > be something unique about each of these domains. Why can't the firmware > > specify the uniqueness or the difference via the name? > > > > The example above seems firmware is being just lazy to update it. Also > > for the user/developer/debugger, the unique name might be more useful > > than just this number. > > > > So please use the name(we must now have extended name if 16bytes are less) > > to provide unique names. Please stop working around such silly firmware > > bugs like this, it just makes using debugfs for anything useful harder. > > This is just meant to address firmware that are already out in the wild. > That being said I don't necessarily agree with the patch either since > it's penalizing firmware that actually uses a proper name by appending > something inherently less useful to it. Since, the using of an unique > domain name isn't required by the spec, the need for it goes under the radar > for vendors. Mandating it might be the right thing to do since > the kernel seems inherently expect that. > Well I would love if spec authors can agree and mandate this. But this is one of those things I can't argue as I don't necessarily agree with the argument. There are 2 distinct/unique domains but firmware authors ran out of unique names for them or just can't be bothered to care about it. They can't run out of characters as well in above examples, firmware can add some useless domain ID in the name if they can't be bothered or creative. So I must admit I can't be bothered as well with that honestly. -- Regards, Sudeep
diff --git a/drivers/pmdomain/arm/scmi_perf_domain.c b/drivers/pmdomain/arm/scmi_perf_domain.c index d7ef46ccd9b8..0af5dc941349 100644 --- a/drivers/pmdomain/arm/scmi_perf_domain.c +++ b/drivers/pmdomain/arm/scmi_perf_domain.c @@ -18,6 +18,7 @@ struct scmi_perf_domain { const struct scmi_perf_proto_ops *perf_ops; const struct scmi_protocol_handle *ph; const struct scmi_perf_domain_info *info; + char domain_name[SCMI_MAX_STR_SIZE]; u32 domain_id; }; @@ -123,7 +124,12 @@ static int scmi_perf_domain_probe(struct scmi_device *sdev) scmi_pd->domain_id = i; scmi_pd->perf_ops = perf_ops; scmi_pd->ph = ph; - scmi_pd->genpd.name = scmi_pd->info->name; + + /* Domain attributes can report identical names across domains */ + snprintf(scmi_pd->domain_name, sizeof(scmi_pd->domain_name), "%s-%d", + scmi_pd->info->name, scmi_pd->domain_id); + + scmi_pd->genpd.name = scmi_pd->domain_name; scmi_pd->genpd.flags = GENPD_FLAG_ALWAYS_ON | GENPD_FLAG_OPP_TABLE_FW; scmi_pd->genpd.set_performance_state = scmi_pd_set_perf_state;
The domain attributes returned by the perf protocol can end up reporting identical names across domains, resulting in debugfs node creation failure. Fix this duplication by appending the domain-id to the domain name. Logs: debugfs: Directory 'NCC' with parent 'pm_genpd' already present! debugfs: Directory 'NCC' with parent 'pm_genpd' already present! Fixes: 2af23ceb8624 ("pmdomain: arm: Add the SCMI performance domain") Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> --- drivers/pmdomain/arm/scmi_perf_domain.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)