From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@lst.de>, Robert Elliott <Elliott@hp.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] blk-mq: Avoid that I/O hangs in bt_get()
Date: Mon, 08 Dec 2014 18:59:08 +0100 [thread overview]
Message-ID: <5485E6EC.3030501@acm.org> (raw)
In-Reply-To: <5485D6B0.3060901@kernel.dk>
On 12/08/14 17:49, Jens Axboe wrote:
> On 12/08/2014 07:55 AM, Bart Van Assche wrote:
>> diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
>> index 67ab88b..e88af88 100644
>> --- a/block/blk-mq-tag.c
>> +++ b/block/blk-mq-tag.c
>> @@ -256,6 +256,8 @@ static int bt_get(struct blk_mq_alloc_data *data,
>> break;
>> }
>>
>> + blk_mq_run_hw_queue(hctx, false);
>> +
>> blk_mq_put_ctx(data->ctx);
>>
>> io_schedule();
>
> Ah yes, that could be an issue for some cases, we do need to run the
> queue there. For a tag map shared across hardware queues, we might need
> to run more than just the current queue, however. For now we can safely
> assume that we allocate fairly, so it should not be an issue.
>
> It might be worth experimenting with doing a __bt_get() after the queue
> run before going to sleep, in case the queue run found completions as well.
Unless anyone objects I will start testing the following patch:
[PATCH] blk-mq: Fix bt_get() hang
Avoid that if there are fewer hardware queues than CPU threads that
bt_get() can hang. The symptoms of the hang were as follows:
* All tags allocated for a particular hardware queue.
* (nr_tags) pending commands for that hardware queue.
* No pending commands for the software queues associated with that
hardware queue.
The call stack that corresponds to the hang is as follows:
io_schedule+0x9c/0x130
bt_get+0xef/0x180
blk_mq_get_tag+0x9f/0xd0
__blk_mq_alloc_request+0x16/0x1f0
blk_mq_map_request+0x123/0x130
blk_mq_make_request+0x69/0x280
generic_make_request+0xc0/0x110
submit_bio+0x64/0x130
do_blockdev_direct_IO+0x1dc8/0x2da0
__blockdev_direct_IO+0x47/0x50
blkdev_direct_IO+0x49/0x50
generic_file_read_iter+0x546/0x610
blkdev_read_iter+0x32/0x40
aio_run_iocb+0x1f8/0x400
do_io_submit+0x121/0x490
SyS_io_submit+0xb/0x10
system_call_fastpath+0x12/0x17
---
block/blk-mq-tag.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index c22491e..14ab120 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -256,6 +256,12 @@ static int bt_get(struct blk_mq_alloc_data *data,
if (tag != -1)
break;
+ blk_mq_run_hw_queue(hctx, false);
+
+ tag = __bt_get(hctx, bt, last_tag);
+ if (tag != -1)
+ break;
+
blk_mq_put_ctx(data->ctx);
io_schedule();
--
2.1.2
prev parent reply other threads:[~2014-12-08 17:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-06 12:27 Bart Van Assche
2014-10-06 17:40 ` Jens Axboe
2014-10-06 18:53 ` Jens Axboe
2014-10-07 8:46 ` Bart Van Assche
2014-10-07 14:44 ` Jens Axboe
2014-11-06 13:41 ` Bart Van Assche
2014-12-08 14:55 ` Bart Van Assche
2014-12-08 16:49 ` Jens Axboe
2014-12-08 17:59 ` Bart Van Assche [this message]
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=5485E6EC.3030501@acm.org \
--to=bvanassche@acm.org \
--cc=Elliott@hp.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome