[PATCH V2 5/6] tools headers UAPI: Sync include/uapi/linux/perf_event.h header with the kernel

From: kan . liang
Date: Mon May 22 2023 - 07:31:41 EST


From: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>

Sync the new sample type and extension bit for the branch event feature.

Reviewed-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Signed-off-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
---

Changes since V1:
- Rename to PERF_SAMPLE_BRANCH_EVT_CNTRS
- Drop the event ID sample type
- Add extension bit

tools/include/uapi/linux/perf_event.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h
index 37675437b768..3911cf000e8a 100644
--- a/tools/include/uapi/linux/perf_event.h
+++ b/tools/include/uapi/linux/perf_event.h
@@ -204,6 +204,8 @@ enum perf_branch_sample_type_shift {

PERF_SAMPLE_BRANCH_PRIV_SAVE_SHIFT = 18, /* save privilege mode */

+ PERF_SAMPLE_BRANCH_EVT_CNTRS_SHIFT = 19, /* save occurrences of events on a branch */
+
PERF_SAMPLE_BRANCH_MAX_SHIFT /* non-ABI */
};

@@ -235,6 +237,8 @@ enum perf_branch_sample_type {

PERF_SAMPLE_BRANCH_PRIV_SAVE = 1U << PERF_SAMPLE_BRANCH_PRIV_SAVE_SHIFT,

+ PERF_SAMPLE_BRANCH_EVT_CNTRS = 1U << PERF_SAMPLE_BRANCH_EVT_CNTRS_SHIFT,
+
PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT,
};

@@ -1410,6 +1414,7 @@ union perf_mem_data_src {
* cycles: cycles from last branch (or 0 if not supported)
* type: branch type
* spec: branch speculation info (or 0 if not supported)
+ * ext: has extension space for extra info (or 0 if not supported)
*/
struct perf_branch_entry {
__u64 from;
@@ -1423,7 +1428,8 @@ struct perf_branch_entry {
spec:2, /* branch speculation info */
new_type:4, /* additional branch type */
priv:3, /* privilege level */
- reserved:31;
+ ext:1, /* has extension */
+ reserved:30;
};

union perf_sample_weight {
--
2.35.1