mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Jiayuan Chen <jiayuan.chen@linux.dev>,
	linux-rt-devel@lists.linux.dev,
	Steven Rostedt <rostedt@goodmis.org>,
	Clark Williams <clrkwllms@kernel.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	linux-kernel@vger.kernel.org,
	Florian Bezdeka <florian.bezdeka@siemens.com>
Subject: Re: [PATCH v2] irq_work: Fix use-after-free in irq_work_single on PREEMPT_RT
Date: Wed, 19 Aug 2026 13:46:51 +0200	[thread overview]
Message-ID: <60887e69-ae28-495c-a6d7-7d0a94fd1aa8@siemens.com> (raw)
In-Reply-To: <20260819105259.7ENaDrl2@linutronix.de>

On 19.08.26 12:52, Sebastian Andrzej Siewior wrote:
> On 2026-08-19 12:44:57 [+0200], Jan Kiszka wrote:
>> With this patch, arm 32-bit, and a single-core SoC, I got a noticeable
>> slowdown of irq_work_sync. Reverting the patch resolves this. So I dug
>> deeper, found out that things were even worse before [1], but even with
>> that, I could still see up to 2 ticks delay per call. If you combine
>> that with an unfortunate loop of irq_work_sync calls (mine is
>> out-of-tree, but I see something even "worse" in bpf_mem_alloc_destroy),
>> there is this impact.
>>
>> While this patch is motivated by PREEMPT_RT, the condition to enter the
>> modified branch are not limited to it:
> 
> It is not motivated by PREEMPT_RT. All the lazy-work has "this" problem.
> It is just on RT most of the work is stuffed into the lazy queue.

I was suspecting that already, but the patch description still reads
rt-only.

> 
>> ... || !arch_irq_work_has_interrupt()
>>
>> arch_irq_work_has_interrupt() is false on some archs, either always
>> (very rare) or under certain conditions. On arm, it's false when
>> is_smp() is false.
>>
>> If we "only" need the synchronize_rcu() for PREEMPT_RT, should we limit
>> it to that configuration? Or do we actually need otherwise as well?
>>
>> And what could be done to accelerate irq_work_sync loops? Practically, a
>> single synchronize_rcu() at the end could be enough, no?
> 
> Let me look into this again…
> 

Thanks!

I was meanwhile considering to backport the synchronize_rcu accelerator
commit. Seems to be straightforward for 6.12, but older kernels need more...

Jan

-- 
Siemens AG, Foundational Technologies
Linux Expert Center

      reply	other threads:[~2026-08-19 11:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30  7:32 Jiayuan Chen
2026-04-02  6:50 ` Sebastian Andrzej Siewior
2026-06-05 10:31   ` Xi Ruoyao
2026-06-05 10:45     ` Sebastian Andrzej Siewior
2026-06-05 17:26       ` Xi Ruoyao
2026-05-11 14:31 ` [tip: irq/urgent] irq_work: Fix use-after-free in irq_work_single() " tip-bot2 for Jiayuan Chen
2026-08-19 10:44 ` [PATCH v2] irq_work: Fix use-after-free in irq_work_single " Jan Kiszka
2026-08-19 10:52   ` Sebastian Andrzej Siewior
2026-08-19 11:46     ` Jan Kiszka [this message]

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=60887e69-ae28-495c-a6d7-7d0a94fd1aa8@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=bigeasy@linutronix.de \
    --cc=clrkwllms@kernel.org \
    --cc=florian.bezdeka@siemens.com \
    --cc=jiayuan.chen@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®