From: Keith Busch <kbusch@kernel.org>
To: "Nadolski, Edmund" <edmund.nadolski@intel.com>
Cc: Christoph Hellwig <hch@lst.de>, linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvme: clear stale nvmeq->tags after tagset free
Date: Wed, 22 Jan 2020 04:12:34 +0900 [thread overview]
Message-ID: <20200121191234.GB4954@redsun51.ssa.fujisawa.hgst.com> (raw)
In-Reply-To: <0fd26a56-d57c-eeae-52b0-a80b64943bdb@intel.com>
On Tue, Jan 21, 2020 at 11:49:53AM -0700, Nadolski, Edmund wrote:
> On 1/21/2020 10:42 AM, Keith Busch wrote:
> > On Tue, Jan 21, 2020 at 10:32:22AM -0700, Nadolski, Edmund wrote:
> > > The tagset pointer gets invalidated when the driver calls the following:
> > >
> > > nvme_reset_work()
> > > +-> nvme_setup_io_queues() <<< cmd fails, no io queues created
> > > +-> nvme_kill_queues()
> > > +-> nvme_remove_namespaces()
> > > | +-> nvme_ns_remove() <<< for each ctrl->namespaces
> > > | +-> del_gendisk()
> > > | +-> blk_cleanup_queue()
> > > | | +-> blk_mq_exit_queue() <<< invalidates the tags
> > > | | +-> blk_mq_del_queue_tag_set()
> > > | | +-> blk_mq_exit_hw_queues()
> > > | | +-> blk_mq_exit_hctx()
> > > | | +-> set->ops->exit_hctx(...) <<< driver callback
> > > | +-> nvme_put_ns()
> > > +-> nvme_free_tagset()
> > > | +-> blk_mq_free_tagset()
> > > +-> nvme_start_ctrl() <<< allow operation w/o namespaces
> > >
> > > So the nvmeq->tags is already dead and stale by the time we get to
> > > nvme_free_tagset.
> >
> > No, nvmeq->tags is not stale until we call nvme_free_tagset().
>
> I see this in blk/blk-mq.c:
>
> 2943 /* tags can _not_ be used after returning from blk_mq_exit_queue */
> 2944 void blk_mq_exit_queue(struct request_queue *q)
You can't access it through q->tag_set after that. The tagset still
exists beyond any individual request_queue using it until you call
blk_mq_free_tag_set().
> which ends up being called on every individual ctrl->namespaces entry. What
> have I overlooked?
There are various paths that can have driver can remove a subset of
namespaces rather than all of them. Is that what you're overlooking?
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2020-01-21 19:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 18:17 [PATCH] nvme: clear stale nvmeq->tags after tagset free Edmund Nadolski
2020-01-16 16:06 ` Keith Busch
2020-01-16 22:06 ` Nadolski, Edmund
2020-01-16 23:26 ` Keith Busch
2020-01-21 17:32 ` Nadolski, Edmund
2020-01-21 17:42 ` Keith Busch
2020-01-21 18:49 ` Nadolski, Edmund
2020-01-21 19:12 ` Keith Busch [this message]
2020-01-21 19:26 ` Nadolski, Edmund
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=20200121191234.GB4954@redsun51.ssa.fujisawa.hgst.com \
--to=kbusch@kernel.org \
--cc=edmund.nadolski@intel.com \
--cc=hch@lst.de \
--cc=linux-nvme@lists.infradead.org \
/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).