All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <keith.busch@intel.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
	Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>
Subject: Re: [PATCH 4/5] nvme: Fail dead namespace's entered requests
Date: Fri, 8 Mar 2019 15:06:41 -0700	[thread overview]
Message-ID: <20190308220640.GA5629@localhost.localdomain> (raw)
In-Reply-To: <1552082046.45180.91.camel@acm.org>

On Fri, Mar 08, 2019 at 01:54:06PM -0800, Bart Van Assche wrote:
> On Fri, 2019-03-08 at 11:19 -0700, Keith Busch wrote:
> > On Fri, Mar 08, 2019 at 10:15:27AM -0800, Bart Van Assche wrote:
> > > On Fri, 2019-03-08 at 10:40 -0700, Keith Busch wrote:
> > > > End the entered requests on a quieced queue directly rather than flush
> > > > them through the low level driver's queue_rq().
> > > > 
> > > > Signed-off-by: Keith Busch <keith.busch@intel.com>
> > > > ---
> > > >  drivers/nvme/host/core.c | 10 ++++++++--
> > > >  1 file changed, 8 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> > > > index cc5d9a83d5af..7095406bb293 100644
> > > > --- a/drivers/nvme/host/core.c
> > > > +++ b/drivers/nvme/host/core.c
> > > > @@ -94,6 +94,13 @@ static void nvme_put_subsystem(struct nvme_subsystem *subsys);
> > > >  static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl,
> > > >  					   unsigned nsid);
> > > >  
> > > > +static bool nvme_fail_request(struct blk_mq_hw_ctx *hctx, struct request *req,
> > > > +			      void *data, bool reserved)
> > > > +{
> > > > +	blk_mq_end_request(req, BLK_STS_IOERR);
> > > > +	return true;
> > > > +}
> > > 
> > > Calling blk_mq_end_request() from outside the .queue_rq() or .complete()
> > > callback functions is wrong. Did you perhaps want to call
> > > blk_mq_complete_request()?
> > 
> > This callback can only see requests in MQ_RQ_IDLE state, and
> > bkl_mq_end_request() is the correct way to end those that never entered
> > a driver's queue_rq().
> 
> Hi Keith,
> 
> What guarantees that nvme_fail_request() only sees requests in the idle state?
> From block/blk-mq-tag.c:
> 
> /**
>  * blk_mq_queue_tag_busy_iter - iterate over all requests with a driver tag
>  * [ ... ]
>  */

It's the driver's responsibility to ensure the queue is quiesced before
requesting the iteration. When we call it through nvme_kill_queues(),
the queues were already quiesced before calling that. The only other
place it's called is on a frozen queue, so it's actually a no-op there
since there no requests once frozen.

WARNING: multiple messages have this Message-ID (diff)
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH 4/5] nvme: Fail dead namespace's entered requests
Date: Fri, 8 Mar 2019 15:06:41 -0700	[thread overview]
Message-ID: <20190308220640.GA5629@localhost.localdomain> (raw)
In-Reply-To: <1552082046.45180.91.camel@acm.org>

On Fri, Mar 08, 2019@01:54:06PM -0800, Bart Van Assche wrote:
> On Fri, 2019-03-08@11:19 -0700, Keith Busch wrote:
> > On Fri, Mar 08, 2019@10:15:27AM -0800, Bart Van Assche wrote:
> > > On Fri, 2019-03-08@10:40 -0700, Keith Busch wrote:
> > > > End the entered requests on a quieced queue directly rather than flush
> > > > them through the low level driver's queue_rq().
> > > > 
> > > > Signed-off-by: Keith Busch <keith.busch at intel.com>
> > > > ---
> > > >  drivers/nvme/host/core.c | 10 ++++++++--
> > > >  1 file changed, 8 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> > > > index cc5d9a83d5af..7095406bb293 100644
> > > > --- a/drivers/nvme/host/core.c
> > > > +++ b/drivers/nvme/host/core.c
> > > > @@ -94,6 +94,13 @@ static void nvme_put_subsystem(struct nvme_subsystem *subsys);
> > > >  static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl,
> > > >  					   unsigned nsid);
> > > >  
> > > > +static bool nvme_fail_request(struct blk_mq_hw_ctx *hctx, struct request *req,
> > > > +			      void *data, bool reserved)
> > > > +{
> > > > +	blk_mq_end_request(req, BLK_STS_IOERR);
> > > > +	return true;
> > > > +}
> > > 
> > > Calling blk_mq_end_request() from outside the .queue_rq() or .complete()
> > > callback functions is wrong. Did you perhaps want to call
> > > blk_mq_complete_request()?
> > 
> > This callback can only see requests in MQ_RQ_IDLE state, and
> > bkl_mq_end_request() is the correct way to end those that never entered
> > a driver's queue_rq().
> 
> Hi Keith,
> 
> What guarantees that nvme_fail_request() only sees requests in the idle state?
> From block/blk-mq-tag.c:
> 
> /**
>  * blk_mq_queue_tag_busy_iter - iterate over all requests with a driver tag
>  * [ ... ]
>  */

