Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'perf-tools-fixes-for-v6.16-1-2025-06-20' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools

Pull perf tools fixes from Arnaldo Carvalho de Melo:

- Fix some file descriptor leaks that stand out with recent changes to
'perf list'

- Fix prctl include to fix building 'perf bench futex' hash with musl
libc

- Restrict 'perf test' uniquifying entry to machines with 'uncore_imc'
PMUs

- Document new output fields (op, cache, mem, dtlb, snoop) used with
'perf mem'

- Synchronize kernel header copies

* tag 'perf-tools-fixes-for-v6.16-1-2025-06-20' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools:
tools headers x86 cpufeatures: Sync with the kernel sources
perf bench futex: Fix prctl include in musl libc
perf test: Directory file descriptor leak
perf evsel: Missed close() when probing hybrid core PMUs
tools headers: Synchronize linux/bits.h with the kernel sources
tools arch amd ibs: Sync ibs.h with the kernel sources
tools arch x86: Sync the msr-index.h copy with the kernel sources
tools headers: Syncronize linux/build_bug.h with the kernel sources
tools headers: Update the copy of x86's mem{cpy,set}_64.S used in 'perf bench'
tools headers UAPI: Sync linux/kvm.h with the kernel sources
tools headers UAPI: Sync the drm/drm.h with the kernel sources
perf beauty: Update copy of linux/socket.h with the kernel sources
tools headers UAPI: Sync kvm header with the kernel sources
tools headers x86 svm: Sync svm headers with the kernel sources
tools headers UAPI: Sync KVM's vmx.h header with the kernel sources
tools kvm headers arm64: Update KVM header from the kernel sources
tools headers UAPI: Sync linux/prctl.h with the kernel sources to pick FUTEX knob
perf mem: Document new output fields (op, cache, mem, dtlb, snoop)
tools headers: Update the fs headers with the kernel sources
perf test: Restrict uniquifying test to machines with 'uncore_imc'

