Skip to content

Commit 01abac2

Browse files
committed
Merge tag 'perf-tools-fixes-for-v6.13-2024-12-12' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
Pull perf tools fixes from Namhyung Kim: "A set of random fixes for this cycle. perf record: - Fix build-id event size calculation in perf record - Fix perf record -C/--cpu option on hybrid systems - Fix perf mem record with precise-ip on SapphireRapids perf test: - Refresh hwmon directory before reading the test files - Make sure system_tsc_freq event is tested on x86 only Others: - Usual header file sync - Fix undefined behavior in perf ftrace profile - Properly initialize a return variable in perf probe" * tag 'perf-tools-fixes-for-v6.13-2024-12-12' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools: (21 commits) perf probe: Fix uninitialized variable libperf: evlist: Fix --cpu argument on hybrid platform perf test expr: Fix system_tsc_freq for only x86 perf test hwmon_pmu: Fix event file location perf hwmon_pmu: Use openat rather than dup to refresh directory perf ftrace: Fix undefined behavior in cmp_profile_data() perf tools: Fix precise_ip fallback logic perf tools: Fix build error on generated/fs_at_flags_array.c tools headers: Sync uapi/linux/prctl.h with the kernel sources tools headers: Sync uapi/linux/mount.h with the kernel sources tools headers: Sync uapi/linux/fcntl.h with the kernel sources tools headers: Sync uapi/asm-generic/mman.h with the kernel sources tools headers: Sync *xattrat syscall changes with the kernel sources tools headers: Sync arm64 kvm header with the kernel sources tools headers: Sync x86 kvm and cpufeature headers with the kernel tools headers: Sync uapi/linux/kvm.h with the kernel sources tools headers: Sync uapi/linux/perf_event.h with the kernel sources tools headers: Sync uapi/drm/drm.h with the kernel sources perf machine: Initialize machine->env to address a segfault perf test: Don't signal all processes on system when interrupting tests ...
2 parents eefa7a9 + 434fffa commit 01abac2

File tree

27 files changed

+194
-44
lines changed

27 files changed

+194
-44
lines changed

