From: John Garry <john.g.garry@oracle.com>
To: Robin Murphy <robin.murphy@arm.com>, will@kernel.org
Cc: mark.rutland@arm.com, ilkka@os.amperecomputing.com,
renyu.zj@linux.alibaba.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] perf/arm-cmn: Add sysfs identifier
Date: Wed, 14 Jun 2023 15:55:42 +0100 [thread overview]
Message-ID: <5efa7af9-6347-a409-370c-b8b78b3d53aa@oracle.com> (raw)
In-Reply-To: <b8a14c14fcdf028939ebf57849863e8ae01743de.1686588640.git.robin.murphy@arm.com>
On 12/06/2023 18:16, Robin Murphy wrote:
> Expose a sysfs identifier encapsulating the CMN part number and revision
> so that jevents can narrow down a fundamental set of possible events for
> calculating metrics. Configuration-dependent aspects - such as whether a
> given node type is present, and/or a given node ID is valid - are still
> not covered, and in general it's hard to see how userspace could handle
> them, so we won't be removing any data or validation logic from the
> driver any time soon, but at least it's a step in a useful direction.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
FWIW, Reviewed-by:
John Garry <john.g.garry@oracle.com>
However a comment, below.
> ---
> drivers/perf/arm-cmn.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 8cf4ed932950..088dc5c690a4 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -1199,19 +1199,31 @@ static ssize_t arm_cmn_cpumask_show(struct device *dev,
> static struct device_attribute arm_cmn_cpumask_attr =
> __ATTR(cpumask, 0444, arm_cmn_cpumask_show, NULL);
>
> -static struct attribute *arm_cmn_cpumask_attrs[] = {
> +static ssize_t arm_cmn_identifier_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct arm_cmn *cmn = to_cmn(dev_get_drvdata(dev));
> +
> + return sysfs_emit(buf, "%03x%02x\n", cmn->part, cmn->rev);
I don't think that this gives the "0x" prefix, right? It is just an
encoded string of values, so not strictly necessary or even appropriate,
I suppose.
However, if userspace wants to improve scalability by, say, matching an
event for all revs of a model, userspace (perf tool) needs to be
programmed in the JSONs somehow since we have no delimiter.
Thanks,
John
> +}
> +
> +static struct device_attribute arm_cmn_identifier_attr =
> + __ATTR(identifier, 0444, arm_cmn_identifier_show, NULL);
> +
> +static struct attribute *arm_cmn_other_attrs[] = {
> &arm_cmn_cpumask_attr.attr,
> + &arm_cmn_identifier_attr.attr,
> NULL,
> };
>
> -static const struct attribute_group arm_cmn_cpumask_attr_group = {
> - .attrs = arm_cmn_cpumask_attrs,
> +static const struct attribute_group arm_cmn_other_attrs_group = {
> + .attrs = arm_cmn_other_attrs,
> };
>
> static const struct attribute_group *arm_cmn_attr_groups[] = {
> &arm_cmn_event_attrs_group,
> &arm_cmn_format_attrs_group,
> - &arm_cmn_cpumask_attr_group,
> + &arm_cmn_other_attrs_group,
> NULL
> };
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-06-14 14:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 17:16 [PATCH 0/2] perf/arm-cmn: Identifier support Robin Murphy
2023-06-12 17:16 ` [PATCH 1/2] perf/arm-cmn: Revamp model detection Robin Murphy
2023-06-14 8:24 ` Ilkka Koskinen
2023-06-12 17:16 ` [PATCH 2/2] perf/arm-cmn: Add sysfs identifier Robin Murphy
2023-06-14 8:25 ` Ilkka Koskinen
2023-06-14 12:45 ` Jing Zhang
2023-06-14 14:55 ` John Garry [this message]
2023-06-14 17:29 ` Robin Murphy
2023-06-16 11:23 ` [PATCH 0/2] perf/arm-cmn: Identifier support Will Deacon
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=5efa7af9-6347-a409-370c-b8b78b3d53aa@oracle.com \
--to=john.g.garry@oracle.com \
--cc=ilkka@os.amperecomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=renyu.zj@linux.alibaba.com \
--cc=robin.murphy@arm.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;
as well as URLs for NNTP newsgroup(s).