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

From: Anshuman Khandual
Date: Wed Sep 07 2022 - 05:19:51 EST


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

Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Mark Rutland <mark.rutland@xxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: linux-perf-users@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Reviewed-by: James Clark <james.clark@xxxxxxx>
Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
---
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