All of lore.kernel.org
 help / color / mirror / Atom feed
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 19:34:03 -0600	[thread overview]
Message-ID: <fefbae5d-18ed-2150-8dc6-a3e271a49c5f@kernel.dk> (raw)
In-Reply-To: <YQnskyUwX+3icYyU@T590>

On 8/3/21 7:25 PM, Ming Lei wrote:
> 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().

Yes I know, see email sent 1 min after the one you're replying to.

-- 
Jens Axboe


  reply	other threads:[~2021-08-04  1:34 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
2021-08-04  1:34     ` Jens Axboe [this message]
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=fefbae5d-18ed-2150-8dc6-a3e271a49c5f@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 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.