From 4e095bbe903c77ca184772fa0a05e4149c3b5c41 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 17:09:29 +0000 Subject: [PATCH 01/22] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index d0d3d7c..679bc06 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -12,7 +12,7 @@ Name: libpfm Version: 4.11.0 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Library to encode performance events for use by perf tool @@ -126,6 +126,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Thu Jan 19 2023 Fedora Release Engineering - 4.11.0-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Thu Jul 21 2022 Fedora Release Engineering - 4.11.0-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From a5d81468548000cb31c6587323494f8870efcb06 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 14 Mar 2023 10:52:30 -0400 Subject: [PATCH 02/22] Add libpfm upstream patch to allow papi-7.0.1 to build. --- libpfm-kernel518.patch | 266 +++++++++++++++++++++++++++++++++++++++++ libpfm.spec | 7 +- 2 files changed, 272 insertions(+), 1 deletion(-) create mode 100644 libpfm-kernel518.patch diff --git a/libpfm-kernel518.patch b/libpfm-kernel518.patch new file mode 100644 index 0000000..67cc260 --- /dev/null +++ b/libpfm-kernel518.patch @@ -0,0 +1,266 @@ +commit 8c606bc2f2d186c2797d9f013283c9150f594f93 +Author: Masahiko, Yamada +Date: Tue Sep 20 14:04:31 2022 +0900 + + update perf_event.h to Linux 5.18 + + The perf_events interface for directly accessing PMU registers + from userspace for arm64 has been formally implemented in the + kernel v5.18. + + Update perf_event.h header used to build perf_event based examples. + + Signed-off-by: Masahiko Yamada + +diff --git a/include/perfmon/perf_event.h b/include/perfmon/perf_event.h +index 81e02a2..a3bbb14 100644 +--- a/include/perfmon/perf_event.h ++++ b/include/perfmon/perf_event.h +@@ -143,7 +143,12 @@ enum perf_event_sample_format { + PERF_SAMPLE_TRANSACTION = 1U << 17, + PERF_SAMPLE_REGS_INTR = 1U << 18, + PERF_SAMPLE_PHYS_ADDR = 1U << 19, +- PERF_SAMPLE_MAX = 1U << 19, ++ PERF_SAMPLE_AUX = 1U << 20, ++ PERF_SAMPLE_CGROUP = 1U << 21, ++ PERF_SAMPLE_DATA_PAGE_SIZE = 1U << 22, ++ PERF_SAMPLE_CODE_PAGE_SIZE = 1U << 23, ++ PERF_SAMPLE_WEIGHT_STRUCT = 1U << 24, ++ PERF_SAMPLE_MAX = 1U << 25, + }; + enum { + PERF_TXN_ELISION = (1 << 0), +@@ -180,6 +185,7 @@ enum perf_branch_sample_type_shift { + PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 14, + PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 15, + PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16, ++ PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 17, + + PERF_SAMPLE_BRANCH_MAX_SHIFT /* non-ABI */ + }; +@@ -204,6 +210,7 @@ enum perf_branch_sample_type { + PERF_SAMPLE_BRANCH_NO_FLAGS = 1U << PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT, + PERF_SAMPLE_BRANCH_NO_CYCLES = 1U << PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT, + PERF_SAMPLE_BRANCH_TYPE_SAVE = 1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT, ++ PERF_SAMPLE_BRANCH_HW_INDEX = 1U << PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT, + + PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT, + }; +@@ -232,6 +239,8 @@ enum perf_event_read_format { + /* add: sample_stack_user */ + #define PERF_ATTR_SIZE_VER4 104 /* add: sample_regs_intr */ + #define PERF_ATTR_SIZE_VER5 112 /* add: aux_watermark */ ++#define PERF_ATTR_SIZE_VER6 120 /* add: aux_sample_size */ ++#define PERF_ATTR_SIZE_VER7 128 /* add: sig_data */ + + + /* +@@ -289,7 +298,16 @@ typedef struct perf_event_attr { + context_switch : 1, + write_backward : 1, + namespaces : 1, +- __reserved_1 : 35; ++ ksymbol : 1, ++ bpf_event : 1, ++ aux_output : 1, ++ cgroup : 1, ++ text_poke : 1, ++ build_id : 1, ++ inherit_thread : 1, ++ remove_on_exec : 1, ++ sigtrap : 1, ++ __reserved_1 : 26; + + union { + uint32_t wakeup_events; +@@ -311,7 +329,11 @@ typedef struct perf_event_attr { + int32_t clockid; + uint64_t sample_regs_intr; + uint32_t aux_watermark; +- uint32_t __reserved_2; ++ uint16_t sample_max_stack; ++ uint16_t __reserved_2; ++ uint32_t aux_sample_size; ++ uint32_t __reserved_3; ++ uint64_t sig_data; + } perf_event_attr_t; + + struct perf_branch_entry { +@@ -340,19 +362,32 @@ struct perf_branch_stack { + struct perf_branch_entry entries[0]; + }; + ++/* ++ * Structure used by below PERF_EVENT_IOC_QUERY_BPF command ++ * to query bpf programs attached to the same perf tracepoint ++ * as the given perf event. ++ */ ++struct perf_event_query_bpf { ++ uint32_t ids_len; ++ uint32_t prog_cnt; ++ uint32_t ids[0]; ++}; ++ + /* + * perf_events ioctl commands, use with event fd + */ +-#define PERF_EVENT_IOC_ENABLE _IO ('$', 0) +-#define PERF_EVENT_IOC_DISABLE _IO ('$', 1) +-#define PERF_EVENT_IOC_REFRESH _IO ('$', 2) +-#define PERF_EVENT_IOC_RESET _IO ('$', 3) +-#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, uint64_t) +-#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) +-#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) +-#define PERF_EVENT_IOC_ID _IOR('$', 7, uint64_t *) +-#define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, uint32_t) +-#define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) ++#define PERF_EVENT_IOC_ENABLE _IO ('$', 0) ++#define PERF_EVENT_IOC_DISABLE _IO ('$', 1) ++#define PERF_EVENT_IOC_REFRESH _IO ('$', 2) ++#define PERF_EVENT_IOC_RESET _IO ('$', 3) ++#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, uint64_t) ++#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) ++#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) ++#define PERF_EVENT_IOC_ID _IOR('$', 7, uint64_t *) ++#define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, uint32_t) ++#define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) ++#define PERF_EVENT_IOC_QUERY_BPF _IOWR('$', 10, struct perf_event_query_bpf *) ++#define PERF_EVENT_IOC_MODIFY_ATTRIBUTES _IOW('$', 11, struct perf_event_attr *) + + /* + * ioctl() 3rd argument +@@ -381,7 +416,8 @@ struct perf_event_mmap_page { + cap_usr_rdpmc:1, + cap_user_time:1, + cap_user_time_zero:1, +- cap_____res:59; ++ cap_user_time_short:1, ++ cap_____res:58; + } SWIG_NAME(rdmap_cap_s); + } SWIG_NAME(rdmap_cap_u); + uint16_t pmc_width; +@@ -391,7 +427,10 @@ struct perf_event_mmap_page { + + uint64_t time_zero; + uint32_t size; +- uint8_t __reserved[118*8+4]; ++ uint32_t __reserved_1; ++ uint64_t time_cycles; ++ uint64_t time_mask; ++ uint8_t __reserved[116*8]; + + uint64_t data_head; + uint64_t data_tail; +@@ -450,9 +489,38 @@ enum perf_event_type { + PERF_RECORD_SWITCH = 14, + PERF_RECORD_SWITCH_CPU_WIDE = 15, + PERF_RECORD_NAMESPACES = 16, ++ PERF_RECORD_KSYMBOL = 17, ++ PERF_RECORD_BPF_EVENT = 18, ++ PERF_RECORD_CGROUP = 19, ++ PERF_RECORD_TEXT_POKE = 20, ++ PERF_RECORD_AUX_OUTPUT_HW_ID = 21, + PERF_RECORD_MAX + }; + ++enum perf_record_ksymbol_type { ++ PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0, ++ PERF_RECORD_KSYMBOL_TYPE_BPF = 1, ++ /* ++ * Out of line code such as kprobe-replaced instructions or optimized ++ * kprobes or ftrace trampolines. ++ */ ++ PERF_RECORD_KSYMBOL_TYPE_OOL = 2, ++ PERF_RECORD_KSYMBOL_TYPE_MAX /* non-ABI */ ++}; ++ ++#define PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER (1 << 0) ++ ++enum perf_bpf_event_type { ++ PERF_BPF_EVENT_UNKNOWN = 0, ++ PERF_BPF_EVENT_PROG_LOAD = 1, ++ PERF_BPF_EVENT_PROG_UNLOAD = 2, ++ PERF_BPF_EVENT_MAX, /* non-ABI */ ++}; ++ ++#define PERF_MAX_STACK_DEPTH 127 ++#define PERF_MAX_CONTEXTS_PER_STACK 8 ++ ++ + enum perf_callchain_context { + PERF_CONTEXT_HV = (uint64_t)-32, + PERF_CONTEXT_KERNEL = (uint64_t)-128, +@@ -465,8 +533,16 @@ enum perf_callchain_context { + PERF_CONTEXT_MAX = (uint64_t)-4095, + }; + +-#define PERF_AUX_FLAG_TRUNCATED 0x01 +-#define PERF_AUX_FLAG_OVERWRITE 0x02 ++#define PERF_AUX_FLAG_TRUNCATED 0x01 ++#define PERF_AUX_FLAG_OVERWRITE 0x02 ++#define PERF_AUX_FLAG_PARTIAL 0x04 ++#define PERF_AUX_FLAG_COLLISION 0x08 ++#define PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK 0xff00 ++ ++/* CoreSight PMU AUX buffer formats */ ++#define PERF_AUX_FLAG_CORESIGHT_FORMAT_CORESIGHT 0x0000 ++#define PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW 0x0100 ++ + + /* + * flags for perf_event_open() +@@ -544,12 +620,17 @@ perf_event_open( + union perf_mem_data_src { + uint64_t val; + struct { +- uint64_t mem_op:5, /* type of opcode */ +- mem_lvl:14, /* memory hierarchy level */ +- mem_snoop:5, /* snoop mode */ +- mem_lock:2, /* lock instr */ +- mem_dtlb:7, /* tlb access */ +- mem_rsvd:31; ++ uint64_t mem_op:5, /* type of opcode */ ++ mem_lvl:14, /* memory hierarchy level */ ++ mem_snoop:5, /* snoop mode */ ++ mem_lock:2, /* lock instr */ ++ mem_dtlb:7, /* tlb access */ ++ mem_lvl_num:4, /* memory hierarchy level number */ ++ mem_remote:1, /* remote */ ++ mem_snoopx:2, /* snoop mode, ext */ ++ mem_blk:3, /* access blocked */ ++ mem_hops:3, /* hop level */ ++ mem_rsvd:18; + }; + }; + +@@ -590,7 +671,8 @@ union perf_mem_data_src { + #define PERF_MEM_SNOOP_SHIFT 19 + + #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ +-#define PERF_MEM_SNOOPX_SHIFT 37 ++/* 1 free */ ++#define PERF_MEM_SNOOPX_SHIFT 38 + + /* locked instruction */ + #define PERF_MEM_LOCK_NA 0x01 /* not available */ +@@ -607,6 +689,20 @@ union perf_mem_data_src { + #define PERF_MEM_TLB_OS 0x40 /* OS fault handler */ + #define PERF_MEM_TLB_SHIFT 26 + ++/* Access blocked */ ++#define PERF_MEM_BLK_NA 0x01 /* not available */ ++#define PERF_MEM_BLK_DATA 0x02 /* data could not be forwarded */ ++#define PERF_MEM_BLK_ADDR 0x04 /* address conflict */ ++#define PERF_MEM_BLK_SHIFT 40 ++ ++/* hop level */ ++#define PERF_MEM_HOPS_0 0x01 /* remote core, same node */ ++#define PERF_MEM_HOPS_1 0x02 /* remote node, same socket */ ++#define PERF_MEM_HOPS_2 0x03 /* remote socket, same board */ ++#define PERF_MEM_HOPS_3 0x04 /* remote board */ ++/* 5-7 available */ ++#define PERF_MEM_HOPS_SHIFT 43 ++ + #define PERF_MEM_S(a, s) \ + (((u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT) + diff --git a/libpfm.spec b/libpfm.spec index 679bc06..bb1fa70 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -12,7 +12,7 @@ Name: libpfm Version: 4.11.0 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Library to encode performance events for use by perf tool @@ -21,6 +21,7 @@ URL: http://perfmon2.sourceforge.net/ Source0: http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz Patch2: libpfm-python3-setup.patch Patch3: libpfm-gcc12.patch +Patch4: libpfm-kernel518.patch BuildRequires: make BuildRequires: gcc @@ -73,6 +74,7 @@ Python bindings for libpfm4 and perf_event_open system call. %setup -q %patch2 -p1 -b .python3 %patch3 -p1 -b .gcc12 +%patch4 -p1 -b .kernel518 %build %if %{with python} @@ -126,6 +128,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Tue Mar 14 2023 William Cohen - 4.11.0-12 +- Add libpfm upstream patch to allow papi-7.0.1 to build. + * Thu Jan 19 2023 Fedora Release Engineering - 4.11.0-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From face84c751eeb8488ba37dd603eda6294104f5c9 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 28 Mar 2023 23:31:46 -0400 Subject: [PATCH 03/22] Rebase on libpfm-4.13.0. --- .gitignore | 1 + libpfm-gcc12.patch | 89 -------------- libpfm-kernel518.patch | 266 ----------------------------------------- libpfm.spec | 11 +- sources | 2 +- 5 files changed, 7 insertions(+), 362 deletions(-) delete mode 100644 libpfm-gcc12.patch delete mode 100644 libpfm-kernel518.patch diff --git a/.gitignore b/.gitignore index df137f8..0f753c1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ /libpfm-4.10.0.tar.gz /libpfm-4.10.1.tar.gz /libpfm-4.11.0.tar.gz +/libpfm-4.13.0.tar.gz diff --git a/libpfm-gcc12.patch b/libpfm-gcc12.patch deleted file mode 100644 index af3bf2c..0000000 --- a/libpfm-gcc12.patch +++ /dev/null @@ -1,89 +0,0 @@ -commit a7b26272d8327ad1c001456a18518a0ac65dc2bb -Author: Stephane Eranian -Date: Wed Jun 8 06:55:36 2022 -0700 - - avoid GCC-12 use-after-free warnings - - gcc-12 seems to complain about bogus use-after-free situations in the - libpfm4 code: - - p = realloc(q, ...) - if (!p) - return NULL - - s = p + (q - z) - - It complains because of the use of q after realloc in this case. - Yet q - z is just pointer artihmetic and is not dereferencing any - memory through the pointer q which may have been freed by realloc. - - Fix is to pre-computer the delta before realloc to avoid using the - pointer after the call. - - Reported-by: Vitaly Chikunov - Signed-off-by: Stephane Eranian - -diff --git a/lib/pfmlib_perf_event_pmu.c b/lib/pfmlib_perf_event_pmu.c -index c3386aa..637c5b1 100644 ---- a/lib/pfmlib_perf_event_pmu.c -+++ b/lib/pfmlib_perf_event_pmu.c -@@ -268,6 +268,7 @@ perf_table_alloc_event(void) - perf_table_alloc_event(void) - { - perf_event_t *new_pe; -+ size_t num_free; - - retry: - if (perf_pe_free < perf_pe_end) -@@ -286,11 +287,20 @@ retry: - - perf_pe_count += PERF_ALLOC_EVENT_COUNT; - -+ /* -+ * compute number of free events left -+ * before realloc() to avoid compiler warning (use-after-free) -+ * even though we are simply doing pointer arithmetic and not -+ * dereferencing the perf_pe after realloc when it may be stale -+ * in case the memory was moved. -+ */ -+ num_free = perf_pe_free - perf_pe; -+ - new_pe = realloc(perf_pe, perf_pe_count * sizeof(perf_event_t)); - if (!new_pe) - return NULL; - -- perf_pe_free = new_pe + (perf_pe_free - perf_pe); -+ perf_pe_free = new_pe + num_free; - perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT; - perf_pe = new_pe; - -@@ -315,18 +325,27 @@ static perf_umask_t * - perf_table_alloc_umask(void) - { - perf_umask_t *new_um; -+ size_t num_free; - - retry: - if (perf_um_free < perf_um_end) - return perf_um_free++; - - perf_um_count += PERF_ALLOC_UMASK_COUNT; -- -+ -+ /* -+ * compute number of free unmasks left -+ * before realloc() to avoid compiler warning (use-after-free) -+ * even though we are simply doing pointer arithmetic and not -+ * dereferencing the perf_um after realloc when it may be stale -+ * in case the memory was moved. -+ */ -+ num_free = perf_um_free - perf_um; - new_um = realloc(perf_um, perf_um_count * sizeof(*new_um)); - if (!new_um) - return NULL; - -- perf_um_free = new_um + (perf_um_free - perf_um); -+ perf_um_free = new_um + num_free; - perf_um_end = perf_um_free + PERF_ALLOC_UMASK_COUNT; - perf_um = new_um; - diff --git a/libpfm-kernel518.patch b/libpfm-kernel518.patch deleted file mode 100644 index 67cc260..0000000 --- a/libpfm-kernel518.patch +++ /dev/null @@ -1,266 +0,0 @@ -commit 8c606bc2f2d186c2797d9f013283c9150f594f93 -Author: Masahiko, Yamada -Date: Tue Sep 20 14:04:31 2022 +0900 - - update perf_event.h to Linux 5.18 - - The perf_events interface for directly accessing PMU registers - from userspace for arm64 has been formally implemented in the - kernel v5.18. - - Update perf_event.h header used to build perf_event based examples. - - Signed-off-by: Masahiko Yamada - -diff --git a/include/perfmon/perf_event.h b/include/perfmon/perf_event.h -index 81e02a2..a3bbb14 100644 ---- a/include/perfmon/perf_event.h -+++ b/include/perfmon/perf_event.h -@@ -143,7 +143,12 @@ enum perf_event_sample_format { - PERF_SAMPLE_TRANSACTION = 1U << 17, - PERF_SAMPLE_REGS_INTR = 1U << 18, - PERF_SAMPLE_PHYS_ADDR = 1U << 19, -- PERF_SAMPLE_MAX = 1U << 19, -+ PERF_SAMPLE_AUX = 1U << 20, -+ PERF_SAMPLE_CGROUP = 1U << 21, -+ PERF_SAMPLE_DATA_PAGE_SIZE = 1U << 22, -+ PERF_SAMPLE_CODE_PAGE_SIZE = 1U << 23, -+ PERF_SAMPLE_WEIGHT_STRUCT = 1U << 24, -+ PERF_SAMPLE_MAX = 1U << 25, - }; - enum { - PERF_TXN_ELISION = (1 << 0), -@@ -180,6 +185,7 @@ enum perf_branch_sample_type_shift { - PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 14, - PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 15, - PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16, -+ PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 17, - - PERF_SAMPLE_BRANCH_MAX_SHIFT /* non-ABI */ - }; -@@ -204,6 +210,7 @@ enum perf_branch_sample_type { - PERF_SAMPLE_BRANCH_NO_FLAGS = 1U << PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT, - PERF_SAMPLE_BRANCH_NO_CYCLES = 1U << PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT, - PERF_SAMPLE_BRANCH_TYPE_SAVE = 1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT, -+ PERF_SAMPLE_BRANCH_HW_INDEX = 1U << PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT, - - PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT, - }; -@@ -232,6 +239,8 @@ enum perf_event_read_format { - /* add: sample_stack_user */ - #define PERF_ATTR_SIZE_VER4 104 /* add: sample_regs_intr */ - #define PERF_ATTR_SIZE_VER5 112 /* add: aux_watermark */ -+#define PERF_ATTR_SIZE_VER6 120 /* add: aux_sample_size */ -+#define PERF_ATTR_SIZE_VER7 128 /* add: sig_data */ - - - /* -@@ -289,7 +298,16 @@ typedef struct perf_event_attr { - context_switch : 1, - write_backward : 1, - namespaces : 1, -- __reserved_1 : 35; -+ ksymbol : 1, -+ bpf_event : 1, -+ aux_output : 1, -+ cgroup : 1, -+ text_poke : 1, -+ build_id : 1, -+ inherit_thread : 1, -+ remove_on_exec : 1, -+ sigtrap : 1, -+ __reserved_1 : 26; - - union { - uint32_t wakeup_events; -@@ -311,7 +329,11 @@ typedef struct perf_event_attr { - int32_t clockid; - uint64_t sample_regs_intr; - uint32_t aux_watermark; -- uint32_t __reserved_2; -+ uint16_t sample_max_stack; -+ uint16_t __reserved_2; -+ uint32_t aux_sample_size; -+ uint32_t __reserved_3; -+ uint64_t sig_data; - } perf_event_attr_t; - - struct perf_branch_entry { -@@ -340,19 +362,32 @@ struct perf_branch_stack { - struct perf_branch_entry entries[0]; - }; - -+/* -+ * Structure used by below PERF_EVENT_IOC_QUERY_BPF command -+ * to query bpf programs attached to the same perf tracepoint -+ * as the given perf event. -+ */ -+struct perf_event_query_bpf { -+ uint32_t ids_len; -+ uint32_t prog_cnt; -+ uint32_t ids[0]; -+}; -+ - /* - * perf_events ioctl commands, use with event fd - */ --#define PERF_EVENT_IOC_ENABLE _IO ('$', 0) --#define PERF_EVENT_IOC_DISABLE _IO ('$', 1) --#define PERF_EVENT_IOC_REFRESH _IO ('$', 2) --#define PERF_EVENT_IOC_RESET _IO ('$', 3) --#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, uint64_t) --#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) --#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) --#define PERF_EVENT_IOC_ID _IOR('$', 7, uint64_t *) --#define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, uint32_t) --#define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) -+#define PERF_EVENT_IOC_ENABLE _IO ('$', 0) -+#define PERF_EVENT_IOC_DISABLE _IO ('$', 1) -+#define PERF_EVENT_IOC_REFRESH _IO ('$', 2) -+#define PERF_EVENT_IOC_RESET _IO ('$', 3) -+#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, uint64_t) -+#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) -+#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) -+#define PERF_EVENT_IOC_ID _IOR('$', 7, uint64_t *) -+#define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, uint32_t) -+#define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) -+#define PERF_EVENT_IOC_QUERY_BPF _IOWR('$', 10, struct perf_event_query_bpf *) -+#define PERF_EVENT_IOC_MODIFY_ATTRIBUTES _IOW('$', 11, struct perf_event_attr *) - - /* - * ioctl() 3rd argument -@@ -381,7 +416,8 @@ struct perf_event_mmap_page { - cap_usr_rdpmc:1, - cap_user_time:1, - cap_user_time_zero:1, -- cap_____res:59; -+ cap_user_time_short:1, -+ cap_____res:58; - } SWIG_NAME(rdmap_cap_s); - } SWIG_NAME(rdmap_cap_u); - uint16_t pmc_width; -@@ -391,7 +427,10 @@ struct perf_event_mmap_page { - - uint64_t time_zero; - uint32_t size; -- uint8_t __reserved[118*8+4]; -+ uint32_t __reserved_1; -+ uint64_t time_cycles; -+ uint64_t time_mask; -+ uint8_t __reserved[116*8]; - - uint64_t data_head; - uint64_t data_tail; -@@ -450,9 +489,38 @@ enum perf_event_type { - PERF_RECORD_SWITCH = 14, - PERF_RECORD_SWITCH_CPU_WIDE = 15, - PERF_RECORD_NAMESPACES = 16, -+ PERF_RECORD_KSYMBOL = 17, -+ PERF_RECORD_BPF_EVENT = 18, -+ PERF_RECORD_CGROUP = 19, -+ PERF_RECORD_TEXT_POKE = 20, -+ PERF_RECORD_AUX_OUTPUT_HW_ID = 21, - PERF_RECORD_MAX - }; - -+enum perf_record_ksymbol_type { -+ PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0, -+ PERF_RECORD_KSYMBOL_TYPE_BPF = 1, -+ /* -+ * Out of line code such as kprobe-replaced instructions or optimized -+ * kprobes or ftrace trampolines. -+ */ -+ PERF_RECORD_KSYMBOL_TYPE_OOL = 2, -+ PERF_RECORD_KSYMBOL_TYPE_MAX /* non-ABI */ -+}; -+ -+#define PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER (1 << 0) -+ -+enum perf_bpf_event_type { -+ PERF_BPF_EVENT_UNKNOWN = 0, -+ PERF_BPF_EVENT_PROG_LOAD = 1, -+ PERF_BPF_EVENT_PROG_UNLOAD = 2, -+ PERF_BPF_EVENT_MAX, /* non-ABI */ -+}; -+ -+#define PERF_MAX_STACK_DEPTH 127 -+#define PERF_MAX_CONTEXTS_PER_STACK 8 -+ -+ - enum perf_callchain_context { - PERF_CONTEXT_HV = (uint64_t)-32, - PERF_CONTEXT_KERNEL = (uint64_t)-128, -@@ -465,8 +533,16 @@ enum perf_callchain_context { - PERF_CONTEXT_MAX = (uint64_t)-4095, - }; - --#define PERF_AUX_FLAG_TRUNCATED 0x01 --#define PERF_AUX_FLAG_OVERWRITE 0x02 -+#define PERF_AUX_FLAG_TRUNCATED 0x01 -+#define PERF_AUX_FLAG_OVERWRITE 0x02 -+#define PERF_AUX_FLAG_PARTIAL 0x04 -+#define PERF_AUX_FLAG_COLLISION 0x08 -+#define PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK 0xff00 -+ -+/* CoreSight PMU AUX buffer formats */ -+#define PERF_AUX_FLAG_CORESIGHT_FORMAT_CORESIGHT 0x0000 -+#define PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW 0x0100 -+ - - /* - * flags for perf_event_open() -@@ -544,12 +620,17 @@ perf_event_open( - union perf_mem_data_src { - uint64_t val; - struct { -- uint64_t mem_op:5, /* type of opcode */ -- mem_lvl:14, /* memory hierarchy level */ -- mem_snoop:5, /* snoop mode */ -- mem_lock:2, /* lock instr */ -- mem_dtlb:7, /* tlb access */ -- mem_rsvd:31; -+ uint64_t mem_op:5, /* type of opcode */ -+ mem_lvl:14, /* memory hierarchy level */ -+ mem_snoop:5, /* snoop mode */ -+ mem_lock:2, /* lock instr */ -+ mem_dtlb:7, /* tlb access */ -+ mem_lvl_num:4, /* memory hierarchy level number */ -+ mem_remote:1, /* remote */ -+ mem_snoopx:2, /* snoop mode, ext */ -+ mem_blk:3, /* access blocked */ -+ mem_hops:3, /* hop level */ -+ mem_rsvd:18; - }; - }; - -@@ -590,7 +671,8 @@ union perf_mem_data_src { - #define PERF_MEM_SNOOP_SHIFT 19 - - #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ --#define PERF_MEM_SNOOPX_SHIFT 37 -+/* 1 free */ -+#define PERF_MEM_SNOOPX_SHIFT 38 - - /* locked instruction */ - #define PERF_MEM_LOCK_NA 0x01 /* not available */ -@@ -607,6 +689,20 @@ union perf_mem_data_src { - #define PERF_MEM_TLB_OS 0x40 /* OS fault handler */ - #define PERF_MEM_TLB_SHIFT 26 - -+/* Access blocked */ -+#define PERF_MEM_BLK_NA 0x01 /* not available */ -+#define PERF_MEM_BLK_DATA 0x02 /* data could not be forwarded */ -+#define PERF_MEM_BLK_ADDR 0x04 /* address conflict */ -+#define PERF_MEM_BLK_SHIFT 40 -+ -+/* hop level */ -+#define PERF_MEM_HOPS_0 0x01 /* remote core, same node */ -+#define PERF_MEM_HOPS_1 0x02 /* remote node, same socket */ -+#define PERF_MEM_HOPS_2 0x03 /* remote socket, same board */ -+#define PERF_MEM_HOPS_3 0x04 /* remote board */ -+/* 5-7 available */ -+#define PERF_MEM_HOPS_SHIFT 43 -+ - #define PERF_MEM_S(a, s) \ - (((u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT) - diff --git a/libpfm.spec b/libpfm.spec index bb1fa70..8d6e2c4 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -11,8 +11,8 @@ %endif Name: libpfm -Version: 4.11.0 -Release: 12%{?dist} +Version: 4.13.0 +Release: 1%{?dist} Summary: Library to encode performance events for use by perf tool @@ -20,8 +20,6 @@ License: MIT URL: http://perfmon2.sourceforge.net/ Source0: http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz Patch2: libpfm-python3-setup.patch -Patch3: libpfm-gcc12.patch -Patch4: libpfm-kernel518.patch BuildRequires: make BuildRequires: gcc @@ -73,8 +71,6 @@ Python bindings for libpfm4 and perf_event_open system call. %prep %setup -q %patch2 -p1 -b .python3 -%patch3 -p1 -b .gcc12 -%patch4 -p1 -b .kernel518 %build %if %{with python} @@ -128,6 +124,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Tue Mar 28 2023 William Cohen - 4.13.0-1 +- Rebase on libpfm-4.13.0. + * Tue Mar 14 2023 William Cohen - 4.11.0-12 - Add libpfm upstream patch to allow papi-7.0.1 to build. diff --git a/sources b/sources index 3d5afdf..b2d4ea3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libpfm-4.11.0.tar.gz) = 633035b8a7b35973437572095cdc80d422b2a1a61e74e14f106db95fa8e44e4518e591699cc457f828b8f2fb63f60eef6d0c7535c6b4c9a6c3a70d4550b3c3c7 +SHA512 (libpfm-4.13.0.tar.gz) = e61b210aa2ce80f0e47603c88eee2e4f2fe30ca2c0e194a5472b6a8de3bf9dc1085e5261bbb9ddbe5b6531c4b391fb34f20d038e5ebd8e6f4c14c2112aee508f From 0f9c88b81f951d126ac2c53f7fdf24ca24c0d1ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 25 Apr 2023 14:13:18 +0200 Subject: [PATCH 04/22] Don't install a Python .egg Due to an upcoming deprecation of .eggs in pip, we'd like to avoid all Python .eggs in Fedora. setuptools forces installation of an .egg when --prefix is set without --root. To make this work, we set the make's DESTDIR variable rather than prefixing other values with it. To assert this works, we list the Python files explicitly, as required by https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_explicit_lists --- libpfm.spec | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/libpfm.spec b/libpfm.spec index 8d6e2c4..66d92f4 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -12,7 +12,7 @@ Name: libpfm Version: 4.13.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Library to encode performance events for use by perf tool @@ -71,6 +71,10 @@ Python bindings for libpfm4 and perf_event_open system call. %prep %setup -q %patch2 -p1 -b .python3 +# to prevent setuptools from installing an .egg, we need to pass --root to setup.py install +# see https://github.com/pypa/setuptools/issues/3143 +# and https://github.com/pypa/pip/issues/11501 +sed -i 's/--prefix=$(DESTDIR)$(PYTHON_PREFIX)/--root=$(DESTDIR) --prefix=$(PYTHON_PREFIX)/' python/Makefile %build %if %{with python} @@ -86,14 +90,15 @@ Python bindings for libpfm4 and perf_event_open system call. rm -rf $RPM_BUILD_ROOT %if %{with python} -%global python_config CONFIG_PFMLIB_NOPYTHON=n PYTHON_PREFIX=$RPM_BUILD_ROOT/%{python_prefix} +%global python_config CONFIG_PFMLIB_NOPYTHON=n PYTHON_PREFIX=%{python_prefix} %else %global python_config CONFIG_PFMLIB_NOPYTHON=y %endif make \ - PREFIX=$RPM_BUILD_ROOT%{_prefix} \ - LIBDIR=$RPM_BUILD_ROOT%{_libdir} \ + DESTDIR=$RPM_BUILD_ROOT \ + PREFIX=%{_prefix} \ + LIBDIR=%{_libdir} \ %{python_config} \ LDCONFIG=/bin/true \ install @@ -120,10 +125,14 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %if %{with python} %files -n python3-libpfm -%{python3_sitearch}/* +%{python3_sitearch}/perfmon-*.egg-info/ +%{python3_sitearch}/perfmon/ %endif %changelog +* Tue Apr 25 2023 Miro Hrončok - 4.13.0-2 +- Don't install a Python .egg + * Tue Mar 28 2023 William Cohen - 4.13.0-1 - Rebase on libpfm-4.13.0. From 2d5dcdf0e7fe33efea8e0da642fbd4f43a736751 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Tue, 13 Jun 2023 20:43:09 +0200 Subject: [PATCH 05/22] Rebuilt for Python 3.12 --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index 66d92f4..d806936 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -12,7 +12,7 @@ Name: libpfm Version: 4.13.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Library to encode performance events for use by perf tool @@ -130,6 +130,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Tue Jun 13 2023 Python Maint - 4.13.0-3 +- Rebuilt for Python 3.12 + * Tue Apr 25 2023 Miro Hrončok - 4.13.0-2 - Don't install a Python .egg From 22274b8db4c93af0f63611d8ba5ebb4f43466490 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jul 2023 11:45:57 +0000 Subject: [PATCH 06/22] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index d806936..baec9e3 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -12,7 +12,7 @@ Name: libpfm Version: 4.13.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Library to encode performance events for use by perf tool @@ -130,6 +130,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Thu Jul 20 2023 Fedora Release Engineering - 4.13.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Tue Jun 13 2023 Python Maint - 4.13.0-3 - Rebuilt for Python 3.12 From 109072acb0151a65f618f627957f23685d13f615 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 1 Aug 2023 09:48:34 -0400 Subject: [PATCH 07/22] migrated to SPDX license --- libpfm.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index baec9e3..0bb1e41 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -12,7 +12,7 @@ Name: libpfm Version: 4.13.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Library to encode performance events for use by perf tool @@ -37,6 +37,7 @@ kernels performance monitoring interfaces. The current version provides support for the perf_events interface available in upstream Linux kernels since v2.6.31. %package devel +License: MIT Summary: Development library to encode performance events for perf_events based tools Requires: %{name}%{?_isa} = %{version}-%{release} @@ -46,6 +47,7 @@ applications for the perf_events interface. %if %{with_static} %package static +License: MIT Summary: Static library to encode performance events for perf_events based tools Requires: %{name}%{?_isa} = %{version}-%{release} @@ -56,6 +58,7 @@ applications for the perf_events interface. %if %{with python} %package -n python3-libpfm +License: MIT AND LicenseRef-Fedora-UltraPermissive %{?python_provide:%python_provide python3-libpfm} # Remove before F30 Provides: %{name}-python = %{version}-%{release} @@ -130,6 +133,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Tue Aug 1 2023 William Cohen - 4.13.0-5 +- migrated to SPDX license + * Thu Jul 20 2023 Fedora Release Engineering - 4.13.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 0697d01219e46a0c4cf4b72aff06385fedf4e519 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 21 Jan 2024 05:00:03 +0000 Subject: [PATCH 08/22] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index 0bb1e41..51cd03a 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -12,7 +12,7 @@ Name: libpfm Version: 4.13.0 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Library to encode performance events for use by perf tool @@ -133,6 +133,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Sun Jan 21 2024 Fedora Release Engineering - 4.13.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Tue Aug 1 2023 William Cohen - 4.13.0-5 - migrated to SPDX license From 461c2dd0bd9a31f0f6e7c5755804e6f97a2354ef Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jan 2024 03:13:09 +0000 Subject: [PATCH 09/22] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index 51cd03a..699adb1 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -12,7 +12,7 @@ Name: libpfm Version: 4.13.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Library to encode performance events for use by perf tool @@ -133,6 +133,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Thu Jan 25 2024 Fedora Release Engineering - 4.13.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sun Jan 21 2024 Fedora Release Engineering - 4.13.0-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From dcb84740cd296a92ffc8598b7318faa6c457096a Mon Sep 17 00:00:00 2001 From: William Cohen Date: Mon, 29 Jan 2024 16:34:57 -0500 Subject: [PATCH 10/22] Fix gcc-14 -Werror=calloc-transposed-args compatibility --- libpfm-gcc14.patch | 21 +++++++++++++++++++++ libpfm.spec | 9 +++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 libpfm-gcc14.patch diff --git a/libpfm-gcc14.patch b/libpfm-gcc14.patch new file mode 100644 index 0000000..9f2a62d --- /dev/null +++ b/libpfm-gcc14.patch @@ -0,0 +1,21 @@ +commit cb944829e0940d74009e09b8985b4f2139f5cb3b +Author: William Cohen +Date: Mon Jan 29 16:23:43 2024 -0500 + + Correct s390x code to avoid GCC-14 -Werror=calloc-transposed-args errors + +diff --git a/lib/pfmlib_s390x_cpumf.c b/lib/pfmlib_s390x_cpumf.c +index d8ce22d..718f5f8 100644 +--- a/lib/pfmlib_s390x_cpumf.c ++++ b/lib/pfmlib_s390x_cpumf.c +@@ -216,8 +216,8 @@ static int pfm_cpumcf_init(void *this) + break; + } + +- cpumcf_pe = calloc(sizeof(*cpumcf_pe), +- cfvn_set_count + csvn_set_count + ext_set_count); ++ cpumcf_pe = calloc(cfvn_set_count + csvn_set_count + ext_set_count, ++ sizeof(*cpumcf_pe)); + if (cpumcf_pe == NULL) + return PFM_ERR_NOMEM; + diff --git a/libpfm.spec b/libpfm.spec index 699adb1..bd80765 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -12,7 +12,7 @@ Name: libpfm Version: 4.13.0 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Library to encode performance events for use by perf tool @@ -20,6 +20,7 @@ License: MIT URL: http://perfmon2.sourceforge.net/ Source0: http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz Patch2: libpfm-python3-setup.patch +Patch3: libpfm-gcc14.patch BuildRequires: make BuildRequires: gcc @@ -73,7 +74,8 @@ Python bindings for libpfm4 and perf_event_open system call. %prep %setup -q -%patch2 -p1 -b .python3 +%patch -P2 -p1 -b .python3 +%patch -P3 -p1 -b .gcc14 # to prevent setuptools from installing an .egg, we need to pass --root to setup.py install # see https://github.com/pypa/setuptools/issues/3143 # and https://github.com/pypa/pip/issues/11501 @@ -133,6 +135,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Mon Jan 29 2024 William Cohen - 4.13.0-8 +- Fix gcc-14 -Werror=calloc-transposed-args compatibility + * Thu Jan 25 2024 Fedora Release Engineering - 4.13.0-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From e8e4c2f2e9a0db1b35984de163068639facadb7c Mon Sep 17 00:00:00 2001 From: Michal Kolar Date: Fri, 2 Feb 2024 09:11:21 +0000 Subject: [PATCH 11/22] plans/ci.fmf: fix deprecated fmf plan attribute --- plans/ci.fmf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plans/ci.fmf b/plans/ci.fmf index 1ad2c12..3fd3ab7 100644 --- a/plans/ci.fmf +++ b/plans/ci.fmf @@ -1,6 +1,5 @@ summary: CI Gating Plan discover: how: fmf - directory: tests execute: - how: beakerlib + how: tmt From 5b33854516e671b5dcc693b4d4c4ed5b5ffbc303 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 23 Jan 2024 15:47:16 -0500 Subject: [PATCH 12/22] Modernize provides filter https://docs.fedoraproject.org/en-US/packaging-guidelines/AutoProvidesAndRequiresFiltering/ --- libpfm.spec | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libpfm.spec b/libpfm.spec index bd80765..093ff6e 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -4,10 +4,7 @@ %if %{with python} %define python_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %define python_prefix %(python3 -c "import sys; print (sys.prefix)") -%{?filter_setup: -%filter_provides_in %{python3_sitearch}/perfmon/.*\.so$ -%filter_setup -} +%global __provides_exclude_from ^%{python3_sitearch}/perfmon/.*\.so$ %endif Name: libpfm From 9c38e7ca4d14ddecd9137e45b475a3173de67b1b Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 7 Jun 2024 08:51:39 +0200 Subject: [PATCH 13/22] Rebuilt for Python 3.13 --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index 093ff6e..ebd1d73 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -9,7 +9,7 @@ Name: libpfm Version: 4.13.0 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Library to encode performance events for use by perf tool @@ -132,6 +132,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Fri Jun 07 2024 Python Maint - 4.13.0-9 +- Rebuilt for Python 3.13 + * Mon Jan 29 2024 William Cohen - 4.13.0-8 - Fix gcc-14 -Werror=calloc-transposed-args compatibility From d9915b348de8759e2a31690c755d23cb1882434a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 18 Jul 2024 14:46:25 +0000 Subject: [PATCH 14/22] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index ebd1d73..afcbc0d 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -9,7 +9,7 @@ Name: libpfm Version: 4.13.0 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Library to encode performance events for use by perf tool @@ -132,6 +132,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Thu Jul 18 2024 Fedora Release Engineering - 4.13.0-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Fri Jun 07 2024 Python Maint - 4.13.0-9 - Rebuilt for Python 3.13 From c9663bf9f8d06cf44a0a055ff1480f3b9448bef4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jan 2025 12:58:01 +0000 Subject: [PATCH 15/22] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index afcbc0d..10c14f9 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -9,7 +9,7 @@ Name: libpfm Version: 4.13.0 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Library to encode performance events for use by perf tool @@ -132,6 +132,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Fri Jan 17 2025 Fedora Release Engineering - 4.13.0-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Thu Jul 18 2024 Fedora Release Engineering - 4.13.0-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From fab74e854f1a6f0106eea0746fc92e568a8e3179 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Mon, 2 Jun 2025 20:26:21 +0200 Subject: [PATCH 16/22] Rebuilt for Python 3.14 --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index 10c14f9..d478b11 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -9,7 +9,7 @@ Name: libpfm Version: 4.13.0 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Library to encode performance events for use by perf tool @@ -132,6 +132,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Mon Jun 02 2025 Python Maint - 4.13.0-12 +- Rebuilt for Python 3.14 + * Fri Jan 17 2025 Fedora Release Engineering - 4.13.0-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 12330968afe4d47e389a8242296bb9634058bbef Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 20:10:36 +0000 Subject: [PATCH 17/22] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index d478b11..79bca51 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -9,7 +9,7 @@ Name: libpfm Version: 4.13.0 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Library to encode performance events for use by perf tool @@ -132,6 +132,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 4.13.0-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Mon Jun 02 2025 Python Maint - 4.13.0-12 - Rebuilt for Python 3.14 From 9b4205af69aa73b02e72726991365d5f870048d3 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 15 Aug 2025 12:56:39 +0200 Subject: [PATCH 18/22] Rebuilt for Python 3.14.0rc2 bytecode --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index 79bca51..fef78c1 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -9,7 +9,7 @@ Name: libpfm Version: 4.13.0 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Library to encode performance events for use by perf tool @@ -132,6 +132,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Fri Aug 15 2025 Python Maint - 4.13.0-14 +- Rebuilt for Python 3.14.0rc2 bytecode + * Thu Jul 24 2025 Fedora Release Engineering - 4.13.0-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From 91fced006a95ab85a5c30a572a81f870fc9b0f87 Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Mon, 25 Aug 2025 11:18:03 -0400 Subject: [PATCH 19/22] tests/runtest.sh: Fix path to tests Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2389127 --- tests/libpfm-testsuite/runtest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/libpfm-testsuite/runtest.sh b/tests/libpfm-testsuite/runtest.sh index 7c8e03d..a5997d6 100755 --- a/tests/libpfm-testsuite/runtest.sh +++ b/tests/libpfm-testsuite/runtest.sh @@ -55,7 +55,7 @@ rlJournalStart rlRun "yum-builddep -y $TmpDir/SPECS/*.spec" rlRun "su -c 'rpmbuild -D \"_topdir $TmpDir\" -bp $TmpDir/SPECS/*.spec &>$TmpDir/rpmbuild.log' $BUILD_USER" rlRun "rlFileSubmit $TmpDir/rpmbuild.log" - rlRun "cd $TmpDir/BUILD/libpfm-*/tests" + rlRun "cd \"$TmpDir\"/BUILD/libpfm-*-build/libpfm-*/tests 2>/dev/null || cd \"$TmpDir\"/BUILD/libpfm-*/tests" rlRun "su -c 'make PFMLIB=`rpm -ql libpfm | grep .so | head -n 1`' $BUILD_USER" rlRun "ldd validate | tee $TmpDir/ldd.log" rlRun "grep -q 'libpfm.so' $TmpDir/ldd.log" From 0bfaf1d1cb79cffd156b0ea7a73095c9eb07d2ff Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Mon, 25 Aug 2025 12:04:16 -0400 Subject: [PATCH 20/22] libpfm.spec: bump release number --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index fef78c1..409d65b 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -9,7 +9,7 @@ Name: libpfm Version: 4.13.0 -Release: 14%{?dist} +Release: 15%{?dist} Summary: Library to encode performance events for use by perf tool @@ -132,6 +132,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Mon Aug 25 2025 Aaron Merey - 4.13.0-15 +- Fix path in tests/runtest.sh + * Fri Aug 15 2025 Python Maint - 4.13.0-14 - Rebuilt for Python 3.14.0rc2 bytecode From 37780f084700403189de71ed0f73776008123bf3 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 19 Sep 2025 12:27:20 +0200 Subject: [PATCH 21/22] Rebuilt for Python 3.14.0rc3 bytecode --- libpfm.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpfm.spec b/libpfm.spec index 409d65b..f9fb838 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -9,7 +9,7 @@ Name: libpfm Version: 4.13.0 -Release: 15%{?dist} +Release: 16%{?dist} Summary: Library to encode performance events for use by perf tool @@ -132,6 +132,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Fri Sep 19 2025 Python Maint - 4.13.0-16 +- Rebuilt for Python 3.14.0rc3 bytecode + * Mon Aug 25 2025 Aaron Merey - 4.13.0-15 - Fix path in tests/runtest.sh From 7581f961126a36779ddff1aa5f81497a2fe1a7f7 Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Tue, 16 Dec 2025 10:55:52 -0500 Subject: [PATCH 22/22] Add libpfm-fix-const.patch --- libpfm-fix-const.patch | 59 ++++++++++++++++++++++++++++++++++++++++++ libpfm.spec | 7 ++++- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 libpfm-fix-const.patch diff --git a/libpfm-fix-const.patch b/libpfm-fix-const.patch new file mode 100644 index 0000000..b9a2308 --- /dev/null +++ b/libpfm-fix-const.patch @@ -0,0 +1,59 @@ +From ded148888c501c2e9d21c23263d7c09aed4b97d6 Mon Sep 17 00:00:00 2001 +From: Aaron Merey +Date: Fri, 19 Dec 2025 12:33:33 -0500 +Subject: [PATCH] fix discarded const warning on newer gcc + +--- + lib/pfmlib_common.c | 15 +++++++++------ + tests/validate_x86.c | 2 +- + 2 files changed, 10 insertions(+), 7 deletions(-) + +diff --git a/lib/pfmlib_common.c b/lib/pfmlib_common.c +index 44b5de4..59a7cff 100644 +--- a/lib/pfmlib_common.c ++++ b/lib/pfmlib_common.c +@@ -1625,12 +1625,6 @@ pfmlib_parse_event(const char *event, pfmlib_event_desc_t *d) + const char *pname = NULL; + int i, j, ret; + +- /* +- * support only one event at a time. +- */ +- p = strpbrk(event, PFMLIB_EVENT_DELIM); +- if (p) +- return PFM_ERR_INVAL; + /* + * create copy because string is const + */ +@@ -1638,6 +1632,15 @@ pfmlib_parse_event(const char *event, pfmlib_event_desc_t *d) + if (!str) + return PFM_ERR_NOMEM; + ++ /* ++ * support only one event at a time. ++ */ ++ p = strpbrk(s, PFMLIB_EVENT_DELIM); ++ if (p) { ++ free(s); ++ return PFM_ERR_INVAL; ++ } ++ + + /* check for optional PMU name */ + p = strstr(s, PFMLIB_PMU_DELIM); +diff --git a/tests/validate_x86.c b/tests/validate_x86.c +index 500a697..68a776d 100644 +--- a/tests/validate_x86.c ++++ b/tests/validate_x86.c +@@ -8018,7 +8018,7 @@ static int + check_pmu_supported(const char *evt) + { + pfm_pmu_info_t info; +- char *p; ++ const char *p; + int ret; + pfm_pmu_t i; + +-- +2.52.0 + diff --git a/libpfm.spec b/libpfm.spec index f9fb838..d7384ca 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -9,13 +9,14 @@ Name: libpfm Version: 4.13.0 -Release: 16%{?dist} +Release: 17%{?dist} Summary: Library to encode performance events for use by perf tool License: MIT URL: http://perfmon2.sourceforge.net/ Source0: http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz +Patch1: libpfm-fix-const.patch Patch2: libpfm-python3-setup.patch Patch3: libpfm-gcc14.patch @@ -71,6 +72,7 @@ Python bindings for libpfm4 and perf_event_open system call. %prep %setup -q +%patch -P1 -p1 -b .fix-const %patch -P2 -p1 -b .python3 %patch -P3 -p1 -b .gcc14 # to prevent setuptools from installing an .egg, we need to pass --root to setup.py install @@ -132,6 +134,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a %endif %changelog +* Tue Dec 16 2025 Aaron Merey - 4.13.0-17 +- Add libpfm-fix-const.patch + * Fri Sep 19 2025 Python Maint - 4.13.0-16 - Rebuilt for Python 3.14.0rc3 bytecode