Commit Graph

153 Commits

Author SHA1 Message Date
Jeff Moyer 4bdf424e42 io_uring/net: support non-zerocopy sendto
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 516e82f0e043a1a0e8d00800ed0ffe2137cf0e7e
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Sep 21 12:17:51 2022 +0100

    io_uring/net: support non-zerocopy sendto
    
    We have normal sends, but what is missing is sendto-like requests. Add
    sendto() capabilities to IORING_OP_SEND by passing in addr just as we do
    for IORING_OP_SEND_ZC.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/69fbd8b2cb830e57d1bf9ec351e9bf95c5b77e3f.1663668091.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:23:56 -04:00
Jeff Moyer b6a48388b9 io_uring/net: refactor io_setup_async_addr
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 6ae61b7aa2c758ce07347ebfa9c79b6f208098d5
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Sep 21 12:17:50 2022 +0100

    io_uring/net: refactor io_setup_async_addr
    
    Instead of passing the right address into io_setup_async_addr() only
    specify local on-stack storage and let the function infer where to grab
    it from. It optimises out one local variable we have to deal with.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/6bfa9ab810d776853eb26ed59301e2536c3a5471.1663668091.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:23:56 -04:00
Jeff Moyer fd543b3e34 io_uring/net: don't lose partial send_zc on fail
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 5693bcce892d7b8b15a7a92b011d3d40a023b53c
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Sep 21 12:17:49 2022 +0100

    io_uring/net: don't lose partial send_zc on fail
    
    Partial zc send may end up in io_req_complete_failed(), which not only
    would return invalid result but also mask out the notification leading
    to lifetime issues.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/5673285b5e83e6ceca323727b4ddaa584b5cc91e.1663668091.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:23:56 -04:00
Jeff Moyer dd4be430aa io_uring/net: don't lose partial send/recv on fail
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 7e6b638ed501cced4e472298d6b08dd16346f3a6
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Sep 21 12:17:48 2022 +0100

    io_uring/net: don't lose partial send/recv on fail
    
    Just as with rw, partial send/recv may end up in
    io_req_complete_failed() and loose the result, make sure we return the
    number of bytes processed.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/a4ff95897b5419356fca9ea55db91ac15b2975f9.1663668091.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:23:55 -04:00
Jeff Moyer 1277c6c3a6 io_uring/net: use io_sr_msg for sendzc
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit ac9e5784bbe72f4f603d1af84760ec09bc0b5ccd
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Sep 8 13:20:34 2022 +0100

    io_uring/net: use io_sr_msg for sendzc
    
    Reuse struct io_sr_msg for zerocopy sends, which is handy. There is
    only one zerocopy specific field, namely .notif, and we have enough
    space for it.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/408c5b1b2d8869e1a12da5f5a78ed72cac112149.1662639236.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:23:52 -04:00
Jeff Moyer 0851e5d75e io_uring/net: refactor io_sr_msg types
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 0b048557db761d287777360a100e1d010760d209
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Sep 8 13:20:33 2022 +0100

    io_uring/net: refactor io_sr_msg types
    
    In preparation for using struct io_sr_msg for zerocopy sends, clean up
    types. First, flags can be u16 as it's provided by the userspace in u16
    ioprio, as well as addr_len. This saves us 4 bytes. Also use unsigned
    for size and done_io, both are as well limited to u32.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/42c2639d6385b8b2181342d2af3a42d3b1c5bcd2.1662639236.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:23:52 -04:00
Jeff Moyer 2374daccdb io_uring/net: add non-bvec sg chunking callback
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit cd9021e88fddf0d9fa9704564153af2bdb5dc13c
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Sep 8 13:20:32 2022 +0100

    io_uring/net: add non-bvec sg chunking callback
    
    Add a sg_from_iter() for when we initiate non-bvec zerocopy sends, which
    helps us to remove some extra steps from io_sg_from_iter(). The only
    thing the new function has to do before giving control away to
    __zerocopy_sg_from_iter() is to check if the skb has managed frags and
    downgrade them if so.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/cda3dea0d36f7931f63a70f350130f085ac3f3dd.1662639236.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:23:51 -04:00
