From: Bart Van Assche <bvanassche@acm.org>
To: "jianchao.wang" <jianchao.w.wang@oracle.com>,
Keith Busch <keith.busch@intel.com>,
Linux Block <linux-block@vger.kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH] blk-mq: Allow blocking queue tag iter callbacks
Date: Mon, 24 Sep 2018 19:20:54 -0700 [thread overview]
Message-ID: <fc9d3a15-b136-478c-c35f-74a9a3479fb7@acm.org> (raw)
In-Reply-To: <45fc0cf9-92b2-2380-d11b-428613a470c2@oracle.com>
On 9/24/18 7:11 PM, jianchao.wang wrote:
> Hi Keith
>
> On 09/25/2018 05:09 AM, Keith Busch wrote:
>> - /* A deadlock might occur if a request is stuck requiring a
>> - * timeout at the same time a queue freeze is waiting
>> - * completion, since the timeout code would not be able to
>> - * acquire the queue reference here.
>> - *
>> - * That's why we don't use blk_queue_enter here; instead, we use
>> - * percpu_ref_tryget directly, because we need to be able to
>> - * obtain a reference even in the short window between the queue
>> - * starting to freeze, by dropping the first reference in
>> - * blk_freeze_queue_start, and the moment the last request is
>> - * consumed, marked by the instant q_usage_counter reaches
>> - * zero.
>> - */
>> - if (!percpu_ref_tryget(&q->q_usage_counter))
>> + if (!blk_mq_queue_tag_busy_iter(q, blk_mq_check_expired, &next))
>> return;
>
> We cannot discard the percpu_ref_tryget here.
>
> There following code in blk_mq_timeout_work still need it:
>
> if (next != 0) {
> mod_timer(&q->timeout, next);
> } else {
> queue_for_each_hw_ctx(q, hctx, i) {
> /* the hctx may be unmapped, so check it here */
> if (blk_mq_hw_queue_mapped(hctx))
> blk_mq_tag_idle(hctx);
> }
> }
Hi Jianchao,
Had you noticed that the percpu_ref_tryget() call has been moved into
blk_mq_queue_tag_busy_iter()?
Bart.
next prev parent reply other threads:[~2018-09-25 2:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-24 21:09 [PATCH] blk-mq: Allow blocking queue tag iter callbacks Keith Busch
2018-09-25 2:11 ` jianchao.wang
2018-09-25 2:20 ` Bart Van Assche [this message]
2018-09-25 2:39 ` jianchao.wang
2018-09-25 14:39 ` Keith Busch
2018-09-25 15:14 ` Bart Van Assche
2018-09-25 15:47 ` 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=fc9d3a15-b136-478c-c35f-74a9a3479fb7@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=jianchao.w.wang@oracle.com \
--cc=keith.busch@intel.com \
--cc=linux-block@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;
as well as URLs for NNTP newsgroup(s).