linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Fri, 22 Aug 2025 08:07:47 -1000	[thread overview]
Message-ID: <aKix80fycymWz3Mh@slm.duckdns.org> (raw)
In-Reply-To: <20250822094812.L4hiquhY@linutronix.de>

Hello, Sebastian.

On Fri, Aug 22, 2025 at 11:48:12AM +0200, Sebastian Andrzej Siewior wrote:
> > Okay, so, on !RT, that busy loop section is there to allow
> > cancel_work_sync() to be called from BH-disabled contexts and the caller is
> > responsible for ensuring there's no recursion. It's not great but matches
> > the existing behavior. 
> 
> hold on for for a sec: existing behaviour for tasklet_unlock_spin_wait()
> which has three users (a fourth one if we count i915 which has its own
> tasklet layer). Not something that I would call common or wide spread
> behaviour in the kernel (and task workqueue does not have it either).

IIRC, there was a conversion patchset which didn't get pushed to completion
and it hit those, so the patch to add the busy wait.

> tasklet_disable() and tasklet_kill() both sleep while waiting for
> completion and don't spin.
> 
> >                        Obviously, in !RT, we can't go to
> > wait_for_completion() there because we can be in a non-sleepable context.
> 
> Again, only a small amount of users require to do so.
> 
> > Are you saying that, in RT, it'd be fine to call wait_for_completion()
> > inside local_bh_disable() and won't trip any of the context warnings? If so,
> > yeah, we don't need any of the looping.
> 
> No, that won't work. local_bh_disable() will start a RCU read section
> and then RCU will complain during schedule().
> So if the requirement is to cancel a BH workitem from within a BH
> disabled section then we need the first patch in this thread.
> 
> But if we get rid of this requirement…

Agreed, once we get rid of them, we can drop the whole block for both RT and
!RT - ie. revert the patch that added it. But, wouldn't it be more orderly
to match the semantics in both cases even if the behavior isn't quite
optimal? We can put some comment noting what to do once the culprits are
updated to not need it.

Thanks.

-- 
tejun

  reply	other threads:[~2025-08-22 18:07 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
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 [this message]
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=aKix80fycymWz3Mh@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).