Skip to content

Commit b737458

Browse files
committed
Merge tag 'perf-urgent-2020-04-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf tooling fixes and updates from Thomas Gleixner: - Fix the header line of perf stat output for '--metric-only --per-socket' - Fix the python build with clang - The usual tools UAPI header synchronization * tag 'perf-urgent-2020-04-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: tools headers: Synchronize linux/bits.h with the kernel sources tools headers: Adopt verbatim copy of compiletime_assert() from kernel sources tools headers: Update x86's syscall_64.tbl with the kernel sources tools headers UAPI: Sync drm/i915_drm.h with the kernel sources tools headers UAPI: Update tools's copy of drm.h headers tools headers kvm: Sync linux/kvm.h with the kernel sources tools headers UAPI: Sync linux/fscrypt.h with the kernel sources tools include UAPI: Sync linux/vhost.h with the kernel sources tools arch x86: Sync asm/cpufeatures.h with the kernel sources tools headers UAPI: Sync linux/mman.h with the kernel tools headers UAPI: Sync sched.h with the kernel tools headers: Update linux/vdso.h and grab a copy of vdso/const.h perf stat: Fix no metric header if --per-socket and --metric-only set perf python: Check if clang supports -fno-semantic-interposition tools arch x86: Sync the msr-index.h copy with the kernel sources
2 parents 80ade29 + cd09433 commit b737458

File tree

22 files changed

+646
-387
lines changed

22 files changed

+646
-387
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
#define X86_FEATURE_IBRS ( 7*32+25) /* Indirect Branch Restricted Speculation */
218218
#define X86_FEATURE_IBPB ( 7*32+26) /* Indirect Branch Prediction Barrier */
219219
#define X86_FEATURE_STIBP ( 7*32+27) /* Single Thread Indirect Branch Predictors */
220-
#define X86_FEATURE_ZEN ( 7*32+28) /* "" CPU is AMD family 0x17 (Zen) */
220+
#define X86_FEATURE_ZEN ( 7*32+28) /* "" CPU is AMD family 0x17 or above (Zen) */
221221
#define X86_FEATURE_L1TF_PTEINV ( 7*32+29) /* "" L1TF workaround PTE inversion */
222222
#define X86_FEATURE_IBRS_ENHANCED ( 7*32+30) /* Enhanced IBRS */
223223
#define X86_FEATURE_MSR_IA32_FEAT_CTL ( 7*32+31) /* "" MSR IA32_FEAT_CTL configured */
@@ -285,6 +285,7 @@
285285
#define X86_FEATURE_CQM_MBM_LOCAL (11*32+ 3) /* LLC Local MBM monitoring */
286286
#define X86_FEATURE_FENCE_SWAPGS_USER (11*32+ 4) /* "" LFENCE in user entry SWAPGS path */
287287
#define X86_FEATURE_FENCE_SWAPGS_KERNEL (11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */
288+
#define X86_FEATURE_SPLIT_LOCK_DETECT (11*32+ 6) /* #AC for split lock */
288289

289290
/* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
290291
#define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */
@@ -299,6 +300,7 @@
299300
#define X86_FEATURE_AMD_IBRS (13*32+14) /* "" Indirect Branch Restricted Speculation */
300301
#define X86_FEATURE_AMD_STIBP (13*32+15) /* "" Single Thread Indirect Branch Predictors */
301302
#define X86_FEATURE_AMD_STIBP_ALWAYS_ON (13*32+17) /* "" Single Thread Indirect Branch Predictors always-on preferred */
303+
#define X86_FEATURE_AMD_PPIN (13*32+23) /* Protected Processor Inventory Number */
302304
#define X86_FEATURE_AMD_SSBD (13*32+24) /* "" Speculative Store Bypass Disable */
303305
#define X86_FEATURE_VIRT_SSBD (13*32+25) /* Virtualized Speculative Store Bypass Disable */
304306
#define X86_FEATURE_AMD_SSB_NO (13*32+26) /* "" Speculative Store Bypass is fixed in hardware. */
@@ -367,6 +369,7 @@
367369
#define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */
368370
#define X86_FEATURE_FLUSH_L1D (18*32+28) /* Flush L1D cache */
369371
#define X86_FEATURE_ARCH_CAPABILITIES (18*32+29) /* IA32_ARCH_CAPABILITIES MSR (Intel) */
372+
#define X86_FEATURE_CORE_CAPABILITIES (18*32+30) /* "" IA32_CORE_CAPABILITIES MSR */
370373
#define X86_FEATURE_SPEC_CTRL_SSBD (18*32+31) /* "" Speculative Store Bypass Disable */
371374

372375
/*

tools/arch/x86/include/asm/msr-index.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141

4242
/* Intel MSRs. Some also available on other CPUs */
4343

