Skip to contentSkip to conversation

io_uring updates for 6.8-rc1

GIT PULL Merged Jens Axboe 2 participants 3 messages Jan 8, 2024 – Jan 11, 2024 io_uring

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

Hi Linus,

Mostly just come fixes and cleanups, but one feature as well. In detail:

- Harden the check for handling IOPOLL based on return (Pavel)

- Various minor optimizations (Pavel)

- Drop remnants of SCM_RIGHTS fd passing support, now that it's no longer supported since 6.7 (me)

- Fix for a case where bytes_done wasn't initialized properly on a failure condition for read/write requests (me)

- Move the register related code to a separate file (me)

- Add support for returning the provided ring buffer head (me)

- Add support for adding a direct descriptor to the normal file table (me, Christian Brauner)

- Fix for ensuring pending task_work for a ring with DEFER_TASKRUN is run even if we timeout waiting (me)

Note that this has Christian's vfs.file branch pulled in, as he renamed __receive_fd() to receive_fd(). Sending this out now, as I saw Christian already included this branch in his pull requests sent out last week.

Also note that this will throw a merge conflict with the block branch, as we killed the IORING_URING_CMD_POLLED flag and associated cookie in struct io_uring_cmd, and this branch moved those things to a different file. The resolution is to remove all of the offending hunk in include/linux/io_uring.h and then edit include/linux/io_uring/cmd.h, killing IORING_URING_CMD_POLLED in there and getting rid of the union and cookie field in struct io_uring_cmd. Including my resolution of the merge at the end of the email.

Please pull!

The following changes since commit 4e94ddfe2aab72139acb8d5372fac9e6c3f3e383:

file: remove __receive_fd() (2023-12-12 14:24:14 +0100)

are available in the Git repository at:

git://git.kernel.dk/linux.git tags/for-6.8/io_uring-2024-01-08

for you to fetch changes up to 6ff1407e24e6fdfa4a16ba9ba551e3d253a26391:

io_uring: ensure local task_work is run on wait timeout (2024-01-04 12:21:08 -0700)

----------------------------------------------------------------
for-6.8/io_uring-2024-01-08

----------------------------------------------------------------
Jens Axboe (8):
Merge branch 'vfs.file' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs into for-6.8/io_uring io_uring/openclose: add support for IORING_OP_FIXED_FD_INSTALL
io_uring/register: move io_uring_register(2) related code to register.c io_uring/unix: drop usage of io_uring socket
io_uring: drop any code related to SCM_RIGHTS
io_uring/rw: ensure io->bytes_done is always initialized
io_uring/kbuf: add method for returning provided buffer ring head
io_uring: ensure local task_work is run on wait timeout

Pavel Begunkov (5):
io_uring: don't check iopoll if request completes
io_uring: optimise ltimeout for inline execution
io_uring: split out cmd api into a separate header io_uring/cmd: inline io_uring_cmd_do_in_task_lazy io_uring/cmd: inline io_uring_cmd_get_task

 MAINTAINERS                    |   1 +
 drivers/block/ublk_drv.c       |   2 +-
 drivers/nvme/host/ioctl.c      |   2 +-
 include/linux/io_uring.h       |  95 +------
 include/linux/io_uring/cmd.h   |  82 ++++++
 include/linux/io_uring_types.h |  34 ++-
 include/uapi/linux/io_uring.h  |  19 ++
 io_uring/Makefile              |   2 +-
 io_uring/filetable.c           |  11 +-
 io_uring/io_uring.c            | 663 +++-------------------------------------------
 io_uring/io_uring.h            |  19 +-
 io_uring/kbuf.c                |  26 ++
 io_uring/kbuf.h                |   1 +
 io_uring/opdef.c               |   9 +
 io_uring/openclose.c           |  44 +++
 io_uring/openclose.h           |   3 +
 io_uring/register.c            | 605 ++++++++++++++++++++++++++++++++++++++++++
 io_uring/register.h            |   8 +
 io_uring/rsrc.c                | 169 +-----------
 io_uring/rsrc.h                |  15 --
 io_uring/rw.c                  |  12 +-
 io_uring/uring_cmd.c           |  15 +-
 net/core/scm.c                 |   2 +-
 net/unix/scm.c                 |   4 +-
 security/selinux/hooks.c       |   2 +-
 security/smack/smack_lsm.c     |   2 +-
 26 files changed, 895 insertions(+), 952 deletions(-)
 create mode 100644 include/linux/io_uring/cmd.h
 create mode 100644 io_uring/register.c
 create mode 100644 io_uring/register.h

commit 4437f65f37924cdce96bcd687cbe225f175e70da
Merge: aed185852af9 6ff1407e24e6
Author: Jens Axboe <[email protected]>
Date: Mon Jan 8 11:21:41 2024 -0700

Merge branch 'for-6.8/io_uring' into test

