Skip to contentSkip to conversation

tools headers: Sync header files with the kernel

PATCH In review Namhyung Kim 5 participants 18 messages Apr 10, 2025 – Apr 24, 2025

Subsystems (9)
Networking Network drivers VFS KVM +5 more subsystems
lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

cover tools headers: Sync header files with the kernel

Hello,

FYI I'm carrying these changes in the perf tools tree so make perf trace beautifiers get the recent changes in syscall, ioctl, and so on. For the background, please see tools/include/uapi/README.

Still there are some remaining items but it requires a bit more changes. So I'd like to leave them for the next cycle.

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/bits.h include/uapi/linux/bits.h diff -u tools/include/linux/bits.h include/linux/bits.h
diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h

Thanks,
Namhyung

Namhyung Kim (10):
tools headers: Update the KVM headers with the kernel sources
tools headers: Update the socket headers with the kernel sources
tools headers: Update the uapi/linux/perf_event.h copy with the kernel sources tools headers: Update the VFS headers with the kernel sources
tools headers: Update the syscall table with the kernel sources
tools headers: Update the uapi/linux/prctl.h copy with the kernel sources tools headers: Update the uapi/asm-generic/mman-common.h copy with the kernel sources tools headers: Update the linux/unaligned.h copy with the kernel sources tools headers: Update the x86 headers with the kernel sources
tools headers: Update the arch/x86/lib/memset_64.S copy with the kernel sources

 tools/arch/arm64/include/uapi/asm/kvm.h       |  5 +-
 tools/arch/arm64/include/uapi/asm/unistd.h    | 24 +----
 tools/arch/x86/include/asm/cpufeatures.h      | 28 ++++--
 tools/arch/x86/include/asm/msr-index.h        | 31 +++---
 tools/arch/x86/include/uapi/asm/kvm.h         |  4 +
 tools/arch/x86/include/uapi/asm/svm.h         |  2 +
 tools/arch/x86/lib/memset_64.S                |  3 +-
 tools/include/linux/cfi_types.h               | 45 +++++++++
 tools/include/uapi/asm-generic/mman-common.h  |  1 +
 tools/include/uapi/asm-generic/unistd.h       |  4 +-
 tools/include/uapi/linux/in.h                 |  2 +
 tools/include/uapi/linux/kvm.h                |  9 +-
 tools/include/uapi/linux/perf_event.h         |  2 +
 tools/include/uapi/linux/stat.h               | 99 ++++++++++++++-----
 .../perf/arch/arm/entry/syscalls/syscall.tbl  |  1 +
 .../arch/mips/entry/syscalls/syscall_n64.tbl  |  1 +
 .../arch/powerpc/entry/syscalls/syscall.tbl   |  1 +
 .../perf/arch/s390/entry/syscalls/syscall.tbl |  1 +
 tools/perf/arch/sh/entry/syscalls/syscall.tbl |  1 +
 .../arch/sparc/entry/syscalls/syscall.tbl     |  1 +
 .../arch/x86/entry/syscalls/syscall_32.tbl    |  3 +-
 .../arch/x86/entry/syscalls/syscall_64.tbl    |  1 +
 .../arch/xtensa/entry/syscalls/syscall.tbl    |  1 +
 tools/perf/check-headers.sh                   |  1 +
 .../perf/trace/beauty/include/linux/socket.h  |  2 +
 .../trace/beauty/include/uapi/linux/fcntl.h   |  4 +
 .../perf/trace/beauty/include/uapi/linux/fs.h | 21 +++-
 .../trace/beauty/include/uapi/linux/mount.h   | 10 +-
 .../trace/beauty/include/uapi/linux/prctl.h   | 11 +++
 .../trace/beauty/include/uapi/linux/stat.h    | 99 ++++++++++++++-----
 .../trace/beauty/include/uapi/sound/asound.h  |  8 +-
 tools/scripts/syscall.tbl                     |  1 +
 32 files changed, 318 insertions(+), 109 deletions(-)
 create mode 100644 tools/include/linux/cfi_types.h

base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8

Signature · 1 line
2.49.0.504.g3bcea36a83-goog
author maintainer
#1 lore raw

PATCH 1/10 tools headers: Update the KVM headers with the kernel sources

To pick up the changes in:

af5366bea2cb9dfb KVM: x86: Drop the now unused KVM_X86_DISABLE_VALID_EXITS 915d2f0718a42ee0 KVM: Move KVM_REG_SIZE() definition to common uAPI header 5c17848134ab1ffb KVM: x86/xen: Restrict hypercall MSR to unofficial synthetic range 9364789567f9b492 KVM: x86: Add a VM type define for TDX
fa662c9080732b1f KVM: SVM: Add Idle HLT intercept support 3adaee78306148da KVM: arm64: Allow userspace to change the implementation ID registers faf7714a47a25c62 KVM: arm64: nv: Allow userland to set VGIC maintenance IRQ c0000e58c74eed07 KVM: arm64: Introduce KVM_REG_ARM_VENDOR_HYP_BMAP_2 f83c41fb3dddbf47 KVM: arm64: Allow userspace to limit NV support to nVHE

Addressing this perf tools build warning:

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h diff -u tools/arch/x86/include/uapi/asm/svm.h arch/x86/include/uapi/asm/svm.h diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h

Please see tools/include/uapi/README for further details.

---
 tools/arch/arm64/include/uapi/asm/kvm.h | 5 ++---
 tools/arch/x86/include/uapi/asm/kvm.h   | 4 ++++
 tools/arch/x86/include/uapi/asm/svm.h   | 2 ++
 tools/include/uapi/linux/kvm.h          | 9 +++++----
 4 files changed, 13 insertions(+), 7 deletions(-)
tools/arch/arm64/include/uapi/asm/kvm.h +2 -3
index 6d44f8c8a18fd98e..af9d9acaf9975a88 100644
@@ -43,9 +43,6 @@
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
 #define KVM_DIRTY_LOG_PAGE_OFFSET 64
 
