Commit 18118a42 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'perf-tools-fixes-for-v5.17-2022-02-06' of...

Merge tag 'perf-tools-fixes-for-v5.17-2022-02-06' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

Pull perf tools fixes from Arnaldo Carvalho de Melo:

 - Fix display of grouped aliased events in 'perf stat'.

 - Add missing branch_sample_type to perf_event_attr__fprintf().

 - Apply correct label to user/kernel symbols in branch mode.

 - Fix 'perf ftrace' system_wide tracing, it has to be set before
   creating the maps.

 - Return error if procfs isn't mounted for PID namespaces when
   synthesizing records for pre-existing processes.

 - Set error stream of objdump process for 'perf annotate' TUI, to avoid
   garbling the screen.

 - Add missing arm64 support to perf_mmap__read_self(), the kernel part
   got into 5.17.

 - Check for NULL pointer before dereference writing debug info about a
   sample.

 - Update UAPI copies for asound, perf_event, prctl and kvm headers.

 - Fix a typo in bpf_counter_cgroup.c.

* tag 'perf-tools-fixes-for-v5.17-2022-02-06' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  perf ftrace: system_wide collection is not effective by default
  libperf: Add arm64 support to perf_mmap__read_self()
  tools include UAPI: Sync sound/asound.h copy with the kernel sources
  perf stat: Fix display of grouped aliased events
  perf tools: Apply correct label to user/kernel symbols in branch mode
  perf bpf: Fix a typo in bpf_counter_cgroup.c
  perf synthetic-events: Return error if procfs isn't mounted for PID namespaces
  perf session: Check for NULL pointer before dereference
  perf annotate: Set error stream of objdump process for TUI
  perf tools: Add missing branch_sample_type to perf_event_attr__fprintf()
  tools headers UAPI: Sync linux/kvm.h with the kernel sources
  tools headers UAPI: Sync linux/prctl.h with the kernel sources
  perf beauty: Make the prctl arg regexp more strict to cope with PR_SET_VMA
  tools headers cpufeatures: Sync with the kernel sources
  tools headers UAPI: Sync linux/perf_event.h with the kernel sources
  tools include UAPI: Sync sound/asound.h copy with the kernel sources
parents c3bf8a14 fceb6212
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -299,7 +299,9 @@
/* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
#define X86_FEATURE_AVX_VNNI		(12*32+ 4) /* AVX VNNI instructions */
#define X86_FEATURE_AVX512_BF16		(12*32+ 5) /* AVX512 BFLOAT16 instructions */
#define X86_FEATURE_AMX_BF16		(18*32+22) /* AMX bf16 Support */
#define X86_FEATURE_AMX_TILE		(18*32+24) /* AMX tile Support */
#define X86_FEATURE_AMX_INT8		(18*32+25) /* AMX int8 Support */

/* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */
#define X86_FEATURE_CLZERO		(13*32+ 0) /* CLZERO instruction */
+3 −3
Original line number Diff line number Diff line
@@ -1624,9 +1624,6 @@ struct kvm_enc_region {
#define KVM_S390_NORMAL_RESET	_IO(KVMIO,   0xc3)
#define KVM_S390_CLEAR_RESET	_IO(KVMIO,   0xc4)

/* Available with KVM_CAP_XSAVE2 */
#define KVM_GET_XSAVE2		  _IOR(KVMIO,  0xcf, struct kvm_xsave)

struct kvm_s390_pv_sec_parm {
	__u64 origin;
	__u64 length;
@@ -2048,4 +2045,7 @@ struct kvm_stats_desc {

#define KVM_GET_STATS_FD  _IO(KVMIO,  0xce)

/* Available with KVM_CAP_XSAVE2 */
#define KVM_GET_XSAVE2		  _IOR(KVMIO,  0xcf, struct kvm_xsave)

#endif /* __LINUX_KVM_H */
+3 −0
Original line number Diff line number Diff line
@@ -272,4 +272,7 @@ struct prctl_mm_map {
# define PR_SCHED_CORE_SCOPE_THREAD_GROUP	1
# define PR_SCHED_CORE_SCOPE_PROCESS_GROUP	2

#define PR_SET_VMA		0x53564d41
# define PR_SET_VMA_ANON_NAME		0

#endif /* _LINUX_PRCTL_H */
+9 −2
Original line number Diff line number Diff line
@@ -56,8 +56,10 @@
 *                                                                          *
 ****************************************************************************/

#define AES_IEC958_STATUS_SIZE		24

struct snd_aes_iec958 {
	unsigned char status[24];	/* AES/IEC958 channel status bits */
	unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
	unsigned char subcode[147];	/* AES/IEC958 subcode bits */
	unsigned char pad;		/* nothing */
	unsigned char dig_subframe[4];	/* AES/IEC958 subframe bits */
@@ -202,6 +204,11 @@ typedef int __bitwise snd_pcm_format_t;
#define	SNDRV_PCM_FORMAT_S24_BE	((__force snd_pcm_format_t) 7) /* low three bytes */
#define	SNDRV_PCM_FORMAT_U24_LE	((__force snd_pcm_format_t) 8) /* low three bytes */
#define	SNDRV_PCM_FORMAT_U24_BE	((__force snd_pcm_format_t) 9) /* low three bytes */
/*
 * For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
 * available bit count in most significant bit. It's for the case of so-called 'left-justified' or
 * `right-padding` sample which has less width than 32 bit.
 */
#define	SNDRV_PCM_FORMAT_S32_LE	((__force snd_pcm_format_t) 10)
#define	SNDRV_PCM_FORMAT_S32_BE	((__force snd_pcm_format_t) 11)
#define	SNDRV_PCM_FORMAT_U32_LE	((__force snd_pcm_format_t) 12)
@@ -300,7 +307,7 @@ typedef int __bitwise snd_pcm_subformat_t;
#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME    0x04000000  /* report estimated link audio time */
#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000  /* report synchronized audio/system time */
#define SNDRV_PCM_INFO_EXPLICIT_SYNC	0x10000000	/* needs explicit sync of pointers and data */

#define SNDRV_PCM_INFO_NO_REWINDS	0x20000000	/* hardware can only support monotonic changes of appl_ptr */
#define SNDRV_PCM_INFO_DRAIN_TRIGGER	0x40000000		/* internal kernel flag - trigger in drain */
#define SNDRV_PCM_INFO_FIFO_IN_FRAMES	0x80000000	/* internal kernel flag - FIFO size is in frames */

+98 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include <internal/lib.h>
#include <linux/kernel.h>
#include <linux/math64.h>
#include <linux/stringify.h>
#include "internal.h"

void perf_mmap__init(struct perf_mmap *map, struct perf_mmap *prev,
@@ -294,6 +295,103 @@ static u64 read_timestamp(void)

	return low | ((u64)high) << 32;
}
#elif defined(__aarch64__)
#define read_sysreg(r) ({						\
	u64 __val;							\
	asm volatile("mrs %0, " __stringify(r) : "=r" (__val));		\
	__val;								\
})

static u64 read_pmccntr(void)
{
	return read_sysreg(pmccntr_el0);
}

#define PMEVCNTR_READ(idx)					\
	static u64 read_pmevcntr_##idx(void) {			\
		return read_sysreg(pmevcntr##idx##_el0);	\
	}

PMEVCNTR_READ(0);
PMEVCNTR_READ(1);
PMEVCNTR_READ(2);
PMEVCNTR_READ(3);
PMEVCNTR_READ(4);
PMEVCNTR_READ(5);
PMEVCNTR_READ(6);
PMEVCNTR_READ(7);
PMEVCNTR_READ(8);
PMEVCNTR_READ(9);
PMEVCNTR_READ(10);
PMEVCNTR_READ(11);
PMEVCNTR_READ(12);
PMEVCNTR_READ(13);
PMEVCNTR_READ(14);
PMEVCNTR_READ(15);
PMEVCNTR_READ(16);
PMEVCNTR_READ(17);
PMEVCNTR_READ(18);
PMEVCNTR_READ(19);
PMEVCNTR_READ(20);
PMEVCNTR_READ(21);
PMEVCNTR_READ(22);
PMEVCNTR_READ(23);
PMEVCNTR_READ(24);
PMEVCNTR_READ(25);
PMEVCNTR_READ(26);
PMEVCNTR_READ(27);
PMEVCNTR_READ(28);
PMEVCNTR_READ(29);
PMEVCNTR_READ(30);

/*
 * Read a value direct from PMEVCNTR<idx>
 */
static u64 read_perf_counter(unsigned int counter)
{
	static u64 (* const read_f[])(void) = {
		read_pmevcntr_0,
		read_pmevcntr_1,
		read_pmevcntr_2,
		read_pmevcntr_3,
		read_pmevcntr_4,
		read_pmevcntr_5,
		read_pmevcntr_6,
		read_pmevcntr_7,
		read_pmevcntr_8,
		read_pmevcntr_9,
		read_pmevcntr_10,
		read_pmevcntr_11,
		read_pmevcntr_13,
		read_pmevcntr_12,
		read_pmevcntr_14,
		read_pmevcntr_15,
		read_pmevcntr_16,
		read_pmevcntr_17,
		read_pmevcntr_18,
		read_pmevcntr_19,
		read_pmevcntr_20,
		read_pmevcntr_21,
		read_pmevcntr_22,
		read_pmevcntr_23,
		read_pmevcntr_24,
		read_pmevcntr_25,
		read_pmevcntr_26,
		read_pmevcntr_27,
		read_pmevcntr_28,
		read_pmevcntr_29,
		read_pmevcntr_30,
		read_pmccntr
	};

	if (counter < ARRAY_SIZE(read_f))
		return (read_f[counter])();

	return 0;
}

static u64 read_timestamp(void) { return read_sysreg(cntvct_el0); }

#else
static u64 read_perf_counter(unsigned int counter __maybe_unused) { return 0; }
static u64 read_timestamp(void) { return 0; }
Loading