public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Jens Axboe" <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ming Lei <ming.lei@redhat.com>
Subject: Re: [RFC PATCH] block: Make request_queue lockdep splats show up earlier
Date: Mon, 17 Mar 2025 11:28:09 -0700	[thread overview]
Message-ID: <5b81f4be-427f-4083-8cbe-e201d0f255c5@acm.org> (raw)
In-Reply-To: <13031d34692b0c97799de81c0b83875d56076e13.camel@linux.intel.com>

On 3/17/25 11:13 AM, Thomas Hellström wrote:
> On Mon, 2025-03-17 at 10:37 -0700, Bart Van Assche wrote:
>> On 3/17/25 10:11 AM, Thomas Hellström wrote:
>>> diff --git a/block/blk-core.c b/block/blk-core.c
>>> index d6c4fa3943b5..4aa439309406 100644
>>> --- a/block/blk-core.c
>>> +++ b/block/blk-core.c
>>> @@ -455,6 +455,12 @@ struct request_queue *blk_alloc_queue(struct
>>> queue_limits *lim, int node_id)
>>>    	lockdep_init_map(&q->q_lockdep_map, "&q-
>>>> q_usage_counter(queue)",
>>>    			 &q->q_lock_cls_key, 0);
>>>    
>>> +	/* Prime io_lockdep_map as reclaim tainted */
>>> +	fs_reclaim_acquire(GFP_KERNEL);
>>> +	rwsem_acquire_read(&q->io_lockdep_map, 0, 0, _RET_IP_);
>>> +	rwsem_release(&q->io_lockdep_map, _RET_IP_);
>>> +	fs_reclaim_release(GFP_KERNEL);
>>> +
>>>    	q->nr_requests = BLKDEV_DEFAULT_RQ;
>>>    
>>>    	return q;
>>
>> Hmm ... my understanding is that it is fine if FS code calls block
>> layer
>> code but also that block layer code never should call FS code.
> 
> That added code only mimics the locking sequence that happens during
> reclaim with the existing code to register the locking order expected
> by the reclaim code. If anything violates that, lockdep splat [2] will
> appear.
> 
> So I'm not quite following your comment?
Shouldn't the above code be added in the VFS code rather than in the
block layer?

Thanks,

Bart.

  reply	other threads:[~2025-03-17 18:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17 17:11 [RFC PATCH] block: Make request_queue lockdep splats show up earlier Thomas Hellström
2025-03-17 17:37 ` Bart Van Assche
2025-03-17 18:13   ` Thomas Hellström
2025-03-17 18:28     ` Bart Van Assche [this message]
2025-03-17 18:38       ` Thomas Hellström
2025-03-18  1:18 ` Ming Lei
2025-03-18  7:56   ` Thomas Hellström
2025-03-18  8:10     ` Ming Lei

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=5b81f4be-427f-4083-8cbe-e201d0f255c5@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=thomas.hellstrom@linux.intel.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