Jeff Moyer 17da94e149 io_uring/net: io_async_msghdr caches for sendzc
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 6bf8ad25fcd42a719f24613deabcff2fd341c789
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Sep 8 13:20:31 2022 +0100

    io_uring/net: io_async_msghdr caches for sendzc
    
    We already keep io_async_msghdr caches for normal send/recv requests,
    use them also for zerocopy send.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/42fa615b6e0be25f47a685c35d7b5e4f1b03d348.1662639236.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:23:51 -04:00
Jeff Moyer 4d90be4396 io_uring/net: use async caches for async prep
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 858c293e5d3b7fd3037883fcc0379594517c926c
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Sep 8 13:20:30 2022 +0100

    io_uring/net: use async caches for async prep
    
    send/recv have async_data caches but there are only used from within
    issue handlers. Extend their use also to ->prep_async, should be handy
    with links and IOSQE_ASYNC.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/b9a2264b807582a97ed606c5bfcdc2399384e8a5.1662639236.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:23:51 -04:00
Jeff Moyer fa961b3cec io_uring/net: reshuffle error handling
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 95eafc74be5e11f9dd6a11504c27321c515ce00f
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Sep 8 13:20:29 2022 +0100

    io_uring/net: reshuffle error handling
    
    We should prioritise send/recv retry cases over failures, they're more
    important. Shuffle -ERESTARTSYS after we handled retries.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/d9059691b30d0963b7269fa4a0c81ee7720555e6.1662639236.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:23:50 -04:00
Jeff Moyer 1855ac02a3 io_uring/net: fix zc fixed buf lifetime
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit e3366e0234971a09f0e16f0e6fa16f4cbae45e47
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Fri Sep 16 23:22:57 2022 +0100

    io_uring/net: fix zc fixed buf lifetime
    
    Notifications usually outlive requests, so we need to pin buffers with
    it by assigning a rsrc to it instead of the request.
    
    Fixed: b48c312be05e8 ("io_uring/net: simplify zerocopy send user API")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/dd6406ff8a90887f2b36ed6205dac9fda17c1f35.1663366886.git.asml.silence@gmail.com
    Reviewed-by: Stefan Metzmacher <metze@samba.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:23:00 -04:00
Jeff Moyer 2b2b055e53 io_uring/net: copy addr for zc on POLL_FIRST
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 3c8400532dd8305024ff6eea38707de20b1b9822
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Sep 8 14:01:10 2022 +0100

    io_uring/net: copy addr for zc on POLL_FIRST
    
    Every time we return from an issue handler and expect the request to be
    retried we should also setup it for async exec ourselves. Do that when
    we return on IORING_RECVSEND_POLL_FIRST in io_sendzc(), otherwise it'll
    re-read the address, which might be a surprise for the userspace.
    
    Fixes: 092aeedb750a9 ("io_uring: allow to pass addr into sendzc")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/ab1d0657890d6721339c56d2e161a4bba06f85d0.1662642013.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:22:59 -04:00
Jeff Moyer b2fa46daef io_uring/net: simplify zerocopy send user API
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit b48c312be05e83b55a4d58bf61f80b4a3288fb7e
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Sep 1 11:54:04 2022 +0100

    io_uring/net: simplify zerocopy send user API
    
    Following user feedback, this patch simplifies zerocopy send API. One of
    the main complaints is that the current API is difficult with the
    userspace managing notification slots, and then send retries with error
    handling make it even worse.
    
    Instead of keeping notification slots change it to the per-request
    notifications model, which posts both completion and notification CQEs
    for each request when any data has been sent, and only one CQE if it
    fails. All notification CQEs will have IORING_CQE_F_NOTIF set and
    IORING_CQE_F_MORE in completion CQEs indicates whether to wait a
    notification or not.
    
    IOSQE_CQE_SKIP_SUCCESS is disallowed with zerocopy sends for now.
    
    This is less flexible, but greatly simplifies the user API and also the
    kernel implementation. We reuse notif helpers in this patch, but in the
    future there won't be need for keeping two requests.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/95287640ab98fc9417370afb16e310677c63e6ce.1662027856.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:22:58 -04:00
