linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Clark <james.clark@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	linux-arm-kernel@lists.infradead.org, x86@kernel.org,
	Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	peterz@infradead.org
Subject: Re: [PATCH V2 3/4] arm64/perf: Assert all platform event flags are within PERF_EVENT_FLAG_ARCH
Date: Mon, 5 Sep 2022 10:10:03 +0100	[thread overview]
Message-ID: <3ad268df-f6fd-a899-ce0e-131b5fdfeae8@arm.com> (raw)
In-Reply-To: <20220905054239.324029-4-anshuman.khandual@arm.com>



On 05/09/2022 06:42, Anshuman Khandual wrote:
> Ensure all platform specific event flags are within PERF_EVENT_FLAG_ARCH.
> 
> Cc: Will Deacon <will@kernel.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-perf-users@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  drivers/perf/arm_spe_pmu.c   | 4 +++-
>  include/linux/perf/arm_pmu.h | 9 +++++----
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
> index b65a7d9640e1..db8a0a841062 100644
> --- a/drivers/perf/arm_spe_pmu.c
> +++ b/drivers/perf/arm_spe_pmu.c
> @@ -44,7 +44,9 @@
>   * This allows us to perform the check, i.e, perfmon_capable(),
>   * in the context of the event owner, once, during the event_init().
>   */
> -#define SPE_PMU_HW_FLAGS_CX			BIT(0)
> +#define SPE_PMU_HW_FLAGS_CX			0x00001
> +
> +static_assert((PERF_EVENT_FLAG_ARCH & SPE_PMU_HW_FLAGS_CX) == SPE_PMU_HW_FLAGS_CX);
>  
>  static void set_spe_event_has_cx(struct perf_event *event)
>  {
> diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h
> index 0407a38b470a..0356cb6a215d 100644
> --- a/include/linux/perf/arm_pmu.h
> +++ b/include/linux/perf/arm_pmu.h
> @@ -24,10 +24,11 @@
>  /*
>   * ARM PMU hw_event flags
>   */
> -/* Event uses a 64bit counter */
> -#define ARMPMU_EVT_64BIT		1
> -/* Event uses a 47bit counter */
> -#define ARMPMU_EVT_47BIT		2
> +#define ARMPMU_EVT_64BIT		0x00001 /* Event uses a 64bit counter */
> +#define ARMPMU_EVT_47BIT		0x00002 /* Event uses a 47bit counter */
> +

Minor nit:

I don't think changing the definitions to hex adds anything except more
noise in the git blame.

Either way, for the whole set:

Reviewed-by: James Clark <james.clark@arm.com>

> +static_assert((PERF_EVENT_FLAG_ARCH & ARMPMU_EVT_64BIT) == ARMPMU_EVT_64BIT);
> +static_assert((PERF_EVENT_FLAG_ARCH & ARMPMU_EVT_47BIT) == ARMPMU_EVT_47BIT);
>  
>  #define HW_OP_UNSUPPORTED		0xFFFF
>  #define C(_x)				PERF_COUNT_HW_CACHE_##_x

  reply	other threads:[~2022-09-05  9:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05  5:42 [PATCH V2 0/4] perf/core: Assert PERF_EVENT_FLAG_ARCH is followed Anshuman Khandual
2022-09-05  5:42 ` [PATCH V2 1/4] perf/core: Expand PERF_EVENT_FLAG_ARCH Anshuman Khandual
2022-09-05  5:42 ` [PATCH V2 2/4] perf/core: Assert PERF_EVENT_FLAG_ARCH does not overlap with generic flags Anshuman Khandual
2022-09-05  5:42 ` [PATCH V2 3/4] arm64/perf: Assert all platform event flags are within PERF_EVENT_FLAG_ARCH Anshuman Khandual
2022-09-05  9:10   ` James Clark [this message]
2022-09-06  2:57     ` Anshuman Khandual
2022-09-05  5:42 ` [PATCH V2 4/4] x86/perf: " Anshuman Khandual
2022-09-06 19:22   ` Peter Zijlstra
2022-09-07  5:27     ` Anshuman Khandual
2022-09-07  8:30       ` Peter Zijlstra

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=3ad268df-f6fd-a899-ce0e-131b5fdfeae8@arm.com \
    --to=james.clark@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=jolsa@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    --cc=x86@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).