Re: [PATCH v5 18/22] kho: extend scratch

Pratyush Yadav <[email protected]> Thu, 30 Jul 2026 13:48:36 +0200
Newsgroups org.infradead.lists.kexec,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On Thu, Jul 30 2026, Mike Rapoport wrote:

>> +static void __init kho_extend_scratch(void)
>> +{
>> +	const struct kho_radix_walk_cb kho_cb = {
>> +		.leaf = kho_ext_walk_leaf,
>> +		.node = kho_ext_walk_node,
>> +	};
>> +	const struct kho_radix_walk_cb ext_cb = {
>> +		.leaf = kho_ext_mark_scratch,
>> +	};
>> +	struct kho_radix_tree radix;
>> +	phys_addr_t prev_end = 0;
>> +	int err = 0;
>> +
>> +	err = kho_radix_init_tree(&radix, NULL);
>> +	if (err)
>> +		goto print;
>> +
>> +	/* Walk the KHO radix tree to find busy blocks. */
>> +	err = kho_radix_walk_tree(&kho_in.radix_tree, &kho_cb, &radix);
>
> sashiko: Will this trigger a lockdep recursive locking warning?
>
> I think it will.

It does indeed, but that's a false positive. These are different trees
and so they have different mutexes. So I ignored this when sending the
v5.

But now that you also point it out, I went and did some digging. And I
think I know how to fix this. Setting a different lockdep class for the
local tree makes the warning go away. And from my sampling of other
users of lockdep_set_class(), this does seem to be right right usage of
the API, though I can't find much documentation on it.

While trying to explain in a comment why this is needed, I also realized
"radix" is not a descriptive name at all, and I renamed it to
"busy_blocks".

I'll send a v6 shortly with these changes.

-- 
Regards,
Pratyush Yadav