From: Xiaoguang Wang <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Cc: [email protected]
Subject: Re: [PATCH 2/2] io_uring: add memory barrier to synchronize io_kiocb's result and iopoll_completed
Date: Mon, 15 Jun 2020 22:48:37 +0800 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
hi,
> On 6/15/20 3:24 AM, Xiaoguang Wang wrote:
>> In io_complete_rw_iopoll(), stores to io_kiocb's result and iopoll
>> completed are two independent store operations, to ensure that once
>> iopoll_completed is ture and then req->result must been perceived by
>> the cpu executing io_do_iopoll(), proper memory barrier should be used.
>>
>> And in io_do_iopoll(), we check whether req->result is EAGAIN, if it is,
>> we'll need to issue this io request using io-wq again. In order to just
>> issue a single smp_rmb() on the completion side, move the re-submit work
>> to io_iopoll_complete().
>
> Did you actually test this one?
I only run test cases in liburing/test in a vm.
>
>> @@ -1736,11 +1748,20 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events,
>> {
>> struct req_batch rb;
>> struct io_kiocb *req;
>> + LIST_HEAD(again);
>> +
>> + /* order with ->result store in io_complete_rw_iopoll() */
>> + smp_rmb();
>>
>> rb.to_free = rb.need_iter = 0;
>> while (!list_empty(done)) {
>> int cflags = 0;
>>
>> + if (READ_ONCE(req->result) == -EAGAIN) {
>> + req->iopoll_completed = 0;
>> + list_move_tail(&req->list, &again);
>> + continue;
>> + }
>> req = list_first_entry(done, struct io_kiocb, list);
>> list_del(&req->list);
>>
>
> You're using 'req' here before you initialize it...
Sorry, next time when I submit patches, I'll construct test cases which
will cover my codes changes.
Regards,
Xiaoguang Wang
>
next prev parent reply other threads:[~2020-06-15 14:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-15 9:24 [PATCH 0/2] add proper memory barrier for IOPOLL mode Xiaoguang Wang
2020-06-15 9:24 ` [PATCH 1/2] io_uring: don't fail links for EAGAIN error in " Xiaoguang Wang
2020-06-15 9:24 ` [PATCH 2/2] io_uring: add memory barrier to synchronize io_kiocb's result and iopoll_completed Xiaoguang Wang
2020-06-15 14:36 ` Jens Axboe
2020-06-15 14:48 ` Xiaoguang Wang [this message]
2020-06-15 15:02 ` Jens Axboe
2020-06-15 15:09 ` Pavel Begunkov
2020-06-15 15:32 ` Xiaoguang Wang
2020-06-15 15:35 ` Jens Axboe
2020-06-15 16:51 ` Jens Axboe
2020-06-15 17:53 ` Xiaoguang Wang
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=e47dd9c1-60a6-8365-6754-88437cf828f5@linux.alibaba.com \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox