Commit Graph

135 Commits

Author SHA1 Message Date
fangzhiyi18 0ae77b95ef 升级2.7
Signed-off-by: fangzhiyi18 <fangzhiyi1@huawei.com>
2024-10-21 02:53:20 +00:00
Stefan Metzmacher 5bc5722b9f uapi: Sync with the kernel in order to build systems without linux/time_types.h
Fixes: https://github.com/axboe/liburing/issues/708
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-10-24 12:09:51 +02:00
Pavel Begunkov df332dd03d tests: add sendmsg_zc tests
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/d698961d4bf8f0ab3bb7ad36b42c309c3395e0c2.1663759148.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-09-21 09:00:26 -06:00
Dylan Yudaken 8d4a96d044 Copy defer task run definition from kernel
Copy the flag from upstream

Signed-off-by: Dylan Yudaken <dylany@fb.com>
Tested-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> # Build
Link: https://lore.kernel.org/r/20220905132258.1858915-2-dylany@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-09-05 11:41:24 -06:00
Pavel Begunkov 4d730231ee zc: adjust sendzc to the simpler uapi
We update the zerocopy API, reflect it in liburing, this includes
removing the whole notification story, updating headers and fixing
up tests.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/f56ab1638b9704d5745082e4a8a4b610a784d62f.1662116617.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-09-02 05:56:53 -06:00
Ammar Faizi c5c670533f io_uring: uapi: Sync with the kernel
This is a full copy from the kernel tree without any modifition. Now
this header is fully in sync with the kernel. Next time when changing
this header from the kernel side, just copy the file directly to
liburing, no need manual modification.

Link: https://lore.kernel.org/io-uring/f1feef16-6ea2-0653-238f-4aaee35060b6@kernel.dk
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Dylan Yudaken <dylany@fb.com>
Cc: Facebook Kernel Team <kernel-team@fb.com>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-08-23 07:22:49 -06:00
Ankit Kumar 91c4d2630d io_uring.h: sync sqe entry with 5.20 io_uring
Add a few missing fields which was added for uring command

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20220728093327.32580-3-ankit.kumar@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-07-28 07:07:00 -06:00
Pavel Begunkov beefb994c9 io_uring.h: sync with kernel for zc send and notifiers
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/75b424869b9dad220d425693a43ec5ae97e5b8e8.1658748624.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-07-25 09:46:23 -06:00
Dylan Yudaken 5d46081c96 Copy IORING_SETUP_SINGLE_ISSUER into io_uring.h
Copy from the 5.20 tree IORING_SETUP_SINGLE_ISSUER which is queued up.

Signed-off-by: Dylan Yudaken <dylany@fb.com>
Link: https://lore.kernel.org/r/20220721144229.1224141-3-dylany@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-07-21 09:25:52 -06:00
Dylan Yudaken df4f819eaf add multishot recvmsg API
This adds a new API to do multishot recvmsg. This is more complicated than
multishot recv as it requires handling a well known data layout copied by
the kernel.

Signed-off-by: Dylan Yudaken <dylany@fb.com>
Link: https://lore.kernel.org/r/20220714115428.1569612-2-dylany@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-07-14 12:01:52 -06:00
Jens Axboe f8cd687ba8 Correct mistakes on send/recv* flags
They go into ->ioprio, not off/addr2.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-07-09 10:01:32 -06:00
Dylan Yudaken a724d78156 add IORING_RECV_MULTISHOT to io_uring.h
copy relevant part from include/uapi/linux/io_uring.h from
for-5.20/io_uring branch

Signed-off-by: Dylan Yudaken <dylany@fb.com>
Link: https://lore.kernel.org/r/20220630164918.3958710-3-dylany@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-06-30 14:19:28 -06:00
Pavel Begunkov a45defe13a update io_uring.h with file slot alloc ranges
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/8f98bd6d014b9e8b1d86d04aa165b6d36cfb0ed5.1656597976.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-06-30 10:46:56 -06:00
Jens Axboe b1580d37a2 Add sync cancel helper
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-06-29 10:09:31 -06:00
Jens Axboe 2b90897b3a Remove IORING_CLOSE_FD_AND_FILE_SLOT
We dropped this from 5.19, prune it from liburing as well for now.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-06-15 09:54:17 -06:00
Xiaoguang Wang 87de496e03 Let IORING_OP_FILES_UPDATE support to choose fixed file slots
Allocate available direct descriptors instead of having the
application pass free fixed file slots. To use it, pass
IORING_FILE_INDEX_ALLOC to io_uring_prep_files_update(), then
io_uring in kernel will store picked fixed file slots in fd
array and let cqe return the number of slots allocated.

Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Link: https://lore.kernel.org/r/20220530173604.38000-1-xiaoguang.wang@linux.alibaba.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-30 16:48:05 -06:00
Jens Axboe b62cf9078c Add ring based registered buffers
Add definitions and a helper to set them up.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-18 14:24:03 -06:00
Jens Axboe 8279b74214 io_uring.h: sync with 5.19 io_uring release
A few missing bits due to the topic branches not being synced.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-17 06:04:15 -06:00
Jens Axboe 59c4616464 io_uring.h: fix merge error
The registered buffer rings haven't been added yet, but a hunk
snuck into the release anyway. Fix it up.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-17 06:03:46 -06:00
Jens Axboe 627572212c Merge branch 'accept-multi'
* accept-multi:
  open/openat2: update man page to include IORING_FILE_INDEX_ALLOC
  liburing.h: use helper for io_uring_prep_multishot_accept()
  man/io_uring_prep_accept.3: fixup some phrasing
  man/io_uring_prep_accept.3: add man info for multishot accept
  test/accept.c: test for multishot direct accept with wrong arg
  test/accept.c: add test for multishot mode accept
  liburing.h: add api to support multishot accept direct
  liburing.h: support multishot accept
  test/accept.c: close the listen fd at the end of the test