Jeff Moyer c8485c0739 io_uring/notif: remove notif registration
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 57f332246afa5929bdf2e7a5facddedb43549be4
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Sep 1 11:54:03 2022 +0100

    io_uring/notif: remove notif registration
    
    We're going to remove the userspace exposed zerocopy notification API,
    remove notification registration.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/6ff00b97be99869c386958a990593c9c31cf105b.1662027856.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:22:57 -04:00
Jeff Moyer 30d6b1e64f io_uring/net: fix overexcessive retries
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit dfb58b1796d19c8405a38eb457f97669440c59d4
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Fri Aug 26 17:15:47 2022 +0100

    io_uring/net: fix overexcessive retries
    
    Length parameter of io_sg_from_iter() can be smaller than the iterator's
    size, as it's with TCP, so when we set from->count at the end of the
    function we truncate the iterator forcing TCP to return preliminary with
    a short send. It affects zerocopy sends with large payload sizes and
    leads to retries and possible request failures.
    
    Fixes: 3ff1a0d395c00 ("io_uring: enable managed frags with register buffers")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/0bc0d5179c665b4ef5c328377c84c7a1f298467e.1661530037.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:22:56 -04:00
Jeff Moyer adda922e38 io_uring/net: save address for sendzc async execution
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 581711c46612c1fd7f98960f9ad53f04fdb89853
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Aug 24 13:07:43 2022 +0100

    io_uring/net: save address for sendzc async execution
    
    We usually copy all bits that a request needs from the userspace for
    async execution, so the userspace can keep them on the stack. However,
    send zerocopy violates this pattern for addresses and may reloads it
    e.g. from io-wq. Save the address if any in ->async_data as usual.
    
    Reported-by: Stefan Metzmacher <metze@samba.org>
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/d7512d7aa9abcd36e9afe1a4d292a24cb2d157e5.1661342812.git.asml.silence@gmail.com
    [axboe: fold in incremental fix]
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:22:55 -04:00
Jeff Moyer 017905abd8 io_uring/net: fix indentation
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 986e263def32eec89153babf469859d837507d34
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Aug 24 13:07:40 2022 +0100

    io_uring/net: fix indentation
    
    Fix up indentation before we get complaints from tooling.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/bd5754e3764215ccd7fb04cd636ea9167aaa275d.1661342812.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:22:54 -04:00
Jeff Moyer 2fc1137c21 io_uring/net: fix zc send link failing
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 5a848b7c9e5e4d94390fbc391ccb81d40f3ccfb5
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Aug 24 13:07:39 2022 +0100

    io_uring/net: fix zc send link failing
    
    Failed requests should be marked with req_set_fail(), so links and cqe
    skipping work correctly, which is missing in io_sendzc(). Note,
    io_sendzc() return IOU_OK on failure, so the core code won't do the
    cleanup for us.
    
    Fixes: 06a5464be84e4 ("io_uring: wire send zc request type")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/e47d46fda9db30154ce66a549bb0d3380b780520.1661342812.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-05-05 15:22:54 -04:00
Jeff Moyer d41b3c5cab io_uring/net: use right helpers for async_data
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 3f743e9bbb8fe20f4c477e4bf6341c4187a4a264
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Aug 18 12:38:34 2022 +0100

    io_uring/net: use right helpers for async_data
    
    There is another spot where we check ->async_data directly instead of
    using req_has_async_data(), which is the way to do it, fix it up.
    
    Fixes: 43e0bbbd0b0e3 ("io_uring: add netmsg cache")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/42f33b9a81dd6ae65dda92f0372b0ff82d548517.1660822636.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:48:02 -04:00
Jeff Moyer 0071d10cbe io_uring/net: improve zc addr import error handling
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 86dc8f23bb1b68262ca5db890ec7177b2d074640
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Mon Aug 15 13:42:01 2022 +0100

    io_uring/net: improve zc addr import error handling
    
    We may account memory to a memcg of a request that didn't even got to
    the network layer. It's not a bug as it'll be routinely cleaned up on
    flush, but it might be confusing for the userspace.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/b8aae61f4c3ddc4da97c1da876bb73871f352d50.1660566179.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:46:02 -04:00
Jeff Moyer c764dbfb0e io_uring/net: use right helpers for async recycle
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 063604265f967e90901996a1b173fe6df582d350
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Mon Aug 15 13:42:00 2022 +0100

    io_uring/net: use right helpers for async recycle
    
    We have a helper that checks for whether a request contains anything in
    ->async_data or not, namely req_has_async_data(). It's better to use it
    as it might have some extra considerations.
    
    Fixes: 43e0bbbd0b0e3 ("io_uring: add netmsg cache")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/b7414da4e7c3c32c31fc02dfd1355af4ccf4ca5f.1660566179.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:45:02 -04:00
Jeff Moyer 95438cbb8c io_uring: make io_kiocb_to_cmd() typesafe
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit f2ccb5aed7bce1d8b3ed5b3385759a5509663028
Author: Stefan Metzmacher <metze@samba.org>
Date:   Thu Aug 11 09:11:15 2022 +0200

    io_uring: make io_kiocb_to_cmd() typesafe
    
    We need to make sure (at build time) that struct io_cmd_data is not
    casted to a structure that's larger.
    
    Signed-off-by: Stefan Metzmacher <metze@samba.org>
    Link: https://lore.kernel.org/r/c024cdf25ae19fc0319d4180e2298bade8ed17b8.1660201408.git.metze@samba.org
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:43:02 -04:00
Jeff Moyer 50b2250f53 io_uring: fix io_recvmsg_prep_multishot sparse warnings
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit d1f6222c4978817712e0f2825ce9e830763f0695
Author: Dylan Yudaken <dylany@fb.com>
Date:   Fri Aug 5 04:54:50 2022 -0700

    io_uring: fix io_recvmsg_prep_multishot sparse warnings
    
    Fix casts missing the __user parts. This seemed to only cause errors on
    the alpha build, or if checked with sparse, but it was definitely an
    oversight.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Fixes: 9bb66906f23e ("io_uring: support multishot in recvmsg")
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220805115450.3921352-1-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:40:02 -04:00
Jeff Moyer 7b3e735402 io_uring/net: send retry for zerocopy
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 4a933e62083ead6cd064293a7505c56165859320
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Aug 4 15:15:30 2022 +0100

    io_uring/net: send retry for zerocopy
    
    io_uring handles short sends/recvs for stream sockets when MSG_WAITALL
    is set, however new zerocopy send is inconsistent in this regard, which
    might be confusing. Handle short sends.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/b876a4838597d9bba4f3215db60d72c33c448ad0.1659622472.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:39:02 -04:00
Jeff Moyer 97935db1e3 io_uring: notification completion optimisation
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 14b146b688ad9593f5eee93d51a34d09a47e50b5
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Jul 27 10:30:41 2022 +0100

    io_uring: notification completion optimisation
    
    We want to use all optimisations that we have for io_uring requests like
    completion batching, memory caching and more but for zc notifications.
    Fortunately, notification perfectly fit the request model so we can
    overlay them onto struct io_kiocb and use all the infratructure.
    
    Most of the fields of struct io_notif natively fits into io_kiocb, so we
    replace struct io_notif with struct io_kiocb carrying struct
    io_notif_data in the cmd cache line. Then we adapt io_alloc_notif() to
    use io_alloc_req()/io_alloc_req_refill(), and kill leftovers of hand
    coded caching. __io_notif_complete_tw() is converted to use io_uring's
    tw infra.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/9e010125175e80baf51f0ca63bdc7cc6a4a9fa56.1658913593.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:35:02 -04:00
Jeff Moyer b3c7d7525d io_uring/net: use unsigned for flags
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 293402e564a7391f38541c7694e736f5fde20aea
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Mon Jul 25 10:52:06 2022 +0100

    io_uring/net: use unsigned for flags
    
    Use unsigned int type for msg flags.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/5cfaed13d3191337b14b8664ca68b515d9e2d1b4.1658742118.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:33:02 -04:00
Jeff Moyer 56754e8145 io_uring/net: make page accounting more consistent
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 6a9ce66f4d0872861e0bbc67eee6ce5dca5dd886
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Mon Jul 25 10:52:05 2022 +0100

    io_uring/net: make page accounting more consistent
    
    Make network page accounting more consistent with how buffer
    registration is working, i.e. account all memory to ctx->user.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/4aacfe64bbb81b27f9ecf5d5c219c69a07e5aa56.1658742118.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:32:02 -04:00
