From: Jens Axboe <axboe@kernel.dk>
To: Peter Zijlstra <peterz@infradead.org>
Cc: parri.andrea@gmail.com, linux-kernel@vger.kernel.org,
tom.leiming@gmail.com, hch@lst.de, paulmck@linux.vnet.ibm.com,
will.deacon@arm.com, boqun.feng@gmail.com,
stern@rowland.harvard.edu
Subject: Re: [PATCH -v2] blk-mq: Start to fix memory ordering...
Date: Wed, 4 Oct 2017 11:18:53 -0600 [thread overview]
Message-ID: <26c964cd-4ad8-7bbb-6fc9-3c5dafa2117d@kernel.dk> (raw)
In-Reply-To: <20170906080022.sotl4pvihs2nvg4m@hirez.programming.kicks-ass.net>
On 09/06/2017 02:00 AM, Peter Zijlstra wrote:
>
> Attempt to untangle the ordering in blk-mq. The patch introducing the
> single smp_mb__before_atomic() is obviously broken in that it doesn't
> clearly specify a pairing barrier and an obtained guarantee.
>
> The comment is further misleading in that it hints that the
> deadline store and the COMPLETE store also need to be ordered, but
> AFAICT there is no such dependency. However what does appear to be
> important is the clear happening _after_ the store, and that worked by
> pure accident.
>
> This clarifies blk_mq_start_request() -- we should not get there with
> STARTING set -- this simplifies the code and makes the barrier usage
> sane (the old code could be read to allow not having _any_ atomic after
> the barrier, in which case the barrier hasn't got anything to order). We
> then also introduce the missing pairing barrier for it.
>
> Also down-grade the barrier to smp_wmb(), this is cheaper for
> PowerPC/ARM and doesn't cost anything extra on x86.
>
> And it documents the STARTING vs COMPLETE ordering. Although I've not
> been entirely successful in reverse engineering the blk-mq state
> machine so there might still be more funnies around timeout vs
> requeue.
>
> If I got anything wrong, feel free to educate me by adding comments to
> clarify things ;-)
Sorry for the belated response on this, I spent some time and looked
over everything. Looks solid to me.
I'll queue this up for some testing, and also add a compile check to
prevent us violating the need to have STARTED and COMPLETED be in
the same byte of storage.
--
Jens Axboe
prev parent reply other threads:[~2017-10-04 17:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 8:00 Peter Zijlstra
2017-09-06 14:02 ` Alan Stern
2017-09-06 14:19 ` Boqun Feng
2017-10-04 17:18 ` Jens Axboe [this message]
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=26c964cd-4ad8-7bbb-6fc9-3c5dafa2117d@kernel.dk \
--to=axboe@kernel.dk \
--cc=boqun.feng@gmail.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=parri.andrea@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=stern@rowland.harvard.edu \
--cc=tom.leiming@gmail.com \
--cc=will.deacon@arm.com \
/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
all inboxes | Powered by JetHome®