[PATCH V3 2/4] perf/core: Assert PERF_EVENT_FLAG_ARCH does not overlap with generic flags

Anshuman Khandual posted 4 patches 3 years, 7 months ago
[PATCH V3 2/4] perf/core: Assert PERF_EVENT_FLAG_ARCH does not overlap with generic flags
Posted by Anshuman Khandual 3 years, 7 months ago
This just ensures that PERF_EVENT_FLAG_ARCH does not overlap with generic
hardware event flags.

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-perf-users@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 include/linux/perf_event.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 3f51fbf4a595..10e23a0f9db0 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -140,6 +140,8 @@ struct hw_perf_event_extra {
 #define PERF_EVENT_FLAG_ARCH			0x000fffff
 #define PERF_EVENT_FLAG_USER_READ_CNT		0x80000000
 
+static_assert((PERF_EVENT_FLAG_USER_READ_CNT & PERF_EVENT_FLAG_ARCH) == 0);
+
 /**
  * struct hw_perf_event - performance event hardware details:
  */
-- 
2.25.1
[tip: perf/core] perf/core: Assert PERF_EVENT_FLAG_ARCH does not overlap with generic flags
Posted by tip-bot2 for Anshuman Khandual 3 years, 6 months ago
The following commit has been merged into the perf/core branch of tip:

Commit-ID:     f67dd218fafd9de9a13d095e775b621db76a058f
Gitweb:        https://git.kernel.org/tip/f67dd218fafd9de9a13d095e775b621db76a058f
Author:        Anshuman Khandual <anshuman.khandual@arm.com>
AuthorDate:    Wed, 07 Sep 2022 14:49:22 +05:30
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 07 Sep 2022 21:54:00 +02:00

perf/core: Assert PERF_EVENT_FLAG_ARCH does not overlap with generic flags

This just ensures that PERF_EVENT_FLAG_ARCH does not overlap with generic
hardware event flags.

Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: James Clark <james.clark@arm.com>
Link: https://lkml.kernel.org/r/20220907091924.439193-3-anshuman.khandual@arm.com
---
 include/linux/perf_event.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 3e3c075..f88cb31 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -141,6 +141,8 @@ struct hw_perf_event_extra {
 #define PERF_EVENT_FLAG_ARCH			0x000fffff
 #define PERF_EVENT_FLAG_USER_READ_CNT		0x80000000
 
+static_assert((PERF_EVENT_FLAG_USER_READ_CNT & PERF_EVENT_FLAG_ARCH) == 0);
+
 /**
  * struct hw_perf_event - performance event hardware details:
  */