Jeff Moyer 92a5c0b64a io_uring/net: checks errors of zc mem accounting
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 2e32ba5607ee2b668baa8831dd74f7cc867a1f7e
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Mon Jul 25 10:52:04 2022 +0100

    io_uring/net: checks errors of zc mem accounting
    
    mm_account_pinned_pages() may fail, don't ignore the return value.
    
    Fixes: e29e3bd4b968 ("io_uring: account locked pages for non-fixed zc")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/dae0542ed8e6706071bb83ad3e7ad6a70d207fd9.1658742118.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:31:02 -04:00
Jeff Moyer fececa14d0 io_uring: enable managed frags with register buffers
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 3ff1a0d395c00e42ee15f561431e0c04097595b9
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Tue Jul 12 21:52:50 2022 +0100

    io_uring: enable managed frags with register buffers
    
    io_uring's registered buffers infra has a good performant way of pinning
    pages, so let's use SKBFL_MANAGED_FRAG_REFS when our requests are purely
    register buffer backed.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/278731d3f20caf346cfc025fbee0b4c9ee4ed751.1657643355.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:28:02 -04:00
Jeff Moyer b1bf677022 io_uring: flush notifiers after sendzc
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 63809137ebb58f0aa2ce359117422686e3304f45
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Tue Jul 12 21:52:47 2022 +0100

    io_uring: flush notifiers after sendzc
    
    Allow to flush notifiers as a part of sendzc request by setting
    IORING_SENDZC_FLUSH flag. When the sendzc request succeedes it will
    flush the used [active] notifier.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/e0b4d9a6797e2fd6092824fe42953db7a519bbc8.1657643355.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:25:02 -04:00
Jeff Moyer 29fa5ec15b io_uring: sendzc with fixed buffers
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 10c7d33ecd51619e453cf6aeee8e326f8ba5cfea
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Tue Jul 12 21:52:46 2022 +0100

    io_uring: sendzc with fixed buffers
    
    Allow zerocopy sends to use fixed buffers. There is an optimisation for
    this case, the network layer don't need to reference the pages, see
    SKBFL_MANAGED_FRAG_REFS, so io_uring have to ensure validity of fixed
    buffers until the notifier is released.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/e1d8bd1b5934e541d90c1824eb4020ae3f5f43f3.1657643355.git.asml.silence@gmail.com
    [axboe: fold in 32-bit pointer cast warning fix]
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:24:02 -04:00
Jeff Moyer 87e6d96713 io_uring: allow to pass addr into sendzc
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 092aeedb750a9fad0f0252d6067fc91d76ca44bd
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Tue Jul 12 21:52:45 2022 +0100

    io_uring: allow to pass addr into sendzc
    
    Allow to specify an address to zerocopy sends making it more like
    sendto(2).
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/70417a8f7c5b51ab454690bae08adc0c187f89e8.1657643355.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:23:02 -04:00
Jeff Moyer d0e436c131 io_uring: account locked pages for non-fixed zc
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit e29e3bd4b968d50bfb3bbdcee6bfdc340f7792cf
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Tue Jul 12 21:52:44 2022 +0100

    io_uring: account locked pages for non-fixed zc
    
    Fixed buffers are RLIMIT_MEMLOCK accounted, however it doesn't cover iovec
    based zerocopy sends. Do the accounting on the io_uring side.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/19b6e3975440f59f1f6199c7ee7acf977b4eecdc.1657643355.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:22:02 -04:00
Jeff Moyer 7d666a408d io_uring: wire send zc request type
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 06a5464be84e4ae48394d34441baf34bf9706827
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Tue Jul 12 21:52:43 2022 +0100

    io_uring: wire send zc request type
    
    Add a new io_uring opcode IORING_OP_SENDZC. The main distinction from
    IORING_OP_SEND is that the user should specify a notification slot
    index in sqe::notification_idx and the buffers are safe to reuse only
    when the used notification is flushed and completes.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/a80387c6a68ce9cf99b3b6ef6f71068468761fb7.1657643355.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:21:02 -04:00
