Unify architecture io_uring syscall numbers
authorJens Axboe <axboe@kernel.dk>
Thu, 6 Feb 2020 14:59:00 +0000 (07:59 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 6 Feb 2020 14:59:00 +0000 (07:59 -0700)
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>
arch/arch-aarch64.h
arch/arch-ppc.h
arch/arch-x86-common.h
arch/arch.h
engines/io_uring.c
t/io_uring.c

index de9b349be57ed8c8c96a527768071aa00fc55ae4..2a86cc5ab4d9b9cb1bef2dcf5d0aab24bfc38fb8 100644 (file)
@@ -8,18 +8,6 @@
 
 #define FIO_ARCH       (arch_aarch64)
 
 
 #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)
 #define nop            do { __asm__ __volatile__ ("yield"); } while (0)
 #define read_barrier() do { __sync_synchronize(); } while (0)
 #define write_barrier()        do { __sync_synchronize(); } while (0)
index 46246baeec1bd69ea8e217b926d5c501541b017e..804d596aecc632cb27f547c90a5b2b997ef79b42 100644 (file)
 #define PPC_CNTLZL "cntlzw"
 #endif
 
 #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;
 static inline int __ilog2(unsigned long bitmask)
 {
        int lz;
index 87925bdc2de90f0843dd1d0468d833898c49910d..f32835cce33bc4a74adeb5b9ad59f49515bceeeb 100644 (file)
@@ -3,16 +3,6 @@
 
 #include <string.h>
 
 
 #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)
 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_INIT
-#define ARCH_HAVE_IOURING
 
 extern bool tsc_reliable;
 extern int arch_random;
 
 extern bool tsc_reliable;
 extern int arch_random;
index 0ec3f10feae03f25d372e39ae179fa9987e6dda2..30c0d2056d3eaa7abcffd5cd703f698d99790edd 100644 (file)
@@ -76,4 +76,32 @@ static inline int arch_init(char *envp[])
 }
 #endif
 
 }
 #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
 #endif
index f1ffc7128ea60fcf334c55e6fdb34f2420c9d6b1..5e59f975c3c529ab735961763c49270ec63eb111 100644 (file)
@@ -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)
 {
 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);
 }
 
                        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;
 
        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;
 
                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;
                                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;
        }
 
                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:
                        IORING_REGISTER_FILES, ld->fds, td->o.nr_files);
        if (ret) {
 err:
index c2e5e0989ee9a4f84096f95def112b38e1b41153..55b75f6ed9664858a7cc6155ce0c159a146a4479 100644 (file)
@@ -100,7 +100,7 @@ static int io_uring_register_buffers(struct submitter *s)
        if (do_nop)
                return 0;
 
        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);
 }
 
                        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;
        }
 
                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)
 {
                        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)
 {
 }
 
 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
 }
 
 #ifndef CONFIG_HAVE_GETTID