44+
#define MSR_TEST_CTRL 0x00000033
45+
#define MSR_TEST_CTRL_SPLIT_LOCK_DETECT_BIT 29
46+
#define MSR_TEST_CTRL_SPLIT_LOCK_DETECT BIT(MSR_TEST_CTRL_SPLIT_LOCK_DETECT_BIT)
47+
4448
#define MSR_IA32_SPEC_CTRL 0x00000048 /* Speculation Control */
4549
#define SPEC_CTRL_IBRS BIT(0) /* Indirect Branch Restricted Speculation */
4650
#define SPEC_CTRL_STIBP_SHIFT 1 /* Single Thread Indirect Branch Predictor (STIBP) bit */
@@ -70,6 +74,11 @@
7074
*/
7175
#define MSR_IA32_UMWAIT_CONTROL_TIME_MASK (~0x03U)
7276

77+
/* Abbreviated from Intel SDM name IA32_CORE_CAPABILITIES */
78+
#define MSR_IA32_CORE_CAPS 0x000000cf
79+
#define MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT_BIT 5
80+
#define MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT BIT(MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT_BIT)
81+
7382
#define MSR_PKG_CST_CONFIG_CONTROL 0x000000e2
7483
#define NHM_C3_AUTO_DEMOTE (1UL << 25)
7584
#define NHM_C1_AUTO_DEMOTE (1UL << 26)

tools/include/linux/bits.h

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
#define __LINUX_BITS_H
44

55
#include <linux/const.h>
6+
#include <vdso/bits.h>
67
#include <asm/bitsperlong.h>
78

8-
#define BIT(nr) (UL(1) << (nr))
99
#define BIT_ULL(nr) (ULL(1) << (nr))
1010
#define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))
1111
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
@@ -18,12 +18,30 @@
1818
* position @h. For example
1919
* GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
2020
*/
21-
#define GENMASK(h, l) \
21+
#if !defined(__ASSEMBLY__) && \
22+
(!defined(CONFIG_CC_IS_GCC) || CONFIG_GCC_VERSION >= 49000)
23+
#include <linux/build_bug.h>
24+
#define GENMASK_INPUT_CHECK(h, l) \
25+
(BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
26+
__builtin_constant_p((l) > (h)), (l) > (h), 0)))
27+
#else
28+
/*
29+
* BUILD_BUG_ON_ZERO is not available in h files included from asm files,
30+
* disable the input check if that is the case.
31+
*/
32+
#define GENMASK_INPUT_CHECK(h, l) 0
33+
#endif
34+
35+
#define __GENMASK(h, l) \
2236
(((~UL(0)) - (UL(1) << (l)) + 1) & \
2337
(~UL(0) >> (BITS_PER_LONG - 1 - (h))))
38+
#define GENMASK(h, l) \
39+
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
2440

