Linux real-time development
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Kegl Rohit <keglrohit@gmail.com>
Cc: linux-rt-devel@lists.linux.dev
Subject: Re: ksoftirqd priority inversion wait_event_interruptible_timeout/schedule_timeout/del_timer_sync
Date: Mon, 23 Jun 2025 16:30:51 +0200	[thread overview]
Message-ID: <20250623143051.pCoclIs7@linutronix.de> (raw)
In-Reply-To: <CAMeyCbgeL-UuxiJPVy_=zLSJfWgudKAvSQVViL8=u05yty_Pyg@mail.gmail.com>

On 2025-06-17 09:52:07 [+0200], Kegl Rohit wrote:
> Hello!
Hi,

> Using 5.10.184-rt90 on arm (nxp imx6q).
> 
> A proprietary driver starts a `kthread` with `SCHED_FIFO` -98 priority.
> This `kthread` waits for a completion using
> `wait_event_interruptible_timeout(comp, 1000)`
> and wakes up every second to perform its work. The completion itself
> only fires very infrequently.
> 
> Tracing the kernel showed that `ksoftirqd` was periodically boosted to
> the same `SCHED_FIFO` -98 priority.
> This is caused by the `schedule_timeout` handler within
> `wait_event_interruptible_timeout`.
> 
> del_timer_wait_running takes spin_lock_bh and causes the priority inversion.
> This is very bad because e.g. network softirq processing happens with
> very high priority for some time.
> 
> Was this issue addressed in a more recent kernel version?

The timer related bits moved to ktimersd thread (instead of ksoftirqd)
but the basic boosting problem remains.

There is work in progress to address this. The endgame is:
	https://lore.kernel.org/linux-rt-devel/20250613105653.1860729-1-bigeasy@linutronix.de/

Sebastian

  reply	other threads:[~2025-06-23 14:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17  7:52 ksoftirqd priority inversion wait_event_interruptible_timeout/schedule_timeout/del_timer_sync Kegl Rohit
2025-06-23 14:30 ` Sebastian Andrzej Siewior [this message]
2025-06-26 11:37   ` Kegl Rohit

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=20250623143051.pCoclIs7@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=keglrohit@gmail.com \
    --cc=linux-rt-devel@lists.linux.dev \
    /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