From: ming.lei@redhat.com (Ming Lei)
Subject: [PATCH 5.0 66/95] nvme: cancel request synchronously
Date: Tue, 21 May 2019 18:41:22 +0800 [thread overview]
Message-ID: <20190521104121.GA31530@ming.t460p> (raw)
In-Reply-To: <7a4863ba-ece9-e3fa-8396-21736d54e1fe@mellanox.com>
On Tue, May 21, 2019@01:21:39PM +0300, Max Gurtovoy wrote:
>
> On 5/21/2019 12:45 PM, Ming Lei wrote:
> > On Tue, May 21, 2019@11:36:26AM +0300, Max Gurtovoy wrote:
> > > On 5/9/2019 9:42 PM, Greg Kroah-Hartman wrote:
> > > > [ Upstream commit eb3afb75b57c28599af0dfa03a99579d410749e9 ]
> > > >
> > > > nvme_cancel_request() is used in error handler, and it is always
> > > > reliable to cancel request synchronously, and avoids possible race
> > > > in which request may be completed after real hw queue is destroyed.
> > > Ming,
> > >
> > > If the completion is async in the block layer, can't a "good" request (not a
> > > canceled one..) complete after real HW queue is destroyed ?
> > In theory, it can't.
> >
> > 1) in case of error recovery
> >
> > It is driver's responsibility to sync normal completion and handling
> > error. NVMe PCI calls nvme_dev_disable() to shutdown controller, and
> > there won't be good request any more after nvme_dev_disable() returns.
> > I am not very familiar with NVMe RDMA code, but nvme_rdma_stop_io_queues()
> > is supposed to do that for avoiding race with normal completion. Otherwise,
> > it isn't enough by simply canceling in-flight requests.
>
> Indeed nvme_rdma_stop_io_queues will guaranty that we won't get anything
> from the wire/HCA anymore.
>
>
> But what happens to IO's that were completed before
> "nvme_rdma_stop_io_queues" in async way:
>
> 1. nvme_end_request --> blk_mq_complete_request (async)
>
> 2. error recovery starts (queues are stopped)
>
> 3. block layer calls ops->complete(rq) on rq from step #1
>
> if the blk_mq_quiesce_queue + blk_mq_unquiesce_queue don't sync the requests
> from #1, i think it might be problematic..
You are right, we might have to wait until there isn't any in-flight request
which is marked as transient MQ_RQ_COMPLETE before destroying hw queue.
Thanks,
Ming
next prev parent reply other threads:[~2019-05-21 10:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190509181309.180685671@linuxfoundation.org>
2019-05-09 18:42 ` [PATCH 5.0 65/95] blk-mq: introduce blk_mq_complete_request_sync() Greg Kroah-Hartman
2019-05-09 18:42 ` [PATCH 5.0 66/95] nvme: cancel request synchronously Greg Kroah-Hartman
2019-05-21 8:36 ` Max Gurtovoy
2019-05-21 9:45 ` Ming Lei
2019-05-21 10:21 ` Max Gurtovoy
2019-05-21 10:41 ` Ming Lei [this message]
2019-05-21 11:50 ` Max Gurtovoy
2019-05-21 12:49 ` Ming Lei
2019-05-24 8:15 ` Sagi Grimberg
2019-05-24 8:23 ` Ming Lei
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=20190521104121.GA31530@ming.t460p \
--to=ming.lei@redhat.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