lkml.org 
[lkml]   [2022]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm: slub: fix a deadlock warning in kmem_cache_destroy
On 2022-01-17 16:32:46 [+0800], Xin Long wrote:
> another issue. From the code analysis, this issue does exist on the
> upstream kernel, though I couldn't build an upstream RT kernel for the
> testing.

This should also reproduce in v5.16 since the commit in question is
there.

> > > CPU0 CPU1
> > > ---- ----
> > > cpus_read_lock()
> > > kn->active++
> > > cpus_read_lock() [a]
> > > wait until kn->active == 0
> > >
> > > Although cpu_hotplug_lock is a RWSEM, [a] will not block in there. But as
> > > lockdep annotations are added for cpu_hotplug_lock, a deadlock warning
> > > would be detected:

The cpu_hotplug_lock is a per-CPU RWSEM. The lock in [a] will block if
there is a writer pending.

> > > ======================================================
> > > WARNING: possible circular locking dependency detected
> > > ------------------------------------------------------
> > > dmsetup/1832 is trying to acquire lock:
> > > ffff986f5a0f9f20 (kn->count#144){++++}-{0:0}, at: kernfs_remove+0x1d/0x30
> > >
> > > but task is already holding lock:
> > > ffffffffa43817c0 (slab_mutex){+.+.}-{3:3}, at: kmem_cache_destroy+0x2a/0x120
> > >

I tried to create & destroy a cryptarget which creates/destroy a cache
via bio_put_slab(). Either the callchain is different or something else
is but I didn't see a lockdep warning.

Sebastian

\
 
 \ /
  Last update: 2022-01-17 10:35    [W:0.165 / U:1.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site