tools/arch/arm64/include/uapi/asm/kvm.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,12 @@ enum {
484484
*/
485485
#define KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2 (1ULL << 0)
486486

487+
/*
488+
* Shutdown caused by a PSCI v1.3 SYSTEM_OFF2 call.
489+
* Valid only when the system event has a type of KVM_SYSTEM_EVENT_SHUTDOWN.
490+
*/
491+
#define KVM_SYSTEM_EVENT_SHUTDOWN_FLAG_PSCI_OFF2 (1ULL << 0)
492+
487493
/* run->fail_entry.hardware_entry_failure_reason codes. */
488494
#define KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED (1ULL << 0)
489495

tools/arch/x86/include/asm/cpufeatures.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
#define X86_FEATURE_SPEC_STORE_BYPASS_DISABLE ( 7*32+23) /* Disable Speculative Store Bypass. */
216216
#define X86_FEATURE_LS_CFG_SSBD ( 7*32+24) /* AMD SSBD implementation via LS_CFG MSR */
217217
#define X86_FEATURE_IBRS ( 7*32+25) /* "ibrs" Indirect Branch Restricted Speculation */
218-
#define X86_FEATURE_IBPB ( 7*32+26) /* "ibpb" Indirect Branch Prediction Barrier */
218+
#define X86_FEATURE_IBPB ( 7*32+26) /* "ibpb" Indirect Branch Prediction Barrier without a guaranteed RSB flush */
219219
#define X86_FEATURE_STIBP ( 7*32+27) /* "stibp" Single Thread Indirect Branch Predictors */
220220
#define X86_FEATURE_ZEN ( 7*32+28) /* Generic flag for all Zen and newer */
221221
#define X86_FEATURE_L1TF_PTEINV ( 7*32+29) /* L1TF workaround PTE inversion */
@@ -317,6 +317,9 @@
317317
#define X86_FEATURE_ZEN1 (11*32+31) /* CPU based on Zen1 microarchitecture */
318318

319319
/* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
320+
#define X86_FEATURE_SHA512 (12*32+ 0) /* SHA512 instructions */
321+
#define X86_FEATURE_SM3 (12*32+ 1) /* SM3 instructions */
322+
#define X86_FEATURE_SM4 (12*32+ 2) /* SM4 instructions */
320323
#define X86_FEATURE_AVX_VNNI (12*32+ 4) /* "avx_vnni" AVX VNNI instructions */
321324
#define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* "avx512_bf16" AVX512 BFLOAT16 instructions */
322325
#define X86_FEATURE_CMPCCXADD (12*32+ 7) /* CMPccXADD instructions */
@@ -348,6 +351,7 @@
348351
#define X86_FEATURE_CPPC (13*32+27) /* "cppc" Collaborative Processor Performance Control */
349352
#define X86_FEATURE_AMD_PSFD (13*32+28) /* Predictive Store Forwarding Disable */
350353
#define X86_FEATURE_BTC_NO (13*32+29) /* Not vulnerable to Branch Type Confusion */
354+
#define X86_FEATURE_AMD_IBPB_RET (13*32+30) /* IBPB clears return address predictor */
351355
#define X86_FEATURE_BRS (13*32+31) /* "brs" Branch Sampling available */
352356

353357
/* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */
@@ -472,7 +476,9 @@
472476
#define X86_FEATURE_BHI_CTRL (21*32+ 2) /* BHI_DIS_S HW control available */
473477
#define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* BHI_DIS_S HW control enabled */
474478
#define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* Clear branch history at vmexit using SW loop */
475-
#define X86_FEATURE_AMD_FAST_CPPC (21*32 + 5) /* AMD Fast CPPC */
479+
#define X86_FEATURE_AMD_FAST_CPPC (21*32 + 5) /* Fast CPPC */
480+
#define X86_FEATURE_AMD_HETEROGENEOUS_CORES (21*32 + 6) /* Heterogeneous Core Topology */
481+
#define X86_FEATURE_AMD_WORKLOAD_CLASS (21*32 + 7) /* Workload Classification */
476482

477483
/*
478484
* BUG word(s)
@@ -523,4 +529,5 @@
523529
#define X86_BUG_DIV0 X86_BUG(1*32 + 1) /* "div0" AMD DIV0 speculation bug */
524530
#define X86_BUG_RFDS X86_BUG(1*32 + 2) /* "rfds" CPU is vulnerable to Register File Data Sampling */
525531
#define X86_BUG_BHI X86_BUG(1*32 + 3) /* "bhi" CPU is affected by Branch History Injection */
532+
#define X86_BUG_IBPB_NO_RET X86_BUG(1*32 + 4) /* "ibpb_no_ret" IBPB omits return target predictions */
526533
#endif /* _ASM_X86_CPUFEATURES_H */

tools/arch/x86/include/uapi/asm/kvm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ struct kvm_sync_regs {
440440
#define KVM_X86_QUIRK_FIX_HYPERCALL_INSN (1 << 5)
441441
#define KVM_X86_QUIRK_MWAIT_NEVER_UD_FAULTS (1 << 6)
442442
#define KVM_X86_QUIRK_SLOT_ZAP_ALL (1 << 7)
443+
#define KVM_X86_QUIRK_STUFF_FEATURE_MSRS (1 << 8)
443444

444445
#define KVM_STATE_NESTED_FORMAT_VMX 0
445446
#define KVM_STATE_NESTED_FORMAT_SVM 1

tools/include/uapi/asm-generic/mman.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@
1919
#define MCL_FUTURE 2 /* lock all future mappings */
2020
#define MCL_ONFAULT 4 /* lock all pages that are faulted in */
2121

22+
#define SHADOW_STACK_SET_TOKEN (1ULL << 0) /* Set up a restore token in the shadow stack */
23+
#define SHADOW_STACK_SET_MARKER (1ULL << 1) /* Set up a top of stack marker in the shadow stack */
24+
25+
2226
#endif /* __ASM_GENERIC_MMAN_H */

tools/include/uapi/asm-generic/unistd.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,17 @@ __SYSCALL(__NR_lsm_list_modules, sys_lsm_list_modules)
841841
#define __NR_mseal 462
842842
__SYSCALL(__NR_mseal, sys_mseal)
843843

844+
#define __NR_setxattrat 463
845+
__SYSCALL(__NR_setxattrat, sys_setxattrat)
846+
#define __NR_getxattrat 464
847+
__SYSCALL(__NR_getxattrat, sys_getxattrat)
848+
#define __NR_listxattrat 465
849+
__SYSCALL(__NR_listxattrat, sys_listxattrat)
850+
#define __NR_removexattrat 466
851+
__SYSCALL(__NR_removexattrat, sys_removexattrat)
852+
844853
#undef __NR_syscalls
845-
#define __NR_syscalls 463
854+
#define __NR_syscalls 467
846855

847856
/*
848857
* 32 bit systems traditionally used different

tools/include/uapi/drm/drm.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,13 @@ struct drm_crtc_queue_sequence {
10241024
__u64 user_data; /* user data passed to event */
10251025
};
10261026

1027+
#define DRM_CLIENT_NAME_MAX_LEN 64
1028+
struct drm_set_client_name {
1029+
__u64 name_len;
1030+
__u64 name;
1031+
};
1032+
1033+
10271034
#if defined(__cplusplus)
10281035
}
10291036
#endif
@@ -1288,6 +1295,16 @@ extern "C" {
12881295
*/
12891296
#define DRM_IOCTL_MODE_CLOSEFB DRM_IOWR(0xD0, struct drm_mode_closefb)
12901297

1298+
/**
1299+
* DRM_IOCTL_SET_CLIENT_NAME - Attach a name to a drm_file
1300+
*
1301+
* Having a name allows for easier tracking and debugging.
1302+
* The length of the name (without null ending char) must be
1303+
* <= DRM_CLIENT_NAME_MAX_LEN.
1304+
* The call will fail if the name contains whitespaces or non-printable chars.
1305+
*/
1306+
#define DRM_IOCTL_SET_CLIENT_NAME DRM_IOWR(0xD1, struct drm_set_client_name)
1307+
12911308
/*
12921309
* Device specific ioctls should only be in their respective headers
12931310
* The device specific ioctl range is from 0x40 to 0x9f.

tools/include/uapi/linux/kvm.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,15 @@ enum kvm_device_type {
11581158
#define KVM_DEV_TYPE_ARM_PV_TIME KVM_DEV_TYPE_ARM_PV_TIME
11591159
KVM_DEV_TYPE_RISCV_AIA,
11601160
#define KVM_DEV_TYPE_RISCV_AIA KVM_DEV_TYPE_RISCV_AIA
1161+
KVM_DEV_TYPE_LOONGARCH_IPI,
1162+
#define KVM_DEV_TYPE_LOONGARCH_IPI KVM_DEV_TYPE_LOONGARCH_IPI
1163+
KVM_DEV_TYPE_LOONGARCH_EIOINTC,
1164+
#define KVM_DEV_TYPE_LOONGARCH_EIOINTC KVM_DEV_TYPE_LOONGARCH_EIOINTC
1165+
KVM_DEV_TYPE_LOONGARCH_PCHPIC,
1166+
#define KVM_DEV_TYPE_LOONGARCH_PCHPIC KVM_DEV_TYPE_LOONGARCH_PCHPIC
1167+
11611168
KVM_DEV_TYPE_MAX,
1169+
11621170
};
11631171

11641172
struct kvm_vfio_spapr_tce {

tools/include/uapi/linux/perf_event.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,16 @@ struct perf_event_attr {
511511
__u16 sample_max_stack;
512512
__u16 __reserved_2;
513513
__u32 aux_sample_size;
514-
__u32 __reserved_3;
514+
515+
union {
516+
__u32 aux_action;
517+
struct {
518+
__u32 aux_start_paused : 1, /* start AUX area tracing paused */
519+
aux_pause : 1, /* on overflow, pause AUX area tracing */
520+
aux_resume : 1, /* on overflow, resume AUX area tracing */
521+
__reserved_3 : 29;
522+
};
523+
};
515524

