From: "jianchao.wang" <jianchao.w.wang@oracle.com>
To: Bart Van Assche <Bart.VanAssche@wdc.com>,
"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH] blk-mq: use mutex_trylock to avoid lock inversion
Date: Thu, 21 Jun 2018 16:23:58 +0800 [thread overview]
Message-ID: <2a1dda06-5c7c-b75b-c1ae-75d1a2a49694@oracle.com> (raw)
In-Reply-To: <2c2003ff1baac05688495677f67239d52f6d9527.camel@wdc.com>
Hi Bart
On 06/21/2018 12:18 AM, Bart Van Assche wrote:
> On Wed, 2018-06-20 at 10:09 +0800, jianchao.wang wrote:
>> It is very easy to reproduce with following scripts.
>>
>> script 0
>> while true
>> do
>> modprobe null_blk queue_mode=2 shared_tags=1
>> sleep 0.1
>> rmmod null_blk
>> sleep 0.1
>> done
>>
>> script 1
>> file0="/sys/block/nullb0/mq/0/nr_tags"
>> file1="/sys/block/nullb0/mq/0/cpu0/rq_list"
>> while true;
>> do
>> if [ -e $file0 ];then
>> cat $file0
>> fi
>> if [ -e $file1 ];then
>> cat $file1
>> fi
>> done
>
> Hello Jianchao,
>
> Thanks for having shared a reproducer. However, the approach of the patch you
> posted doesn't seem like the right approach to me. I propose to proceed as
> follows:
> * Convert the reproducer into a blktests test and submit is as a patch to the
> blktests project (https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_osandov_blktests&d=DwIGaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=7WdAxUBeiTUTCy8v-7zXyr4qk7sx26ATvfo6QSTvZyQ&m=_TjwODcX-0o-OZfrVTFMpvbS0QbYxoya17aHM9pZAXw&s=wdVpTkE6PJX3GXvjXNwEup3opdflyCGY324CAYXSixY&e=).
> * Remove the mutex_lock/unlock(&sysfs_lock) calls from blk_cleanup_queue().
> These calls are useless. Block drivers are required to call del_gendisk()
> before calling blk_cleanup_queue(). That means that sysfs attributes are
> removed synchronously before blk_cleanup_queue() is called. The following
> statement in blk_cleanup_queue() verifies that:
> WARN_ON_ONCE(q->kobj.state_in_sysfs);
> BTW, this also means that the blk_queue_dying() checks in various show and
> store methods are superfluous.
> * Introduce a new mutex to serialize blk_mq_register_dev() and
> blk_mq_sysfs_register() and blk_mq_sysfs_unregister(). I think it is wrong
> that these functions use sysfs_mutex.
> * Document the purpose of sysfs_mutex in include/linux/blkdev.h, namely to
> serialize the sysfs .show() and .store() callback functions and also to
> serialize elevator changes.
>
Really appreciate your kindly and detailed directive.
I will post the V2 version based on your suggestions later.
Thanks
Jianchao
>
>
>
next prev parent reply other threads:[~2018-06-21 8:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-19 7:00 [PATCH] blk-mq: use mutex_trylock to avoid lock inversion Jianchao Wang
2018-06-19 15:20 ` Bart Van Assche
2018-06-20 2:09 ` jianchao.wang
2018-06-20 16:18 ` Bart Van Assche
2018-06-21 8:23 ` jianchao.wang [this message]
2018-06-26 3:46 ` jianchao.wang
2018-06-26 15:36 ` Bart Van Assche
2018-06-28 1:11 ` jianchao.wang
2018-06-28 1:15 ` jianchao.wang
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=2a1dda06-5c7c-b75b-c1ae-75d1a2a49694@oracle.com \
--to=jianchao.w.wang@oracle.com \
--cc=Bart.VanAssche@wdc.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@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