All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <keith.busch@gmail.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Ming Lei <ming.lei@redhat.com>, Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Sagi Grimberg <sagi@grimberg.me>,
	linux-nvme <linux-nvme@lists.infradead.org>,
	Keith Busch <keith.busch@intel.com>,
	Max Gurtovoy <maxg@mellanox.com>, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 3/5] nvme: don't abort completed request in nvme_cancel_request
Date: Mon, 22 Jul 2019 17:22:33 -0600	[thread overview]
Message-ID: <CAOSXXT5TkrfH0AFZCV0c+YtbFCQ4MnShKM-gkZrj8Qex+Z7Png@mail.gmail.com> (raw)
In-Reply-To: <d82ead02-c893-4d14-307e-70a6d4596439@acm.org>

On Mon, Jul 22, 2019 at 9:27 AM Bart Van Assche <bvanassche@acm.org> wrote:
> On 7/21/19 10:39 PM, Ming Lei wrote:
> > Before aborting in-flight requests, all IO queues have been shutdown.
> > However, request's completion fn may not be done yet because it may
> > be scheduled to run via IPI.
> >
> > So don't abort one request if it is marked as completed, otherwise
> > we may abort one normal completed request.
> >
> > Cc: Max Gurtovoy <maxg@mellanox.com>
> > Cc: Sagi Grimberg <sagi@grimberg.me>
> > Cc: Keith Busch <keith.busch@intel.com>
> > Cc: Christoph Hellwig <hch@lst.de>
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > ---
> >   drivers/nvme/host/core.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> > index cc09b81fc7f4..cb8007cce4d1 100644
> > --- a/drivers/nvme/host/core.c
> > +++ b/drivers/nvme/host/core.c
> > @@ -285,6 +285,10 @@ EXPORT_SYMBOL_GPL(nvme_complete_rq);
> >
> >   bool nvme_cancel_request(struct request *req, void *data, bool reserved)
> >   {
> > +     /* don't abort one completed request */
> > +     if (blk_mq_request_completed(req))
> > +             return;
> > +
> >       dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device,
> >                               "Cancelling I/O %d", req->tag);
>
> Something I probably already asked before: what prevents that
> nvme_cancel_request() is executed concurrently with the completion
> handler of the same request?

At least for pci, we've shutdown the queues and their interrupts prior
to tagset iteration, so we can't concurrently execute a natural
completion for in-flight requests while cancelling them.

WARNING: multiple messages have this Message-ID (diff)
From: keith.busch@gmail.com (Keith Busch)
Subject: [PATCH 3/5] nvme: don't abort completed request in nvme_cancel_request
Date: Mon, 22 Jul 2019 17:22:33 -0600	[thread overview]
Message-ID: <CAOSXXT5TkrfH0AFZCV0c+YtbFCQ4MnShKM-gkZrj8Qex+Z7Png@mail.gmail.com> (raw)
In-Reply-To: <d82ead02-c893-4d14-307e-70a6d4596439@acm.org>

On Mon, Jul 22, 2019@9:27 AM Bart Van Assche <bvanassche@acm.org> wrote:
> On 7/21/19 10:39 PM, Ming Lei wrote:
> > Before aborting in-flight requests, all IO queues have been shutdown.
> > However, request's completion fn may not be done yet because it may
> > be scheduled to run via IPI.
> >
> > So don't abort one request if it is marked as completed, otherwise
> > we may abort one normal completed request.
> >
> > Cc: Max Gurtovoy <maxg at mellanox.com>
> > Cc: Sagi Grimberg <sagi at grimberg.me>
> > Cc: Keith Busch <keith.busch at intel.com>
> > Cc: Christoph Hellwig <hch at lst.de>
> > Signed-off-by: Ming Lei <ming.lei at redhat.com>
> > ---
> >   drivers/nvme/host/core.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> > index cc09b81fc7f4..cb8007cce4d1 100644
> > --- a/drivers/nvme/host/core.c
> > +++ b/drivers/nvme/host/core.c
> > @@ -285,6 +285,10 @@ EXPORT_SYMBOL_GPL(nvme_complete_rq);
> >
> >   bool nvme_cancel_request(struct request *req, void *data, bool reserved)
> >   {
> > +     /* don't abort one completed request */
> > +     if (blk_mq_request_completed(req))
> > +             return;
> > +
> >       dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device,
> >                               "Cancelling I/O %d", req->tag);
>
> Something I probably already asked before: what prevents that
> nvme_cancel_request() is executed concurrently with the completion
> handler of the same request?