Jeff Moyer d80fa47279 io_uring: initialise msghdr::msg_ubuf
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit e02b66512738db161e83634255e9826c8cb51336
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Tue Jul 12 21:52:36 2022 +0100

    io_uring: initialise msghdr::msg_ubuf
    
    Initialise newly added ->msg_ubuf in io_recv() and io_send().
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/b8f9f263875a4a36e7f26cc5d55ebe315308f57d.1657643355.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 08:14:02 -04:00
Jeff Moyer 08db2b1b9b net: fix compat pointer in get_compat_msghdr()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 4f6a94d337408f23e199eee7d35ed6edc201df0c
Author: Jens Axboe <axboe@kernel.dk>
Date:   Fri Jul 15 15:54:47 2022 -0600

    net: fix compat pointer in get_compat_msghdr()
    
    A previous change enabled external users to copy the data before
    calling __get_compat_msghdr(), but didn't modify get_compat_msghdr() or
    __io_compat_recvmsg_copy_hdr() to take that into account. They are both
    stil passing in the __user pointer rather than the copied version.
    
    Ensure we pass in the kernel struct, not the pointer to the user data.
    
    Link: https://lore.kernel.org/all/46439555-644d-08a1-7d66-16f8f9a320f0@samsung.com/
    Fixes: 1a3e4e94a1b9 ("net: copy from user before calling __get_compat_msghdr")
    Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:38:02 -04:00
