From: Boqun Feng <boqun.feng@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Vlastimil Babka <vbabka@suse.cz>, Marco Elver <elver@google.com>,
linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
kasan-dev@googlegroups.com, linux-mm@kvack.org,
sfr@canb.auug.org.au, longman@redhat.com, cl@linux.com,
penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com,
akpm@linux-foundation.org
Subject: Re: [BUG] -next lockdep invalid wait context
Date: Fri, 1 Nov 2024 12:50:30 -0700 [thread overview]
Message-ID: <ZyUxBr5Umbc9odcH@boqun-archlinux> (raw)
In-Reply-To: <186804c5-0ebd-4d38-b9ad-bfb74e39b353@paulmck-laptop>
On Thu, Oct 31, 2024 at 10:50:29AM -0700, Paul E. McKenney wrote:
> On Thu, Oct 31, 2024 at 08:55:09AM +0100, Sebastian Andrzej Siewior wrote:
> > On 2024-10-31 08:35:45 [+0100], Vlastimil Babka wrote:
> > > On 10/31/24 08:21, Sebastian Andrzej Siewior wrote:
> > > > 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.
> > >
> > > However, isn't this the case that the rule is actually about hardirq context
> > > on RT, and most of these operations that are in IRQ context on !RT become
> > > the threaded interrupt context on RT, so they are actually fine? Or is smp
> > > call callback a hardirq context on RT and thus it really can't do those
> > > operations?
> >
> > interrupt handlers as of request_irq() are forced-threaded on RT so you
> > can do kmalloc()/ kfree() there. smp_call_function.*() on the other hand
> > are not threaded and invoked directly within the IRQ context.
>
> OK, thank you all for the explanation! I will fix using Boqun's
> suggestion of irq work, but avoiding the issue Boqun raises by invoking
I've tried fixing this with irq work, however, unlike normal
work_struct, irq_work will still touch the work item header after the
work function is executed (see irq_work_single()). So it needs more work
to build an "one-off free" functionality on it.
I think we can just use normal workqueue, because queue_work() uses
local_irq_save() + raw_spin_lock(), so it's irq-safe even for
non-threaded interrupts.
Sending a patch soon.
Regards,
Boqun
> the irq-work handler from the smp_call_function() handler.
>
> It will be a few days before I get to this, so if there is a better way,
> please do not keep it a secret!
>
> Thanx, Paul
next prev parent reply other threads:[~2024-11-01 19:51 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-30 21:05 [BUG] -next lockdep invalid wait context 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 [this message]
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
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=ZyUxBr5Umbc9odcH@boqun-archlinux \
--to=boqun.feng@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=cl@linux.com \
--cc=elver@google.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-next@vger.kernel.org \
--cc=longman@redhat.com \
--cc=paulmck@kernel.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=sfr@canb.auug.org.au \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.