From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "hch@lst.de" <hch@lst.de>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"keith.busch@intel.com" <keith.busch@intel.com>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"axboe@fb.com" <axboe@fb.com>,
"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "marc@merlins.org" <marc@merlins.org>
Subject: Re: [PATCH 5/6] blk-mq: Fix queue freeze deadlock
Date: Thu, 5 Jan 2017 07:33:22 +0000 [thread overview]
Message-ID: <1483601585.2811.5.camel@sandisk.com> (raw)
In-Reply-To: <1483569671-1462-6-git-send-email-keith.busch@intel.com>
On Wed, 2017-01-04 at 17:41 -0500, Keith Busch wrote:
> +static void blk_mq_abandon_stopped_requests(struct request_queue *q)
> +{
> + int i;
> + struct request *rq, *next;
> + struct blk_mq_hw_ctx *hctx;
> + LIST_HEAD(rq_list);
> +
> + blk_mq_sync_queue(q);
> +
> + spin_lock(&q->requeue_lock);
> + list_for_each_entry_safe(rq, next, &q->requeue_list, queuelist) {
> + struct blk_mq_ctx *ctx;
> +
> + ctx =3D rq->mq_ctx;
> + hctx =3D blk_mq_map_queue(q, ctx->cpu);
> + if (blk_mq_hctx_stopped(hctx)) {
> + list_del_init(&rq->queuelist);
> +
> + spin_lock(&hctx->lock);
> + list_add_tail(&rq->queuelist, &rq_list);
> + spin_unlock(&hctx->lock);
> + }
> + }
> +
> + queue_for_each_hw_ctx(q, hctx, i) {
> + if (!blk_mq_hctx_stopped(hctx))
> + continue;
> +
> + flush_busy_ctxs(hctx, &rq_list);
> +
> + spin_lock(&hctx->lock);
> + if (!list_empty(&hctx->dispatch))
> + list_splice_init(&hctx->dispatch, &rq_list);
> + spin_unlock(&hctx->lock);
> + }
> + spin_unlock(&q->requeue_lock);
> +
> + while (!list_empty(&rq_list)) {
> + rq =3D list_first_entry(&rq_list, struct request, queuelist);
> + list_del_init(&rq->queuelist);
> + rq->errors =3D -EAGAIN;
> + blk_mq_end_request(rq, rq->errors);
> + }
> +}
Hello Keith,
This patch adds a second code path to the blk-mq core for running queues an=
d
hence will make the blk-mq core harder to maintain. Have you considered to
implement this functionality by introducing a new "fail all requests" flag
for hctx queues such that blk_mq_abandon_stopped_requests() can reuse the
existing mechanism for running a queue?
Bart.
WARNING: multiple messages have this Message-ID (diff)
From: Bart.VanAssche@sandisk.com (Bart Van Assche)
Subject: [PATCH 5/6] blk-mq: Fix queue freeze deadlock
Date: Thu, 5 Jan 2017 07:33:22 +0000 [thread overview]
Message-ID: <1483601585.2811.5.camel@sandisk.com> (raw)
In-Reply-To: <1483569671-1462-6-git-send-email-keith.busch@intel.com>
On Wed, 2017-01-04@17:41 -0500, Keith Busch wrote:
> +static void blk_mq_abandon_stopped_requests(struct request_queue *q)
> +{
> + int i;
> + struct request *rq, *next;
> + struct blk_mq_hw_ctx *hctx;
> + LIST_HEAD(rq_list);
> +
> + blk_mq_sync_queue(q);
> +
> + spin_lock(&q->requeue_lock);
> + list_for_each_entry_safe(rq, next, &q->requeue_list, queuelist) {
> + struct blk_mq_ctx *ctx;
> +
> + ctx = rq->mq_ctx;
> + hctx = blk_mq_map_queue(q, ctx->cpu);
> + if (blk_mq_hctx_stopped(hctx)) {
> + list_del_init(&rq->queuelist);
> +
> + spin_lock(&hctx->lock);
> + list_add_tail(&rq->queuelist, &rq_list);
> + spin_unlock(&hctx->lock);
> + }
> + }
> +
> + queue_for_each_hw_ctx(q, hctx, i) {
> + if (!blk_mq_hctx_stopped(hctx))
> + continue;
> +
> + flush_busy_ctxs(hctx, &rq_list);
> +
> + spin_lock(&hctx->lock);
> + if (!list_empty(&hctx->dispatch))
> + list_splice_init(&hctx->dispatch, &rq_list);
> + spin_unlock(&hctx->lock);
> + }
> + spin_unlock(&q->requeue_lock);
> +
> + while (!list_empty(&rq_list)) {
> + rq = list_first_entry(&rq_list, struct request, queuelist);
> + list_del_init(&rq->queuelist);
> + rq->errors = -EAGAIN;
> + blk_mq_end_request(rq, rq->errors);
> + }
> +}
Hello Keith,
This patch adds a second code path to the blk-mq core for running queues and
hence will make the blk-mq core harder to maintain. Have you considered to
implement this functionality by introducing a new "fail all requests" flag
for hctx queues such that blk_mq_abandon_stopped_requests() can reuse the
existing mechanism for running a queue?
Bart.
next prev parent reply other threads:[~2017-01-05 7:33 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-04 22:41 [PATCH 0/6] NVMe related fixes Keith Busch
2017-01-04 22:41 ` Keith Busch
2017-01-04 22:41 ` [PATCH 1/6] irq/affinity: Assign all online CPUs to vectors Keith Busch
2017-01-04 22:41 ` Keith Busch
2017-01-13 20:21 ` Sagi Grimberg
2017-01-13 20:21 ` Sagi Grimberg
2017-01-23 18:30 ` Christoph Hellwig
2017-01-23 18:30 ` Christoph Hellwig
2017-01-04 22:41 ` [PATCH 2/6] irq/affinity: Assign offline CPUs a vector Keith Busch
2017-01-04 22:41 ` Keith Busch
2017-01-08 10:01 ` Christoph Hellwig
2017-01-08 10:01 ` Christoph Hellwig
2017-01-13 20:26 ` Sagi Grimberg
2017-01-13 20:26 ` Sagi Grimberg
2017-01-04 22:41 ` [PATCH 3/6] nvme/pci: Start queues after tagset is updated Keith Busch
2017-01-04 22:41 ` Keith Busch
2017-01-13 20:38 ` Sagi Grimberg
2017-01-13 20:38 ` Sagi Grimberg
2017-01-23 18:31 ` Christoph Hellwig
2017-01-23 18:31 ` Christoph Hellwig
2017-01-04 22:41 ` [PATCH 4/6] blk-mq: Update queue map when changing queue count Keith Busch
2017-01-04 22:41 ` Keith Busch
2017-01-13 20:39 ` Sagi Grimberg
2017-01-13 20:39 ` Sagi Grimberg
2017-01-23 18:32 ` Christoph Hellwig
2017-01-23 18:32 ` Christoph Hellwig
2017-01-04 22:41 ` [PATCH 5/6] blk-mq: Fix queue freeze deadlock Keith Busch
2017-01-04 22:41 ` Keith Busch
2017-01-05 7:33 ` Bart Van Assche [this message]
2017-01-05 7:33 ` Bart Van Assche
2017-01-17 17:53 ` Keith Busch
2017-01-17 17:53 ` Keith Busch
2017-01-13 21:05 ` Sagi Grimberg
2017-01-13 21:05 ` Sagi Grimberg
2017-01-17 18:00 ` Keith Busch
2017-01-17 18:00 ` Keith Busch
2017-01-19 7:54 ` Sagi Grimberg
2017-01-19 7:54 ` Sagi Grimberg
2017-01-04 22:41 ` [PATCH 6/6] blk-mq: Remove unused variable Keith Busch
2017-01-04 22:41 ` Keith Busch
2017-01-08 10:02 ` Christoph Hellwig
2017-01-08 10:02 ` Christoph Hellwig
2017-01-13 21:05 ` Sagi Grimberg
2017-01-13 21:05 ` Sagi Grimberg
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=1483601585.2811.5.camel@sandisk.com \
--to=bart.vanassche@sandisk.com \
--cc=axboe@fb.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=keith.busch@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=marc@merlins.org \
--cc=tglx@linutronix.de \
/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.