Jeff Moyer dbb804cd3c io_uring: fix types in io_recvmsg_multishot_overflow
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 9b0fc3c054ff2eb13753104884f1045b5bb3a627
Author: Dylan Yudaken <dylany@fb.com>
Date:   Fri Jul 15 06:02:52 2022 -0700

    io_uring: fix types in io_recvmsg_multishot_overflow
    
    io_recvmsg_multishot_overflow had incorrect types on non x64 system.
    But also it had an unnecessary INT_MAX check, which could just be done
    by changing the type of the accumulator to int (also simplifying the
    casts).
    
    Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Fixes: a8b38c4ce724 ("io_uring: support multishot in recvmsg")
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220715130252.610639-1-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:37:02 -04:00
Jeff Moyer 3658149696 io_uring: support multishot in recvmsg
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 9bb66906f23e50d6db1e11f7498b72dfca1982a2
Author: Dylan Yudaken <dylany@fb.com>
Date:   Thu Jul 14 04:02:58 2022 -0700

    io_uring: support multishot in recvmsg
    
    Similar to multishot recv, this will require provided buffers to be
    used. However recvmsg is much more complex than recv as it has multiple
    outputs. Specifically flags, name, and control messages.
    
    Support this by introducing a new struct io_uring_recvmsg_out with 4
    fields. namelen, controllen and flags match the similar out fields in
    msghdr from standard recvmsg(2), payloadlen is the length of the payload
    following the header.
    This struct is placed at the start of the returned buffer. Based on what
    the user specifies in struct msghdr, the next bytes of the buffer will be
    name (the next msg_namelen bytes), and then control (the next
    msg_controllen bytes). The payload will come at the end. The return value
    in the CQE is the total used size of the provided buffer.
    
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220714110258.1336200-4-dylany@fb.com
    [axboe: style fixups, see link]
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:36:02 -04:00
Jeff Moyer e4e22a0993 net: copy from user before calling __get_compat_msghdr
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237
Conflicts: RHEL has commit d547c1b717fc ("net: clear msg_get_inq in
__get_compat_msghdr()") backported out of order, so it causes a patch
application failure when applying this patch.

commit 72c531f8ef3052c682d39dc21dcb5576afda208c
Author: Dylan Yudaken <dylany@fb.com>
Date:   Thu Jul 14 04:02:57 2022 -0700

    net: copy from user before calling __get_compat_msghdr
    
    this is in preparation for multishot receive from io_uring, where it needs
    to have access to the original struct user_msghdr.
    
    functionally this should be a no-op.
    
    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220714110258.1336200-3-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:35:02 -04:00
Jeff Moyer 79c5b9e709 net: copy from user before calling __copy_msghdr
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 7fa875b8e53c288d616234b9daf417b0650ce1cc
Author: Dylan Yudaken <dylany@fb.com>
Date:   Thu Jul 14 04:02:56 2022 -0700

    net: copy from user before calling __copy_msghdr
    
    this is in preparation for multishot receive from io_uring, where it needs
    to have access to the original struct user_msghdr.
    
    functionally this should be a no-op.
    
    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220714110258.1336200-2-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:34:02 -04:00
Jeff Moyer 4df8a65844 io_uring: support 0 length iov in buffer select in compat
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 6d2f75a0cf3048ef38c48493f66a923353bf664b
Author: Dylan Yudaken <dylany@fb.com>
Date:   Fri Jul 8 11:18:36 2022 -0700

    io_uring: support 0 length iov in buffer select in compat
    
    Match up work done in "io_uring: allow iov_len = 0 for recvmsg and buffer
    select", but for compat code path.
    
    Fixes: a68caad69ce5 ("io_uring: allow iov_len = 0 for recvmsg and buffer select")
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220708181838.1495428-3-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:31:02 -04:00
Jeff Moyer 94e6ace00d io_uring: fix multishot ending when not polled
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit e2df2ccb753e3b598a9045760e79f1847f7b31cd
Author: Dylan Yudaken <dylany@fb.com>
Date:   Fri Jul 8 11:18:35 2022 -0700

    io_uring: fix multishot ending when not polled
    
    If multishot is not actually polling then return IOU_OK rather than the
    result.
    If the result was > 0 this will confuse things further up the callstack
    which expect a return <= 0.
    
    Fixes: 1300ebb20286 ("io_uring: multishot recv")
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220708181838.1495428-2-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:30:02 -04:00
Jeff Moyer 9eaf9409ea io_uring: add netmsg cache
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 43e0bbbd0b0e30d232fd8e9e908125b5c49a9fbc
Author: Jens Axboe <axboe@kernel.dk>
Date:   Thu Jul 7 14:30:09 2022 -0600

    io_uring: add netmsg cache
    
    For recvmsg/sendmsg, if they don't complete inline, we currently need
    to allocate a struct io_async_msghdr for each request. This is a
    somewhat large struct.
    
    Hook up sendmsg/recvmsg to use the io_alloc_cache. This reduces the
    alloc + free overhead considerably, yielding 4-5% of extra performance
    running netbench.
    
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:29:02 -04:00
Jeff Moyer 03b94efe8c io_uring: disable multishot recvmsg
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit cf0dd9527eee5d6d183fa724fdee6a128cb17b8d
Author: Dylan Yudaken <dylany@fb.com>
Date:   Mon Jul 4 07:01:06 2022 -0700

    io_uring: disable multishot recvmsg
    
    recvmsg has semantics that do not make it trivial to extend to
    multishot. Specifically it has user pointers and returns data in the
    original parameter. In order to make this API useful these will need to be
    somehow included with the provided buffers.
    
    For now remove multishot for recvmsg as it is not useful.
    
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220704140106.200167-1-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:21:02 -04:00
Jeff Moyer c771e6098e io_uring: multishot recv
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit b3fdea6ecb55c3ceea866ff66486927e51a982b3
Author: Dylan Yudaken <dylany@fb.com>
Date:   Thu Jun 30 02:12:29 2022 -0700

    io_uring: multishot recv
    
    Support multishot receive for io_uring.
    Typical server applications will run a loop where for each recv CQE it
    requeues another recv/recvmsg.
    
    This can be simplified by using the existing multishot functionality
    combined with io_uring's provided buffers.
    The API is to add the IORING_RECV_MULTISHOT flag to the SQE. CQEs will
    then be posted (with IORING_CQE_F_MORE flag set) when data is available
    and is read. Once an error occurs or the socket ends, the multishot will
    be removed and a completion without IORING_CQE_F_MORE will be posted.
    
    The benefit to this is that the recv is much more performant.
     * Subsequent receives are queued up straight away without requiring the
       application to finish a processing loop.
     * If there are more data in the socket (sat the provided buffer size is
       smaller than the socket buffer) then the data is immediately
       returned, improving batching.
     * Poll is only armed once and reused, saving CPU cycles
    
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220630091231.1456789-11-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:18:02 -04:00
Jeff Moyer 432247b19d io_uring: fix multishot accept ordering
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit cbd25748545c709d35734deb9220e0af0a69e5d2
Author: Dylan Yudaken <dylany@fb.com>
Date:   Thu Jun 30 02:12:28 2022 -0700

    io_uring: fix multishot accept ordering
    
    Similar to multishot poll, drop multishot accept when CQE overflow occurs.
    
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220630091231.1456789-10-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:17:02 -04:00
Jeff Moyer 6abae6e2c4 io_uring: add allow_overflow to io_post_aux_cqe
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 52120f0fadcbdaaa981c19327f1865a714e85268
Author: Dylan Yudaken <dylany@fb.com>
Date:   Thu Jun 30 02:12:26 2022 -0700

    io_uring: add allow_overflow to io_post_aux_cqe
    
    Some use cases of io_post_aux_cqe would not want to overflow as is, but
    might want to change the flags/result. For example multishot receive
    requires in order CQE, and so if there is an overflow it would need to
    stop receiving until the overflow is taken care of.
    
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220630091231.1456789-8-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:15:02 -04:00
Jeff Moyer 76728db05d io_uring: recycle buffers on error
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit d4e097dae29c24bf33a5056a2a43cff2e45c4978
Author: Dylan Yudaken <dylany@fb.com>
Date:   Thu Jun 30 02:12:23 2022 -0700

    io_uring: recycle buffers on error
    
    Rather than passing an error back to the user with a buffer attached,
    recycle the buffer immediately.
    
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220630091231.1456789-5-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:12:02 -04:00
Jeff Moyer b9f906ac7b io_uring: allow iov_len = 0 for recvmsg and buffer select
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 5702196e7d9d1232c41769e197eb33ba78a9b463
Author: Dylan Yudaken <dylany@fb.com>
Date:   Thu Jun 30 02:12:22 2022 -0700

    io_uring: allow iov_len = 0 for recvmsg and buffer select
    
    When using BUFFER_SELECT there is no technical requirement that the user
    actually provides iov, and this removes one copy_from_user call.
    
    So allow iov_len to be 0.
    
    Signed-off-by: Dylan Yudaken <dylany@fb.com>
    Link: https://lore.kernel.org/r/20220630091231.1456789-4-dylany@fb.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 07:11:02 -04:00
Jeff Moyer 8034d812f4 io_uring: kill extra io_uring_types.h includes
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 27a9d66fec77cff0e32d2ecd5d0ac7ef878a7bb0
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu Jun 16 13:57:18 2022 +0100

    io_uring: kill extra io_uring_types.h includes
    
    io_uring/io_uring.h already includes io_uring_types.h, no need to
    include it every time. Kill it in a bunch of places, it prepares us for
    following patches.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/94d8c943fbe0ef949981c508ddcee7fc1c18850f.1655384063.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 06:19:02 -04:00
Jeff Moyer 14da90670c io_uring: don't expose io_fill_cqe_aux()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit d245bca6375bccfd589a6a7d5007df28575bb626
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Fri Jun 17 09:48:00 2022 +0100

    io_uring: don't expose io_fill_cqe_aux()
    
    Deduplicate some code and add a helper for filling an aux CQE, locking
    and notification.
    
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/b7c6557c8f9dc5c4cfb01292116c682a0ff61081.1655455613.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 06:13:02 -04:00
Jeff Moyer bc165e5818 io_uring: split provided buffers handling into its own file
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit 3b77495a97239faa27989f946d29b6be7dd091e9
Author: Jens Axboe <axboe@kernel.dk>
Date:   Mon Jun 13 07:07:23 2022 -0600

    io_uring: split provided buffers handling into its own file
    
    Move both the opcodes related to it, and the internals code dealing with
    it.
    
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 05:38:02 -04:00
Jeff Moyer 38ad21ddaf io_uring: split network related opcodes into its own file
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068237

commit f9ead18c10589a351f395ac5aa107360f2f6ce53
Author: Jens Axboe <axboe@kernel.dk>
Date:   Wed May 25 06:25:13 2022 -0600

    io_uring: split network related opcodes into its own file
    
    While at it, convert the handlers to just use io_eopnotsupp_prep()
    if CONFIG_NET isn't set.
    
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-04-29 05:26:02 -04:00