From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Xin Long <lucien.xin@gmail.com>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm@kvack.org, Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@suse.cz>,
Antoine Tenart <atenart@kernel.org>
Subject: Re: [PATCH] mm: slub: fix a deadlock warning in kmem_cache_destroy
Date: Mon, 17 Jan 2022 10:33:59 +0100 [thread overview]
Message-ID: <YeU4B46F+oFUBRLE@linutronix.de> (raw)
In-Reply-To: <CADvbK_eY=3Gf79MkvK72Nh86ysN4eoFei0k1jg0frg22GgToGA@mail.gmail.com>
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
next prev parent reply other threads:[~2022-01-17 9:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-14 14:23 [PATCH] mm: slub: fix a deadlock warning in kmem_cache_destroy Xin Long
2022-01-16 6:35 ` Hyeonggon Yoo
2022-01-17 8:32 ` Xin Long
2022-01-17 9:33 ` Sebastian Andrzej Siewior [this message]
2022-01-17 12:40 ` Vlastimil Babka
2022-01-17 13:13 ` Juri Lelli
2022-01-18 8:00 ` Xin Long
2022-01-18 11:07 ` Vlastimil Babka
2022-01-19 8:38 ` Xin Long
2022-06-01 14:36 ` Maurizio Lombardi
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=YeU4B46F+oFUBRLE@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=atenart@kernel.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lucien.xin@gmail.com \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
/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;
as well as URLs for NNTP newsgroup(s).