Blame fix-io_uring-build.patch

Eric Sandeen 3e758d
Eric Sandeen 3e758d
Eric Sandeen 3e758d
commit bfed648c9dae6a2459cb43f55c14d8303dcec07b
Eric Sandeen 3e758d
Author: Jens Axboe <axboe@kernel.dk>
Eric Sandeen 3e758d
Date:   Thu Feb 6 07:59:00 2020 -0700
Eric Sandeen 3e758d
Eric Sandeen 3e758d
    Unify architecture io_uring syscall numbers
Eric Sandeen 3e758d
    
Eric Sandeen 3e758d
    Only Alpha is the odd one out, apart from that all architectures use
Eric Sandeen 3e758d
    the same system call number. So pull the code out arch headers, and
Eric Sandeen 3e758d
    into the generic arch header.
Eric Sandeen 3e758d
    
Eric Sandeen 3e758d
    Fixes: https://github.com/axboe/fio/issues/923
Eric Sandeen 3e758d
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
Eric Sandeen 3e758d
Eric Sandeen 3e758d
diff --git a/arch/arch-aarch64.h b/arch/arch-aarch64.h
Eric Sandeen 3e758d
index de9b349..2a86cc5 100644
Eric Sandeen 3e758d
--- a/arch/arch-aarch64.h
Eric Sandeen 3e758d
+++ b/arch/arch-aarch64.h
Eric Sandeen 3e758d
@@ -8,18 +8,6 @@
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
 #define FIO_ARCH	(arch_aarch64)
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
-#define ARCH_HAVE_IOURING
Eric Sandeen 3e758d
-
Eric Sandeen 3e758d
-#ifndef __NR_sys_io_uring_setup
Eric Sandeen 3e758d
-#define __NR_sys_io_uring_setup		425
Eric Sandeen 3e758d
-#endif
Eric Sandeen 3e758d
-#ifndef __NR_sys_io_uring_enter
Eric Sandeen 3e758d
-#define __NR_sys_io_uring_enter		426
Eric Sandeen 3e758d
-#endif
Eric Sandeen 3e758d
-#ifndef __NR_sys_io_uring_register
Eric Sandeen 3e758d
-#define __NR_sys_io_uring_register	427
Eric Sandeen 3e758d
-#endif
Eric Sandeen 3e758d
-
Eric Sandeen 3e758d
 #define nop		do { __asm__ __volatile__ ("yield"); } while (0)
Eric Sandeen 3e758d
 #define read_barrier()	do { __sync_synchronize(); } while (0)
Eric Sandeen 3e758d
 #define write_barrier()	do { __sync_synchronize(); } while (0)
Eric Sandeen 3e758d
diff --git a/arch/arch-ppc.h b/arch/arch-ppc.h
Eric Sandeen 3e758d
index 46246ba..804d596 100644
Eric Sandeen 3e758d
--- a/arch/arch-ppc.h
Eric Sandeen 3e758d
+++ b/arch/arch-ppc.h
Eric Sandeen 3e758d
@@ -24,18 +24,6 @@
Eric Sandeen 3e758d
 #define PPC_CNTLZL "cntlzw"
Eric Sandeen 3e758d
 #endif
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
-#define ARCH_HAVE_IOURING
Eric Sandeen 3e758d
-
Eric Sandeen 3e758d
-#ifndef __NR_sys_io_uring_setup
Eric Sandeen 3e758d
-#define __NR_sys_io_uring_setup		425
Eric Sandeen 3e758d
-#endif
Eric Sandeen 3e758d
-#ifndef __NR_sys_io_uring_enter
Eric Sandeen 3e758d
-#define __NR_sys_io_uring_enter		426
Eric Sandeen 3e758d
-#endif
Eric Sandeen 3e758d
-#ifndef __NR_sys_io_uring_register
Eric Sandeen 3e758d
-#define __NR_sys_io_uring_register	427
Eric Sandeen 3e758d
-#endif
Eric Sandeen 3e758d
-
Eric Sandeen 3e758d
 static inline int __ilog2(unsigned long bitmask)
