All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Stefan Metzmacher <metze@samba.org>,
	Pavel Begunkov <asml.silence@gmail.com>,
	io-uring@vger.kernel.org
Subject: Re: [PATCH 1/1] io_uring/net: send retry for zerocopy
Date: Sun, 14 Aug 2022 08:05:51 -0600	[thread overview]
Message-ID: <14283cb1-11b3-2847-4f48-9ea30c48c1bf@kernel.dk> (raw)
In-Reply-To: <064b4920-5441-1ae2-b492-cb75f7796d8d@samba.org>

On 8/14/22 3:31 AM, Stefan Metzmacher wrote:
> Hi Pavel,
> 
>> 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>
>> ---
>>   io_uring/net.c | 20 +++++++++++++++++---
>>   1 file changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/io_uring/net.c b/io_uring/net.c
>> index 32fc3da04e41..f9f080b3cc1e 100644
>> --- a/io_uring/net.c
>> +++ b/io_uring/net.c
>> @@ -70,6 +70,7 @@ struct io_sendzc {
>>       unsigned            flags;
>>       unsigned            addr_len;
>>       void __user            *addr;
>> +    size_t                done_io;
>>   };
>>     #define IO_APOLL_MULTI_POLLED (REQ_F_APOLL_MULTISHOT | REQ_F_POLLED)
>> @@ -878,6 +879,7 @@ int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
>>         zc->addr = u64_to_user_ptr(READ_ONCE(sqe->addr2));
>>       zc->addr_len = READ_ONCE(sqe->addr_len);
>> +    zc->done_io = 0;
>>     #ifdef CONFIG_COMPAT
>>       if (req->ctx->compat)
>> @@ -1012,11 +1014,23 @@ int io_sendzc(struct io_kiocb *req, unsigned int issue_flags)
>>       if (unlikely(ret < min_ret)) {
>>           if (ret == -EAGAIN && (issue_flags & IO_URING_F_NONBLOCK))
>>               return -EAGAIN;
>> -        return ret == -ERESTARTSYS ? -EINTR : ret;
>> +        if (ret > 0 && io_net_retry(sock, msg.msg_flags)) {
>> +            zc->len -= ret;
>> +            zc->buf += ret;
>> +            zc->done_io += ret;
>> +            req->flags |= REQ_F_PARTIAL_IO;
> 
> Don't we need a prep_async function and/or something like
> io_setup_async_msg() here to handle address?

I don't think so, it's a non-vectored interface, so all the state is
already in io_sendzc.

-- 
Jens Axboe


  reply	other threads:[~2022-08-14 14:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 14:15 [PATCH 1/1] io_uring/net: send retry for zerocopy Pavel Begunkov
2022-08-04 14:53 ` Jens Axboe
2022-08-14  9:31 ` Stefan Metzmacher
2022-08-14 14:05   ` Jens Axboe [this message]
2022-08-14 14:11     ` Stefan Metzmacher
2022-08-14 14:13       ` Jens Axboe
2022-08-14 14:48         ` Stefan Metzmacher
2022-08-15  9:14           ` Pavel Begunkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14283cb1-11b3-2847-4f48-9ea30c48c1bf@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    --cc=metze@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.