mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Hillf Danton <hdanton@sina.com>
Cc: linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
	Takashi Iwai <tiwai@suse.de>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v3 2/3] softirq: Provide a handshake for canceling tasklets via polling
Date: Thu, 18 Sep 2025 17:49:37 +0200	[thread overview]
Message-ID: <20250918154937.RQqkeYxI@linutronix.de> (raw)
In-Reply-To: <20250918134753.7122-1-hdanton@sina.com>

On 2025-09-18 21:47:52 [+0800], Hillf Danton wrote:
> On Mon, 15 Sep 2025 09:39:33 +0200 Sebastian Andrzej Siewior wrote:
> >On 2025-09-05 18:15:01 [+0800], Hillf Danton wrote:
> >> 	CPU0			CPU1
> >> 	----			----
> >> 	lock A
> >> 				tasklet C callback
> >> 				lock A
> >> 	cancel tasklet B
> >> 	DEADLOCK-01
> >> 
> >> After this work could DEADLOCK-01 be triggered, given no chance for DEADLOCK-02 ?
> >> 
> >> 	CPU2			CPU3
> >> 	----			----
> >> 	lock A
> >> 				timer C callback
> >> 				lock A
> >> 	timer_delete_sync(timer B)
> >> 	DEADLOCK-02
> >
> > You are not supposed to acquire the lock, that is also acquired in the
> > callback, while canceling the timer/ tasklet.
> > Tell me please, how is this relevant?
> > 
> > If lock A is acquired on CPU0/ 2 then tasklet/ timer on CPU1/ 3 can't
> > make progress. Now CPU0/ 2 waits for the callback to complete. This
> > deadlocks as of today regardless of PREEMPT_RT and this change.
> > 
> In case of !RT, the chance for DEADLOCK-02 is zero because deadlock is
> detected based on per-timer instead of per-cpu.

But your "lock A" is global, isn't it?

> > The difference is that !RT requires two CPU for this to happen while RT
> > is efficient and can trigger this with just one CPU.
> 
> In case of RT OTOH, false positive deadlock could be triggered because
> canceling taskletB has nothing to do with the callback of taskletC.
> 
> In short I am highlighting the gap between per-timer/tasklet and per-cpu.

I don't see a problem here.

Sebastian

  reply	other threads:[~2025-09-18 15:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 14:25 [PATCH v3 0/3] Allow to drop the softirq-BKL lock on PREEMPT_RT Sebastian Andrzej Siewior
2025-09-04 14:25 ` [PATCH v3 1/3] workqueue: Provide a handshake for canceling BH workers Sebastian Andrzej Siewior
2025-09-04 17:28   ` Tejun Heo
2025-09-04 14:25 ` [PATCH v3 2/3] softirq: Provide a handshake for canceling tasklets via polling Sebastian Andrzej Siewior
2025-09-05 10:15   ` Hillf Danton
2025-09-15  7:39     ` Sebastian Andrzej Siewior
2025-09-18 13:47       ` Hillf Danton
2025-09-18 15:49         ` Sebastian Andrzej Siewior [this message]
2025-09-20  1:29           ` Hillf Danton
2025-09-17 14:44   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2025-09-04 14:25 ` [PATCH v3 3/3] softirq: Allow to drop the softirq-BKL lock on PREEMPT_RT Sebastian Andrzej Siewior
2025-09-17 14:44   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2025-09-15  7:42 ` [PATCH v3 0/3] " Sebastian Andrzej Siewior

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=20250918154937.RQqkeYxI@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=tiwai@suse.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

all inboxes | Powered by JetHome®