From: Boqun Feng <boqun.feng@gmail.com>
To: Hillf Danton <hdanton@sina.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
"Paul E. McKenney" <paulmck@kernel.org>,
Marco Elver <elver@google.com>,
linux-kernel@vger.kernel.org, tj@kernel.org,
gregkh@linuxfoundation.org
Subject: Re: [BUG] -next lockdep invalid wait context
Date: Fri, 1 Nov 2024 17:45:01 -0700 [thread overview]
Message-ID: <ZyV2DfuIPsISds-1@Boquns-Mac-mini.local> (raw)
In-Reply-To: <20241102001224.2789-1-hdanton@sina.com>
On Sat, Nov 02, 2024 at 08:12:24AM +0800, Hillf Danton wrote:
> On Thu, 31 Oct 2024 08:21:36 +0100 Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > On 2024-10-30 16:10:58 [-0700], Paul E. McKenney wrote:
> > >
> > > So I need to avoid calling kfree() within an smp_call_function() handler?
> >
> > Yes. No kmalloc()/ kfree() in IRQ context.
> >
> Another splat [1] with no link to kmalloc()/ kfree().
>
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...
Regards,
Boqun
> [ BUG: Invalid wait context ]
> 6.12.0-rc5-next-20241031-syzkaller #0 Not tainted
> -----------------------------
> strace-static-x/5846 is trying to lock:
> ffffffff8eac8698 (kernfs_rename_lock){....}-{3:3}, at: kernfs_path_from_node+0x92/0xb00 fs/kernfs/dir.c:229
> other info that might help us debug this:
> context-{5:5}
> 3 locks held by strace-static-x/5846:
> #0: ffff8880b873e598 (&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0x2a/0x140 kernel/sched/core.c:598
> #1: ffffffff8e939f20 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:337 [inline]
> #1: ffffffff8e939f20 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
> #1: ffffffff8e939f20 (rcu_read_lock){....}-{1:3}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2339 [inline]
> #1: ffffffff8e939f20 (rcu_read_lock){....}-{1:3}, at: bpf_trace_run2+0x1fc/0x540 kernel/trace/bpf_trace.c:2381
> #2: ffff88802f7129e0 (&mm->mmap_lock){++++}-{4:4}, at: mmap_read_trylock include/linux/mmap_lock.h:208 [inline]
> #2: ffff88802f7129e0 (&mm->mmap_lock){++++}-{4:4}, at: stack_map_get_build_id_offset+0x431/0x870 kernel/bpf/stackmap.c:157
>
> [1] Subject: [syzbot] [kernfs?] WARNING: locking bug in kernfs_path_from_node
> https://lore.kernel.org/lkml/67251dc6.050a0220.529b6.015e.GAE@google.com/
next prev parent reply other threads:[~2024-11-02 0:45 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-30 21:05 Paul E. McKenney
2024-10-30 21:48 ` Vlastimil Babka
2024-10-30 22:34 ` Marco Elver
2024-10-30 23:04 ` Boqun Feng
2024-10-30 23:10 ` Paul E. McKenney
2024-10-31 7:21 ` Sebastian Andrzej Siewior
2024-10-31 7:35 ` Vlastimil Babka
2024-10-31 7:55 ` Sebastian Andrzej Siewior
2024-10-31 8:18 ` Vlastimil Babka
2024-11-01 17:14 ` Paul E. McKenney
2024-10-31 17:50 ` Paul E. McKenney
2024-11-01 19:50 ` Boqun Feng
2024-11-01 19:54 ` [PATCH] scftorture: Use workqueue to free scf_check Boqun Feng
2024-11-01 23:35 ` Paul E. McKenney
2024-11-03 3:35 ` Boqun Feng
2024-11-03 15:03 ` Paul E. McKenney
2024-11-04 10:50 ` [PATCH 1/2] scftorture: Move memory allocation outside of preempt_disable region Sebastian Andrzej Siewior
2024-11-04 10:50 ` [PATCH 2/2] scftorture: Use a lock-less list to free memory Sebastian Andrzej Siewior
2024-11-05 1:00 ` Boqun Feng
2024-11-07 11:21 ` Sebastian Andrzej Siewior
2024-11-07 14:08 ` Paul E. McKenney
2024-11-07 14:43 ` Sebastian Andrzej Siewior
2024-11-07 14:59 ` Paul E. McKenney
2024-11-02 0:12 ` [BUG] -next lockdep invalid wait context Hillf Danton
2024-11-02 0:45 ` Boqun Feng [this message]
2024-11-04 18:08 ` Tejun Heo
2024-11-05 9:37 ` Vlastimil Babka
2024-11-08 10:05 ` Sebastian Andrzej Siewior
2024-11-08 17:02 ` Tejun Heo
2024-11-08 17:12 ` Sebastian Andrzej Siewior
2024-11-08 22:24 ` [PATCH] kernfs: Use RCU for kernfs_node::name lookup Sebastian Andrzej Siewior
2024-11-08 22:31 ` Tejun Heo
2024-11-11 17:04 ` Sebastian Andrzej Siewior
2024-11-12 19:02 ` Tejun Heo
2024-11-13 7:58 ` Sebastian Andrzej Siewior
2024-11-08 23:16 ` Hillf Danton
2024-11-08 23:48 ` [syzbot] [kernfs?] WARNING: locking bug in kernfs_path_from_node syzbot
2024-11-11 4:49 ` [PATCH] kernfs: Use RCU for kernfs_node::name lookup kernel test robot
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=ZyV2DfuIPsISds-1@Boquns-Mac-mini.local \
--to=boqun.feng@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=elver@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=tj@kernel.org \
/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
Powered by JetHome