At least for pci, we've shutdown the queues and their interrupts prior
to tagset iteration, so we can't concurrently execute a natural
completion for in-flight requests while cancelling them.

  reply	other threads:[~2019-07-22 23:22 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22  5:39 [PATCH 0/5] blk-mq: wait until completed req's complete fn is run Ming Lei
2019-07-22  5:39 ` Ming Lei
2019-07-22  5:39 ` [PATCH 1/5] blk-mq: introduce blk_mq_request_completed() Ming Lei
2019-07-22  5:39   ` Ming Lei
2019-07-23 20:26   ` Sagi Grimberg
2019-07-23 20:26     ` Sagi Grimberg
2019-07-22  5:39 ` [PATCH 2/5] blk-mq: introduce blk_mq_tagset_wait_completed_request() Ming Lei
2019-07-22  5:39   ` Ming Lei
2019-07-22 15:25   ` Bart Van Assche
2019-07-22 15:25     ` Bart Van Assche
2019-07-23  1:06     ` Ming Lei
2019-07-23  1:06       ` Ming Lei
2019-07-23 20:54       ` Bart Van Assche
2019-07-23 20:54         ` Bart Van Assche
2019-07-24  1:34         ` Ming Lei
2019-07-24  1:34           ` Ming Lei
2019-07-23 20:27   ` Sagi Grimberg
2019-07-23 20:27     ` Sagi Grimberg
2019-07-22  5:39 ` [PATCH 3/5] nvme: don't abort completed request in nvme_cancel_request Ming Lei
2019-07-22  5:39   ` Ming Lei
2019-07-22 15:27   ` Bart Van Assche
2019-07-22 15:27     ` Bart Van Assche
2019-07-22 23:22     ` Keith Busch [this message]
2019-07-22 23:22       ` Keith Busch
2019-07-23  0:07       ` Sagi Grimberg
2019-07-23  0:07         ` Sagi Grimberg
2019-07-23  1:08     ` Ming Lei
2019-07-23  1:08       ` Ming Lei
2019-07-23 19:22       ` Bart Van Assche
2019-07-23 19:22         ` Bart Van Assche
2019-07-23 20:27   ` Sagi Grimberg
2019-07-23 20:27     ` Sagi Grimberg
2019-07-22  5:39 ` [PATCH 4/5] nvme: wait until all completed request's complete fn is called Ming Lei
2019-07-22  5:39   ` Ming Lei
2019-07-23 16:14   ` Dongli Zhang
2019-07-23 16:14     ` Dongli Zhang
2019-07-24  2:05     ` Ming Lei
2019-07-24  2:05       ` Ming Lei
2019-07-23 20:29   ` Sagi Grimberg
2019-07-23 20:29     ` Sagi Grimberg
2019-07-24  1:43     ` Ming Lei
2019-07-24  1:43       ` Ming Lei
2019-07-22  5:39 ` [PATCH 5/5] blk-mq: remove blk_mq_complete_request_sync Ming Lei
2019-07-22  5:39   ` Ming Lei
2019-07-23 20:30   ` Sagi Grimberg
2019-07-23 20:30     ` Sagi Grimberg
2019-07-22 23:27 ` [PATCH 0/5] blk-mq: wait until completed req's complete fn is run Bob Liu
2019-07-22 23:27   ` Bob Liu
2019-07-23  1:10   ` Ming Lei
2019-07-23  1:10     ` 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=CAOSXXT5TkrfH0AFZCV0c+YtbFCQ4MnShKM-gkZrj8Qex+Z7Png@mail.gmail.com \
    --to=keith.busch@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=keith.busch@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=maxg@mellanox.com \
    --cc=ming.lei@redhat.com \
    --cc=sagi@grimberg.me \
    /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.