516525
/*
517526
* User provided data if sigtrap=1, passed back to user via

tools/lib/perf/evlist.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,
4747
*/
4848
perf_cpu_map__put(evsel->cpus);
4949
evsel->cpus = perf_cpu_map__intersect(evlist->user_requested_cpus, evsel->own_cpus);
50+
51+
/*
52+
* Empty cpu lists would eventually get opened as "any" so remove
53+
* genuinely empty ones before they're opened in the wrong place.
54+
*/
55+
if (perf_cpu_map__is_empty(evsel->cpus)) {
56+
struct perf_evsel *next = perf_evlist__next(evlist, evsel);
57+
58+
perf_evlist__remove(evlist, evsel);
59+
/* Keep idx contiguous */
60+
if (next)
61+
list_for_each_entry_from(next, &evlist->entries, node)
62+
next->idx--;
63+
}
5064
} else if (!evsel->own_cpus || evlist->has_user_cpus ||
5165
(!evsel->requires_cpu && perf_cpu_map__has_any_cpu(evlist->user_requested_cpus))) {
5266
/*
@@ -80,11 +94,11 @@ static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,
8094

8195
static void perf_evlist__propagate_maps(struct perf_evlist *evlist)
8296
{
83-
struct perf_evsel *evsel;
97+
struct perf_evsel *evsel, *n;
8498

8599
evlist->needs_map_propagation = true;
86100

87-
perf_evlist__for_each_evsel(evlist, evsel)
101+
list_for_each_entry_safe(evsel, n, &evlist->entries, node)
88102
__perf_evlist__propagate_maps(evlist, evsel);
89103
}
90104

tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,3 +377,7 @@
377377
460 n64 lsm_set_self_attr sys_lsm_set_self_attr
378378
461 n64 lsm_list_modules sys_lsm_list_modules
379379
462 n64 mseal sys_mseal
380+
463 n64 setxattrat sys_setxattrat
381+
464 n64 getxattrat sys_getxattrat
382+
465 n64 listxattrat sys_listxattrat
383+
466 n64 removexattrat sys_removexattrat

0 commit comments

Comments
 (0)