From: Mark Rutland <mark.rutland@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
Will Deacon <will@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] driver: perf: arm_pmuv3: Identify 'event->attr.config1' based attributes
Date: Fri, 13 Oct 2023 14:47:44 +0100 [thread overview]
Message-ID: <ZSlKgGtrhsoWCDGT@FVFF77S0Q05N.cambridge.arm.com> (raw)
In-Reply-To: <20231009051753.179355-1-anshuman.khandual@arm.com>
On Mon, Oct 09, 2023 at 10:47:53AM +0530, Anshuman Khandual wrote:
> This defines macros to identify long and rdpmc attributes which get carried
> inside 'event->attr.config1', thus making the code explicit and clear.
>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> This applies on v6.6-rc5.
>
> drivers/perf/arm_pmuv3.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
I think this would make sense to do if we also used a common definition of
these bits in the helper functions *and* their format attributes, but as-is
this does nothing to relate the two, and I don't think that it improves
legibility on its own.
Mark.
> diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c
> index 94723d00548e..797ffd5a8fed 100644
> --- a/drivers/perf/arm_pmuv3.c
> +++ b/drivers/perf/arm_pmuv3.c
> @@ -298,16 +298,19 @@ PMU_FORMAT_ATTR(event, "config:0-15");
> PMU_FORMAT_ATTR(long, "config1:0");
> PMU_FORMAT_ATTR(rdpmc, "config1:1");
>
> +#define ARM_PMUV3_ATTR_LONG 0x01
> +#define ARM_PMUV3_ATTR_RDPMC 0x02
> +
> static int sysctl_perf_user_access __read_mostly;
>
> static inline bool armv8pmu_event_is_64bit(struct perf_event *event)
> {
> - return event->attr.config1 & 0x1;
> + return event->attr.config1 & ARM_PMUV3_ATTR_LONG;
> }
>
> static inline bool armv8pmu_event_want_user_access(struct perf_event *event)
> {
> - return event->attr.config1 & 0x2;
> + return event->attr.config1 & ARM_PMUV3_ATTR_RDPMC;
> }
>
> static struct attribute *armv8_pmuv3_format_attrs[] = {
> --
> 2.25.1
>
next prev parent reply other threads:[~2023-10-13 13:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-09 5:17 Anshuman Khandual
2023-10-13 13:47 ` Mark Rutland [this message]
2023-10-16 3:18 ` Anshuman Khandual
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=ZSlKgGtrhsoWCDGT@FVFF77S0Q05N.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=anshuman.khandual@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--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®