From: Jens Axboe <axboe@kernel.dk>
To: Ming Lei <ming.lei@redhat.com>
Cc: linux-block@vger.kernel.org, Tejun Heo <tj@kernel.org>,
Bruno Goncalves <bgoncalv@redhat.com>
Subject: Re: [PATCH] blk-iocost: fix lockdep warning on blkcg->lock
Date: Tue, 3 Aug 2021 07:03:17 -0600 [thread overview]
Message-ID: <9846133f-dc48-f8e7-2dd0-cfb1ff9e538c@kernel.dk> (raw)
In-Reply-To: <d5b57c0b-4b2a-8ab6-e446-3353f0805fac@kernel.dk>
On 8/3/21 7:02 AM, Jens Axboe wrote:
> On 8/3/21 1:06 AM, Ming Lei wrote:
>> blkcg->lock depends on q->queue_lock which may depend on another driver
>> lock required in irq context, one example is dm-thin:
>>
>> Chain exists of:
>> &pool->lock#3 --> &q->queue_lock --> &blkcg->lock
>>
>> Possible interrupt unsafe locking scenario:
>>
>> CPU0 CPU1
>> ---- ----
>> lock(&blkcg->lock);
>> local_irq_disable();
>> lock(&pool->lock#3);
>> lock(&q->queue_lock);
>> <Interrupt>
>> lock(&pool->lock#3);
>>
>> Fix the issue by using spin_lock_irq(&blkcg->lock) in ioc_weight_write().
>
> This looks fine to me for blk-iocost, but block/blk-cgroup.c:blkg_create()
> also looks like it gets the IRQ state of the same lock wrong?
Ah, that one is under the queue lock, so irqs are already disabled.
--
Jens Axboe
next prev parent reply other threads:[~2021-08-03 13:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-03 7:06 [PATCH] blk-iocost: fix lockdep warning on blkcg->lock Ming Lei
2021-08-03 13:02 ` Jens Axboe
2021-08-03 13:03 ` Jens Axboe [this message]
2021-08-04 1:25 ` Ming Lei
2021-08-04 1:34 ` Jens Axboe
2021-08-09 22:40 ` Tejun Heo
2021-08-10 2: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=9846133f-dc48-f8e7-2dd0-cfb1ff9e538c@kernel.dk \
--to=axboe@kernel.dk \
--cc=bgoncalv@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=tj@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