Eric Sandeen 3e758d
 {
Eric Sandeen 3e758d
 	int lz;
Eric Sandeen 3e758d
diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
Eric Sandeen 3e758d
index 87925bd..f32835c 100644
Eric Sandeen 3e758d
--- a/arch/arch-x86-common.h
Eric Sandeen 3e758d
+++ b/arch/arch-x86-common.h
Eric Sandeen 3e758d
@@ -3,16 +3,6 @@
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
 #include <string.h>
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
-#ifndef __NR_sys_io_uring_setup
Eric Sandeen 3e758d
-#define __NR_sys_io_uring_setup		425
Eric Sandeen 3e758d
-#endif
Eric Sandeen 3e758d
-#ifndef __NR_sys_io_uring_enter
Eric Sandeen 3e758d
-#define __NR_sys_io_uring_enter		426
Eric Sandeen 3e758d
-#endif
Eric Sandeen 3e758d
-#ifndef __NR_sys_io_uring_register
Eric Sandeen 3e758d
-#define __NR_sys_io_uring_register	427
Eric Sandeen 3e758d
-#endif
Eric Sandeen 3e758d
-
Eric Sandeen 3e758d
 static inline void cpuid(unsigned int op,
Eric Sandeen 3e758d
 			 unsigned int *eax, unsigned int *ebx,
Eric Sandeen 3e758d
 			 unsigned int *ecx, unsigned int *edx)
Eric Sandeen 3e758d
@@ -23,7 +13,6 @@ static inline void cpuid(unsigned int op,
Eric Sandeen 3e758d
 }
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
 #define ARCH_HAVE_INIT
Eric Sandeen 3e758d
-#define ARCH_HAVE_IOURING
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
 extern bool tsc_reliable;
Eric Sandeen 3e758d
 extern int arch_random;
Eric Sandeen 3e758d
diff --git a/arch/arch.h b/arch/arch.h
Eric Sandeen 3e758d
index 0ec3f10..30c0d20 100644
Eric Sandeen 3e758d
--- a/arch/arch.h
Eric Sandeen 3e758d
+++ b/arch/arch.h
Eric Sandeen 3e758d
@@ -76,4 +76,32 @@ static inline int arch_init(char *envp[])
Eric Sandeen 3e758d
 }
Eric Sandeen 3e758d
 #endif
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
+#ifdef __alpha__
Eric Sandeen 3e758d
+/*
Eric Sandeen 3e758d
+ * alpha is the only exception, all other architectures
Eric Sandeen 3e758d
+ * have common numbers for new system calls.
Eric Sandeen 3e758d
+ */
Eric Sandeen 3e758d
+# ifndef __NR_io_uring_setup
Eric Sandeen 3e758d
+#  define __NR_io_uring_setup		535
Eric Sandeen 3e758d
+# endif
Eric Sandeen 3e758d
+# ifndef __NR_io_uring_enter
Eric Sandeen 3e758d
+#  define __NR_io_uring_enter		536
Eric Sandeen 3e758d
+# endif
Eric Sandeen 3e758d
+# ifndef __NR_io_uring_register
Eric Sandeen 3e758d
+#  define __NR_io_uring_register	537
Eric Sandeen 3e758d
+# endif
Eric Sandeen 3e758d
+#else /* !__alpha__ */
Eric Sandeen 3e758d
+# ifndef __NR_io_uring_setup
Eric Sandeen 3e758d
+#  define __NR_io_uring_setup		425
Eric Sandeen 3e758d
+# endif
Eric Sandeen 3e758d
+# ifndef __NR_io_uring_enter
Eric Sandeen 3e758d
+#  define __NR_io_uring_enter		426
Eric Sandeen 3e758d
+# endif
Eric Sandeen 3e758d
+# ifndef __NR_io_uring_register
Eric Sandeen 3e758d
+#  define __NR_io_uring_register	427
Eric Sandeen 3e758d
+# endif
Eric Sandeen 3e758d
+#endif
Eric Sandeen 3e758d
+
Eric Sandeen 3e758d
+#define ARCH_HAVE_IOURING
Eric Sandeen 3e758d
+
Eric Sandeen 3e758d
 #endif
Eric Sandeen 3e758d
diff --git a/engines/io_uring.c b/engines/io_uring.c
Eric Sandeen 3e758d
index f1ffc71..5e59f97 100644
Eric Sandeen 3e758d
--- a/engines/io_uring.c
Eric Sandeen 3e758d
+++ b/engines/io_uring.c
Eric Sandeen 3e758d
@@ -191,7 +191,7 @@ static struct fio_option options[] = {
Eric Sandeen 3e758d
 static int io_uring_enter(struct ioring_data *ld, unsigned int to_submit,
Eric Sandeen 3e758d
 			 unsigned int min_complete, unsigned int flags)
Eric Sandeen 3e758d
 {
Eric Sandeen 3e758d
-	return syscall(__NR_sys_io_uring_enter, ld->ring_fd, to_submit,
Eric Sandeen 3e758d
+	return syscall(__NR_io_uring_enter, ld->ring_fd, to_submit,
Eric Sandeen 3e758d
 			min_complete, flags, NULL, 0);
Eric Sandeen 3e758d
 }
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
@@ -548,7 +548,7 @@ static int fio_ioring_queue_init(struct thread_data *td)
Eric Sandeen 3e758d
 		}
Eric Sandeen 3e758d
 	}
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
-	ret = syscall(__NR_sys_io_uring_setup, depth, &p);
Eric Sandeen 3e758d
+	ret = syscall(__NR_io_uring_setup, depth, &p);
Eric Sandeen 3e758d
 	if (ret < 0)
