From: Tejun Heo <tj@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev,
Lai Jiangshan <jiangshanlai@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] softirq: Provide a handshake for canceling tasklets via polling on PREEMPT_RT
Date: Wed, 20 Aug 2025 09:44:53 -1000 [thread overview]
Message-ID: <aKYltdkLBRZJF0Ok@slm.duckdns.org> (raw)
In-Reply-To: <20250820105518.Yf36NzJd@linutronix.de>
Hello,
On Wed, Aug 20, 2025 at 12:55:18PM +0200, Sebastian Andrzej Siewior wrote:
> On 2025-08-20 12:36:59 [+0200], To Tejun Heo wrote:
> > Subject: [PATCH] workqueue: Provide a handshake for canceling BH workers
> …
> > This will flush all BH-work items assigned to that pool.
>
> We need to flush all items because the inserted wq_barrier is at the
> end of the queue. So if the cb_lock is dropped after
> worker->current_func(work) then we will live lock. Just tested, I
> somehow assumed it polls on worker.
Is flushing all a problem tho? I think the main focus is keeping the
semantics matching on RT, right?
...
> - if (from_cancel) {
> + if (from_cancel && !IS_ENABLED(CONFIG_PREEMPT_RT)) {
> unsigned long data = *work_data_bits(work);
>
> if (!WARN_ON_ONCE(data & WORK_STRUCT_PWQ) &&
> (data & WORK_OFFQ_BH)) {
> - /*
> - * On RT, prevent a live lock when %current preempted
> - * soft interrupt processing or prevents ksoftirqd from
> - * running by keeping flipping BH. If the BH work item
> - * runs on a different CPU then this has no effect other
> - * than doing the BH disable/enable dance for nothing.
> - * This is copied from
> - * kernel/softirq.c::tasklet_unlock_spin_wait().
> - */
> while (!try_wait_for_completion(&barr.done)) {
> - if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
> - local_bh_disable();
> - local_bh_enable();
> - } else {
> - cpu_relax();
> - }
> + cpu_relax();
I'm most likely missing something about RT but wouldn't the above still lead
to deadlocks if the caller is non-hardirq but higher priority thread?
Thanks.
--
tejun
next prev parent reply other threads:[~2025-08-20 19:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 14:39 [PATCH] softirq: Provide a handshake for canceling tasklets via polling on PREEMPT_RT Sebastian Andrzej Siewior
2025-08-12 14:53 ` Sebastian Andrzej Siewior
2025-08-12 19:38 ` Tejun Heo
2025-08-13 6:33 ` Sebastian Andrzej Siewior
2025-08-13 18:05 ` Tejun Heo
2025-08-18 12:52 ` Sebastian Andrzej Siewior
2025-08-18 17:41 ` Tejun Heo
2025-08-19 15:01 ` Sebastian Andrzej Siewior
2025-08-20 10:36 ` Sebastian Andrzej Siewior
2025-08-20 10:55 ` Sebastian Andrzej Siewior
2025-08-20 19:44 ` Tejun Heo [this message]
2025-08-21 9:28 ` Sebastian Andrzej Siewior
2025-08-21 17:10 ` Tejun Heo
2025-08-22 9:48 ` Sebastian Andrzej Siewior
2025-08-22 18:07 ` Tejun Heo
2025-08-26 15:49 ` Sebastian Andrzej Siewior
2025-08-26 16:27 ` Tejun Heo
2025-08-28 16:04 ` Sebastian Andrzej Siewior
2025-08-29 19:34 ` Tejun Heo
2025-08-13 8:20 ` 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=aKYltdkLBRZJF0Ok@slm.duckdns.org \
--to=tj@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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).