Rebase on libpfm-4.13.0.
This commit is contained in:
		
							parent
							
								
									a5d8146854
								
							
						
					
					
						commit
						face84c751
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -11,3 +11,4 @@
 | 
				
			|||||||
/libpfm-4.10.0.tar.gz
 | 
					/libpfm-4.10.0.tar.gz
 | 
				
			||||||
/libpfm-4.10.1.tar.gz
 | 
					/libpfm-4.10.1.tar.gz
 | 
				
			||||||
/libpfm-4.11.0.tar.gz
 | 
					/libpfm-4.11.0.tar.gz
 | 
				
			||||||
 | 
					/libpfm-4.13.0.tar.gz
 | 
				
			||||||
 | 
				
			|||||||
@ -1,89 +0,0 @@
 | 
				
			|||||||
commit a7b26272d8327ad1c001456a18518a0ac65dc2bb
 | 
					 | 
				
			||||||
Author: Stephane Eranian <eranian@gmail.com>
 | 
					 | 
				
			||||||
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 <vt@altlinux.org>
 | 
					 | 
				
			||||||
    Signed-off-by: Stephane Eranian <eranian@gmail.com>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@ -1,266 +0,0 @@
 | 
				
			|||||||
commit 8c606bc2f2d186c2797d9f013283c9150f594f93
 | 
					 | 
				
			||||||
Author: Masahiko, Yamada <yamada.masahiko@fujitsu.com>
 | 
					 | 
				
			||||||
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 <yamada.masahiko@fujitsu.com>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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)
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
							
								
								
									
										11
									
								
								libpfm.spec
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								libpfm.spec
									
									
									
									
									
								
							@ -11,8 +11,8 @@
 | 
				
			|||||||
%endif
 | 
					%endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Name:		libpfm
 | 
					Name:		libpfm
 | 
				
			||||||
Version:	4.11.0
 | 
					Version:	4.13.0
 | 
				
			||||||
Release:	12%{?dist}
 | 
					Release:	1%{?dist}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Summary:	Library to encode performance events for use by perf tool
 | 
					Summary:	Library to encode performance events for use by perf tool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -20,8 +20,6 @@ License:	MIT
 | 
				
			|||||||
URL:		http://perfmon2.sourceforge.net/
 | 
					URL:		http://perfmon2.sourceforge.net/
 | 
				
			||||||
Source0:	http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz
 | 
					Source0:	http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz
 | 
				
			||||||
Patch2:		libpfm-python3-setup.patch
 | 
					Patch2:		libpfm-python3-setup.patch
 | 
				
			||||||
Patch3:		libpfm-gcc12.patch
 | 
					 | 
				
			||||||
Patch4:		libpfm-kernel518.patch
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
BuildRequires: make
 | 
					BuildRequires: make
 | 
				
			||||||
BuildRequires:	gcc
 | 
					BuildRequires:	gcc
 | 
				
			||||||
@ -73,8 +71,6 @@ Python bindings for libpfm4 and perf_event_open system call.
 | 
				
			|||||||
%prep
 | 
					%prep
 | 
				
			||||||
%setup -q
 | 
					%setup -q
 | 
				
			||||||
%patch2 -p1 -b .python3
 | 
					%patch2 -p1 -b .python3
 | 
				
			||||||
%patch3 -p1 -b .gcc12
 | 
					 | 
				
			||||||
%patch4 -p1 -b .kernel518
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
%build
 | 
					%build
 | 
				
			||||||
%if %{with python}
 | 
					%if %{with python}
 | 
				
			||||||
@ -128,6 +124,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a
 | 
				
			|||||||
%endif
 | 
					%endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%changelog
 | 
					%changelog
 | 
				
			||||||
 | 
					* Tue Mar 28 2023 William Cohen <wcohen@redhat.com> - 4.13.0-1
 | 
				
			||||||
 | 
					- Rebase on libpfm-4.13.0.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Tue Mar 14 2023 William Cohen <wcohen@redhat.com> - 4.11.0-12
 | 
					* Tue Mar 14 2023 William Cohen <wcohen@redhat.com> - 4.11.0-12
 | 
				
			||||||
- Add libpfm upstream patch to allow papi-7.0.1 to build.
 | 
					- Add libpfm upstream patch to allow papi-7.0.1 to build.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								sources
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								sources
									
									
									
									
									
								
							@ -1 +1 @@
 | 
				
			|||||||
SHA512 (libpfm-4.11.0.tar.gz) = 633035b8a7b35973437572095cdc80d422b2a1a61e74e14f106db95fa8e44e4518e591699cc457f828b8f2fb63f60eef6d0c7535c6b4c9a6c3a70d4550b3c3c7
 | 
					SHA512 (libpfm-4.13.0.tar.gz) = e61b210aa2ce80f0e47603c88eee2e4f2fe30ca2c0e194a5472b6a8de3bf9dc1085e5261bbb9ddbe5b6531c4b391fb34f20d038e5ebd8e6f4c14c2112aee508f
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user