The following changes since commit 995c45c08c7a362ae0fb2e54e2de27b555a757ab: Merge branch 'sigbreak-wait' of github.com:bjpaupor/fio (2022-08-23 17:09:25 -0400) are available in the Git repository at: git://git.kernel.dk/fio.git master for you to fetch changes up to 05ef0e4e822ffa81d6e92ed538d32cc37a907279: Merge branch 'master' of https://github.com/kraj/fio (2022-08-24 20:09:29 -0600) ---------------------------------------------------------------- Bart Van Assche (1): Enable CPU affinity support on Android Jens Axboe (3): engines/io_uring: pass back correct error value when interrupted Merge branch 'master' of https://github.com/bvanassche/fio Merge branch 'master' of https://github.com/kraj/fio Khem Raj (1): io_uring: Replace pthread_self with s->tid engines/io_uring.c | 8 ++++++++ os/os-android.h | 26 ++++++++++++++++++++++++++ t/io_uring.c | 5 ++--- 3 files changed, 36 insertions(+), 3 deletions(-) --- Diff of recent changes: diff --git a/engines/io_uring.c b/engines/io_uring.c index cffc7371..89d64b06 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -445,12 +445,18 @@ static struct io_u *fio_ioring_event(struct thread_data *td, int event) struct io_uring_cqe *cqe; struct io_u *io_u; unsigned index; + static int eio; index = (event + ld->cq_ring_off) & ld->cq_ring_mask; cqe = &ld->cq_ring.cqes[index]; io_u = (struct io_u *) (uintptr_t) cqe->user_data; + if (eio++ == 5) { + printf("mark EIO\n"); + cqe->res = -EIO; + } + if (cqe->res != io_u->xfer_buflen) { if (cqe->res > io_u->xfer_buflen) io_u->error = -cqe->res; @@ -532,6 +538,7 @@ static int fio_ioring_getevents(struct thread_data *td, unsigned int min, if (r < 0) { if (errno == EAGAIN || errno == EINTR) continue; + r = -errno; td_verror(td, errno, "io_uring_enter"); break; } @@ -665,6 +672,7 @@ static int fio_ioring_commit(struct thread_data *td) usleep(1); continue; } + ret = -errno; td_verror(td, errno, "io_uring_enter submit"); break; } diff --git a/os/os-android.h b/os/os-android.h index 2f73d249..34534239 100644 --- a/os/os-android.h +++ b/os/os-android.h @@ -24,6 +24,7 @@ #define __has_builtin(x) 0 // Compatibility with non-clang compilers. #endif +#define FIO_HAVE_CPU_AFFINITY #define FIO_HAVE_DISK_UTIL #define FIO_HAVE_IOSCHED_SWITCH #define FIO_HAVE_IOPRIO @@ -44,6 +45,13 @@ #define OS_MAP_ANON MAP_ANONYMOUS +typedef cpu_set_t os_cpu_mask_t; + +#define fio_setaffinity(pid, cpumask) \ + sched_setaffinity((pid), sizeof(cpumask), &(cpumask)) +#define fio_getaffinity(pid, ptr) \ + sched_getaffinity((pid), sizeof(cpu_set_t), (ptr)) + #ifndef POSIX_MADV_DONTNEED #define posix_madvise madvise #define POSIX_MADV_DONTNEED MADV_DONTNEED @@ -64,6 +72,24 @@ pthread_getaffinity_np(pthread_self(), sizeof(mask), &(mask)) #endif +#define fio_cpu_clear(mask, cpu) CPU_CLR((cpu), (mask)) +#define fio_cpu_set(mask, cpu) CPU_SET((cpu), (mask)) +#define fio_cpu_isset(mask, cpu) (CPU_ISSET((cpu), (mask)) != 0) +#define fio_cpu_count(mask) CPU_COUNT((mask)) + +static inline int fio_cpuset_init(os_cpu_mask_t *mask) +{ + CPU_ZERO(mask); + return 0; +} + +static inline int fio_cpuset_exit(os_cpu_mask_t *mask) +{ + return 0; +} + +#define FIO_MAX_CPUS CPU_SETSIZE + #ifndef CONFIG_NO_SHM /* * Bionic doesn't support SysV shared memory, so implement it using ashmem diff --git a/t/io_uring.c b/t/io_uring.c index 35bf1956..f34a3554 100644 --- a/t/io_uring.c +++ b/t/io_uring.c @@ -799,15 +799,14 @@ static int submitter_init(struct submitter *s) int i, nr_batch, err; static int init_printed; char buf[80]; - s->tid = gettid(); printf("submitter=%d, tid=%d, file=%s, node=%d\n", s->index, s->tid, s->filename, s->numa_node); set_affinity(s); - __init_rand64(&s->rand_state, pthread_self()); - srand48(pthread_self()); + __init_rand64(&s->rand_state, s->tid); + srand48(s->tid); for (i = 0; i < MAX_FDS; i++) s->files[i].fileno = i;