Re: [BUG] -next lockdep invalid wait context
From: Vlastimil Babka
Date: Tue Nov 05 2024 - 04:37:19 EST
On 11/4/24 19:08, Tejun Heo wrote:
> Hello,
>
> On Fri, Nov 01, 2024 at 05:45:01PM -0700, Boqun Feng wrote:
> ...
>> Because it's a different bug.
>>
>> schedule():
>> __schedule():
>> rq_lock(); // <- rq lock is a raw spin lock, so no sleep inside
>> switch_mm_irqs_off():
>> trace_tlb_flush():
>> bpf_trace_run2():
>> stack_map_get_build_id_offset():
>> mmap_read_trylock(): // this is actually ok, because
>> // trylock() on rwsem won't
>> // sleep.
>> __mmap_lock_trace_acquire_returned():
>> get_mm_memcg_path():
>> cgroup_path():
>> kernfs_path_from_node():
>> read_lock_irqsave(); // on RT, read_lock()
>> // is a rwsem IIUC,
>> // so might sleep.
>> // hence the issue.
>>
>> Maybe kernfs can use RCU instead of read_lock here? I don't know...
>
> Yeah, we should be able to make kn->name RCU protected and drop the usage of
> the rename lock in read paths.
For the purposes of the get_mm_memcg_path() usage for tracepoints, it would
be also sufficient to have a trylock variant. If the lock cannot be
acquired, the trace event will omit the memcg detail, which is documented as
a possibility already.
> Thanks.
>