fio/fix-io_uring-build.patch
Eric Sandeen 3e758d8573 New upstream version
Also fix gcc10 FTBFS and upstream build breakage in v3.18
2020-02-13 14:21:02 -06:00

208 lines
5.6 KiB
Diff

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