On 16/03/2023 15:23, Tudor Cretu wrote:
Update the signatures for the uAPI io_uring structs bringing in support for capabilities and re-visit relevant testcases to take into account the structs' new published versions.
Signed-off-by: Tudor Cretu tudor.cretu@arm.com
include/lapi/io_uring.h | 10 +++++----- testcases/kernel/syscalls/io_uring/io_uring01.c | 4 ++-- testcases/kernel/syscalls/io_uring/io_uring02.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h index a63741a08..102e7945f 100644 --- a/include/lapi/io_uring.h +++ b/include/lapi/io_uring.h @@ -38,9 +38,9 @@ struct io_uring_sqe { int32_t fd; /* file descriptor to do IO on */ union { uint64_t off; /* offset into file */
uint64_t addr2;
uintptr_t addr2;
This will break the struct layout in 32-bit. If we cannot use the uapi header directly, then we probably need to define something akin to __kernel_uintptr_t here.
};
- uint64_t addr; /* pointer to buffer or iovecs */
- uintptr_t addr; /* pointer to buffer or iovecs */ uint32_t len; /* buffer size or number of iovecs */ union { __kernel_rwf_t rw_flags;
@@ -55,7 +55,7 @@ struct io_uring_sqe { uint32_t statx_flags; uint32_t fadvise_advice; };
- uint64_t user_data; /* data to be passed back at completion time */
- uintptr_t user_data; /* data to be passed back at completion time */ union { struct { /* index into fixed buffers, if used */
AFAICT __pad2 also needs to be expanded. In fact I'm surprised that these changes work in PCuABI as they stand, because with __pad2 unchanged I would expect the struct to be 16 bytes smaller than the uapi definition. Maybe I'm missing something?
Kevin
@@ -143,7 +143,7 @@ enum {
- IO completion data structure (Completion Queue Entry)
*/ struct io_uring_cqe {
- uint64_t user_data; /* sqe->data submission passed back */
- uintptr_t user_data; /* sqe->data submission passed back */ int32_t res; /* result code for this event */ uint32_t flags;
}; @@ -234,7 +234,7 @@ struct io_uring_params { struct io_uring_files_update { uint32_t offset; uint32_t resv;
- uint64_t __attribute__((aligned(8))) fds;
- uintptr_t __attribute__((aligned(8))) fds;
}; #define IO_URING_OP_SUPPORTED (1U << 0) diff --git a/testcases/kernel/syscalls/io_uring/io_uring01.c b/testcases/kernel/syscalls/io_uring/io_uring01.c index 70151bb85..744c7eca2 100644 --- a/testcases/kernel/syscalls/io_uring/io_uring01.c +++ b/testcases/kernel/syscalls/io_uring/io_uring01.c @@ -203,10 +203,10 @@ static int submit_to_uring_sq(struct submitter *s, struct tcase *tc) sqe->flags = 0; sqe->fd = fd; sqe->opcode = tc->enter_flags;
- sqe->addr = (unsigned long)iov->iov_base;
- sqe->addr = (uintptr_t)iov->iov_base; sqe->len = BLOCK_SZ; sqe->off = 0;
- sqe->user_data = (unsigned long long)iov;
- sqe->user_data = (uintptr_t)iov; sring->array[index] = index; tail = next_tail;
diff --git a/testcases/kernel/syscalls/io_uring/io_uring02.c b/testcases/kernel/syscalls/io_uring/io_uring02.c index c5c770074..026c52b1b 100644 --- a/testcases/kernel/syscalls/io_uring/io_uring02.c +++ b/testcases/kernel/syscalls/io_uring/io_uring02.c @@ -103,7 +103,7 @@ static void drain_fallback(void) sqe_ptr->opcode = IORING_OP_SENDMSG; sqe_ptr->flags = IOSQE_IO_DRAIN; sqe_ptr->fd = sockpair[0];
sqe_ptr->addr = (__u64)&spam_header;
sqe_ptr->user_data = SPAM_MARK; uring.sqr_array[tail & *uring.sqr_mask] = i; }sqe_ptr->addr = (uintptr_t)&spam_header;
@@ -113,7 +113,7 @@ static void drain_fallback(void) sqe_ptr->opcode = IORING_OP_SENDMSG; sqe_ptr->flags = IOSQE_IO_DRAIN; sqe_ptr->fd = sendsock;
- sqe_ptr->addr = (__u64)&beef_header;
- sqe_ptr->addr = (uintptr_t)&beef_header; sqe_ptr->user_data = BEEF_MARK; uring.sqr_array[tail & *uring.sqr_mask] = i; count = ++i;
@@ -218,7 +218,7 @@ static void run(void) sqe_ptr->opcode = IORING_OP_SENDMSG; sqe_ptr->flags = IOSQE_ASYNC; sqe_ptr->fd = sendsock;
- sqe_ptr->addr = (__u64)&beef_header;
- sqe_ptr->addr = (uintptr_t)&beef_header; sqe_ptr->user_data = BEEF_MARK; uring.sqr_array[tail & *uring.sqr_mask] = 0; tail++;