From: Jens Axboe <axboe@fb.com>
To: Ming Lei <ming.lei@canonical.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] blk-mq: prevent unmapped hw queue from being scheduled
Date: Mon, 8 Dec 2014 21:39:22 -0700 [thread overview]
Message-ID: <54867CFA.8040304@fb.com> (raw)
In-Reply-To: <CACVXFVMzQ8TkxsiUujUZR0E=0Lx=BtZ2BsLmhCTHk8D9dr8rag@mail.gmail.com>
On 12/08/2014 05:41 PM, Ming Lei wrote:
> On Wed, Dec 3, 2014 at 7:38 PM, Ming Lei <ming.lei@canonical.com> wrote:
>> When one hardware queue has no mapped software queues, it
>> shouldn't have been scheduled. Otherwise WARNING or OOPS
>> can triggered.
>>
>> blk_mq_hw_queue_mapped() helper is introduce for fixing
>> the problem.
>>
>> Signed-off-by: Ming Lei <ming.lei@canonical.com>
>> ---
>> block/blk-mq.c | 8 ++++++--
>> block/blk-mq.h | 5 +++++
>> 2 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>> index c95abc6..c916ad0 100644
>> --- a/block/blk-mq.c
>> +++ b/block/blk-mq.c
>> @@ -599,7 +599,7 @@ static void blk_mq_rq_timer(unsigned long priv)
>> * If not software queues are currently mapped to this
>> * hardware queue, there's nothing to check
>> */
>> - if (!hctx->nr_ctx || !hctx->tags)
>> + if (!blk_mq_hw_queue_mapped(hctx))
>> continue;
>>
>> blk_mq_tag_busy_iter(hctx, blk_mq_check_expired, &data);
>> @@ -819,7 +819,8 @@ static int blk_mq_hctx_next_cpu(struct blk_mq_hw_ctx *hctx)
>>
>> void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)
>> {
>> - if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state)))
>> + if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state) ||
>> + !blk_mq_hw_queue_mapped(hctx)))
>> return;
>>
>> if (!async) {
>> @@ -926,6 +927,9 @@ static void blk_mq_delay_work_fn(struct work_struct *work)
>>
>> void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs)
>> {
>> + if (unlikely(!blk_mq_hw_queue_mapped(hctx)))
>> + return;
>> +
>> kblockd_schedule_delayed_work_on(blk_mq_hctx_next_cpu(hctx),
>> &hctx->delay_work, msecs_to_jiffies(msecs));
>> }
>> diff --git a/block/blk-mq.h b/block/blk-mq.h
>> index d567d52..206230e 100644
>> --- a/block/blk-mq.h
>> +++ b/block/blk-mq.h
>> @@ -115,4 +115,9 @@ static inline void blk_mq_set_alloc_data(struct blk_mq_alloc_data *data,
>> data->hctx = hctx;
>> }
>>
>> +static inline bool blk_mq_hw_queue_mapped(struct blk_mq_hw_ctx *hctx)
>> +{
>> + return hctx->nr_ctx && hctx->tags;
>> +}
>> +
>> #endif
>
> Gentle ping...
Picked up for 3.19, sorry for the delay. I'm curious how this queue gets
scheduled, though. My worry here would be that we are masking a bug that
should be fixed separately.
--
Jens Axboe
next prev parent reply other threads:[~2014-12-09 4:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-03 11:38 [PATCH] blk-mq: prevent unmapped hw queue from being scheduled Ming Lei
2014-12-09 0:41 ` Ming Lei
2014-12-09 4:39 ` Jens Axboe [this message]
2014-12-09 4:56 ` 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=54867CFA.8040304@fb.com \
--to=axboe@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@canonical.com \
/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