All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Damien Le Moal <damien.lemoal@wdc.com>
Cc: stable@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH] block: mq-deadline: Fix queue restart handling
Date: Sat, 5 Oct 2019 20:01:30 -0400	[thread overview]
Message-ID: <20191006000130.GE25255@sasha-vm> (raw)
In-Reply-To: <20191005030318.3786-1-damien.lemoal@wdc.com>

On Sat, Oct 05, 2019 at 12:03:18PM +0900, Damien Le Moal wrote:
>[ Upstream commit cb8acabbe33b110157955a7425ee876fb81e6bbc ]
>
>Commit 7211aef86f79 ("block: mq-deadline: Fix write completion
>handling") added a call to blk_mq_sched_mark_restart_hctx() in
>dd_dispatch_request() to make sure that write request dispatching does
>not stall when all target zones are locked. This fix left a subtle race
>when a write completion happens during a dispatch execution on another
>CPU:
>
>CPU 0: Dispatch			CPU1: write completion
>
>dd_dispatch_request()
>    lock(&dd->lock);
>    ...
>    lock(&dd->zone_lock);	dd_finish_request()
>    rq = find request		lock(&dd->zone_lock);
>    unlock(&dd->zone_lock);
>    				zone write unlock
>				unlock(&dd->zone_lock);
>				...
>				__blk_mq_free_request
>                                      check restart flag (not set)
>				      -> queue not run
>    ...
>    if (!rq && have writes)
>        blk_mq_sched_mark_restart_hctx()
>    unlock(&dd->lock)
>
>Since the dispatch context finishes after the write request completion
>handling, marking the queue as needing a restart is not seen from
>__blk_mq_free_request() and blk_mq_sched_restart() not executed leading
>to the dispatch stall under 100% write workloads.
>
>Fix this by moving the call to blk_mq_sched_mark_restart_hctx() from
>dd_dispatch_request() into dd_finish_request() under the zone lock to
>ensure full mutual exclusion between write request dispatch selection
>and zone unlock on write request completion.
>
>Fixes: 7211aef86f79 ("block: mq-deadline: Fix write completion handling")
>Cc: stable@vger.kernel.org
>Reported-by: Hans Holmberg <Hans.Holmberg@wdc.com>
>Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
>Reviewed-by: Christoph Hellwig <hch@lst.de>
>Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
>Signed-off-by: Jens Axboe <axboe@kernel.dk>

I've queued it up for 4.19, thanks!

-- 
Thanks,
Sasha

  reply	other threads:[~2019-10-06  0:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-05  3:03 [PATCH] block: mq-deadline: Fix queue restart handling Damien Le Moal
2019-10-06  0:01 ` Sasha Levin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-08-28  4:40 Damien Le Moal
2019-08-28  7:41 ` Hans Holmberg
2019-08-28 15:04 ` Sasha Levin
2019-09-03  9:05 ` Christoph Hellwig
2019-09-03 14:00 ` Jens Axboe

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=20191006000130.GE25255@sasha-vm \
    --to=sashal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@wdc.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=stable@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 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.