Linux block layer
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Jens Axboe <axboe@fb.com>,
	axboe@kernel.dk, linux-block@vger.kernel.org, jbacik@fb.com
Subject: Re: [PATCH 0/2]: Add option for async ->queue_rq
Date: Wed, 28 Sep 2016 09:43:18 -0700	[thread overview]
Message-ID: <20160928164318.GA31729@vader> (raw)
In-Reply-To: <acf43ae6-76d5-8dca-548a-30f16d0e0928@sandisk.com>

On Tue, Sep 27, 2016 at 05:25:36PM -0700, Bart Van Assche wrote:
> On 09/22/16 07:52, Jens Axboe wrote:
> > Two patches that add the ability for a driver to flag itself
> > as wanting the ->queue_rq() invoked in a manner that allows
> > it to block. We'll need that for the nbd conversion, to avoid
> > having to add workqueue offload. We can use this in the current
> > loop mq path as well.
> 
> Hello Jens,
> 
> How can this work since there is code that calls blk_mq_run_hw_queue() with
> a spin lock held? From mq_flush_data_end_io():
> 
> 	spin_lock_irqsave(&fq->mq_flush_lock, flags);
> 	if (blk_flush_complete_seq(rq, fq, REQ_FSEQ_DATA, error))
> 		blk_mq_run_hw_queue(hctx, true);
> 	spin_unlock_irqrestore(&fq->mq_flush_lock, flags);
> 
> Sorry that I hadn't noticed this before.
> 
> Bart.

Hey, Bart,

In this particular case, we're passing async=true to
blk_mq_run_hw_queue(), so we do

	kblockd_schedule_delayed_work_on(blk_mq_hctx_next_cpu(hctx),
			&hctx->run_work, 0);

So ->queue_rq() is being called from a worker thread, not by the calling
thread. Jens' patch 2 makes it so that a driver can request that the
behavior is always as if async were true.

-- 
Omar

      reply	other threads:[~2016-09-28 16:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 14:52 [PATCH 0/2]: Add option for async ->queue_rq Jens Axboe
2016-09-22 14:52 ` [PATCH 1/2] blk-mq: get rid of manual run of queue with __blk_mq_run_hw_queue() Jens Axboe
2016-09-22 14:56   ` Christoph Hellwig
2016-09-22 18:56   ` Christoph Hellwig
2016-09-22 20:29     ` Jens Axboe
2016-09-23 21:59     ` Sagi Grimberg
2016-09-23 21:56   ` Sagi Grimberg
2016-09-22 14:53 ` [PATCH 2/2] blk-mq: add flag for drivers wanting blocking ->queue_rq() Jens Axboe
2016-09-22 14:59   ` Christoph Hellwig
2016-09-22 15:03     ` Jens Axboe
2016-09-22 15:12       ` Christoph Hellwig
2016-09-22 15:17         ` Jens Axboe
2016-09-23  1:43           ` Ming Lei
2016-09-23  2:44             ` Josef Bacik
2016-09-23  1:35         ` Ming Lei
2016-09-22 15:04     ` Josef Bacik
2016-09-22 18:01 ` [PATCH 0/2]: Add option for async ->queue_rq Josef Bacik
2016-09-28  0:25 ` Bart Van Assche
2016-09-28 16:43   ` Omar Sandoval [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=20160928164318.GA31729@vader \
    --to=osandov@osandov.com \
    --cc=axboe@fb.com \
    --cc=axboe@kernel.dk \
    --cc=bart.vanassche@sandisk.com \
    --cc=jbacik@fb.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