From: Crystal Wood <crwood@redhat.com>
To: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>,
Thomas Gleixner <tglx@linutronix.de>
Cc: Vincent Whitchurch <vincent.whitchurch@axis.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Andreas Gruenbacher <agruenba@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] genirq: don't disable BH for PREEMPT_RT
Date: Tue, 30 Apr 2024 16:26:41 -0500 [thread overview]
Message-ID: <32eecb5cec36c6766484607717210bae0f1dab42.camel@redhat.com> (raw)
In-Reply-To: <20240415112800.314649-1-vladimir.kondratiev@mobileye.com>
On Mon, 2024-04-15 at 14:28 +0300, Vladimir Kondratiev wrote:
> With PREEMPT_RT, both BH and irq handled in threads.
> BH served by the ksoftirqd that is SCHED_OTHER, IRQ threads are
> SCHED_FIFO with some priority (default is 50).
>
> On the test platform the following observed:
>
> - ksoftirqd thread running, servicing softirqs
> - hard IRQ received by the CPU. Default handler wakes up IRQ thread
> and exits
> - in the IRQ thread, force_irqthreads is defined as (true) for PREEMPT_RT
> thus handler is irq_forced_thread_fn
> - before calling IRQ handler, irq_forced_thread_fn calls
> local_bh_disable(); it in turn acquires local_lock(&softirq_ctrl.lock);
> - softirq_ctrl.lock still owned by the ksoftirqd thread, so
> slow path taken (rt_spin_lock_slowlock), causing context switch to the
> ksoftirqd (with properly adjusted priority) and waiting for it to
> release the lock. Then, context switched back to the IRQ thread
> - as result, IRQ handler invoked with observed delay for several
> hundreds micro-seconds on 2GHz platform.
>
> This causes failure to deliver on real-time latency requirements.
>
> What is the reason for disabling BH in the PREEMPT_RT? Looks like
> it is more reasonable to let scheduler to run threads according to
> priorities; IRQ thread will preempt BHs, run to its completion.
>
> Experiment conducted with this approach, smooth execution observed with
> no spikes in the IRQ latency.
>
> I am likely missing corner cases with this approach, so this is request
> for comments. Input welcome
I don't know if anything is actually depending on the mutual exclusion, but
disabling BH there causes any softirq raised by the irq to run in
local_bh_enable() rather than waking ksoftirqd. It also appears to be the
only thing causing in_interrupt() to return true inside the threaded
handler, which may or may not actually matter.
-Crystal
prev parent reply other threads:[~2024-04-30 21:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 11:28 Vladimir Kondratiev
2024-04-30 21:26 ` Crystal Wood [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=32eecb5cec36c6766484607717210bae0f1dab42.camel@redhat.com \
--to=crwood@redhat.com \
--cc=agruenba@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--cc=vincent.whitchurch@axis.com \
--cc=vladimir.kondratiev@mobileye.com \
/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®