From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
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: Wed, 4 Aug 2021 09:25:39 +0800 [thread overview]
Message-ID: <YQnskyUwX+3icYyU@T590> (raw)
In-Reply-To: <d5b57c0b-4b2a-8ab6-e446-3353f0805fac@kernel.dk>
On Tue, Aug 03, 2021 at 07:02:28AM -0600, 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?
blkg_create() is called with irq disabled in all three callers:
blkg_lookup_create(), blkg_conf_prep() and blkcg_init_queue().
--
Ming
next prev parent reply other threads:[~2021-08-04 1:25 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
2021-08-04 1:25 ` Ming Lei [this message]
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=YQnskyUwX+3icYyU@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=bgoncalv@redhat.com \
--cc=linux-block@vger.kernel.org \
--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