25-
#define GENMASK_ULL(h, l) \
41+
#define __GENMASK_ULL(h, l) \
2642
(((~ULL(0)) - (ULL(1) << (l)) + 1) & \
2743
(~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
44+
#define GENMASK_ULL(h, l) \
45+
(GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
2846

2947
#endif /* __LINUX_BITS_H */

tools/include/linux/build_bug.h

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _LINUX_BUILD_BUG_H
3+
#define _LINUX_BUILD_BUG_H
4+
5+
#include <linux/compiler.h>
6+
7+
#ifdef __CHECKER__
8+
#define BUILD_BUG_ON_ZERO(e) (0)
9+
#else /* __CHECKER__ */
10+
/*
11+
* Force a compilation error if condition is true, but also produce a
12+
* result (of value 0 and type int), so the expression can be used
13+
* e.g. in a structure initializer (or where-ever else comma expressions
14+
* aren't permitted).
15+
*/
16+
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
17+
#endif /* __CHECKER__ */
18+
19+
/* Force a compilation error if a constant expression is not a power of 2 */
20+
#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \
21+
BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
22+
#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
23+
BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
24+
25+
/*
26+
* BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the
27+
* expression but avoids the generation of any code, even if that expression
28+
* has side-effects.
29+
*/
30+
#define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
31+
32+
/**
33+
* BUILD_BUG_ON_MSG - break compile if a condition is true & emit supplied
34+
* error message.
35+
* @condition: the condition which the compiler should know is false.
36+
*
37+
* See BUILD_BUG_ON for description.
38+
*/
39+
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
40+
41+
/**
42+
* BUILD_BUG_ON - break compile if a condition is true.
43+
* @condition: the condition which the compiler should know is false.
44+
*
45+
* If you have some code which relies on certain constants being equal, or
46+
* some other compile-time-evaluated condition, you should use BUILD_BUG_ON to
47+
* detect if someone changes it.
48+
*/
49+
#define BUILD_BUG_ON(condition) \
50+
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
51+
52+
/**
53+
* BUILD_BUG - break compile if used.
54+
*
55+
* If you have some code that you expect the compiler to eliminate at
56+
* build time, you should use BUILD_BUG to detect if it is
57+
* unexpectedly used.
58+
*/
59+
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
60+
61+
/**
62+
* static_assert - check integer constant expression at build time
63+
*
64+
* static_assert() is a wrapper for the C11 _Static_assert, with a
65+
* little macro magic to make the message optional (defaulting to the
66+
* stringification of the tested expression).
67+
*
68+
* Contrary to BUILD_BUG_ON(), static_assert() can be used at global
69+
* scope, but requires the expression to be an integer constant
70+
* expression (i.e., it is not enough that __builtin_constant_p() is
71+
* true for expr).
72+
*
73+
* Also note that BUILD_BUG_ON() fails the build if the condition is
74+
* true, while static_assert() fails the build if the expression is
75+
* false.
76+
*/
77+
#ifndef static_assert
78+
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
79+
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
80+
#endif // static_assert
81+
82+
#endif /* _LINUX_BUILD_BUG_H */

tools/include/linux/compiler.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,32 @@
1010
# define __compiletime_error(message)
1111
#endif
1212

13+
#ifdef __OPTIMIZE__
14+
# define __compiletime_assert(condition, msg, prefix, suffix) \
15+
do { \
16+
extern void prefix ## suffix(void) __compiletime_error(msg); \
17+
if (!(condition)) \
18+
prefix ## suffix(); \
19+
} while (0)
20+
#else
21+
# define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0)
22+
#endif
23+
24+
#define _compiletime_assert(condition, msg, prefix, suffix) \
25+
__compiletime_assert(condition, msg, prefix, suffix)
26+
27+
/**
28+
* compiletime_assert - break build and emit msg if condition is false
29+
* @condition: a compile-time constant condition to check
30+
* @msg: a message to emit if condition is false
31+
*
32+
* In tradition of POSIX assert, this macro will break the build if the
33+
* supplied condition is *false*, emitting the supplied error message if the
34+
* compiler has support to do so.
35+
*/
36+
#define compiletime_assert(condition, msg) \
37+
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
38+
1339
/* Optimization barrier */
1440
/* The "volatile" is due to gcc bugs */
1541
#define barrier() __asm__ __volatile__("": : :"memory")

tools/include/linux/const.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#ifndef _LINUX_CONST_H
22
#define _LINUX_CONST_H
33

4-
#include <uapi/linux/const.h>
5-
6-
#define UL(x) (_UL(x))
7-
#define ULL(x) (_ULL(x))
4+
#include <vdso/const.h>
85

96
#endif /* _LINUX_CONST_H */

tools/include/linux/kernel.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <stdarg.h>
66
#include <stddef.h>
77
#include <assert.h>
8+
#include <linux/build_bug.h>
89
#include <linux/compiler.h>
910
#include <endian.h>
1011
#include <byteswap.h>
@@ -35,9 +36,6 @@
3536
(type *)((char *)__mptr - offsetof(type, member)); })
3637
#endif
3738

38-
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
39-
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
40-
4139
#ifndef max
4240
#define max(x, y) ({ \
4341
typeof(x) _max1 = (x); \

tools/include/uapi/drm/drm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,8 @@ extern "C" {
948948
#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer)
949949
#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
950950

951+
#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
952+
951953
/**
952954
* Device specific ioctls should only be in their respective headers
953955
* The device specific ioctl range is from 0x40 to 0x9f.

tools/include/uapi/drm/i915_drm.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,27 @@ struct drm_i915_gem_context_param {
16191619
* By default, new contexts allow persistence.
16201620
*/
16211621
#define I915_CONTEXT_PARAM_PERSISTENCE 0xb
1622+
1623+
/*
1624+
* I915_CONTEXT_PARAM_RINGSIZE:
1625+
*
1626+
* Sets the size of the CS ringbuffer to use for logical ring contexts. This
1627+
* applies a limit of how many batches can be queued to HW before the caller
1628+
* is blocked due to lack of space for more commands.
1629+
*
1630+
* Only reliably possible to be set prior to first use, i.e. during
1631+
* construction. At any later point, the current execution must be flushed as
1632+
* the ring can only be changed while the context is idle. Note, the ringsize
1633+
* can be specified as a constructor property, see
1634+
* I915_CONTEXT_CREATE_EXT_SETPARAM, but can also be set later if required.
1635+
*
1636+
* Only applies to the current set of engine and lost when those engines
1637+
* are replaced by a new mapping (see I915_CONTEXT_PARAM_ENGINES).
1638+
*
1639+
* Must be between 4 - 512 KiB, in intervals of page size [4 KiB].
1640+
* Default is 16 KiB.
1641+
*/
1642+
#define I915_CONTEXT_PARAM_RINGSIZE 0xc
16221643
/* Must be kept compact -- no holes and well documented */
16231644

16241645
__u64 value;

tools/include/uapi/linux/fscrypt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ struct fscrypt_get_key_status_arg {
163163
#define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg)
164164
#define FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS _IOWR('f', 25, struct fscrypt_remove_key_arg)
165165
#define FS_IOC_GET_ENCRYPTION_KEY_STATUS _IOWR('f', 26, struct fscrypt_get_key_status_arg)
166+
#define FS_IOC_GET_ENCRYPTION_NONCE _IOR('f', 27, __u8[16])
166167

167168
/**********************************************************************/
168169

tools/include/uapi/linux/kvm.h

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,17 @@ struct kvm_s390_mem_op {
474474
__u32 size; /* amount of bytes */
475475
__u32 op; /* type of operation */
476476
__u64 buf; /* buffer in userspace */
477-
__u8 ar; /* the access register number */
478-
__u8 reserved[31]; /* should be set to 0 */
477+
union {
478+
__u8 ar; /* the access register number */
479+
__u32 sida_offset; /* offset into the sida */
480+
__u8 reserved[32]; /* should be set to 0 */
481+
};
479482
};
480483
/* types for kvm_s390_mem_op->op */
481484
#define KVM_S390_MEMOP_LOGICAL_READ 0
482485
#define KVM_S390_MEMOP_LOGICAL_WRITE 1
486+
#define KVM_S390_MEMOP_SIDA_READ 2
487+
#define KVM_S390_MEMOP_SIDA_WRITE 3
483488
/* flags for kvm_s390_mem_op->flags */
484489
#define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
485490
#define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
@@ -1010,6 +1015,8 @@ struct kvm_ppc_resize_hpt {
10101015
#define KVM_CAP_ARM_NISV_TO_USER 177
10111016
#define KVM_CAP_ARM_INJECT_EXT_DABT 178
10121017
#define KVM_CAP_S390_VCPU_RESETS 179
1018+
#define KVM_CAP_S390_PROTECTED 180
1019+
#define KVM_CAP_PPC_SECURE_GUEST 181
10131020

10141021
#ifdef KVM_CAP_IRQ_ROUTING
10151022

@@ -1478,6 +1485,39 @@ struct kvm_enc_region {
14781485
#define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)
14791486
#define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)
14801487

1488+
struct kvm_s390_pv_sec_parm {
1489+
__u64 origin;
1490+
__u64 length;
1491+
};
1492+
1493+
struct kvm_s390_pv_unp {
1494+
__u64 addr;
1495+
__u64 size;
1496+
__u64 tweak;
1497+
};
1498+
1499+
enum pv_cmd_id {
1500+
KVM_PV_ENABLE,
1501+
KVM_PV_DISABLE,
1502+
KVM_PV_SET_SEC_PARMS,
1503+
KVM_PV_UNPACK,
1504+
KVM_PV_VERIFY,
1505+
KVM_PV_PREP_RESET,
1506+
KVM_PV_UNSHARE_ALL,
1507+
};
1508+
1509+
struct kvm_pv_cmd {
1510+
__u32 cmd; /* Command to be executed */
1511+
__u16 rc; /* Ultravisor return code */
1512+
__u16 rrc; /* Ultravisor return reason code */
1513+
__u64 data; /* Data or address */
1514+
__u32 flags; /* flags for future extensions. Must be 0 for now */
1515+
__u32 reserved[3];
1516+
};
1517+
1518+
/* Available with KVM_CAP_S390_PROTECTED */
1519+
#define KVM_S390_PV_COMMAND _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd)
1520+
14811521
/* Secure Encrypted Virtualization command */
14821522
enum sev_cmd_id {
14831523
/* Guest initialization commands */
@@ -1628,4 +1668,7 @@ struct kvm_hyperv_eventfd {
16281668
#define KVM_HYPERV_CONN_ID_MASK 0x00ffffff
16291669
#define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0)
16301670

1671+
#define KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE (1 << 0)
1672+
#define KVM_DIRTY_LOG_INITIALLY_SET (1 << 1)
1673+
16311674
#endif /* __LINUX_KVM_H */

tools/include/uapi/linux/mman.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
#include <asm/mman.h>
66
#include <asm-generic/hugetlb_encode.h>
77

8-
#define MREMAP_MAYMOVE 1
9-
#define MREMAP_FIXED 2
8+
#define MREMAP_MAYMOVE 1
9+
#define MREMAP_FIXED 2
10+
#define MREMAP_DONTUNMAP 4
1011

1112
#define OVERCOMMIT_GUESS 0
1213
#define OVERCOMMIT_ALWAYS 1

0 commit comments

Comments
 (0)