-#define KVM_REG_SIZE(id)						\
-	(1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
-
 struct kvm_regs {
 	struct user_pt_regs regs;	/* sp = sp_el0 */
 
@@ -108,6 +105,7 @@ struct kvm_regs {
 #define KVM_ARM_VCPU_PTRAUTH_ADDRESS	5 /* VCPU uses address authentication */
 #define KVM_ARM_VCPU_PTRAUTH_GENERIC	6 /* VCPU uses generic authentication */
 #define KVM_ARM_VCPU_HAS_EL2		7 /* Support nested virtualization */
+#define KVM_ARM_VCPU_HAS_EL2_E2H0	8 /* Limit NV support to E2H RES0 */
 
 struct kvm_vcpu_init {
 	__u32 target;
@@ -418,6 +416,7 @@ enum {
 #define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6
 #define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO  7
 #define KVM_DEV_ARM_VGIC_GRP_ITS_REGS 8
+#define KVM_DEV_ARM_VGIC_GRP_MAINT_IRQ  9
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT	10
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \
 			(0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT)
tools/arch/x86/include/uapi/asm/kvm.h +4 -0
index 88585c1de416fa6f..460306b35a4bfee9 100644
@@ -559,6 +559,9 @@ struct kvm_x86_mce {
 #define KVM_XEN_HVM_CONFIG_PVCLOCK_TSC_UNSTABLE	(1 << 7)
 #define KVM_XEN_HVM_CONFIG_SHARED_INFO_HVA	(1 << 8)
 
+#define KVM_XEN_MSR_MIN_INDEX			0x40000000u
+#define KVM_XEN_MSR_MAX_INDEX			0x4fffffffu
+
 struct kvm_xen_hvm_config {
 	__u32 flags;
 	__u32 msr;
@@ -925,5 +928,6 @@ struct kvm_hyperv_eventfd {
 #define KVM_X86_SEV_VM		2
 #define KVM_X86_SEV_ES_VM	3
 #define KVM_X86_SNP_VM		4
+#define KVM_X86_TDX_VM		5
 
 #endif /* _ASM_X86_KVM_H */
tools/arch/x86/include/uapi/asm/svm.h +2 -0
index 1814b413fd5783d2..ec1321248dac2ab5 100644
@@ -95,6 +95,7 @@
 #define SVM_EXIT_CR14_WRITE_TRAP		0x09e
 #define SVM_EXIT_CR15_WRITE_TRAP		0x09f
 #define SVM_EXIT_INVPCID       0x0a2
+#define SVM_EXIT_IDLE_HLT      0x0a6
 #define SVM_EXIT_NPF           0x400
 #define SVM_EXIT_AVIC_INCOMPLETE_IPI		0x401
 #define SVM_EXIT_AVIC_UNACCELERATED_ACCESS	0x402
@@ -224,6 +225,7 @@
 	{ SVM_EXIT_CR4_WRITE_TRAP,	"write_cr4_trap" }, \
 	{ SVM_EXIT_CR8_WRITE_TRAP,	"write_cr8_trap" }, \
 	{ SVM_EXIT_INVPCID,     "invpcid" }, \
+	{ SVM_EXIT_IDLE_HLT,     "idle-halt" }, \
 	{ SVM_EXIT_NPF,         "npf" }, \
 	{ SVM_EXIT_AVIC_INCOMPLETE_IPI,		"avic_incomplete_ipi" }, \
 	{ SVM_EXIT_AVIC_UNACCELERATED_ACCESS,   "avic_unaccelerated_access" }, \
tools/include/uapi/linux/kvm.h +5 -4
index 502ea63b5d2e7371..b6ae8ad8934b52c7 100644
@@ -617,10 +617,6 @@ struct kvm_ioeventfd {
 #define KVM_X86_DISABLE_EXITS_HLT            (1 << 1)
 #define KVM_X86_DISABLE_EXITS_PAUSE          (1 << 2)
 #define KVM_X86_DISABLE_EXITS_CSTATE         (1 << 3)
-#define KVM_X86_DISABLE_VALID_EXITS          (KVM_X86_DISABLE_EXITS_MWAIT | \
-                                              KVM_X86_DISABLE_EXITS_HLT | \
-                                              KVM_X86_DISABLE_EXITS_PAUSE | \
-                                              KVM_X86_DISABLE_EXITS_CSTATE)
 
 /* for KVM_ENABLE_CAP */
 struct kvm_enable_cap {
@@ -933,6 +929,7 @@ struct kvm_enable_cap {
 #define KVM_CAP_PRE_FAULT_MEMORY 236
 #define KVM_CAP_X86_APIC_BUS_CYCLES_NS 237
 #define KVM_CAP_X86_GUEST_MODE 238
+#define KVM_CAP_ARM_WRITABLE_IMP_ID_REGS 239
 
 struct kvm_irq_routing_irqchip {
 	__u32 irqchip;
@@ -1070,6 +1067,10 @@ struct kvm_dirty_tlb {
 
 #define KVM_REG_SIZE_SHIFT	52
 #define KVM_REG_SIZE_MASK	0x00f0000000000000ULL
+
+#define KVM_REG_SIZE(id)		\
+	(1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
+
 #define KVM_REG_SIZE_U8		0x0000000000000000ULL
 #define KVM_REG_SIZE_U16	0x0010000000000000ULL
 #define KVM_REG_SIZE_U32	0x0020000000000000ULL
Signature · 1 line
2.49.0.504.g3bcea36a83-goog
author maintainer
#2 lore raw

PATCH 2/10 tools headers: Update the socket headers with the kernel sources

In reply to Namhyung Kim

To pick up the changes in:

64e844505bc08cde include: uapi: protocol number and packet structs for AGGFRAG in ESP 18912c520674ec4d tcp: devmem: don't write truncated dmabuf CMSGs to userspace

Addressing this perf tools build warning:

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h diff -u tools/perf/trace/beauty/include/linux/socket.h include/linux/socket.h

Please see tools/include/uapi/README for further details.

---
 tools/include/uapi/linux/in.h                  | 2 ++
 tools/perf/trace/beauty/include/linux/socket.h | 2 ++
 2 files changed, 4 insertions(+)
tools/include/uapi/linux/in.h +2 -0
index 5d32d53508d99f86..ced0fc3c3aa5343a 100644
@@ -79,6 +79,8 @@ enum {
 #define IPPROTO_MPLS		IPPROTO_MPLS
   IPPROTO_ETHERNET = 143,	/* Ethernet-within-IPv6 Encapsulation	*/
 #define IPPROTO_ETHERNET	IPPROTO_ETHERNET
+  IPPROTO_AGGFRAG = 144,	/* AGGFRAG in ESP (RFC 9347)		*/
+#define IPPROTO_AGGFRAG		IPPROTO_AGGFRAG
   IPPROTO_RAW = 255,		/* Raw IP packets			*/
 #define IPPROTO_RAW		IPPROTO_RAW
   IPPROTO_SMC = 256,		/* Shared Memory Communications		*/
tools/perf/trace/beauty/include/linux/socket.h +2 -0
index d18cc47e89bd0164..c3322eb3d6865d5e 100644
@@ -392,6 +392,8 @@ struct ucred {
 
 extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
 extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
+extern int put_cmsg_notrunc(struct msghdr *msg, int level, int type, int len,
+			    void *data);
 
 struct timespec64;
 struct __kernel_timespec;
Signature · 1 line
2.49.0.504.g3bcea36a83-goog
author maintainer
#3 lore raw

PATCH 3/10 tools headers: Update the uapi/linux/perf_event.h copy with the kernel sources

In reply to Namhyung Kim

To pick up the changes in:

c53e14f1ea4a8f8d perf: Extend per event callchain limit to branch stack

Addressing this perf tools build warning:

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/perf_event.h include/uapi/linux/perf_event.h

Please see tools/include/uapi/README for further details.

---
 tools/include/uapi/linux/perf_event.h | 2 ++
 1 file changed, 2 insertions(+)
tools/include/uapi/linux/perf_event.h +2 -0
index 0524d541d4e3d501..5fc753c23734dfc4 100644
@@ -385,6 +385,8 @@ enum perf_event_read_format {
  *
  * @sample_max_stack: Max number of frame pointers in a callchain,
  *		      should be < /proc/sys/kernel/perf_event_max_stack
+ *		      Max number of entries of branch stack
+ *		      should be < hardware limit
  */
 struct perf_event_attr {
 
Signature · 1 line
2.49.0.504.g3bcea36a83-goog
author maintainer
#4 lore raw

PATCH 4/10 tools headers: Update the VFS headers with the kernel sources

In reply to Namhyung Kim

To pick up the changes in:

7ed6cbe0f8caa6ee fs: add STATX_DIO_READ_ALIGN
8fc7e23a9bd851e6 fs: reformat the statx definition
a5874fde3c0884a3 exec: Add a new AT_EXECVE_CHECK flag to execveat(2) 1ebd4a3c095cd538 blk-crypto: add ioctls to create and prepare hardware-wrapped keys af6505e5745b9f3a fs: add RWF_DONTCACHE iocb and FOP_DONTCACHE file_operations flag 10783d0ba0d7731e fs, iov_iter: define meta io descriptor 8f6116b5b77b0536 statmount: add a new supported_mask field 37c4a9590e1efcae statmount: allow to retrieve idmappings

Addressing this perf tools build warning:

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/stat.h include/uapi/linux/stat.h
diff -u tools/perf/trace/beauty/include/uapi/linux/stat.h include/uapi/linux/stat.h diff -u tools/perf/trace/beauty/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h diff -u tools/perf/trace/beauty/include/uapi/linux/fs.h include/uapi/linux/fs.h diff -u tools/perf/trace/beauty/include/uapi/linux/mount.h include/uapi/linux/mount.h

Please see tools/include/uapi/README for further details.

---
 tools/include/uapi/linux/stat.h               | 99 ++++++++++++++-----
 .../trace/beauty/include/uapi/linux/fcntl.h   |  4 +
 .../perf/trace/beauty/include/uapi/linux/fs.h | 21 +++-
 .../trace/beauty/include/uapi/linux/mount.h   | 10 +-
 .../trace/beauty/include/uapi/linux/stat.h    | 99 ++++++++++++++-----
 5 files changed, 179 insertions(+), 54 deletions(-)
tools/include/uapi/linux/stat.h +75 -24
index 887a2528644168a3..f78ee3670dd5d7c8 100644
@@ -98,43 +98,93 @@ struct statx_timestamp {
  */
 struct statx {
 	/* 0x00 */
-	__u32	stx_mask;	/* What results were written [uncond] */
-	__u32	stx_blksize;	/* Preferred general I/O size [uncond] */
-	__u64	stx_attributes;	/* Flags conveying information about the file [uncond] */
+	/* What results were written [uncond] */
+	__u32	stx_mask;
+
+	/* Preferred general I/O size [uncond] */
+	__u32	stx_blksize;
+
+	/* Flags conveying information about the file [uncond] */
+	__u64	stx_attributes;
+
 	/* 0x10 */
-	__u32	stx_nlink;	/* Number of hard links */
-	__u32	stx_uid;	/* User ID of owner */
-	__u32	stx_gid;	/* Group ID of owner */
-	__u16	stx_mode;	/* File mode */
+	/* Number of hard links */
+	__u32	stx_nlink;
+
+	/* User ID of owner */
+	__u32	stx_uid;
+
+	/* Group ID of owner */
+	__u32	stx_gid;
+
+	/* File mode */
+	__u16	stx_mode;
 	__u16	__spare0[1];
+
 	/* 0x20 */
-	__u64	stx_ino;	/* Inode number */
-	__u64	stx_size;	/* File size */
-	__u64	stx_blocks;	/* Number of 512-byte blocks allocated */
-	__u64	stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
+	/* Inode number */
+	__u64	stx_ino;
+
+	/* File size */
+	__u64	stx_size;
+
+	/* Number of 512-byte blocks allocated */
+	__u64	stx_blocks;
+
+	/* Mask to show what's supported in stx_attributes */
+	__u64	stx_attributes_mask;
+
 	/* 0x40 */
-	struct statx_timestamp	stx_atime;	/* Last access time */
-	struct statx_timestamp	stx_btime;	/* File creation time */
-	struct statx_timestamp	stx_ctime;	/* Last attribute change time */
-	struct statx_timestamp	stx_mtime;	/* Last data modification time */
+	/* Last access time */
+	struct statx_timestamp	stx_atime;
+
+	/* File creation time */
+	struct statx_timestamp	stx_btime;
+
+	/* Last attribute change time */
+	struct statx_timestamp	stx_ctime;
+
+	/* Last data modification time */
+	struct statx_timestamp	stx_mtime;
+
 	/* 0x80 */
-	__u32	stx_rdev_major;	/* Device ID of special file [if bdev/cdev] */
+	/* Device ID of special file [if bdev/cdev] */
+	__u32	stx_rdev_major;
 	__u32	stx_rdev_minor;
-	__u32	stx_dev_major;	/* ID of device containing file [uncond] */
+
+	/* ID of device containing file [uncond] */
+	__u32	stx_dev_major;
 	__u32	stx_dev_minor;
+
 	/* 0x90 */
 	__u64	stx_mnt_id;
-	__u32	stx_dio_mem_align;	/* Memory buffer alignment for direct I/O */
-	__u32	stx_dio_offset_align;	/* File offset alignment for direct I/O */
+
+	/* Memory buffer alignment for direct I/O */
+	__u32	stx_dio_mem_align;
+
+	/* File offset alignment for direct I/O */
+	__u32	stx_dio_offset_align;
+
 	/* 0xa0 */
-	__u64	stx_subvol;	/* Subvolume identifier */
-	__u32	stx_atomic_write_unit_min;	/* Min atomic write unit in bytes */
-	__u32	stx_atomic_write_unit_max;	/* Max atomic write unit in bytes */
+	/* Subvolume identifier */
+	__u64	stx_subvol;
+
+	/* Min atomic write unit in bytes */
+	__u32	stx_atomic_write_unit_min;
+
+	/* Max atomic write unit in bytes */
+	__u32	stx_atomic_write_unit_max;
+
 	/* 0xb0 */
-	__u32   stx_atomic_write_segments_max;	/* Max atomic write segment count */
-	__u32   __spare1[1];
+	/* Max atomic write segment count */
+	__u32   stx_atomic_write_segments_max;
+
+	/* File offset alignment for direct I/O reads */
+	__u32	stx_dio_read_offset_align;
+
 	/* 0xb8 */
 	__u64	__spare3[9];	/* Spare space for future expansion */
+
 	/* 0x100 */
 };
 
@@ -164,6 +214,7 @@ struct statx {
 #define STATX_MNT_ID_UNIQUE	0x00004000U	/* Want/got extended stx_mount_id */
 #define STATX_SUBVOL		0x00008000U	/* Want/got stx_subvol */
 #define STATX_WRITE_ATOMIC	0x00010000U	/* Want/got atomic_write_* fields */
+#define STATX_DIO_READ_ALIGN	0x00020000U	/* Want/got dio read alignment info */
 
 #define STATX__RESERVED		0x80000000U	/* Reserved for future struct statx expansion */
 
tools/perf/trace/beauty/include/uapi/linux/fcntl.h +4 -0
index 6e6907e63bfc2b4d..a15ac2fa4b202fa0 100644
@@ -155,4 +155,8 @@
 #define AT_HANDLE_MNT_ID_UNIQUE	0x001	/* Return the u64 unique mount ID. */
 #define AT_HANDLE_CONNECTABLE	0x002	/* Request a connectable file handle */
 
+/* Flags for execveat2(2). */
+#define AT_EXECVE_CHECK		0x10000	/* Only perform a check if execution
+					   would be allowed. */
+
 #endif /* _UAPI_LINUX_FCNTL_H */
tools/perf/trace/beauty/include/uapi/linux/fs.h +16 -5
index 7539717707337a8c..e762e1af650c4bf0 100644
@@ -40,6 +40,15 @@
 #define BLOCK_SIZE_BITS 10
 #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
 
+/* flags for integrity meta */
+#define IO_INTEGRITY_CHK_GUARD		(1U << 0) /* enforce guard check */
+#define IO_INTEGRITY_CHK_REFTAG		(1U << 1) /* enforce ref check */
+#define IO_INTEGRITY_CHK_APPTAG		(1U << 2) /* enforce app check */
+
+#define IO_INTEGRITY_VALID_FLAGS (IO_INTEGRITY_CHK_GUARD | \
+				  IO_INTEGRITY_CHK_REFTAG | \
+				  IO_INTEGRITY_CHK_APPTAG)
+
 #define SEEK_SET	0	/* seek relative to beginning of file */
 #define SEEK_CUR	1	/* seek relative to current file position */
 #define SEEK_END	2	/* seek relative to end of file */
@@ -203,10 +212,8 @@ struct fsxattr {
 #define BLKROTATIONAL _IO(0x12,126)
 #define BLKZEROOUT _IO(0x12,127)
 #define BLKGETDISKSEQ _IOR(0x12,128,__u64)
-/*
- * A jump here: 130-136 are reserved for zoned block devices
- * (see uapi/linux/blkzoned.h)
- */
+/* 130-136 are used by zoned block device ioctls (uapi/linux/blkzoned.h) */
+/* 137-141 are used by blk-crypto ioctls (uapi/linux/blk-crypto.h) */
 
 #define BMAP_IOCTL 1		/* obsolete - kept for compatibility */
 #define FIBMAP	   _IO(0x00,1)	/* bmap access */
@@ -332,9 +339,13 @@ typedef int __bitwise __kernel_rwf_t;
 /* Atomic Write */
 #define RWF_ATOMIC	((__force __kernel_rwf_t)0x00000040)
 
+/* buffered IO that drops the cache after reading or writing data */
+#define RWF_DONTCACHE	((__force __kernel_rwf_t)0x00000080)
+
 /* mask of flags supported by the kernel */
 #define RWF_SUPPORTED	(RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
-			 RWF_APPEND | RWF_NOAPPEND | RWF_ATOMIC)
+			 RWF_APPEND | RWF_NOAPPEND | RWF_ATOMIC |\
+			 RWF_DONTCACHE)
 
 #define PROCFS_IOCTL_MAGIC 'f'
 
tools/perf/trace/beauty/include/uapi/linux/mount.h +9 -1
index c07008816acae89c..7fa67c2031a5db52 100644
@@ -179,7 +179,12 @@ struct statmount {
 	__u32 opt_array;	/* [str] Array of nul terminated fs options */
 	__u32 opt_sec_num;	/* Number of security options */
 	__u32 opt_sec_array;	/* [str] Array of nul terminated security options */
-	__u64 __spare2[46];
+	__u64 supported_mask;	/* Mask flags that this kernel supports */
+	__u32 mnt_uidmap_num;	/* Number of uid mappings */
+	__u32 mnt_uidmap;	/* [str] Array of uid mappings (as seen from callers namespace) */
+	__u32 mnt_gidmap_num;	/* Number of gid mappings */
+	__u32 mnt_gidmap;	/* [str] Array of gid mappings (as seen from callers namespace) */
+	__u64 __spare2[43];
 	char str[];		/* Variable size part containing strings */
 };
 
@@ -217,6 +222,9 @@ struct mnt_id_req {
 #define STATMOUNT_SB_SOURCE		0x00000200U	/* Want/got sb_source */
 #define STATMOUNT_OPT_ARRAY		0x00000400U	/* Want/got opt_... */
 #define STATMOUNT_OPT_SEC_ARRAY		0x00000800U	/* Want/got opt_sec... */
+#define STATMOUNT_SUPPORTED_MASK	0x00001000U	/* Want/got supported mask flags */
+#define STATMOUNT_MNT_UIDMAP		0x00002000U	/* Want/got uidmap... */
+#define STATMOUNT_MNT_GIDMAP		0x00004000U	/* Want/got gidmap... */
 
 /*
  * Special @mnt_id values that can be passed to listmount
tools/perf/trace/beauty/include/uapi/linux/stat.h +75 -24

124 lines not on this page · raw message

Signature · 1 line
2.49.0.504.g3bcea36a83-goog
author maintainer
#5 lore raw

PATCH 5/10 tools headers: Update the syscall table with the kernel sources

In reply to Namhyung Kim

To pick up the changes in:

c4a16820d9019940 fs: add open_tree_attr() 2df1ad0d25803399 x86/arch_prctl: Simplify sys_arch_prctl() e632bca07c8eef1d arm64: generate 64-bit syscall.tbl

This is basically to support the new open_tree_attr syscall. But it also needs to update asm-generic unistd.h header to get the new syscall number. And arm64 unistd.h header was converted to use the generic 64-bit header.

Addressing this perf tools build warning:

Warning: Kernel ABI header differences:
diff -u tools/scripts/syscall.tbl scripts/syscall.tbl
diff -u tools/perf/arch/x86/entry/syscalls/syscall_32.tbl arch/x86/entry/syscalls/syscall_32.tbl diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl diff -u tools/perf/arch/arm/entry/syscalls/syscall.tbl arch/arm/tools/syscall.tbl diff -u tools/perf/arch/sh/entry/syscalls/syscall.tbl arch/sh/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/sparc/entry/syscalls/syscall.tbl arch/sparc/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/xtensa/entry/syscalls/syscall.tbl arch/xtensa/kernel/syscalls/syscall.tbl diff -u tools/arch/arm64/include/uapi/asm/unistd.h arch/arm64/include/uapi/asm/unistd.h diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h

Please see tools/include/uapi/README for further details.

---
 tools/arch/arm64/include/uapi/asm/unistd.h    | 24 +------------------
 tools/include/uapi/asm-generic/unistd.h       |  4 +++-
 .../perf/arch/arm/entry/syscalls/syscall.tbl  |  1 +
 .../arch/mips/entry/syscalls/syscall_n64.tbl  |  1 +
 .../arch/powerpc/entry/syscalls/syscall.tbl   |  1 +
 .../perf/arch/s390/entry/syscalls/syscall.tbl |  1 +
 tools/perf/arch/sh/entry/syscalls/syscall.tbl |  1 +
 .../arch/sparc/entry/syscalls/syscall.tbl     |  1 +
 .../arch/x86/entry/syscalls/syscall_32.tbl    |  3 ++-
 .../arch/x86/entry/syscalls/syscall_64.tbl    |  1 +
 .../arch/xtensa/entry/syscalls/syscall.tbl    |  1 +
 tools/scripts/syscall.tbl                     |  1 +
 12 files changed, 15 insertions(+), 25 deletions(-)
tools/arch/arm64/include/uapi/asm/unistd.h +1 -23
index 9306726337fe005e..df36f23876e863ff 100644
@@ -1,24 +1,2 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * Copyright (C) 2012 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#define __ARCH_WANT_RENAMEAT
-#define __ARCH_WANT_NEW_STAT
-#define __ARCH_WANT_SET_GET_RLIMIT
-#define __ARCH_WANT_TIME32_SYSCALLS
-#define __ARCH_WANT_MEMFD_SECRET
-
-#include <asm-generic/unistd.h>
+#include <asm/unistd_64.h>
tools/include/uapi/asm-generic/unistd.h +3 -1
index 88dc393c2bca38c0..2892a45023af6d3e 100644
@@ -849,9 +849,11 @@ __SYSCALL(__NR_getxattrat, sys_getxattrat)
 __SYSCALL(__NR_listxattrat, sys_listxattrat)
 #define __NR_removexattrat 466
 __SYSCALL(__NR_removexattrat, sys_removexattrat)
+#define __NR_open_tree_attr 467
+__SYSCALL(__NR_open_tree_attr, sys_open_tree_attr)
 
 #undef __NR_syscalls
-#define __NR_syscalls 467
+#define __NR_syscalls 468
 
 /*
  * 32 bit systems traditionally used different
tools/perf/arch/arm/entry/syscalls/syscall.tbl +1 -0
index 49eeb2ad8dbd8e07..27c1d5ebcd91c8c2 100644
@@ -481,3 +481,4 @@
 464	common	getxattrat			sys_getxattrat
 465	common	listxattrat			sys_listxattrat
 466	common	removexattrat			sys_removexattrat
+467	common	open_tree_attr			sys_open_tree_attr
tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl +1 -0
index c844cd5cda620b28..1e8c44c7b61492ea 100644
@@ -381,3 +381,4 @@
 464	n64	getxattrat			sys_getxattrat
 465	n64	listxattrat			sys_listxattrat
 466	n64	removexattrat			sys_removexattrat
+467	n64	open_tree_attr			sys_open_tree_attr
tools/perf/arch/powerpc/entry/syscalls/syscall.tbl +1 -0
index d8b4ab78bef076bd..9a084bdb892694bc 100644
@@ -557,3 +557,4 @@
 464	common	getxattrat			sys_getxattrat
 465	common	listxattrat			sys_listxattrat
 466	common	removexattrat			sys_removexattrat
+467	common	open_tree_attr			sys_open_tree_attr
tools/perf/arch/s390/entry/syscalls/syscall.tbl +1 -0
index e9115b4d8b635b84..a4569b96ef06c54c 100644
@@ -469,3 +469,4 @@
 464  common	getxattrat		sys_getxattrat			sys_getxattrat
 465  common	listxattrat		sys_listxattrat			sys_listxattrat
 466  common	removexattrat		sys_removexattrat		sys_removexattrat
+467  common	open_tree_attr		sys_open_tree_attr		sys_open_tree_attr
tools/perf/arch/sh/entry/syscalls/syscall.tbl +1 -0
index c8cad33bf250ea11..52a7652fcff6394b 100644
@@ -470,3 +470,4 @@
 464	common	getxattrat			sys_getxattrat
 465	common	listxattrat			sys_listxattrat
 466	common	removexattrat			sys_removexattrat
+467	common	open_tree_attr			sys_open_tree_attr
tools/perf/arch/sparc/entry/syscalls/syscall.tbl +1 -0
index 727f99d333b304b3..83e45eb6c095a36b 100644
@@ -512,3 +512,4 @@
 464	common	getxattrat			sys_getxattrat
 465	common	listxattrat			sys_listxattrat
 466	common	removexattrat			sys_removexattrat
+467	common	open_tree_attr			sys_open_tree_attr
tools/perf/arch/x86/entry/syscalls/syscall_32.tbl +2 -1
index 4d0fb2fba7e208ae..ac007ea00979dc28 100644
@@ -396,7 +396,7 @@
 381	i386	pkey_alloc		sys_pkey_alloc
 382	i386	pkey_free		sys_pkey_free
 383	i386	statx			sys_statx
-384	i386	arch_prctl		sys_arch_prctl			compat_sys_arch_prctl
+384	i386	arch_prctl		sys_arch_prctl
 385	i386	io_pgetevents		sys_io_pgetevents_time32	compat_sys_io_pgetevents
 386	i386	rseq			sys_rseq
 393	i386	semget			sys_semget
@@ -472,3 +472,4 @@
 464	i386	getxattrat		sys_getxattrat
 465	i386	listxattrat		sys_listxattrat
 466	i386	removexattrat		sys_removexattrat
+467	i386	open_tree_attr		sys_open_tree_attr
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +1 -0
index 5eb708bff1c791de..cfb5ca41e30de1a4 100644
@@ -390,6 +390,7 @@
 464	common	getxattrat		sys_getxattrat
 465	common	listxattrat		sys_listxattrat
 466	common	removexattrat		sys_removexattrat
+467	common	open_tree_attr		sys_open_tree_attr
 
 #
 # Due to a historical design error, certain syscalls are numbered differently
tools/perf/arch/xtensa/entry/syscalls/syscall.tbl +1 -0
index 37effc1b134eea06..f657a77314f8667f 100644
@@ -437,3 +437,4 @@
 464	common	getxattrat			sys_getxattrat
 465	common	listxattrat			sys_listxattrat
 466	common	removexattrat			sys_removexattrat
+467	common	open_tree_attr			sys_open_tree_attr
tools/scripts/syscall.tbl +1 -0
index ebbdb3c42e9f7461..580b4e246aecd5f0 100644
@@ -407,3 +407,4 @@
 464	common	getxattrat			sys_getxattrat
 465	common	listxattrat			sys_listxattrat
 466	common	removexattrat			sys_removexattrat
+467	common	open_tree_attr			sys_open_tree_attr
Signature · 1 line
2.49.0.504.g3bcea36a83-goog
reviewer
#6 lore raw

Re: [PATCH 05/10] tools headers: Update the syscall table with the kernel sources

Quoted 66 lines · Namhyung Kim

To pick up the changes in:

   c4a16820d9019940 fs: add open_tree_attr()
   2df1ad0d25803399 x86/arch_prctl: Simplify sys_arch_prctl()
   e632bca07c8eef1d arm64: generate 64-bit syscall.tbl

This is basically to support the new open_tree_attr syscall. But it also needs to update asm-generic unistd.h header to get the new syscall number. And arm64 unistd.h header was converted to use the generic 64-bit header.

Addressing this perf tools build warning:

Warning: Kernel ABI header differences:
diff -u tools/scripts/syscall.tbl scripts/syscall.tbl
diff -u tools/perf/arch/x86/entry/syscalls/syscall_32.tbl arch/x86/entry/syscalls/syscall_32.tbl diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl diff -u tools/perf/arch/arm/entry/syscalls/syscall.tbl arch/arm/tools/syscall.tbl diff -u tools/perf/arch/sh/entry/syscalls/syscall.tbl arch/sh/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/sparc/entry/syscalls/syscall.tbl arch/sparc/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/xtensa/entry/syscalls/syscall.tbl arch/xtensa/kernel/syscalls/syscall.tbl diff -u tools/arch/arm64/include/uapi/asm/unistd.h arch/arm64/include/uapi/asm/unistd.h diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h

Please see tools/include/uapi/README for further details.

---
  tools/arch/arm64/include/uapi/asm/unistd.h    | 24 +------------------
  tools/include/uapi/asm-generic/unistd.h       |  4 +++-
  .../perf/arch/arm/entry/syscalls/syscall.tbl  |  1 +
  .../arch/mips/entry/syscalls/syscall_n64.tbl  |  1 +
  .../arch/powerpc/entry/syscalls/syscall.tbl   |  1 +
  .../perf/arch/s390/entry/syscalls/syscall.tbl |  1 +
  tools/perf/arch/sh/entry/syscalls/syscall.tbl |  1 +
  .../arch/sparc/entry/syscalls/syscall.tbl     |  1 +
  .../arch/x86/entry/syscalls/syscall_32.tbl    |  3 ++-
  .../arch/x86/entry/syscalls/syscall_64.tbl    |  1 +
  .../arch/xtensa/entry/syscalls/syscall.tbl    |  1 +
  tools/scripts/syscall.tbl                     |  1 +
  12 files changed, 15 insertions(+), 25 deletions(-)
tools/arch/arm64/include/uapi/asm/unistd.h +0 -14
index 9306726337fe005e..df36f23876e863ff 100644
@@ -1,24 +1,2 @@
  /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * Copyright (C) 2012 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.

tools/arch/arm64/include/uapi/asm/unistd.h line 2

Quoted 10 lines
tools/arch/arm64/include/uapi/asm/unistd.h +1 -9
- */
-
-#define __ARCH_WANT_RENAMEAT
-#define __ARCH_WANT_NEW_STAT
-#define __ARCH_WANT_SET_GET_RLIMIT
-#define __ARCH_WANT_TIME32_SYSCALLS
-#define __ARCH_WANT_MEMFD_SECRET
-
-#include <asm-generic/unistd.h>
+#include <asm/unistd_64.h>

Hi Namhyung,

Since we're not including the generic syscalls here anymore we now need to generate the syscall header file for the Perf build to work (build error pasted at the end for reference).

I had a go at adding the rule for it, but I saw that we'd need to pull in quite a bit from the kernel so it was blurring the lines about the separation of the tools/ folder. For example this file has the arm64 defs:

arch/arm64/kernel/Makefile.syscalls

To make this common part of the makefile work:

scripts/Makefile.asm-headers

Maybe we can just copy or reimplement Makefile.syscalls, but I'm not even sure if Makefile.asm-headers will work with the tools/ build structure so maybe that has to be re-implemented too. Adding Arnd to see what he thinks.

As far as I can tell this is a separate issue to the work that Charlie and Ian did recently to build all arch's syscall numbers into Perf to use for reporting, as this is requires a single header for the build.

Thanks
James

---

In file included from /usr/include/aarch64-linux-gnu/sys/syscall.h:24,

                 from evsel.c:4:
/home/jamcla02/workspace/linux/linux/tools/arch/arm64/include/uapi/asm/unistd.h:2:10: fatal error: asm/unistd_64.h: No such file or directory
    2 | #include <asm/unistd_64.h>
      |          ^~~~~~~~~~~~~~~~~
reviewer
#7 lore raw

Re: [PATCH 05/10] tools headers: Update the syscall table with the kernel sources

Quoted 99 lines · James Clark
Quoted 66 lines · Namhyung Kim

To pick up the changes in:

   c4a16820d9019940 fs: add open_tree_attr() 2df1ad0d25803399 x86/arch_prctl: Simplify sys_arch_prctl() e632bca07c8eef1d arm64: generate 64-bit syscall.tbl

This is basically to support the new open_tree_attr syscall.  But it also needs to update asm-generic unistd.h header to get the new syscall number.  And arm64 unistd.h header was converted to use the generic 64-bit header.

Addressing this perf tools build warning:

   Warning: Kernel ABI header differences:
     diff -u tools/scripts/syscall.tbl scripts/syscall.tbl
     diff -u tools/perf/arch/x86/entry/syscalls/syscall_32.tbl arch/ x86/entry/syscalls/syscall_32.tbl diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/ x86/entry/syscalls/syscall_64.tbl diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/ powerpc/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/ s390/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/ mips/kernel/syscalls/syscall_n64.tbl diff -u tools/perf/arch/arm/entry/syscalls/syscall.tbl arch/arm/ tools/syscall.tbl diff -u tools/perf/arch/sh/entry/syscalls/syscall.tbl arch/sh/ kernel/syscalls/syscall.tbl diff -u tools/perf/arch/sparc/entry/syscalls/syscall.tbl arch/ sparc/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/xtensa/entry/syscalls/syscall.tbl arch/ xtensa/kernel/syscalls/syscall.tbl diff -u tools/arch/arm64/include/uapi/asm/unistd.h arch/arm64/ include/uapi/asm/unistd.h diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm- generic/unistd.h

Please see tools/include/uapi/README for further details.

---
  tools/arch/arm64/include/uapi/asm/unistd.h    | 24 +------------------ tools/include/uapi/asm-generic/unistd.h       |  4 +++- .../perf/arch/arm/entry/syscalls/syscall.tbl  |  1 + .../arch/mips/entry/syscalls/syscall_n64.tbl  |  1 + .../arch/powerpc/entry/syscalls/syscall.tbl   |  1 + .../perf/arch/s390/entry/syscalls/syscall.tbl |  1 + tools/perf/arch/sh/entry/syscalls/syscall.tbl |  1 + .../arch/sparc/entry/syscalls/syscall.tbl     |  1 +

  .../arch/x86/entry/syscalls/syscall_32.tbl    |  3 ++-
  .../arch/x86/entry/syscalls/syscall_64.tbl    |  1 +
  .../arch/xtensa/entry/syscalls/syscall.tbl    |  1 +
  tools/scripts/syscall.tbl                     |  1 +
  12 files changed, 15 insertions(+), 25 deletions(-)
tools/arch/arm64/include/uapi/asm/unistd.h +0 -14
index 9306726337fe005e..df36f23876e863ff 100644
@@ -1,24 +1,2 @@
   /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * Copyright (C) 2012 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.

tools/arch/arm64/include/uapi/asm/unistd.h line 2

Quoted 10 lines
tools/arch/arm64/include/uapi/asm/unistd.h +1 -9
- */
-
-#define __ARCH_WANT_RENAMEAT
-#define __ARCH_WANT_NEW_STAT
-#define __ARCH_WANT_SET_GET_RLIMIT
-#define __ARCH_WANT_TIME32_SYSCALLS
-#define __ARCH_WANT_MEMFD_SECRET
-
-#include <asm-generic/unistd.h>
+#include <asm/unistd_64.h>

Hi Namhyung,

Since we're not including the generic syscalls here anymore we now need to generate the syscall header file for the Perf build to work (build error pasted at the end for reference).

I had a go at adding the rule for it, but I saw that we'd need to pull in quite a bit from the kernel so it was blurring the lines about the separation of the tools/ folder. For example this file has the arm64 defs:

 arch/arm64/kernel/Makefile.syscalls

To make this common part of the makefile work:

 scripts/Makefile.asm-headers

Maybe we can just copy or reimplement Makefile.syscalls, but I'm not even sure if Makefile.asm-headers will work with the tools/ build structure so maybe that has to be re-implemented too. Adding Arnd to see what he thinks.

As far as I can tell this is a separate issue to the work that Charlie and Ian did recently to build all arch's syscall numbers into Perf to use for reporting, as this is requires a single header for the build.

Thanks
James

Quoted 10 lines

---

In file included from /usr/include/aarch64-linux-gnu/sys/syscall.h:24,
                 from evsel.c:4:
/home/jamcla02/workspace/linux/linux/tools/arch/arm64/include/uapi/asm/ unistd.h:2:10: fatal error: asm/unistd_64.h: No such file or directory
    2 | #include <asm/unistd_64.h>
      |          ^~~~~~~~~~~~~~~~~

Hmmm I see this was also mentioned a while ago here [1]. Maybe I can have another go at adding the makerule to generate the file. I'll probably start by including as much as possible from the existing make rules from the kernel side. I think something similar was already done for generating the sysreg defs in commit 02e85f74668e ("tools: arm64: Add a Makefile for generating sysreg-defs.h")

[1]: https://lore.kernel.org/lkml/[email protected]/T/#m269c1d3c64e3e0c96f45102d358d9583c69b722f

maintainer
#8 lore raw

Re: [PATCH 05/10] tools headers: Update the syscall table with the kernel sources

Quoted 114 lines · James Clark
Quoted 100 lines · James Clark
Quoted 68 lines · Namhyung Kim

To pick up the changes in:

   c4a16820d9019940 fs: add open_tree_attr() 2df1ad0d25803399 x86/arch_prctl: Simplify sys_arch_prctl() e632bca07c8eef1d arm64: generate 64-bit syscall.tbl

This is basically to support the new open_tree_attr syscall.  But it also needs to update asm-generic unistd.h header to get the new syscall number.  And arm64 unistd.h header was converted to use the generic 64-bit header.

Addressing this perf tools build warning:

   Warning: Kernel ABI header differences:
     diff -u tools/scripts/syscall.tbl scripts/syscall.tbl
     diff -u tools/perf/arch/x86/entry/syscalls/syscall_32.tbl arch/ x86/entry/syscalls/syscall_32.tbl diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/ x86/entry/syscalls/syscall_64.tbl diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/ powerpc/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/ s390/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/ mips/kernel/syscalls/syscall_n64.tbl diff -u tools/perf/arch/arm/entry/syscalls/syscall.tbl arch/arm/ tools/syscall.tbl diff -u tools/perf/arch/sh/entry/syscalls/syscall.tbl arch/sh/ kernel/syscalls/syscall.tbl diff -u tools/perf/arch/sparc/entry/syscalls/syscall.tbl arch/ sparc/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/xtensa/entry/syscalls/syscall.tbl arch/ xtensa/kernel/syscalls/syscall.tbl diff -u tools/arch/arm64/include/uapi/asm/unistd.h arch/arm64/ include/uapi/asm/unistd.h diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/ asm- generic/unistd.h

Please see tools/include/uapi/README for further details.

---
  tools/arch/arm64/include/uapi/asm/unistd.h    | 24 +------------------ tools/include/uapi/asm-generic/unistd.h       |  4 +++- .../perf/arch/arm/entry/syscalls/syscall.tbl  |  1 + .../arch/mips/entry/syscalls/syscall_n64.tbl  |  1 + .../arch/powerpc/entry/syscalls/syscall.tbl   |  1 + .../perf/arch/s390/entry/syscalls/syscall.tbl |  1 + tools/perf/arch/sh/entry/syscalls/syscall.tbl |  1 + .../arch/sparc/entry/syscalls/syscall.tbl     |  1 +

  .../arch/x86/entry/syscalls/syscall_32.tbl    |  3 ++-
  .../arch/x86/entry/syscalls/syscall_64.tbl    |  1 +
  .../arch/xtensa/entry/syscalls/syscall.tbl    |  1 +
  tools/scripts/syscall.tbl                     |  1 +
  12 files changed, 15 insertions(+), 25 deletions(-)
tools/arch/arm64/include/uapi/asm/unistd.h +0 -14
index 9306726337fe005e..df36f23876e863ff 100644
@@ -1,24 +1,2 @@
   /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * Copyright (C) 2012 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/ 

licenses/>.
- */

tools/arch/arm64/include/uapi/asm/unistd.h line 2

Quoted 9 lines
tools/arch/arm64/include/uapi/asm/unistd.h +1 -8
-
-#define __ARCH_WANT_RENAMEAT
-#define __ARCH_WANT_NEW_STAT
-#define __ARCH_WANT_SET_GET_RLIMIT
-#define __ARCH_WANT_TIME32_SYSCALLS
-#define __ARCH_WANT_MEMFD_SECRET
-
-#include <asm-generic/unistd.h>
+#include <asm/unistd_64.h>

Hi Namhyung,

Since we're not including the generic syscalls here anymore we now need to generate the syscall header file for the Perf build to work (build error pasted at the end for reference).

I had a go at adding the rule for it, but I saw that we'd need to pull in quite a bit from the kernel so it was blurring the lines about the separation of the tools/ folder. For example this file has the arm64 defs:

  arch/arm64/kernel/Makefile.syscalls

To make this common part of the makefile work:

  scripts/Makefile.asm-headers

Maybe we can just copy or reimplement Makefile.syscalls, but I'm not even sure if Makefile.asm-headers will work with the tools/ build structure so maybe that has to be re-implemented too. Adding Arnd to see what he thinks.

As far as I can tell this is a separate issue to the work that Charlie and Ian did recently to build all arch's syscall numbers into Perf to use for reporting, as this is requires a single header for the build.

Thanks
James

Quoted 10 lines

---

In file included from /usr/include/aarch64-linux-gnu/sys/syscall.h:24,
                  from evsel.c:4:
/home/jamcla02/workspace/linux/linux/tools/arch/arm64/include/uapi/ asm/ unistd.h:2:10: fatal error: asm/unistd_64.h: No such file or directory 2 | #include <asm/unistd_64.h>
       |          ^~~~~~~~~~~~~~~~~

Quoted 4 lines

Hmmm I see this was also mentioned a while ago here [1]. Maybe I can have another go at adding the makerule to generate the file. I'll probably start by including as much as possible from the existing make rules from the kernel side. I think something similar was already done for generating the sysreg defs in commit 02e85f74668e ("tools: arm64: Add a Makefile for generating sysreg-defs.h")

[1]: https://lore.kernel.org/lkml/[email protected]/T/ #m269c1d3c64e3e0c96f45102d358d9583c69b722f

FWIW I am seeing this build issue too on ARM64 and these changes have now landed in the mainline :-(

So would be great to get this fixed or reverted.

Jon

Signature · 1 line
nvpublic
reviewer
#9 lore raw

Re: [PATCH 05/10] tools headers: Update the syscall table with the kernel sources

Quoted 121 lines · Jon Hunter
Quoted 119 lines · James Clark
Quoted 102 lines · James Clark
Quoted 70 lines · Namhyung Kim

To pick up the changes in:

   c4a16820d9019940 fs: add open_tree_attr() 2df1ad0d25803399 x86/arch_prctl: Simplify sys_arch_prctl() e632bca07c8eef1d arm64: generate 64-bit syscall.tbl

This is basically to support the new open_tree_attr syscall.  But it also needs to update asm-generic unistd.h header to get the new syscall number.  And arm64 unistd.h header was converted to use the generic 64-bit header.

Addressing this perf tools build warning:

   Warning: Kernel ABI header differences:
     diff -u tools/scripts/syscall.tbl scripts/syscall.tbl
     diff -u tools/perf/arch/x86/entry/syscalls/syscall_32.tbl arch/ x86/entry/syscalls/syscall_32.tbl diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/ x86/entry/syscalls/syscall_64.tbl diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/ powerpc/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/ s390/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/ mips/kernel/syscalls/syscall_n64.tbl diff -u tools/perf/arch/arm/entry/syscalls/syscall.tbl arch/ arm/ tools/syscall.tbl diff -u tools/perf/arch/sh/entry/syscalls/syscall.tbl arch/sh/ kernel/syscalls/syscall.tbl diff -u tools/perf/arch/sparc/entry/syscalls/syscall.tbl arch/ sparc/kernel/syscalls/syscall.tbl diff -u tools/perf/arch/xtensa/entry/syscalls/syscall.tbl arch/ xtensa/kernel/syscalls/syscall.tbl diff -u tools/arch/arm64/include/uapi/asm/unistd.h arch/arm64/ include/uapi/asm/unistd.h diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/ asm- generic/unistd.h

Please see tools/include/uapi/README for further details.

---
  tools/arch/arm64/include/uapi/asm/unistd.h    | 24

+------------------
  tools/include/uapi/asm-generic/unistd.h       |  4 +++-
  .../perf/arch/arm/entry/syscalls/syscall.tbl  |  1 +
  .../arch/mips/entry/syscalls/syscall_n64.tbl  |  1 +
  .../arch/powerpc/entry/syscalls/syscall.tbl   |  1 +
  .../perf/arch/s390/entry/syscalls/syscall.tbl |  1 +
  tools/perf/arch/sh/entry/syscalls/syscall.tbl |  1 +
  .../arch/sparc/entry/syscalls/syscall.tbl     |  1 +
  .../arch/x86/entry/syscalls/syscall_32.tbl    |  3 ++-
  .../arch/x86/entry/syscalls/syscall_64.tbl    |  1 +
  .../arch/xtensa/entry/syscalls/syscall.tbl    |  1 +
  tools/scripts/syscall.tbl                     |  1 +
  12 files changed, 15 insertions(+), 25 deletions(-)
tools/arch/arm64/include/uapi/asm/unistd.h +0 -4
index 9306726337fe005e..df36f23876e863ff 100644
@@ -1,24 +1,2 @@
   /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * Copyright (C) 2012 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or 

modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/
licenses/>.
- */

tools/arch/arm64/include/uapi/asm/unistd.h line 2

Quoted 9 lines
tools/arch/arm64/include/uapi/asm/unistd.h +1 -8
-
-#define __ARCH_WANT_RENAMEAT
-#define __ARCH_WANT_NEW_STAT
-#define __ARCH_WANT_SET_GET_RLIMIT
-#define __ARCH_WANT_TIME32_SYSCALLS
-#define __ARCH_WANT_MEMFD_SECRET
-
-#include <asm-generic/unistd.h>
+#include <asm/unistd_64.h>

Hi Namhyung,

Since we're not including the generic syscalls here anymore we now need to generate the syscall header file for the Perf build to work (build error pasted at the end for reference).

I had a go at adding the rule for it, but I saw that we'd need to pull in quite a bit from the kernel so it was blurring the lines about the separation of the tools/ folder. For example this file has the arm64 defs:

  arch/arm64/kernel/Makefile.syscalls

To make this common part of the makefile work:

  scripts/Makefile.asm-headers

Maybe we can just copy or reimplement Makefile.syscalls, but I'm not even sure if Makefile.asm-headers will work with the tools/ build structure so maybe that has to be re-implemented too. Adding Arnd to see what he thinks.

As far as I can tell this is a separate issue to the work that Charlie and Ian did recently to build all arch's syscall numbers into Perf to use for reporting, as this is requires a single header for the build.

Thanks
James

Quoted 10 lines

---

In file included from /usr/include/aarch64-linux-gnu/sys/syscall.h:24,
                  from evsel.c:4:
/home/jamcla02/workspace/linux/linux/tools/arch/arm64/include/uapi/ asm/ unistd.h:2:10: fatal error: asm/unistd_64.h: No such file or directory 2 | #include <asm/unistd_64.h>
       |          ^~~~~~~~~~~~~~~~~

Hmmm I see this was also mentioned a while ago here [1]. Maybe I can have another go at adding the makerule to generate the file. I'll probably start by including as much as possible from the existing make rules from the kernel side. I think something similar was already done for generating the sysreg defs in commit 02e85f74668e ("tools: arm64: Add a Makefile for generating sysreg-defs.h")

Quoted 9 lines
Quoted 1 line

[1]: https://lore.kernel.org/lkml/[email protected]/T/ #m269c1d3c64e3e0c96f45102d358d9583c69b722f

FWIW I am seeing this build issue too on ARM64 and these changes have now landed in the mainline :-(

So would be great to get this fixed or reverted.

Jon

Hi Jon,

I probably should have updated this thread, but the fix is here:

https://lore.kernel.org/linux-perf-users/[email protected]/

Thanks
James

maintainer Tested-by
#10 lore raw

Re: [PATCH 05/10] tools headers: Update the syscall table with the kernel sources

On 23/04/2025 15:57, James Clark wrote:

...

Quoted 4 lines
Quoted 4 lines

FWIW I am seeing this build issue too on ARM64 and these changes have now landed in the mainline :-(

So would be great to get this fixed or reverted.

Quoted 8 lines
Quoted 2 lines

Jon

Hi Jon,

I probably should have updated this thread, but the fix is here:

https://lore.kernel.org/linux-perf-users/20250417-james-perf-fix-gen- [email protected]/

Great!

Thanks for fixing and sharing!

Jon

Signature · 1 line
nvpublic
author maintainer
#11 lore raw

PATCH 6/10 tools headers: Update the uapi/linux/prctl.h copy with the kernel sources

In reply to Namhyung Kim

To pick up the changes in:

ec2d0c04624b3c8a posix-timers: Provide a mechanism to allocate a given timer ID

Addressing this perf tools build warning:

Warning: Kernel ABI header differences:
diff -u tools/perf/trace/beauty/include/uapi/linux/prctl.h include/uapi/linux/prctl.h

Please see tools/include/uapi/README for further details.

Cc Thomas Gleixner <[email protected]>
---
 tools/perf/trace/beauty/include/uapi/linux/prctl.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/perf/trace/beauty/include/uapi/linux/prctl.h +11 -0
index 5c6080680cb27b19..15c18ef4eb11a013 100644
@@ -353,4 +353,15 @@ struct prctl_mm_map {
  */
 #define PR_LOCK_SHADOW_STACK_STATUS      76
 
+/*
+ * Controls the mode of timer_create() for CRIU restore operations.
+ * Enabling this allows CRIU to restore timers with explicit IDs.
+ *
+ * Don't use for normal operations as the result might be undefined.
+ */
+#define PR_TIMER_CREATE_RESTORE_IDS		77
+# define PR_TIMER_CREATE_RESTORE_IDS_OFF	0
+# define PR_TIMER_CREATE_RESTORE_IDS_ON		1
+# define PR_TIMER_CREATE_RESTORE_IDS_GET	2
+
 #endif /* _LINUX_PRCTL_H */
Signature · 1 line
2.49.0.504.g3bcea36a83-goog
author maintainer
#12 lore raw

PATCH 7/10 tools headers: Update the uapi/asm-generic/mman-common.h copy with the kernel sources

In reply to Namhyung Kim

To pick up the changes in:

6d61527d931ba07b mm/pkey: Add PKEY_UNRESTRICTED macro

Addressing this perf tools build warning:

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/asm-generic/mman-common.h include/uapi/asm-generic/mman-common.h

Please see tools/include/uapi/README for further details.

---
 tools/include/uapi/asm-generic/mman-common.h | 1 +
 1 file changed, 1 insertion(+)
tools/include/uapi/asm-generic/mman-common.h +1 -0
index 1ea2c4c33b86a263..ef1c27fa3c570fa4 100644
@@ -85,6 +85,7 @@
 /* compatibility flags */
 #define MAP_FILE	0
 
+#define PKEY_UNRESTRICTED	0x0
 #define PKEY_DISABLE_ACCESS	0x1
 #define PKEY_DISABLE_WRITE	0x2
 #define PKEY_ACCESS_MASK	(PKEY_DISABLE_ACCESS |\
Signature · 1 line
2.49.0.504.g3bcea36a83-goog
author maintainer
#13 lore raw

PATCH 8/10 tools headers: Update the linux/unaligned.h copy with the kernel sources

In reply to Namhyung Kim

To pick up the changes in:

3846699217798061 ALSA: rawmidi: Make tied_device=0 as default / unknown 7bb49d2e8b52adac ALSA: rawmidi: Bump protocol version to 2.0.5 b8fefed73a952a33 ALSA: rawmidi: Show substream activity in info ioctl bdf46443f350dd5d ALSA: rawmidi: Expose the tied device number in info ioctl

Addressing this perf tools build warning:

Warning: Kernel ABI header differences:
diff -u tools/perf/trace/beauty/include/uapi/sound/asound.h include/uapi/sound/asound.h

Please see tools/include/uapi/README for further details.

---
 tools/perf/trace/beauty/include/uapi/sound/asound.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/trace/beauty/include/uapi/sound/asound.h +6 -2
index 4cd513215bcd8f74..5a049eeaeccea59f 100644
@@ -716,7 +716,7 @@ enum {
  *  Raw MIDI section - /dev/snd/midi??
  */
 
-#define SNDRV_RAWMIDI_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 4)
+#define SNDRV_RAWMIDI_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 5)
 
 enum {
 	SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
@@ -728,6 +728,9 @@ enum {
 #define SNDRV_RAWMIDI_INFO_INPUT		0x00000002
 #define SNDRV_RAWMIDI_INFO_DUPLEX		0x00000004
 #define SNDRV_RAWMIDI_INFO_UMP			0x00000008
+#define SNDRV_RAWMIDI_INFO_STREAM_INACTIVE	0x00000010
+
+#define SNDRV_RAWMIDI_DEVICE_UNKNOWN		0
 
 struct snd_rawmidi_info {
 	unsigned int device;		/* RO/WR (control): device number */
@@ -740,7 +743,8 @@ struct snd_rawmidi_info {
 	unsigned char subname[32];	/* name of active or selected subdevice */
 	unsigned int subdevices_count;
 	unsigned int subdevices_avail;
-	unsigned char reserved[64];	/* reserved for future use */
+	int tied_device;		/* R: tied rawmidi device (UMP/legacy) */
+	unsigned char reserved[60];	/* reserved for future use */
 };
 
 #define SNDRV_RAWMIDI_MODE_FRAMING_MASK		(7<<0)
Signature · 1 line
2.49.0.504.g3bcea36a83-goog
author maintainer
#14 lore raw

PATCH 9/10 tools headers: Update the x86 headers with the kernel sources

In reply to Namhyung Kim

To pick up the changes in:

841326332bcb13ae x86/cpufeatures: Generate the <asm/cpufeaturemasks.h> header based on build config 440a65b7d25fb06f x86/mm: Enable AMD translation cache extensions
767ae437a32d6447 x86/mm: Add INVLPGB feature and Kconfig entry
b4cc466b97359011 cpufreq/amd-pstate: Replace all AMD_CPPC_* macros with masks 98c7a713db91c5a9 x86/bugs: Add X86_BUG_SPECTRE_V2_USER
8f64eee70cdd3bb8 x86/bugs: Remove X86_FEATURE_USE_IBPB
8442df2b49ed9bcd x86/bugs: KVM: Add support for SRSO_MSR_FIX
70792aed14551e31 x86/cpufeatures: Add CPUID feature bit for Idle HLT intercept 968e9bc4cef87054 x86: move ZMM exclusion list into CPU feature flag c631a2de7ae48d50 perf/x86/intel: Ensure LBRs are disabled when a CPU is starting 38cc6495cdec18a4 x86/sev: Prevent GUEST_TSC_FREQ MSR interception for Secure TSC enabled guests 288bba2f4c8be1e1 x86/cpufeatures: Remove "AMD" from the comments to the AMD-specific leaf 877818802c3e970f x86/bugs: Add SRSO_USER_KERNEL_NO support
8ae3291f773befee x86/sev: Add full support for a segmented RMP table 0cbc0258415814c8 x86/sev: Add support for the RMPREAD instruction
7a470e826d7521be x86/cpufeatures: Free up unused feature bits

Addressing this perf tools build warning:

Warning: Kernel ABI header differences:
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h

Please see tools/include/uapi/README for further details.

---
 tools/arch/x86/include/asm/cpufeatures.h | 28 +++++++++++++++------
 tools/arch/x86/include/asm/msr-index.h   | 31 +++++++++++++++---------
 2 files changed, 39 insertions(+), 20 deletions(-)
tools/arch/x86/include/asm/cpufeatures.h +20 -8
index 9e3fa7942e7d3f24..6c2c152d8a67b9bf 100644
@@ -75,8 +75,8 @@
 #define X86_FEATURE_CENTAUR_MCR		( 3*32+ 3) /* "centaur_mcr" Centaur MCRs (= MTRRs) */
 #define X86_FEATURE_K8			( 3*32+ 4) /* Opteron, Athlon64 */
 #define X86_FEATURE_ZEN5		( 3*32+ 5) /* CPU based on Zen5 microarchitecture */
-#define X86_FEATURE_P3			( 3*32+ 6) /* P3 */
-#define X86_FEATURE_P4			( 3*32+ 7) /* P4 */
+/* Free                                 ( 3*32+ 6) */
+/* Free                                 ( 3*32+ 7) */
 #define X86_FEATURE_CONSTANT_TSC	( 3*32+ 8) /* "constant_tsc" TSC ticks at a constant rate */
 #define X86_FEATURE_UP			( 3*32+ 9) /* "up" SMP kernel running on UP */
 #define X86_FEATURE_ART			( 3*32+10) /* "art" Always running timer (ART) */
@@ -329,6 +329,7 @@
 #define X86_FEATURE_CLZERO		(13*32+ 0) /* "clzero" CLZERO instruction */
 #define X86_FEATURE_IRPERF		(13*32+ 1) /* "irperf" Instructions Retired Count */
 #define X86_FEATURE_XSAVEERPTR		(13*32+ 2) /* "xsaveerptr" Always save/restore FP error pointers */
+#define X86_FEATURE_INVLPGB		(13*32+ 3) /* INVLPGB and TLBSYNC instructions supported */
 #define X86_FEATURE_RDPRU		(13*32+ 4) /* "rdpru" Read processor register at user level */
 #define X86_FEATURE_WBNOINVD		(13*32+ 9) /* "wbnoinvd" WBNOINVD instruction */
 #define X86_FEATURE_AMD_IBPB		(13*32+12) /* Indirect Branch Prediction Barrier */
@@ -377,6 +378,7 @@
 #define X86_FEATURE_V_SPEC_CTRL		(15*32+20) /* "v_spec_ctrl" Virtual SPEC_CTRL */
 #define X86_FEATURE_VNMI		(15*32+25) /* "vnmi" Virtual NMI */
 #define X86_FEATURE_SVME_ADDR_CHK	(15*32+28) /* SVME addr check */
+#define X86_FEATURE_IDLE_HLT		(15*32+30) /* IDLE HLT intercept */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 16 */
 #define X86_FEATURE_AVX512VBMI		(16*32+ 1) /* "avx512vbmi" AVX512 Vector Bit Manipulation instructions*/
@@ -434,15 +436,18 @@
 #define X86_FEATURE_SPEC_CTRL_SSBD	(18*32+31) /* Speculative Store Bypass Disable */
 
 /* AMD-defined memory encryption features, CPUID level 0x8000001f (EAX), word 19 */
-#define X86_FEATURE_SME			(19*32+ 0) /* "sme" AMD Secure Memory Encryption */
-#define X86_FEATURE_SEV			(19*32+ 1) /* "sev" AMD Secure Encrypted Virtualization */
+#define X86_FEATURE_SME			(19*32+ 0) /* "sme" Secure Memory Encryption */
+#define X86_FEATURE_SEV			(19*32+ 1) /* "sev" Secure Encrypted Virtualization */
 #define X86_FEATURE_VM_PAGE_FLUSH	(19*32+ 2) /* VM Page Flush MSR is supported */
-#define X86_FEATURE_SEV_ES		(19*32+ 3) /* "sev_es" AMD Secure Encrypted Virtualization - Encrypted State */
-#define X86_FEATURE_SEV_SNP		(19*32+ 4) /* "sev_snp" AMD Secure Encrypted Virtualization - Secure Nested Paging */
+#define X86_FEATURE_SEV_ES		(19*32+ 3) /* "sev_es" Secure Encrypted Virtualization - Encrypted State */
+#define X86_FEATURE_SEV_SNP		(19*32+ 4) /* "sev_snp" Secure Encrypted Virtualization - Secure Nested Paging */
 #define X86_FEATURE_V_TSC_AUX		(19*32+ 9) /* Virtual TSC_AUX */
-#define X86_FEATURE_SME_COHERENT	(19*32+10) /* AMD hardware-enforced cache coherency */
-#define X86_FEATURE_DEBUG_SWAP		(19*32+14) /* "debug_swap" AMD SEV-ES full debug state swap support */
+#define X86_FEATURE_SME_COHERENT	(19*32+10) /* hardware-enforced cache coherency */
+#define X86_FEATURE_DEBUG_SWAP		(19*32+14) /* "debug_swap" SEV-ES full debug state swap support */
+#define X86_FEATURE_RMPREAD		(19*32+21) /* RMPREAD instruction */
+#define X86_FEATURE_SEGMENTED_RMP	(19*32+23) /* Segmented RMP support */
 #define X86_FEATURE_SVSM		(19*32+28) /* "svsm" SVSM present */
+#define X86_FEATURE_HV_INUSE_WR_ALLOWED	(19*32+30) /* Allow Write to in-use hypervisor-owned pages */
 
 /* AMD-defined Extended Feature 2 EAX, CPUID level 0x80000021 (EAX), word 20 */
 #define X86_FEATURE_NO_NESTED_DATA_BP	(20*32+ 0) /* No Nested Data Breakpoints */
@@ -455,6 +460,11 @@
 #define X86_FEATURE_SBPB		(20*32+27) /* Selective Branch Prediction Barrier */
 #define X86_FEATURE_IBPB_BRTYPE		(20*32+28) /* MSR_PRED_CMD[IBPB] flushes all branch type predictions */
 #define X86_FEATURE_SRSO_NO		(20*32+29) /* CPU is not affected by SRSO */
+#define X86_FEATURE_SRSO_USER_KERNEL_NO	(20*32+30) /* CPU is not affected by SRSO across user/kernel boundaries */
+#define X86_FEATURE_SRSO_BP_SPEC_REDUCE	(20*32+31) /*
+						    * BP_CFG[BpSpecReduce] can be used to mitigate SRSO for VMs.
+						    * (SRSO_MSR_FIX in the official doc).
+						    */
 
 /*
  * Extended auxiliary flags: Linux defined - for features scattered in various
@@ -470,6 +480,7 @@
 #define X86_FEATURE_AMD_FAST_CPPC	(21*32 + 5) /* Fast CPPC */
 #define X86_FEATURE_AMD_HETEROGENEOUS_CORES (21*32 + 6) /* Heterogeneous Core Topology */
 #define X86_FEATURE_AMD_WORKLOAD_CLASS	(21*32 + 7) /* Workload Classification */
+#define X86_FEATURE_PREFER_YMM		(21*32 + 8) /* Avoid ZMM registers due to downclocking */
 
 /*
  * BUG word(s)
@@ -521,4 +532,5 @@
 #define X86_BUG_RFDS			X86_BUG(1*32 + 2) /* "rfds" CPU is vulnerable to Register File Data Sampling */
 #define X86_BUG_BHI			X86_BUG(1*32 + 3) /* "bhi" CPU is affected by Branch History Injection */
 #define X86_BUG_IBPB_NO_RET	   	X86_BUG(1*32 + 4) /* "ibpb_no_ret" IBPB omits return target predictions */
+#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 */
 #endif /* _ASM_X86_CPUFEATURES_H */
tools/arch/x86/include/asm/msr-index.h +19 -12
index dc1c1057f26e45a8..e6134ef2263d50d1 100644
@@ -397,7 +397,8 @@
 #define MSR_IA32_PASID_VALID		BIT_ULL(31)
 
 /* DEBUGCTLMSR bits (others vary by model): */
-#define DEBUGCTLMSR_LBR			(1UL <<  0) /* last branch recording */
+#define DEBUGCTLMSR_LBR_BIT		0	     /* last branch recording */
+#define DEBUGCTLMSR_LBR			(1UL <<  DEBUGCTLMSR_LBR_BIT)
 #define DEBUGCTLMSR_BTF_SHIFT		1
 #define DEBUGCTLMSR_BTF			(1UL <<  1) /* single-step on branches */
 #define DEBUGCTLMSR_BUS_LOCK_DETECT	(1UL <<  2)
@@ -610,6 +611,7 @@
 #define MSR_AMD_PERF_CTL		0xc0010062
 #define MSR_AMD_PERF_STATUS		0xc0010063
 #define MSR_AMD_PSTATE_DEF_BASE		0xc0010064
+#define MSR_AMD64_GUEST_TSC_FREQ	0xc0010134
 #define MSR_AMD64_OSVW_ID_LENGTH	0xc0010140
 #define MSR_AMD64_OSVW_STATUS		0xc0010141
 #define MSR_AMD_PPIN_CTL		0xc00102f0
@@ -646,6 +648,7 @@
 #define MSR_AMD64_IBS_REG_COUNT_MAX	8 /* includes MSR_AMD64_IBSBRTARGET */
 #define MSR_AMD64_SVM_AVIC_DOORBELL	0xc001011b
 #define MSR_AMD64_VM_PAGE_FLUSH		0xc001011e
+#define MSR_AMD64_VIRT_SPEC_CTRL	0xc001011f
 #define MSR_AMD64_SEV_ES_GHCB		0xc0010130
 #define MSR_AMD64_SEV			0xc0010131
 #define MSR_AMD64_SEV_ENABLED_BIT	0
@@ -684,11 +687,12 @@
 #define MSR_AMD64_SNP_SMT_PROT		BIT_ULL(MSR_AMD64_SNP_SMT_PROT_BIT)
 #define MSR_AMD64_SNP_RESV_BIT		18
 #define MSR_AMD64_SNP_RESERVED_MASK	GENMASK_ULL(63, MSR_AMD64_SNP_RESV_BIT)
-
-#define MSR_AMD64_VIRT_SPEC_CTRL	0xc001011f
-
 #define MSR_AMD64_RMP_BASE		0xc0010132
 #define MSR_AMD64_RMP_END		0xc0010133
+#define MSR_AMD64_RMP_CFG		0xc0010136
+#define MSR_AMD64_SEG_RMP_ENABLED_BIT	0
+#define MSR_AMD64_SEG_RMP_ENABLED	BIT_ULL(MSR_AMD64_SEG_RMP_ENABLED_BIT)
+#define MSR_AMD64_RMP_SEGMENT_SHIFT(x)	(((x) & GENMASK_ULL(13, 8)) >> 8)
 
 #define MSR_SVSM_CAA			0xc001f000
 
@@ -699,15 +703,17 @@
 #define MSR_AMD_CPPC_REQ		0xc00102b3
 #define MSR_AMD_CPPC_STATUS		0xc00102b4
 
-#define AMD_CPPC_LOWEST_PERF(x)		(((x) >> 0) & 0xff)
-#define AMD_CPPC_LOWNONLIN_PERF(x)	(((x) >> 8) & 0xff)
-#define AMD_CPPC_NOMINAL_PERF(x)	(((x) >> 16) & 0xff)
-#define AMD_CPPC_HIGHEST_PERF(x)	(((x) >> 24) & 0xff)
+/* Masks for use with MSR_AMD_CPPC_CAP1 */
+#define AMD_CPPC_LOWEST_PERF_MASK	GENMASK(7, 0)
+#define AMD_CPPC_LOWNONLIN_PERF_MASK	GENMASK(15, 8)
+#define AMD_CPPC_NOMINAL_PERF_MASK	GENMASK(23, 16)
+#define AMD_CPPC_HIGHEST_PERF_MASK	GENMASK(31, 24)
 
-#define AMD_CPPC_MAX_PERF(x)		(((x) & 0xff) << 0)
-#define AMD_CPPC_MIN_PERF(x)		(((x) & 0xff) << 8)
-#define AMD_CPPC_DES_PERF(x)		(((x) & 0xff) << 16)
-#define AMD_CPPC_ENERGY_PERF_PREF(x)	(((x) & 0xff) << 24)
+/* Masks for use with MSR_AMD_CPPC_REQ */
+#define AMD_CPPC_MAX_PERF_MASK		GENMASK(7, 0)
+#define AMD_CPPC_MIN_PERF_MASK		GENMASK(15, 8)
+#define AMD_CPPC_DES_PERF_MASK		GENMASK(23, 16)
+#define AMD_CPPC_EPP_PERF_MASK		GENMASK(31, 24)
 
 /* AMD Performance Counter Global Status and Control MSRs */
 #define MSR_AMD64_PERF_CNTR_GLOBAL_STATUS	0xc0000300
@@ -719,6 +725,7 @@
 
 /* Zen4 */
 #define MSR_ZEN4_BP_CFG                 0xc001102e
+#define MSR_ZEN4_BP_CFG_BP_SPEC_REDUCE_BIT 4
 #define MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT 5
 
 /* Fam 19h MSRs */
Signature · 1 line
2.49.0.504.g3bcea36a83-goog
author maintainer
#15 lore raw

PATCH 10/10 tools headers: Update the arch/x86/lib/memset_64.S copy with the kernel sources

In reply to Namhyung Kim

To pick up the changes in:

2981557cb0408e14 x86,kcfi: Fix EXPORT_SYMBOL vs kCFI

That required adding a copy of include/linux/cfi_types.h and its checking in tools/perf/check-headers.h.

Addressing this perf tools build warning:

Warning: Kernel ABI header differences:

    diff -u tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S

Please see tools/include/uapi/README for further details.

---
 tools/arch/x86/lib/memset_64.S  |  3 ++-
 tools/include/linux/cfi_types.h | 45 +++++++++++++++++++++++++++++++++
 tools/perf/check-headers.sh     |  1 +
 3 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 tools/include/linux/cfi_types.h
tools/arch/x86/lib/memset_64.S +2 -1
index 0199d56cb479d88c..d66b710d628f8865 100644
@@ -3,6 +3,7 @@
 
 #include <linux/export.h>
 #include <linux/linkage.h>
+#include <linux/cfi_types.h>
 #include <asm/cpufeatures.h>
 #include <asm/alternative.h>
 
@@ -28,7 +29,7 @@
  * only for the return value that is the same as the source input,
  * which the compiler could/should do much better anyway.
  */
-SYM_FUNC_START(__memset)
+SYM_TYPED_FUNC_START(__memset)
 	ALTERNATIVE "jmp memset_orig", "", X86_FEATURE_FSRS
 
 	movq %rdi,%r9
tools/include/linux/cfi_types.h new file +45 -0

45 lines not on this page · raw message

tools/perf/check-headers.sh +1 -0
index a4499e5a6f9cb00c..857f6646cc23e949 100755
@@ -20,6 +20,7 @@ FILES=(
   "include/uapi/linux/stat.h"
   "include/linux/bits.h"
   "include/vdso/bits.h"
+  "include/linux/cfi_types.h"
   "include/linux/const.h"
   "include/vdso/const.h"
   "include/vdso/unaligned.h"
Signature · 1 line
2.49.0.504.g3bcea36a83-goog
Acked-by on the v1 series
#16 lore raw
In reply to Namhyung Kim
Quoted 30 lines · Namhyung Kim

Hello,

FYI I'm carrying these changes in the perf tools tree so make perf trace beautifiers get the recent changes in syscall, ioctl, and so on. For the background, please see tools/include/uapi/README.

Still there are some remaining items but it requires a bit more changes. So I'd like to leave them for the next cycle.

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/bits.h include/uapi/linux/bits.h diff -u tools/include/linux/bits.h include/linux/bits.h
diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h

Thanks,
Namhyung

Namhyung Kim (10):
tools headers: Update the KVM headers with the kernel sources
tools headers: Update the socket headers with the kernel sources
tools headers: Update the uapi/linux/perf_event.h copy with the kernel sources tools headers: Update the VFS headers with the kernel sources
tools headers: Update the syscall table with the kernel sources
tools headers: Update the uapi/linux/prctl.h copy with the kernel sources tools headers: Update the uapi/asm-generic/mman-common.h copy with the kernel sources tools headers: Update the linux/unaligned.h copy with the kernel sources tools headers: Update the x86 headers with the kernel sources
tools headers: Update the arch/x86/lib/memset_64.S copy with the kernel sources

Quoted 1 line
 32 files changed, 318 insertions(+), 109 deletions(-)

LGTM, I was eying those warnings too, glad you did this. :-)

Ingo

Tested-by on the v1 series
#17 lore raw
In reply to Namhyung Kim
Quoted 59 lines · Namhyung Kim

Hello,

FYI I'm carrying these changes in the perf tools tree so make perf trace beautifiers get the recent changes in syscall, ioctl, and so on. For the background, please see tools/include/uapi/README.

Still there are some remaining items but it requires a bit more changes. So I'd like to leave them for the next cycle.

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/bits.h include/uapi/linux/bits.h diff -u tools/include/linux/bits.h include/linux/bits.h
diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h

Thanks,
Namhyung

Namhyung Kim (10):
tools headers: Update the KVM headers with the kernel sources
tools headers: Update the socket headers with the kernel sources
tools headers: Update the uapi/linux/perf_event.h copy with the kernel sources tools headers: Update the VFS headers with the kernel sources
tools headers: Update the syscall table with the kernel sources
tools headers: Update the uapi/linux/prctl.h copy with the kernel sources tools headers: Update the uapi/asm-generic/mman-common.h copy with the kernel sources tools headers: Update the linux/unaligned.h copy with the kernel sources tools headers: Update the x86 headers with the kernel sources
tools headers: Update the arch/x86/lib/memset_64.S copy with the kernel sources

tools/arch/arm64/include/uapi/asm/kvm.h       |  5 +-
tools/arch/arm64/include/uapi/asm/unistd.h    | 24 +----
tools/arch/x86/include/asm/cpufeatures.h      | 28 ++++--
tools/arch/x86/include/asm/msr-index.h        | 31 +++---
tools/arch/x86/include/uapi/asm/kvm.h         |  4 +
tools/arch/x86/include/uapi/asm/svm.h         |  2 +
tools/arch/x86/lib/memset_64.S                |  3 +-
tools/include/linux/cfi_types.h               | 45 +++++++++
tools/include/uapi/asm-generic/mman-common.h  |  1 +
tools/include/uapi/asm-generic/unistd.h       |  4 +-
tools/include/uapi/linux/in.h                 |  2 +
tools/include/uapi/linux/kvm.h                |  9 +-
tools/include/uapi/linux/perf_event.h         |  2 +
tools/include/uapi/linux/stat.h               | 99 ++++++++++++++-----
.../perf/arch/arm/entry/syscalls/syscall.tbl  |  1 +
.../arch/mips/entry/syscalls/syscall_n64.tbl  |  1 +
.../arch/powerpc/entry/syscalls/syscall.tbl   |  1 +
.../perf/arch/s390/entry/syscalls/syscall.tbl |  1 +
tools/perf/arch/sh/entry/syscalls/syscall.tbl |  1 +
.../arch/sparc/entry/syscalls/syscall.tbl     |  1 +
.../arch/x86/entry/syscalls/syscall_32.tbl    |  3 +-
.../arch/x86/entry/syscalls/syscall_64.tbl    |  1 +
.../arch/xtensa/entry/syscalls/syscall.tbl    |  1 +
tools/perf/check-headers.sh                   |  1 +
.../perf/trace/beauty/include/linux/socket.h  |  2 +
Quoted 8 lines
.../trace/beauty/include/uapi/linux/fcntl.h   |  4 +
.../perf/trace/beauty/include/uapi/linux/fs.h | 21 +++-
.../trace/beauty/include/uapi/linux/mount.h   | 10 +-
.../trace/beauty/include/uapi/linux/prctl.h   | 11 +++
.../trace/beauty/include/uapi/linux/stat.h    | 99 ++++++++++++++-----
.../trace/beauty/include/uapi/sound/asound.h  |  8 +-
tools/scripts/syscall.tbl                     |  1 +
32 files changed, 318 insertions(+), 109 deletions(-)

Tested this patch series by applying on the base commit: 0af2f6be1b4281385b618cb86ad946eded089ac8 and it fixes the warnings.

Before this patch:

make
BUILD: Doing 'make -j32' parallel build
Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/bits.h include/uapi/linux/bits.h
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
diff -u tools/include/uapi/linux/perf_event.h include/uapi/linux/perf_event.h
diff -u tools/include/uapi/linux/stat.h include/uapi/linux/stat.h
diff -u tools/include/linux/bits.h include/linux/bits.h
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h
diff -u tools/arch/x86/include/uapi/asm/svm.h arch/x86/include/uapi/asm/svm.h
diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
diff -u tools/arch/arm64/include/uapi/asm/unistd.h arch/arm64/include/uapi/asm/unistd.h
diff -u tools/include/uapi/asm-generic/mman-common.h include/uapi/asm-generic/mman-common.h
diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
diff -u tools/scripts/syscall.tbl scripts/syscall.tbl
diff -u tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S
diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
diff -u tools/perf/arch/x86/entry/syscalls/syscall_32.tbl arch/x86/entry/syscalls/syscall_32.tbl
diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl
diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl
diff -u tools/perf/arch/arm/entry/syscalls/syscall.tbl arch/arm/tools/syscall.tbl
diff -u tools/perf/arch/sh/entry/syscalls/syscall.tbl arch/sh/kernel/syscalls/syscall.tbl
diff -u tools/perf/arch/sparc/entry/syscalls/syscall.tbl arch/sparc/kernel/syscalls/syscall.tbl
diff -u tools/perf/arch/xtensa/entry/syscalls/syscall.tbl arch/xtensa/kernel/syscalls/syscall.tbl
diff -u tools/perf/trace/beauty/include/linux/socket.h include/linux/socket.h
diff -u tools/perf/trace/beauty/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
diff -u tools/perf/trace/beauty/include/uapi/linux/fs.h include/uapi/linux/fs.h
diff -u tools/perf/trace/beauty/include/uapi/linux/mount.h include/uapi/linux/mount.h
diff -u tools/perf/trace/beauty/include/uapi/linux/prctl.h include/uapi/linux/prctl.h
diff -u tools/perf/trace/beauty/include/uapi/linux/stat.h include/uapi/linux/stat.h
diff -u tools/perf/trace/beauty/include/uapi/sound/asound.h include/uapi/sound/asound.h
Makefile.config:1093: No libcapstone found, disables disasm engine support for 'perf script', please install libcapstone-dev/capstone-devel Makefile.config:1155: libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev

Auto-detecting system features:

...                                   libdw: [ on  ]
...                                   glibc: [ on  ]
...                                  libbfd: [ on  ]
...                          libbfd-buildid: [ on  ]
...                                  libelf: [ on  ]
...                                 libnuma: [ on  ]
...                  numa_num_possible_cpus: [ on  ]
...                                 libperl: [ on  ]
...                               libpython: [ on  ]
...                               libcrypto: [ on  ]
...                               libunwind: [ OFF ]
...                             libcapstone: [ OFF ]
...                               llvm-perf: [ on  ]
...                                    zlib: [ on  ]
...                                    lzma: [ on  ]
...                               get_cpuid: [ OFF ]
...                                     bpf: [ on  ]
...                                  libaio: [ on  ]
...                                 libzstd: [ on  ]

GEN common-cmds.h
GEN /root/linux/tools/perf/arch/arm64/include/generated/asm/sysreg-defs.h
PERF_VERSION = 6.15.rc1.g0af2f6be1b42
GEN perf-archive

After this patch:

make
BUILD: Doing 'make -j32' parallel build
Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/bits.h include/uapi/linux/bits.h
diff -u tools/include/linux/bits.h include/linux/bits.h
diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
Makefile.config:1093: No libcapstone found, disables disasm engine support for 'perf script', please install libcapstone-dev/capstone-devel Makefile.config:1155: libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev

Auto-detecting system features:

...                                   libdw: [ on  ]
...                                   glibc: [ on  ]
...                                  libbfd: [ on  ]
...                          libbfd-buildid: [ on  ]
...                                  libelf: [ on  ]
...                                 libnuma: [ on  ]
...                  numa_num_possible_cpus: [ on  ]
...                                 libperl: [ on  ]
...                               libpython: [ on  ]
...                               libcrypto: [ on  ]
...                               libunwind: [ OFF ]
...                             libcapstone: [ OFF ]
...                               llvm-perf: [ on  ]
...                                    zlib: [ on  ]
...                                    lzma: [ on  ]
...                               get_cpuid: [ OFF ]
...                                     bpf: [ on  ]
...                                  libaio: [ on  ]
...                                 libzstd: [ on  ]

GEN common-cmds.h
GEN /root/linux/tools/perf/arch/arm64/include/generated/asm/sysreg-defs.h
PERF_VERSION = 6.15.rc1.g634c975b88f0
GEN perf-archive

Quoted 8 lines
 create mode 100644 tools/include/linux/cfi_types.h

base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8

Signature · 1 line
2.49.0.504.g3bcea36a83-goog