* for-6.8/io_uring:
io_uring: ensure local task_work is run on wait timeout io_uring/kbuf: add method for returning provided buffer ring head io_uring/rw: ensure io->bytes_done is always initialized
io_uring: drop any code related to SCM_RIGHTS io_uring/unix: drop usage of io_uring socket io_uring/register: move io_uring_register(2) related code to register.c io_uring/openclose: add support for IORING_OP_FIXED_FD_INSTALL io_uring/cmd: inline io_uring_cmd_get_task
io_uring/cmd: inline io_uring_cmd_do_in_task_lazy
io_uring: split out cmd api into a separate header
io_uring: optimise ltimeout for inline execution
io_uring: don't check iopoll if request completes

include/linux/io_uring/cmd.h +0 -0
diff --cc include/linux/io_uring/cmd.h
index 000000000000,d69b4038aa3e..e453a997c060

mode 000000,100644..100644
--- a/include/linux/io_uring/cmd.h
+++ b/include/linux/io_uring/cmd.h
@@@ -1,0 -1,82 +1,77 @@@
+ /* SPDX-License-Identifier: GPL-2.0-or-later */
+ #ifndef _LINUX_IO_URING_CMD_H
+ #define _LINUX_IO_URING_CMD_H
+
+ #include <uapi/linux/io_uring.h>
+ #include <linux/io_uring_types.h>
+
+ /* only top 8 bits of sqe->uring_cmd_flags for kernel internal use */
+ #define IORING_URING_CMD_CANCELABLE (1U << 30)
-#define IORING_URING_CMD_POLLED (1U << 31)
+
+ struct io_uring_cmd {
+ struct file *file;
+ const struct io_uring_sqe *sqe;
- union {
- /* callback to defer completions to task context */
- void (*task_work_cb)(struct io_uring_cmd *cmd, unsigned);
- /* used for polled completion */
- void *cookie;
- };
++ /* callback to defer completions to task context */
++ void (*task_work_cb)(struct io_uring_cmd *cmd, unsigned);
+ u32 cmd_op;
+ u32 flags;
+ u8 pdu[32]; /* available inline for free use */
+ };
+
+ static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
+ {
+ return sqe->cmd;
+ }
+
+ #if defined(CONFIG_IO_URING)
+ int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
+ struct iov_iter *iter, void *ioucmd);
+ void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t res2,
+ unsigned issue_flags);
+ void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
+ void (*task_work_cb)(struct io_uring_cmd *, unsigned),
+ unsigned flags);
+
+ void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
+ unsigned int issue_flags);
+
+ #else
+ static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
+ struct iov_iter *iter, void *ioucmd)
+ {
+ return -EOPNOTSUPP;
+ }
+ static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret,
+ ssize_t ret2, unsigned issue_flags)
+ {
+ }
+ static inline void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
+ void (*task_work_cb)(struct io_uring_cmd *, unsigned),
+ unsigned flags)
+ {
+ }
+ static inline void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
+ unsigned int issue_flags)
+ {
+ }
+ #endif
+
+ /* users must follow the IOU_F_TWQ_LAZY_WAKE semantics */
+ static inline void io_uring_cmd_do_in_task_lazy(struct io_uring_cmd *ioucmd,
+ void (*task_work_cb)(struct io_uring_cmd *, unsigned))
+ {
+ __io_uring_cmd_do_in_task(ioucmd, task_work_cb, IOU_F_TWQ_LAZY_WAKE);
+ }
+
+ static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
+ void (*task_work_cb)(struct io_uring_cmd *, unsigned))
+ {
+ __io_uring_cmd_do_in_task(ioucmd, task_work_cb, 0);
+ }
+
+ static inline struct task_struct *io_uring_cmd_get_task(struct io_uring_cmd *cmd)
+ {
+ return cmd_to_io_kiocb(cmd)->task;
+ }
+
+ #endif /* _LINUX_IO_URING_CMD_H */

Signature · 1 line
Jens Axboe
author maintainer
#1 lore raw
Quoted 8 lines · Jens Axboe

Also note that this will throw a merge conflict with the block branch, as we killed the IORING_URING_CMD_POLLED flag and associated cookie in struct io_uring_cmd, and this branch moved those things to a different file. The resolution is to remove all of the offending hunk in include/linux/io_uring.h and then edit include/linux/io_uring/cmd.h, killing IORING_URING_CMD_POLLED in there and getting rid of the union and cookie field in struct io_uring_cmd. Including my resolution of the merge at the end of the email.

Forgot to mention the security conflict too, which I was reminded of when that landed upstream. See:

https://lore.kernel.org/lkml/[email protected]/

for the simple fix.

Signature · 1 line
Jens Axboe
merge bot Merged
#2 lore raw
In reply to Jens Axboe
The pull request you sent on Mon, 8 Jan 2024 11:24:23 -0700:

The pull request you sent on Mon, 8 Jan 2024 11:24:23 -0700:

Quoted 1 line

git://git.kernel.dk/linux.git tags/for-6.8/io_uring-2024-01-08

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/4c72e2b8c42e57f65d8fbfb01329e79d2b450653

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html