From: Jens Axboe <axboe@kernel.dk>
To: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
Cc: linux-block@vger.kernel.org
Subject: Re: [PATCH 2/2] io_uring: fix the judging condition in io_sequence_defer
Date: Tue, 16 Jul 2019 08:10:31 -0600 [thread overview]
Message-ID: <310ddf1b-03f3-6bb5-65d0-b57e129b08bd@kernel.dk> (raw)
In-Reply-To: <5d2be620.1c69fb81.fff62.8eeeSMTPIN_ADDED_BROKEN@mx.google.com>
On 7/14/19 8:34 PM, Zhengyuan Liu wrote:
>
> On 7/14/19 5:43 AM, Jens Axboe wrote:
>> On 7/12/19 9:58 PM, Zhengyuan Liu wrote:
>>> sq->cached_sq_head and cq->cached_cq_tail are both unsigned int.
>>> if cached_sq_head gets overflowed before cached_cq_tail, then we
>>> may miss a barrier req. As cached_cq_tail moved always following
>>> cached_sq_head, the NQ should be enough.
>> This (and the previous patch) looks fine to me, just wondering if
>> you had a test case showing this issue?
>>
> Hi.
>
> Actually I don't have a real test case, but I have emulated a test case
> and showed the issue.
>
> Let's preset those count to close overflowed status at the begin:
>
> @@ -2979,6 +2987,10 @@ static int io_allocate_scq_urings(struct
> io_ring_ctx *ctx,
> cq_ring->ring_entries = p->cq_entries;
> ctx->cq_mask = cq_ring->ring_mask;
> ctx->cq_entries = cq_ring->ring_entries;
> +
> + ctx->cached_sq_head = ctx->sq_ring->r.head =
> ctx->sq_ring->r.tail = 0xfffffff8;
> + ctx->cached_cq_tail = ctx->cq_ring->r.head =
> ctx->cq_ring->r.tail = 0xfffffff8
> +
> return 0;
> }
>
> And queue serveral sqes following a io_uring_enter like this:
>
> write1 write2 ... write8 barrier write9 write10
>
> Then we can miss the barrier almost every time.
No problem, just curious if you had a test case, since then I'd add
it to the arsenal.
I've applied this one, thank you.
--
Jens Axboe
next prev parent reply other threads:[~2019-07-16 14:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-13 3:58 [PATCH 1/2] io_uring: make req from defer and link list not touch async list Zhengyuan Liu
2019-07-13 3:58 ` [PATCH 2/2] io_uring: fix the judging condition in io_sequence_defer Zhengyuan Liu
2019-07-13 21:43 ` Jens Axboe
[not found] ` <5d2be620.1c69fb81.fff62.8eeeSMTPIN_ADDED_BROKEN@mx.google.com>
2019-07-16 14:10 ` Jens Axboe [this message]
2019-07-16 14:08 ` [PATCH 1/2] io_uring: make req from defer and link list not touch async list Jens Axboe
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=310ddf1b-03f3-6bb5-65d0-b57e129b08bd@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=liuzhengyuan@kylinos.cn \
/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;
as well as URLs for NNTP newsgroup(s).