2022-05-16 20:37:59 -06:00
Krishna Kanth Reddy be06c0158c liburing: Update io_uring.h
This updates the io_uring.h file with the changes in the kernel.
Fixed the build issue that arises because of the updated fields.

Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
2022-05-16 09:33:26 -06:00
Stefan Roesch d84592704d liburing: Update io_uring.h with large CQE kernel changes
This updates the io_uring.h file with the changes in the kernel.

Signed-off-by: Stefan Roesch <shr@fb.com>
Link: https://lore.kernel.org/r/20220425182639.2446370-2-shr@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16 09:30:52 -06:00
Jens Axboe 5c0604994c io_uring.h: add IORING_SETUP_SQE128
This asks the kernel to setup a ring with 128-byte SQE entries. May fail
with -EINVAL if the kernel doesn't support this feature. If the kernel
does support the feature, then the ring will support big sqe entries
which some commands may require.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16 09:24:47 -06:00
Jens Axboe 0a622c18ca Merge branch 'xattr'
* xattr:
  32-bit build warning cleanups
  test/xattr: don't fail on kernels not supporting the feature
  test/xattr: style fixups
  test/xattr: specify file mode with O_CREAT
  liburing: Add new test program to verify xattr support
  liburing: Add helper functions for fgetxattr and getxattr
  liburing: add helper functions for setxattr and fsetxattr
  liburing: Update io_uring in liburing

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16 09:22:43 -06:00
Jens Axboe 98428cb9ff io_uring.h: add IORING_RECVSEND_POLL_FIRST
This flag can be used by send/sendmsg or recv/recvmsg to tell io_uring
that it expects the socket to not be immediately ready for send or
recv. For that case, it's worthless trying to do IO first, it's better
to just arm poll internally and let that drive the first attempt.

Can be used in conjunction with the IORING_CQE_F_SOCK_NONEMPTY feedback
from the kernel, or independently.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14 15:35:05 -06:00
Jens Axboe ead4d9fdcc io_uring.h: add IORING_CQE_F_SOCK_NONEMPTY
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14 15:31:58 -06:00
Jens Axboe 038d0bc35f Merge branch 'cancel-fd-all'
* cancel-fd-all:
  test/poll-cancel-all: add async read test case
  test/poll-cancel-all: test IORING_ASYNC_CANCEL_ANY
  io_uring.h: add IORING_ASYNC_CANCEL_ANY
  test/poll-cancel-all: abort test if cancel flags not supported
  test/poll-cancel-all: add test case canceling a subset of pending
  test/poll-cancel-all: test issuing CANCEL_ALL | CANCEL_FD
  liburing.h: add io_uring_prep_cancel_fd()
  io_uring: add new cancel flags
2022-05-14 09:45:21 -06:00
Jens Axboe 0f6846fafb Add sparse registration helper and kernel definition
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14 09:43:06 -06:00
Jens Axboe 0697e2afd6 queue: add new IORING_SQ_TASKRUN flag
Check it in cq_ring_needs_flush(), so that a peek operation will notice
and enter the kernel to flush completions.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14 09:35:04 -06:00
Hao Xu 728efca5e8 liburing.h: add api to support multishot accept direct
This is to support the multishot accept directly to the fixed table, the
file_Index should be set to IORING_FILE_INDEX_ALLOC in this case.

Signed-off-by: Hao Xu <howeyxu@tencent.com>
Link: https://lore.kernel.org/r/20220514143534.59162-4-haoxu.linux@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14 09:15:38 -06:00
Hao Xu 491fb96a63 liburing.h: support multishot accept
Add a new api to leverage the multishot mode accept, this feature is to
achieve one accept request for all listened events.

Signed-off-by: Hao Xu <howeyxu@tencent.com>
Link: https://lore.kernel.org/r/20220514143534.59162-3-haoxu.linux@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14 09:15:38 -06:00
Jens Axboe eecc1103a6 io_uring.h: add IORING_ASYNC_CANCEL_ANY
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-16 14:45:38 -06:00
Jens Axboe de9f836308 io_uring: add new cancel flags
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-15 19:43:37 -06:00
Jens Axboe 1df4c75155 io_uring.h: add IORING_FEAT_LINKED_FILE
If this is set in features, applications can rely on file assignments
being done sanely in deferred execution setups (like links, or drain).

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-14 11:17:34 -06:00
Stefan Roesch 1abf222609 liburing: Update io_uring in liburing
Summary:

Update liburing with the kernel changes in io_uring.

Signed-off-by: Stefan Roesch <shr@fb.com>
Link: https://lore.kernel.org/r/20220323154457.3303391-2-shr@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-03-30 14:43:42 -06:00
Jens Axboe 7cd2681240 Remove IORING_CQE_F_MSG
Remove it from the io_uring_prep_msg_ring.3 man page as it's no longer
being set by the kernel, and remove the definition and comment from the
kernel header.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-03-24 06:56:45 -06:00
Jens Axboe 0292e21cf9 Merge branch 'registered-ring'
* registered-ring:
  test/sq-poll-dup: modify ring fd hack to work with enter_ring_fd
  Add ring fd registration helpers
  Add preliminary support for using a registered ring fd
  io_uring.h: sync with kernel for registered ring feature
2022-03-10 20:02:40 -07:00
Jens Axboe 6d5f856d30 test/drop-submit: test function of IORING_SETUP_SUBMIT_ALL flag
If the ring is created with this flag, then we expect submissions to
continue even if we hit an error in a batch. Check if that is the case
or not.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-03-10 17:30:18 -07:00
Jens Axboe 8102356a20 Merge branch 'wakeup-ring'
Merge IORING_OP_MSG_RING support

* wakeup-ring:
  test/msg-ring: add test cases for IORING_OP_MSG_RING
  Add io_uring_prep_msg_ring() helper
2022-03-10 12:46:34 -07:00
Jens Axboe 2f8a716a48 Add io_uring_prep_msg_ring() helper
The IORING_OP_MSG_RING command type can be used to send a notification
to another ring. This can be used to either just wakeup anyone waiting
on the ring, for example.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-03-10 09:27:40 -07:00
Jens Axboe 7a98cbea19 io_uring.h: sync with kernel for registered ring feature
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-03-05 15:48:35 -07:00
Almog Khaikin 7b5f21d7e6 Fix memory ordering in sq_ring_needs_enter
A full memory barrier is required between the store to the SQ tail in
__io_uring_flush_sq and the load of the flags in sq_ring_needs_enter
to prevent a situation where the kernel thread goes to sleep while
sq_ring_needs_enter returns false

Fixes: https://github.com/axboe/liburing/issues/541
Signed-off-by: Almog Khaikin <almogkh@gmail.com>
2022-03-05 19:54:28 +02:00
Jens Axboe a2be75b482 Remove getdents support
There are still discussions about the API, and hence the feature will
miss the 5.17 kernel release. As the API is likely to change, remove
the getdents support for now and we can re-add it when it's finalized.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-01-05 12:21:28 -07:00
Stefan Roesch 1fcc39a47f liburing: update io_uring.h header file
Update io_uring.h header file with new op code for getdents64.

Signed-off-by: Stefan Roesch <shr@fb.com>
Link: https://lore.kernel.org/r/20211123180753.1598611-2-shr@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-12-22 07:16:55 -07:00
Pavel Begunkov 9381adbb5d io_uring.h: update to reflect cqe-skip feature
Add IOSQE_CQE_SKIP_SUCCESS and friends

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/665ef6b2f9440105f5826a63be5ac014b179ccbf.1637786880.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-11-24 14:27:47 -07:00
Pavel Begunkov b75a68e0af io_uring: test IORING_TIMEOUT_ETIME_SUCCESS
Make sure we don't fail links on ETIME when IORING_TIMEOUT_ETIME_SUCCESS
is set.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/d1a5b6bdbcfa1ec6b5ca014248e12b3b1edb4e5d.1633259449.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-10-03 07:06:49 -06:00
Jens Axboe 95902894ed io_uring.h: include recent 5.15-git addition of exported worker type
Applications can index the array they pass in to
IORING_REGISTER_IOWQ_MAX_WORKERS instead of using non-specific 0 and 1
values for bound/unbound.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-09-18 05:12:18 -06:00
Jens Axboe 638f5bbe15 io_uring.h: sync with 5.15 kernel
Just the timeout flags are missing at this point.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-08-31 14:16:11 -06:00
Jens Axboe f0f39c7b0b Fix IORING_REGISTER_IOWQ_MAX_WORKERS name
A previous commit did sync with the kernel in terms of the API, but we
neglected to change the actual enum as well.

Fixes: 8295a41544 ("Change IORING_REGISTER_IOWQ_MAX_UNBOUND_WORKERS")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-08-31 14:13:15 -06:00
Jens Axboe 717d7647f8 Add io_uring_register_iowq_max_unbound() helper
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-08-28 14:49:02 -06:00