Eric Sandeen 3e758d
 		return ret;
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
@@ -563,7 +563,7 @@ static int fio_ioring_queue_init(struct thread_data *td)
Eric Sandeen 3e758d
 		if (setrlimit(RLIMIT_MEMLOCK, &rlim) < 0)
Eric Sandeen 3e758d
 			return -1;
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
-		ret = syscall(__NR_sys_io_uring_register, ld->ring_fd,
Eric Sandeen 3e758d
+		ret = syscall(__NR_io_uring_register, ld->ring_fd,
Eric Sandeen 3e758d
 				IORING_REGISTER_BUFFERS, ld->iovecs, depth);
Eric Sandeen 3e758d
 		if (ret < 0)
Eric Sandeen 3e758d
 			return ret;
Eric Sandeen 3e758d
@@ -589,7 +589,7 @@ static int fio_ioring_register_files(struct thread_data *td)
Eric Sandeen 3e758d
 		f->engine_pos = i;
Eric Sandeen 3e758d
 	}
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
-	ret = syscall(__NR_sys_io_uring_register, ld->ring_fd,
Eric Sandeen 3e758d
+	ret = syscall(__NR_io_uring_register, ld->ring_fd,
Eric Sandeen 3e758d
 			IORING_REGISTER_FILES, ld->fds, td->o.nr_files);
Eric Sandeen 3e758d
 	if (ret) {
Eric Sandeen 3e758d
 err:
Eric Sandeen 3e758d
diff --git a/t/io_uring.c b/t/io_uring.c
Eric Sandeen 3e758d
index c2e5e09..55b75f6 100644
Eric Sandeen 3e758d
--- a/t/io_uring.c
Eric Sandeen 3e758d
+++ b/t/io_uring.c
Eric Sandeen 3e758d
@@ -100,7 +100,7 @@ static int io_uring_register_buffers(struct submitter *s)
Eric Sandeen 3e758d
 	if (do_nop)
Eric Sandeen 3e758d
 		return 0;
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
-	return syscall(__NR_sys_io_uring_register, s->ring_fd,
Eric Sandeen 3e758d
+	return syscall(__NR_io_uring_register, s->ring_fd,
Eric Sandeen 3e758d
 			IORING_REGISTER_BUFFERS, s->iovecs, depth);
Eric Sandeen 3e758d
 }
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
@@ -117,20 +117,20 @@ static int io_uring_register_files(struct submitter *s)
Eric Sandeen 3e758d
 		s->files[i].fixed_fd = i;
Eric Sandeen 3e758d
 	}
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
-	return syscall(__NR_sys_io_uring_register, s->ring_fd,
Eric Sandeen 3e758d
+	return syscall(__NR_io_uring_register, s->ring_fd,
Eric Sandeen 3e758d
 			IORING_REGISTER_FILES, s->fds, s->nr_files);
Eric Sandeen 3e758d
 }
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
 static int io_uring_setup(unsigned entries, struct io_uring_params *p)
Eric Sandeen 3e758d
 {
Eric Sandeen 3e758d
-	return syscall(__NR_sys_io_uring_setup, entries, p);
Eric Sandeen 3e758d
+	return syscall(__NR_io_uring_setup, entries, p);
Eric Sandeen 3e758d
 }
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
 static int io_uring_enter(struct submitter *s, unsigned int to_submit,
Eric Sandeen 3e758d
 			  unsigned int min_complete, unsigned int flags)
Eric Sandeen 3e758d
 {
Eric Sandeen 3e758d
-	return syscall(__NR_sys_io_uring_enter, s->ring_fd, to_submit,
Eric Sandeen 3e758d
-			min_complete, flags, NULL, 0);
Eric Sandeen 3e758d
+	return syscall(__NR_io_uring_enter, s->ring_fd, to_submit, min_complete,
Eric Sandeen 3e758d
+			flags, NULL, 0);
Eric Sandeen 3e758d
 }
Eric Sandeen 3e758d
 
Eric Sandeen 3e758d
 #ifndef CONFIG_HAVE_GETTID
Eric Sandeen 3e758d
Eric Sandeen 3e758d