It's the driver's responsibility to ensure the queue is quiesced before
requesting the iteration. When we call it through nvme_kill_queues(),
the queues were already quiesced before calling that. The only other
place it's called is on a frozen queue, so it's actually a no-op there
since there no requests once frozen.

  reply	other threads:[~2019-03-08 22:06 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08 17:40 [PATCH 1/5] blk-mq: Export reading mq request state Keith Busch
2019-03-08 17:40 ` Keith Busch
2019-03-08 17:40 ` [PATCH 2/5] blk-mq: Export iterating queue requests Keith Busch
2019-03-08 17:40   ` Keith Busch
2019-03-08 18:08   ` Bart Van Assche
2019-03-08 18:08     ` Bart Van Assche
2019-03-08 18:13     ` Keith Busch
2019-03-08 18:13       ` Keith Busch
2019-03-08 17:40 ` [PATCH 3/5] blk-mq: Iterate tagset over all requests Keith Busch
2019-03-08 17:40   ` Keith Busch
2019-03-08 17:40 ` [PATCH 4/5] nvme: Fail dead namespace's entered requests Keith Busch
2019-03-08 17:40   ` Keith Busch
2019-03-08 18:15   ` Bart Van Assche
2019-03-08 18:15     ` Bart Van Assche
2019-03-08 18:19     ` Keith Busch
2019-03-08 18:19       ` Keith Busch
2019-03-08 21:54       ` Bart Van Assche
2019-03-08 21:54         ` Bart Van Assche
2019-03-08 22:06         ` Keith Busch [this message]
2019-03-08 22:06           ` Keith Busch
2019-03-11  3:58   ` jianchao.wang
2019-03-11  3:58     ` jianchao.wang
2019-03-11 15:42     ` Keith Busch
2019-03-11 15:42       ` Keith Busch
2019-03-08 17:40 ` [PATCH 5/5] nvme/pci: Remove queue IO flushing hack Keith Busch
2019-03-08 17:40   ` Keith Busch
2019-03-08 18:19   ` Bart Van Assche
2019-03-08 18:19     ` Bart Van Assche
2019-03-11 18:40   ` Christoph Hellwig
2019-03-11 18:40     ` Christoph Hellwig
2019-03-11 19:37     ` Keith Busch
2019-03-11 19:37       ` Keith Busch
2019-03-27  8:31       ` Christoph Hellwig
2019-03-27  8:31         ` Christoph Hellwig
2019-03-27 13:21         ` Keith Busch
2019-03-27 13:21           ` Keith Busch
2019-03-28  1:42           ` jianchao.wang
2019-03-28  1:42             ` jianchao.wang
2019-03-28  3:33             ` Keith Busch
2019-03-28  3:33               ` Keith Busch
2019-03-08 18:07 ` [PATCH 1/5] blk-mq: Export reading mq request state Bart Van Assche
2019-03-08 18:07   ` Bart Van Assche
2019-03-08 18:15   ` Keith Busch
2019-03-08 18:15     ` Keith Busch
2019-03-08 18:42     ` Bart Van Assche
2019-03-08 18:42       ` Bart Van Assche
2019-03-08 19:19       ` Keith Busch
2019-03-08 19:19         ` Keith Busch
2019-03-08 20:47         ` Bart Van Assche
2019-03-08 20:47           ` Bart Van Assche
2019-03-08 21:14           ` Keith Busch
2019-03-08 21:14             ` Keith Busch
2019-03-08 21:25             ` Bart Van Assche
2019-03-08 21:25               ` Bart Van Assche
2019-03-08 21:31               ` Keith Busch
2019-03-08 21:31                 ` Keith Busch
2019-03-08 20:21 ` Sagi Grimberg
2019-03-08 20:21   ` Sagi Grimberg
2019-03-08 20:29   ` Keith Busch
2019-03-08 20:29     ` Keith Busch

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=20190308220640.GA5629@localhost.localdomain \
    --to=keith.busch@intel.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --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.