+328 -52
+2 -2
include/uapi/linux/bits.h
··· 4 4 #ifndef _UAPI_LINUX_BITS_H 5 5 #define _UAPI_LINUX_BITS_H 6 6 7 - #define __GENMASK(h, l) (((~_UL(0)) << (l)) & (~_UL(0) >> (__BITS_PER_LONG - 1 - (h)))) 7 + #define __GENMASK(h, l) (((~_UL(0)) << (l)) & (~_UL(0) >> (BITS_PER_LONG - 1 - (h)))) 8 8 9 - #define __GENMASK_ULL(h, l) (((~_ULL(0)) << (l)) & (~_ULL(0) >> (__BITS_PER_LONG_LONG - 1 - (h)))) 9 + #define __GENMASK_ULL(h, l) (((~_ULL(0)) << (l)) & (~_ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h)))) 10 10 11 11 #define __GENMASK_U128(h, l) \ 12 12 ((_BIT128((h)) << 1) - (_BIT128(l)))
+5 -4
tools/arch/arm64/include/uapi/asm/kvm.h
··· 431 431 432 432 /* Device Control API on vcpu fd */ 433 433 #define KVM_ARM_VCPU_PMU_V3_CTRL 0 434 - #define KVM_ARM_VCPU_PMU_V3_IRQ 0 435 - #define KVM_ARM_VCPU_PMU_V3_INIT 1 436 - #define KVM_ARM_VCPU_PMU_V3_FILTER 2 437 - #define KVM_ARM_VCPU_PMU_V3_SET_PMU 3 434 + #define KVM_ARM_VCPU_PMU_V3_IRQ 0 435 + #define KVM_ARM_VCPU_PMU_V3_INIT 1 436 + #define KVM_ARM_VCPU_PMU_V3_FILTER 2 437 + #define KVM_ARM_VCPU_PMU_V3_SET_PMU 3 438 + #define KVM_ARM_VCPU_PMU_V3_SET_NR_COUNTERS 4 438 439 #define KVM_ARM_VCPU_TIMER_CTRL 1 439 440 #define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0 440 441 #define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1
+5
tools/arch/x86/include/asm/amd/ibs.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _ASM_X86_AMD_IBS_H 3 + #define _ASM_X86_AMD_IBS_H 4 + 2 5 /* 3 6 * From PPR Vol 1 for AMD Family 19h Model 01h B1 4 7 * 55898 Rev 0.35 - Feb 5, 2021 ··· 154 151 }; 155 152 u64 regs[MSR_AMD64_IBS_REG_COUNT_MAX]; 156 153 }; 154 + 155 + #endif /* _ASM_X86_AMD_IBS_H */
+10 -4
tools/arch/x86/include/asm/cpufeatures.h
··· 336 336 #define X86_FEATURE_AMD_IBRS (13*32+14) /* Indirect Branch Restricted Speculation */ 337 337 #define X86_FEATURE_AMD_STIBP (13*32+15) /* Single Thread Indirect Branch Predictors */ 338 338 #define X86_FEATURE_AMD_STIBP_ALWAYS_ON (13*32+17) /* Single Thread Indirect Branch Predictors always-on preferred */ 339 - #define X86_FEATURE_AMD_IBRS_SAME_MODE (13*32+19) /* Indirect Branch Restricted Speculation same mode protection*/ 339 + #define X86_FEATURE_AMD_IBRS_SAME_MODE (13*32+19) /* Indirect Branch Restricted Speculation same mode protection*/ 340 340 #define X86_FEATURE_AMD_PPIN (13*32+23) /* "amd_ppin" Protected Processor Inventory Number */ 341 341 #define X86_FEATURE_AMD_SSBD (13*32+24) /* Speculative Store Bypass Disable */ 342 342 #define X86_FEATURE_VIRT_SSBD (13*32+25) /* "virt_ssbd" Virtualized Speculative Store Bypass Disable */ ··· 379 379 #define X86_FEATURE_V_SPEC_CTRL (15*32+20) /* "v_spec_ctrl" Virtual SPEC_CTRL */ 380 380 #define X86_FEATURE_VNMI (15*32+25) /* "vnmi" Virtual NMI */ 381 381 #define X86_FEATURE_SVME_ADDR_CHK (15*32+28) /* SVME addr check */ 382 + #define X86_FEATURE_BUS_LOCK_THRESHOLD (15*32+29) /* Bus lock threshold */ 382 383 #define X86_FEATURE_IDLE_HLT (15*32+30) /* IDLE HLT intercept */ 383 384 384 385 /* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 16 */ ··· 448 447 #define X86_FEATURE_DEBUG_SWAP (19*32+14) /* "debug_swap" SEV-ES full debug state swap support */ 449 448 #define X86_FEATURE_RMPREAD (19*32+21) /* RMPREAD instruction */ 450 449 #define X86_FEATURE_SEGMENTED_RMP (19*32+23) /* Segmented RMP support */ 450 + #define X86_FEATURE_ALLOWED_SEV_FEATURES (19*32+27) /* Allowed SEV Features */ 451 451 #define X86_FEATURE_SVSM (19*32+28) /* "svsm" SVSM present */ 452 452 #define X86_FEATURE_HV_INUSE_WR_ALLOWED (19*32+30) /* Allow Write to in-use hypervisor-owned pages */ 453 453 ··· 460 458 #define X86_FEATURE_AUTOIBRS (20*32+ 8) /* Automatic IBRS */ 461 459 #define X86_FEATURE_NO_SMM_CTL_MSR (20*32+ 9) /* SMM_CTL MSR is not present */ 462 460 461 + #define X86_FEATURE_PREFETCHI (20*32+20) /* Prefetch Data/Instruction to Cache Level */ 463 462 #define X86_FEATURE_SBPB (20*32+27) /* Selective Branch Prediction Barrier */ 464 463 #define X86_FEATURE_IBPB_BRTYPE (20*32+28) /* MSR_PRED_CMD[IBPB] flushes all branch type predictions */ 465 464 #define X86_FEATURE_SRSO_NO (20*32+29) /* CPU is not affected by SRSO */ ··· 485 482 #define X86_FEATURE_AMD_HTR_CORES (21*32+ 6) /* Heterogeneous Core Topology */ 486 483 #define X86_FEATURE_AMD_WORKLOAD_CLASS (21*32+ 7) /* Workload Classification */ 487 484 #define X86_FEATURE_PREFER_YMM (21*32+ 8) /* Avoid ZMM registers due to downclocking */ 488 - #define X86_FEATURE_INDIRECT_THUNK_ITS (21*32+ 9) /* Use thunk for indirect branches in lower half of cacheline */ 485 + #define X86_FEATURE_APX (21*32+ 9) /* Advanced Performance Extensions */ 486 + #define X86_FEATURE_INDIRECT_THUNK_ITS (21*32+10) /* Use thunk for indirect branches in lower half of cacheline */ 489 487 490 488 /* 491 489 * BUG word(s) ··· 539 535 #define X86_BUG_BHI X86_BUG( 1*32+ 3) /* "bhi" CPU is affected by Branch History Injection */ 540 536 #define X86_BUG_IBPB_NO_RET X86_BUG( 1*32+ 4) /* "ibpb_no_ret" IBPB omits return target predictions */ 541 537 #define X86_BUG_SPECTRE_V2_USER X86_BUG( 1*32+ 5) /* "spectre_v2_user" CPU is affected by Spectre variant 2 attack between user processes */ 542 - #define X86_BUG_ITS X86_BUG( 1*32+ 6) /* "its" CPU is affected by Indirect Target Selection */ 543 - #define X86_BUG_ITS_NATIVE_ONLY X86_BUG( 1*32+ 7) /* "its_native_only" CPU is affected by ITS, VMX is not affected */ 538 + #define X86_BUG_OLD_MICROCODE X86_BUG( 1*32+ 6) /* "old_microcode" CPU has old microcode, it is surely vulnerable to something */ 539 + #define X86_BUG_ITS X86_BUG( 1*32+ 7) /* "its" CPU is affected by Indirect Target Selection */ 540 + #define X86_BUG_ITS_NATIVE_ONLY X86_BUG( 1*32+ 8) /* "its_native_only" CPU is affected by ITS, VMX is not affected */ 541 + 544 542 #endif /* _ASM_X86_CPUFEATURES_H */
+10 -6
tools/arch/x86/include/asm/msr-index.h
··· 533 533 #define MSR_HWP_CAPABILITIES 0x00000771 534 534 #define MSR_HWP_REQUEST_PKG 0x00000772 535 535 #define MSR_HWP_INTERRUPT 0x00000773 536 - #define MSR_HWP_REQUEST 0x00000774 536 + #define MSR_HWP_REQUEST 0x00000774 537 537 #define MSR_HWP_STATUS 0x00000777 538 538 539 539 /* CPUID.6.EAX */ ··· 550 550 #define HWP_LOWEST_PERF(x) (((x) >> 24) & 0xff) 551 551 552 552 /* IA32_HWP_REQUEST */ 553 - #define HWP_MIN_PERF(x) (x & 0xff) 554 - #define HWP_MAX_PERF(x) ((x & 0xff) << 8) 553 + #define HWP_MIN_PERF(x) (x & 0xff) 554 + #define HWP_MAX_PERF(x) ((x & 0xff) << 8) 555 555 #define HWP_DESIRED_PERF(x) ((x & 0xff) << 16) 556 - #define HWP_ENERGY_PERF_PREFERENCE(x) (((unsigned long long) x & 0xff) << 24) 556 + #define HWP_ENERGY_PERF_PREFERENCE(x) (((u64)x & 0xff) << 24) 557 557 #define HWP_EPP_PERFORMANCE 0x00 558 558 #define HWP_EPP_BALANCE_PERFORMANCE 0x80 559 559 #define HWP_EPP_BALANCE_POWERSAVE 0xC0 560 560 #define HWP_EPP_POWERSAVE 0xFF 561 - #define HWP_ACTIVITY_WINDOW(x) ((unsigned long long)(x & 0xff3) << 32) 562 - #define HWP_PACKAGE_CONTROL(x) ((unsigned long long)(x & 0x1) << 42) 561 + #define HWP_ACTIVITY_WINDOW(x) ((u64)(x & 0xff3) << 32) 562 + #define HWP_PACKAGE_CONTROL(x) ((u64)(x & 0x1) << 42) 563 563 564 564 /* IA32_HWP_STATUS */ 565 565 #define HWP_GUARANTEED_CHANGE(x) (x & 0x1) ··· 602 602 /* V6 PMON MSR range */ 603 603 #define MSR_IA32_PMC_V6_GP0_CTR 0x1900 604 604 #define MSR_IA32_PMC_V6_GP0_CFG_A 0x1901 605 + #define MSR_IA32_PMC_V6_GP0_CFG_B 0x1902 606 + #define MSR_IA32_PMC_V6_GP0_CFG_C 0x1903 605 607 #define MSR_IA32_PMC_V6_FX0_CTR 0x1980 608 + #define MSR_IA32_PMC_V6_FX0_CFG_B 0x1982 609 + #define MSR_IA32_PMC_V6_FX0_CFG_C 0x1983 606 610 #define MSR_IA32_PMC_V6_STEP 4 607 611 608 612 /* KeyID partitioning between MKTME and TDX */
+71
tools/arch/x86/include/uapi/asm/kvm.h
··· 441 441 #define KVM_X86_QUIRK_MWAIT_NEVER_UD_FAULTS (1 << 6) 442 442 #define KVM_X86_QUIRK_SLOT_ZAP_ALL (1 << 7) 443 443 #define KVM_X86_QUIRK_STUFF_FEATURE_MSRS (1 << 8) 444 + #define KVM_X86_QUIRK_IGNORE_GUEST_PAT (1 << 9) 444 445 445 446 #define KVM_STATE_NESTED_FORMAT_VMX 0 446 447 #define KVM_STATE_NESTED_FORMAT_SVM 1 ··· 931 930 #define KVM_X86_SEV_ES_VM 3 932 931 #define KVM_X86_SNP_VM 4 933 932 #define KVM_X86_TDX_VM 5 933 + 934 + /* Trust Domain eXtension sub-ioctl() commands. */ 935 + enum kvm_tdx_cmd_id { 936 + KVM_TDX_CAPABILITIES = 0, 937 + KVM_TDX_INIT_VM, 938 + KVM_TDX_INIT_VCPU, 939 + KVM_TDX_INIT_MEM_REGION, 940 + KVM_TDX_FINALIZE_VM, 941 + KVM_TDX_GET_CPUID, 942 + 943 + KVM_TDX_CMD_NR_MAX, 944 + }; 945 + 946 + struct kvm_tdx_cmd { 947 + /* enum kvm_tdx_cmd_id */ 948 + __u32 id; 949 + /* flags for sub-commend. If sub-command doesn't use this, set zero. */ 950 + __u32 flags; 951 + /* 952 + * data for each sub-command. An immediate or a pointer to the actual 953 + * data in process virtual address. If sub-command doesn't use it, 954 + * set zero. 955 + */ 956 + __u64 data; 957 + /* 958 + * Auxiliary error code. The sub-command may return TDX SEAMCALL 959 + * status code in addition to -Exxx. 960 + */ 961 + __u64 hw_error; 962 + }; 963 + 964 + struct kvm_tdx_capabilities { 965 + __u64 supported_attrs; 966 + __u64 supported_xfam; 967 + __u64 reserved[254]; 968 + 969 + /* Configurable CPUID bits for userspace */ 970 + struct kvm_cpuid2 cpuid; 971 + }; 972 + 973 + struct kvm_tdx_init_vm { 974 + __u64 attributes; 975 + __u64 xfam; 976 + __u64 mrconfigid[6]; /* sha384 digest */ 977 + __u64 mrowner[6]; /* sha384 digest */ 978 + __u64 mrownerconfig[6]; /* sha384 digest */ 979 + 980 + /* The total space for TD_PARAMS before the CPUIDs is 256 bytes */ 981 + __u64 reserved[12]; 982 + 983 + /* 984 + * Call KVM_TDX_INIT_VM before vcpu creation, thus before 985 + * KVM_SET_CPUID2. 986 + * This configuration supersedes KVM_SET_CPUID2s for VCPUs because the 987 + * TDX module directly virtualizes those CPUIDs without VMM. The user 988 + * space VMM, e.g. qemu, should make KVM_SET_CPUID2 consistent with 989 + * those values. If it doesn't, KVM may have wrong idea of vCPUIDs of 990 + * the guest, and KVM may wrongly emulate CPUIDs or MSRs that the TDX 991 + * module doesn't virtualize. 992 + */ 993 + struct kvm_cpuid2 cpuid; 994 + }; 995 + 996 + #define KVM_TDX_MEASURE_MEMORY_REGION _BITULL(0) 997 + 998 + struct kvm_tdx_init_mem_region { 999 + __u64 source_addr; 1000 + __u64 gpa; 1001 + __u64 nr_pages; 1002 + }; 934 1003 935 1004 #endif /* _ASM_X86_KVM_H */
+2
tools/arch/x86/include/uapi/asm/svm.h
··· 95 95 #define SVM_EXIT_CR14_WRITE_TRAP 0x09e 96 96 #define SVM_EXIT_CR15_WRITE_TRAP 0x09f 97 97 #define SVM_EXIT_INVPCID 0x0a2 98 + #define SVM_EXIT_BUS_LOCK 0x0a5 98 99 #define SVM_EXIT_IDLE_HLT 0x0a6 99 100 #define SVM_EXIT_NPF 0x400 100 101 #define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401 ··· 226 225 { SVM_EXIT_CR4_WRITE_TRAP, "write_cr4_trap" }, \ 227 226 { SVM_EXIT_CR8_WRITE_TRAP, "write_cr8_trap" }, \ 228 227 { SVM_EXIT_INVPCID, "invpcid" }, \ 228 + { SVM_EXIT_BUS_LOCK, "buslock" }, \ 229 229 { SVM_EXIT_IDLE_HLT, "idle-halt" }, \ 230 230 { SVM_EXIT_NPF, "npf" }, \ 231 231 { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, \
+4 -1
tools/arch/x86/include/uapi/asm/vmx.h
··· 34 34 #define EXIT_REASON_TRIPLE_FAULT 2 35 35 #define EXIT_REASON_INIT_SIGNAL 3 36 36 #define EXIT_REASON_SIPI_SIGNAL 4 37 + #define EXIT_REASON_OTHER_SMI 6 37 38 38 39 #define EXIT_REASON_INTERRUPT_WINDOW 7 39 40 #define EXIT_REASON_NMI_WINDOW 8 ··· 93 92 #define EXIT_REASON_TPAUSE 68 94 93 #define EXIT_REASON_BUS_LOCK 74 95 94 #define EXIT_REASON_NOTIFY 75 95 + #define EXIT_REASON_TDCALL 77 96 96 97 97 #define VMX_EXIT_REASONS \ 98 98 { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \ ··· 157 155 { EXIT_REASON_UMWAIT, "UMWAIT" }, \ 158 156 { EXIT_REASON_TPAUSE, "TPAUSE" }, \ 159 157 { EXIT_REASON_BUS_LOCK, "BUS_LOCK" }, \ 160 - { EXIT_REASON_NOTIFY, "NOTIFY" } 158 + { EXIT_REASON_NOTIFY, "NOTIFY" }, \ 159 + { EXIT_REASON_TDCALL, "TDCALL" } 161 160 162 161 #define VMX_EXIT_REASON_FLAGS \ 163 162 { VMX_EXIT_REASONS_FAILED_VMENTRY, "FAILED_VMENTRY" }
+1
tools/arch/x86/lib/memcpy_64.S
··· 40 40 EXPORT_SYMBOL(__memcpy) 41 41 42 42 SYM_FUNC_ALIAS_MEMFUNC(memcpy, __memcpy) 43 + SYM_PIC_ALIAS(memcpy) 43 44 EXPORT_SYMBOL(memcpy) 44 45 45 46 SYM_FUNC_START_LOCAL(memcpy_orig)
+1
tools/arch/x86/lib/memset_64.S
··· 42 42 EXPORT_SYMBOL(__memset) 43 43 44 44 SYM_FUNC_ALIAS_MEMFUNC(memset, __memset) 45 + SYM_PIC_ALIAS(memset) 45 46 EXPORT_SYMBOL(memset) 46 47 47 48 SYM_FUNC_START_LOCAL(memset_orig)
+55 -2
tools/include/linux/bits.h
··· 12 12 #define BIT_ULL_MASK(nr) (ULL(1) << ((nr) % BITS_PER_LONG_LONG)) 13 13 #define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) 14 14 #define BITS_PER_BYTE 8 15 + #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) 15 16 16 17 /* 17 18 * Create a contiguous bitmask starting at bit position @l and ending at ··· 20 19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. 21 20 */ 22 21 #if !defined(__ASSEMBLY__) 22 + 23 + /* 24 + * Missing asm support 25 + * 26 + * GENMASK_U*() and BIT_U*() depend on BITS_PER_TYPE() which relies on sizeof(), 27 + * something not available in asm. Nevertheless, fixed width integers is a C 28 + * concept. Assembly code can rely on the long and long long versions instead. 29 + */ 30 + 23 31 #include <linux/build_bug.h> 24 32 #include <linux/compiler.h> 33 + #include <linux/overflow.h> 34 + 25 35 #define GENMASK_INPUT_CHECK(h, l) BUILD_BUG_ON_ZERO(const_true((l) > (h))) 26 - #else 36 + 37 + /* 38 + * Generate a mask for the specified type @t. Additional checks are made to 39 + * guarantee the value returned fits in that type, relying on 40 + * -Wshift-count-overflow compiler check to detect incompatible arguments. 41 + * For example, all these create build errors or warnings: 42 + * 43 + * - GENMASK(15, 20): wrong argument order 44 + * - GENMASK(72, 15): doesn't fit unsigned long 45 + * - GENMASK_U32(33, 15): doesn't fit in a u32 46 + */ 47 + #define GENMASK_TYPE(t, h, l) \ 48 + ((t)(GENMASK_INPUT_CHECK(h, l) + \ 49 + (type_max(t) << (l) & \ 50 + type_max(t) >> (BITS_PER_TYPE(t) - 1 - (h))))) 51 + 52 + #define GENMASK_U8(h, l) GENMASK_TYPE(u8, h, l) 53 + #define GENMASK_U16(h, l) GENMASK_TYPE(u16, h, l) 54 + #define GENMASK_U32(h, l) GENMASK_TYPE(u32, h, l) 55 + #define GENMASK_U64(h, l) GENMASK_TYPE(u64, h, l) 56 + 57 + /* 58 + * Fixed-type variants of BIT(), with additional checks like GENMASK_TYPE(). The 59 + * following examples generate compiler warnings due to -Wshift-count-overflow: 60 + * 61 + * - BIT_U8(8) 62 + * - BIT_U32(-1) 63 + * - BIT_U32(40) 64 + */ 65 + #define BIT_INPUT_CHECK(type, nr) \ 66 + BUILD_BUG_ON_ZERO(const_true((nr) >= BITS_PER_TYPE(type))) 67 + 68 + #define BIT_TYPE(type, nr) ((type)(BIT_INPUT_CHECK(type, nr) + BIT_ULL(nr))) 69 + 70 + #define BIT_U8(nr) BIT_TYPE(u8, nr) 71 + #define BIT_U16(nr) BIT_TYPE(u16, nr) 72 + #define BIT_U32(nr) BIT_TYPE(u32, nr) 73 + #define BIT_U64(nr) BIT_TYPE(u64, nr) 74 + 75 + #else /* defined(__ASSEMBLY__) */ 76 + 27 77 /* 28 78 * BUILD_BUG_ON_ZERO is not available in h files included from asm files, 29 79 * disable the input check if that is the case. 30 80 */ 31 81 #define GENMASK_INPUT_CHECK(h, l) 0 32 - #endif 82 + 83 + #endif /* !defined(__ASSEMBLY__) */ 33 84 34 85 #define GENMASK(h, l) \ 35 86 (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
+5 -5
tools/include/linux/build_bug.h
··· 4 4 5 5 #include <linux/compiler.h> 6 6 7 - #ifdef __CHECKER__ 8 - #define BUILD_BUG_ON_ZERO(e) (0) 9 - #else /* __CHECKER__ */ 10 7 /* 11 8 * Force a compilation error if condition is true, but also produce a 12 9 * result (of value 0 and type int), so the expression can be used 13 10 * e.g. in a structure initializer (or where-ever else comma expressions 14 11 * aren't permitted). 12 + * 13 + * Take an error message as an optional second argument. If omitted, 14 + * default to the stringification of the tested expression. 15 15 */ 16 - #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) 17 - #endif /* __CHECKER__ */ 16 + #define BUILD_BUG_ON_ZERO(e, ...) \ 17 + __BUILD_BUG_ON_ZERO_MSG(e, ##__VA_ARGS__, #e " is true") 18 18 19 19 /* Force a compilation error if a constant expression is not a power of 2 */ 20 20 #define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \
+8
tools/include/linux/compiler.h
··· 244 244 __asm__ ("" : "=r" (var) : "0" (var)) 245 245 #endif 246 246 247 + #ifndef __BUILD_BUG_ON_ZERO_MSG 248 + #if defined(__clang__) 249 + #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)(sizeof(struct { int:(-!!(e)); }))) 250 + #else 251 + #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);})) 252 + #endif 253 + #endif 254 + 247 255 #endif /* __ASSEMBLY__ */ 248 256 249 257 #endif /* _TOOLS_LINUX_COMPILER_H */
+4
tools/include/uapi/drm/drm.h
··· 905 905 }; 906 906 907 907 #define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0) 908 + #define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_TIMELINE (1 << 1) 908 909 #define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0) 910 + #define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_TIMELINE (1 << 1) 909 911 struct drm_syncobj_handle { 910 912 __u32 handle; 911 913 __u32 flags; 912 914 913 915 __s32 fd; 914 916 __u32 pad; 917 + 918 + __u64 point; 915 919 }; 916 920 917 921 struct drm_syncobj_transfer {
+4 -2
tools/include/uapi/linux/fscrypt.h
··· 119 119 */ 120 120 struct fscrypt_provisioning_key_payload { 121 121 __u32 type; 122 - __u32 __reserved; 122 + __u32 flags; 123 123 __u8 raw[]; 124 124 }; 125 125 ··· 128 128 struct fscrypt_key_specifier key_spec; 129 129 __u32 raw_size; 130 130 __u32 key_id; 131 - __u32 __reserved[8]; 131 + #define FSCRYPT_ADD_KEY_FLAG_HW_WRAPPED 0x00000001 132 + __u32 flags; 133 + __u32 __reserved[7]; 132 134 __u8 raw[]; 133 135 }; 134 136
+4
tools/include/uapi/linux/kvm.h
··· 375 375 #define KVM_SYSTEM_EVENT_WAKEUP 4 376 376 #define KVM_SYSTEM_EVENT_SUSPEND 5 377 377 #define KVM_SYSTEM_EVENT_SEV_TERM 6 378 + #define KVM_SYSTEM_EVENT_TDX_FATAL 7 378 379 __u32 type; 379 380 __u32 ndata; 380 381 union { ··· 931 930 #define KVM_CAP_X86_APIC_BUS_CYCLES_NS 237 932 931 #define KVM_CAP_X86_GUEST_MODE 238 933 932 #define KVM_CAP_ARM_WRITABLE_IMP_ID_REGS 239 933 + #define KVM_CAP_ARM_EL2 240 934 + #define KVM_CAP_ARM_EL2_E2H0 241 935 + #define KVM_CAP_RISCV_MP_STATE_RESET 242 934 936 935 937 struct kvm_irq_routing_irqchip { 936 938 __u32 irqchip;
+6 -2
tools/include/uapi/linux/stat.h
··· 182 182 /* File offset alignment for direct I/O reads */ 183 183 __u32 stx_dio_read_offset_align; 184 184 185 - /* 0xb8 */ 186 - __u64 __spare3[9]; /* Spare space for future expansion */ 185 + /* Optimised max atomic write unit in bytes */ 186 + __u32 stx_atomic_write_unit_max_opt; 187 + __u32 __spare2[1]; 188 + 189 + /* 0xc0 */ 190 + __u64 __spare3[8]; /* Spare space for future expansion */ 187 191 188 192 /* 0x100 */ 189 193 };
+41 -16
tools/perf/Documentation/perf-amd-ibs.txt
··· 171 171 # perf mem report 172 172 173 173 A normal perf mem report output will provide detailed memory access profile. 174 - However, it can also be aggregated based on output fields. For example: 174 + New output fields will show related access info together. For example: 175 175 176 - # perf mem report -F mem,sample,snoop 177 - Samples: 3M of event 'ibs_op//', Event count (approx.): 23524876 178 - Memory access Samples Snoop 179 - N/A 1903343 N/A 180 - L1 hit 1056754 N/A 181 - L2 hit 75231 N/A 182 - L3 hit 9496 HitM 183 - L3 hit 2270 N/A 184 - RAM hit 8710 N/A 185 - Remote node, same socket RAM hit 3241 N/A 186 - Remote core, same node Any cache hit 1572 HitM 187 - Remote core, same node Any cache hit 514 N/A 188 - Remote node, same socket Any cache hit 1216 HitM 189 - Remote node, same socket Any cache hit 350 N/A 190 - Uncached hit 18 N/A 176 + # perf mem report -F overhead,cache,snoop,comm 177 + ... 178 + # Samples: 92K of event 'ibs_op//' 179 + # Total weight : 531104 180 + # 181 + # ---------- Cache ----------- --- Snoop ---- 182 + # Overhead L1 L2 L1-buf Other HitM Other Command 183 + # ........ ............................ .............. .......... 184 + # 185 + 76.07% 5.8% 35.7% 0.0% 34.6% 23.3% 52.8% cc1 186 + 5.79% 0.2% 0.0% 0.0% 5.6% 0.1% 5.7% make 187 + 5.78% 0.1% 4.4% 0.0% 1.2% 0.5% 5.3% gcc 188 + 5.33% 0.3% 3.9% 0.0% 1.1% 0.2% 5.2% as 189 + 5.00% 0.1% 3.8% 0.0% 1.0% 0.3% 4.7% sh 190 + 1.56% 0.1% 0.1% 0.0% 1.4% 0.6% 0.9% ld 191 + 0.28% 0.1% 0.0% 0.0% 0.2% 0.1% 0.2% pkg-config 192 + 0.09% 0.0% 0.0% 0.0% 0.1% 0.0% 0.1% git 193 + 0.03% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% rm 194 + ... 195 + 196 + Also, it can be aggregated based on various memory access info using the 197 + sort keys. For example: 198 + 199 + # perf mem report -s mem,snoop 200 + ... 201 + # Samples: 92K of event 'ibs_op//' 202 + # Total weight : 531104 203 + # Sort order : mem,snoop 204 + # 205 + # Overhead Samples Memory access Snoop 206 + # ........ ............ ....................................... ............ 207 + # 208 + 47.99% 1509 L2 hit N/A 209 + 25.08% 338 core, same node Any cache hit HitM 210 + 10.24% 54374 N/A N/A 211 + 6.77% 35938 L1 hit N/A 212 + 6.39% 101 core, same node Any cache hit N/A 213 + 3.50% 69 RAM hit N/A 214 + 0.03% 158 LFB/MAB hit N/A 215 + 0.00% 2 Uncached hit N/A 191 216 192 217 Please refer to their man page for more detail. 193 218
+50
tools/perf/Documentation/perf-mem.txt
··· 119 119 And the default sort keys are changed to local_weight, mem, sym, dso, 120 120 symbol_daddr, dso_daddr, snoop, tlb, locked, blocked, local_ins_lat. 121 121 122 + -F:: 123 + --fields=:: 124 + Specify output field - multiple keys can be specified in CSV format. 125 + Please see linkperf:perf-report[1] for details. 126 + 127 + In addition to the default fields, 'perf mem report' will provide the 128 + following fields to break down sample periods. 129 + 130 + - op: operation in the sample instruction (load, store, prefetch, ...) 131 + - cache: location in CPU cache (L1, L2, ...) where the sample hit 132 + - mem: location in memory or other places the sample hit 133 + - dtlb: location in Data TLB (L1, L2) where the sample hit 134 + - snoop: snoop result for the sampled data access 135 + 136 + Please take a look at the OUTPUT FIELD SELECTION section for caveats. 137 + 122 138 -T:: 123 139 --type-profile:: 124 140 Show data-type profile result instead of code symbols. This requires ··· 171 155 $ perf mem report -F overhead,symbol 172 156 90% [k] memcpy 173 157 10% [.] strcmp 158 + 159 + OUTPUT FIELD SELECTION 160 + ---------------------- 161 + "perf mem report" adds a number of new output fields specific to data source 162 + information in the sample. Some of them have the same name with the existing 163 + sort keys ("mem" and "snoop"). So unlike other fields and sort keys, they'll 164 + behave differently when it's used by -F/--fields or -s/--sort. 165 + 166 + Using those two as output fields will aggregate samples altogether and show 167 + breakdown. 168 + 169 + $ perf mem report -F mem,snoop 170 + ... 171 + # ------ Memory ------- --- Snoop ---- 172 + # RAM Uncach Other HitM Other 173 + # ..................... .............. 174 + # 175 + 3.5% 0.0% 96.5% 25.1% 74.9% 176 + 177 + But using the same name for sort keys will aggregate samples for each type 178 + separately. 179 + 180 + $ perf mem report -s mem,snoop 181 + # Overhead Samples Memory access Snoop 182 + # ........ ............ ....................................... ............ 183 + # 184 + 47.99% 1509 L2 hit N/A 185 + 25.08% 338 core, same node Any cache hit HitM 186 + 10.24% 54374 N/A N/A 187 + 6.77% 35938 L1 hit N/A 188 + 6.39% 101 core, same node Any cache hit N/A 189 + 3.50% 69 RAM hit N/A 190 + 0.03% 158 LFB/MAB hit N/A 191 + 0.00% 2 Uncached hit N/A 174 192 175 193 SEE ALSO 176 194 --------
-1
tools/perf/bench/futex-hash.c
··· 18 18 #include <stdlib.h> 19 19 #include <linux/compiler.h> 20 20 #include <linux/kernel.h> 21 - #include <linux/prctl.h> 22 21 #include <linux/zalloc.h> 23 22 #include <sys/time.h> 24 23 #include <sys/mman.h>
+8 -1
tools/perf/bench/futex.c
··· 2 2 #include <err.h> 3 3 #include <stdio.h> 4 4 #include <stdlib.h> 5 - #include <linux/prctl.h> 6 5 #include <sys/prctl.h> 7 6 8 7 #include "futex.h" 8 + 9 + #ifndef PR_FUTEX_HASH 10 + #define PR_FUTEX_HASH 78 11 + # define PR_FUTEX_HASH_SET_SLOTS 1 12 + # define FH_FLAG_IMMUTABLE (1ULL << 0) 13 + # define PR_FUTEX_HASH_GET_SLOTS 2 14 + # define PR_FUTEX_HASH_GET_IMMUTABLE 3 15 + #endif // PR_FUTEX_HASH 9 16 10 17 void futex_set_nbuckets_param(struct bench_futex_parameters *params) 11 18 {
+1 -1
tools/perf/check-headers.sh
··· 186 186 # diff with extra ignore lines 187 187 check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memcpy_\(erms\|orig\))" -I"^#include <linux/cfi_types.h>"' 188 188 check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memset_\(erms\|orig\))"' 189 - check arch/x86/include/asm/amd/ibs.h '-I "^#include [<\"]\(asm/\)*msr-index.h"' 189 + check arch/x86/include/asm/amd/ibs.h '-I "^#include .*/msr-index.h"' 190 190 check arch/arm64/include/asm/cputype.h '-I "^#include [<\"]\(asm/\)*sysreg.h"' 191 191 check include/linux/unaligned.h '-I "^#include <linux/unaligned/packed_struct.h>" -I "^#include <asm/byteorder.h>" -I "^#pragma GCC diagnostic"' 192 192 check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
+10 -2
tools/perf/tests/shell/stat+event_uniquifying.sh
··· 9 9 err=0 10 10 11 11 test_event_uniquifying() { 12 - # We use `clockticks` to verify the uniquify behavior. 12 + # We use `clockticks` in `uncore_imc` to verify the uniquify behavior. 13 + pmu="uncore_imc" 13 14 event="clockticks" 14 15 15 16 # If the `-A` option is added, the event should be uniquified. ··· 44 43 echo "stat event uniquifying test" 45 44 uniquified_event_array=() 46 45 46 + # Skip if the machine does not have `uncore_imc` device. 47 + if ! ${perf_tool} list pmu | grep -q ${pmu}; then 48 + echo "Target does not support PMU ${pmu} [Skipped]" 49 + err=2 50 + return 51 + fi 52 + 47 53 # Check how many uniquified events. 48 54 while IFS= read -r line; do 49 55 uniquified_event=$(echo "$line" | awk '{print $1}') 50 56 uniquified_event_array+=("${uniquified_event}") 51 - done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]") 57 + done < <(${perf_tool} list -v ${event} | grep ${pmu}) 52 58 53 59 perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true" 54 60 $perf_command
+1
tools/perf/tests/tests-scripts.c
··· 260 260 continue; /* Skip scripts that have a separate driver. */ 261 261 fd = openat(dir_fd, ent->d_name, O_PATH); 262 262 append_scripts_in_dir(fd, result, result_sz); 263 + close(fd); 263 264 } 264 265 for (i = 0; i < n_dirs; i++) /* Clean up */ 265 266 zfree(&entlist[i]);
+1 -1
tools/perf/trace/beauty/include/linux/socket.h
··· 168 168 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); 169 169 } 170 170 171 - static inline size_t msg_data_left(struct msghdr *msg) 171 + static inline size_t msg_data_left(const struct msghdr *msg) 172 172 { 173 173 return iov_iter_count(&msg->msg_iter); 174 174 }
+1
tools/perf/trace/beauty/include/uapi/linux/fs.h
··· 361 361 #define PAGE_IS_PFNZERO (1 << 5) 362 362 #define PAGE_IS_HUGE (1 << 6) 363 363 #define PAGE_IS_SOFT_DIRTY (1 << 7) 364 + #define PAGE_IS_GUARD (1 << 8) 364 365 365 366 /* 366 367 * struct page_region - Page region with flags
+7
tools/perf/trace/beauty/include/uapi/linux/prctl.h
··· 364 364 # define PR_TIMER_CREATE_RESTORE_IDS_ON 1 365 365 # define PR_TIMER_CREATE_RESTORE_IDS_GET 2 366 366 367 + /* FUTEX hash management */ 368 + #define PR_FUTEX_HASH 78 369 + # define PR_FUTEX_HASH_SET_SLOTS 1 370 + # define FH_FLAG_IMMUTABLE (1ULL << 0) 371 + # define PR_FUTEX_HASH_GET_SLOTS 2 372 + # define PR_FUTEX_HASH_GET_IMMUTABLE 3 373 + 367 374 #endif /* _LINUX_PRCTL_H */
+6 -2
tools/perf/trace/beauty/include/uapi/linux/stat.h
··· 182 182 /* File offset alignment for direct I/O reads */ 183 183 __u32 stx_dio_read_offset_align; 184 184 185 - /* 0xb8 */ 186 - __u64 __spare3[9]; /* Spare space for future expansion */ 185 + /* Optimised max atomic write unit in bytes */ 186 + __u32 stx_atomic_write_unit_max_opt; 187 + __u32 __spare2[1]; 188 + 189 + /* 0xc0 */ 190 + __u64 __spare3[8]; /* Spare space for future expansion */ 187 191 188 192 /* 0x100 */ 189 193 };
+4
tools/perf/util/include/linux/linkage.h
··· 132 132 SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) 133 133 #endif 134 134 135 + #ifndef SYM_PIC_ALIAS 136 + #define SYM_PIC_ALIAS(sym) SYM_ALIAS(__pi_ ## sym, sym, SYM_T_FUNC, SYM_L_GLOBAL) 137 + #endif 138 + 135 139 #endif /* PERF_LINUX_LINKAGE_H_ */
+1
tools/perf/util/print-events.c
··· 268 268 ret = evsel__open(evsel, NULL, tmap) >= 0; 269 269 } 270 270 271 + evsel__close(evsel); 271 272 evsel__delete(evsel); 272 273 } 273 274