From: Christoph Hellwig <hch@infradead.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Christoph Hellwig <hch@infradead.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v3] smp: Wake ksoftirqd on PREEMPT_RT instead do_softirq().
Date: Tue, 8 Feb 2022 23:57:05 -0800 [thread overview]
Message-ID: <YgNz0caX70zhaP1F@infradead.org> (raw)
In-Reply-To: <YgKgL6aPj8aBES6G@linutronix.de>
On Tue, Feb 08, 2022 at 05:54:07PM +0100, Sebastian Andrzej Siewior wrote:
> The softirq implementation on PREEMPT_RT does not provide do_softirq(). The
> softirq can not be handled directly here because migration_cpu_stop() is
> invoked with disabled preemption/ interrupts.
>
> A known user of scheduling softirqs from a remote function call is the block
> layer. It won't happen on PREEMPT_RT because it doesn't make sense for
> latency/ performance reasons and is disabled. Nevertheless this should
> be handled in case of a new user pops up rather than simply ignoring it.
>
> Waking ksoftirqd unconditionally can be problematic if softirqs were already
> pending but not yet handled. This can happen since the migration thread
> is running at a high priority and able to preempt a threaded-interrupt.
> The woken-up ksoftirqd would catch-up all pending (and later raised)
> softirqs which is not desired on PREEMPT_RT since it is no longer
> handled where it has been originally raised. This in turn delays the
> actual processing until a SCHED_OTHER task can run.
>
> Wake the softirq thread on PREEMPT_RT if a remote function call raised
> softirqs. Add warning in this case since this condition is not desired.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> v2…v3:
> - Only wake ksoftirqd if the softirqs were raised wthin
> flush_smp_call_function_queue().
> - Add a warning in the wake case.
> v1…v2: Drop an empty line.
>
> kernel/smp.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
> ---
> --- a/kernel/smp.c
> +++ b/kernel/smp.c
> @@ -691,10 +691,25 @@ void flush_smp_call_function_from_idle(v
> cfd_seq_store(this_cpu_ptr(&cfd_seq_local)->idle, CFD_SEQ_NOCPU,
> smp_processor_id(), CFD_SEQ_IDLE);
> local_irq_save(flags);
> - flush_smp_call_function_queue(true);
> - if (local_softirq_pending())
> - do_softirq();
> + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) {
I still absolutely hate these pointless negations in simple if
statements.
next prev parent reply other threads:[~2022-02-09 7:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-08 16:54 Sebastian Andrzej Siewior
2022-02-09 7:57 ` Christoph Hellwig [this message]
2022-03-18 7:34 ` Sebastian Andrzej Siewior
2022-05-01 8:05 ` [tip: sched/core] smp: Make softirq handling RT safe in flush_smp_call_function_queue() tip-bot2 for 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=YgNz0caX70zhaP1F@infradead.org \
--to=hch@infradead.org \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®