From: Jens Axboe <axboe@kernel.dk>
To: chengming.zhou@linux.dev, hch@lst.de, bvanassche@acm.org,
ming.lei@redhat.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
zhouchengming@bytedance.com, chuck.lever@oracle.com,
lkp@intel.com, kernel test robot <oliver.sang@intel.com>
Subject: Re: [PATCH] blk-mq: fix mismatch between IO scheduler insert and finish
Date: Sat, 19 Aug 2023 07:49:35 -0600 [thread overview]
Message-ID: <05ce0ba0-9c34-4da4-b8d0-e1b5a1c6c125@kernel.dk> (raw)
In-Reply-To: <20230819031206.2744005-1-chengming.zhou@linux.dev>
On 8/18/23 9:12 PM, chengming.zhou@linux.dev wrote:
> From: Chengming Zhou <zhouchengming@bytedance.com>
>
> IO scheduler has requirement that one request which has been inserted
> must call finish_request() only once.
>
> Now we have three special cases to consider:
> 1. rq has not insert, has complete: e.g. empty preflush
> 2. rq has insert, has not complete: e.g. merged requests will be freed
> 3. rq has insert, has twice complete: e.g. postflushes
>
> Note case 1 which existed before, has been no problem since all the
> schedulers will check in their finish_request() if the rq has been
> inserted or not, like checking "rq->elv.priv[0]".
>
> Then case 2 and case 3 are the introduced regression, we moved the
> scheduler finish_request() from free phase to complete phase to solve
> a deadlock problem. But it caused no finish_request() for request in
> case 2, and double finish_request() for request in case 3.
>
> So we still need finish_request() in blk_mq_free_request() to cover
> case 2. And clear RQF_USE_SCHED flag to avoid double finish_request().
> It should be fine since we're freeing the request now anyway.
>
> Of course, we can also make all schedulers' finish_request() to clear
> "rq->elv.priv[0]" to avoid double finish. Or clear it in blk-mq, make
> the rq like not inserted as case 1.
>
> FYI it's easy to reproduce warning in mq-deadline using this:
> ```
> DEV=sdb
> echo mq-deadline > /sys/block/$DEV/queue/scheduler
> mkfs.ext4 /dev/$DEV
> mount /dev/$DEV /mnt
> cd /mnt
> stress-ng --symlink 4 --timeout 60
> echo none > /sys/block/$DEV/queue/scheduler
> ```
>
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202308172100.8ce4b853-oliver.sang@intel.com
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
I folded in this one and added a link to it as well, final result is here:
https://git.kernel.dk/cgit/linux/commit/?h=block-6.5&id=e5c0ca13659e9d18f53368d651ed7e6e433ec1cf
I'll get this sent off today.
--
Jens Axboe
prev parent reply other threads:[~2023-08-19 13:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-19 3:12 [PATCH] blk-mq: fix mismatch between IO scheduler insert and finish chengming.zhou
2023-08-19 13:49 ` Jens Axboe [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=05ce0ba0-9c34-4da4-b8d0-e1b5a1c6c125@kernel.dk \
--to=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=chengming.zhou@linux.dev \
--cc=chuck.lever@oracle.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=ming.lei@redhat.com \
--cc=oliver.sang@intel.com \
--cc=zhouchengming@bytedance.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