public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: "bigeasy@linutronix.de" <bigeasy@linutronix.de>
To: "Preclik, Tobias" <tobias.preclik@siemens.com>
Cc: "Bezdeka, Florian" <florian.bezdeka@siemens.com>,
	"linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>,
	"Kiszka, Jan" <jan.kiszka@siemens.com>
Subject: Re: Control of IRQ Affinities from Userspace
Date: Tue, 11 Nov 2025 15:34:56 +0100	[thread overview]
Message-ID: <20251111143456.YML0ggA7@linutronix.de> (raw)
In-Reply-To: <6523960abaff2054ed25bf57b2a12e381f305a3e.camel@siemens.com>

On 2025-11-05 13:11:29 [+0000], Preclik, Tobias wrote:
> > > so if the IRQ is managed and you have IRQ isolation enabled then it
> > > should exclude the non-isolated CPUs. Would that work?
> 
> For that code path to be taken we would have to specify isolcpus and
> managed_irq on the kernel command-line. However, we already migrated
> away from the deprecated isolcpus parameter. Additionally, we need to
> dynamically change the interrupt affinities while in operation. For
> that matter we have to rely on setting the interrupt affinities in
> procfs.

I would be careful with the deprecated term here. The functionality is
not deprecated just the interface is. The CPU affinity has been migrated
a cgroup based interface. If the matching irq affinity is missing then
it should be added rather than avoiding the whole "affinity is managed"
interface since this looks as it has been meant for your use case.

…

> Thanks for sharing the details Florian. The discovery of newly
> registered/requested IRQs in userland is indeed an additional problem.
> Still I would say that we can work around it by polling procfs and
> setting the default interrupt affinity appropriately (given that it is
> not ignored by the drivers of course). RT applications might have to
> accept an initial delay until the interrupts on their I/O path are
> detected and properly tuned.

This depends how you sell it. The initial setup of the application/
system might take a small hit until everything is ready and setup for
your workload. I don't know how changing the XDP program fits into this.
Usually I would expect that you setup it once and use it. However if
switching the XDP program makes sense within your real time workload
then maybe the affinity should not be randomly assigned.

> > I tried to modify stmmac and let it evaluate the default affinity
> > while
> > doing the IRQ balancing dance. That turned out to be working at the
> > end,
> > but each line violated several coding/style/abstraction rules. There
> > is
> > no API at driver level to read the current default affinity - or I
> > missed it. I could sent that hack out as RFC if requested. Just let
> > me
> > know.
> 
> When drivers at least respect the default affinity when rebalancing
> interrupts we can avoid interfering with RT applications. However, we
> must also ensure that specific interrupts which are in use by RT
> applications on their I/O path must remain on the application core.
> Meaning the IRQ rebalancing should also respect the interrupt
> affinities set from userspace via /proc/irq/${IRQ_NO}/smp_affinity.

If free_irq() removes all information about the IRQ then it might also
lose the configured smp_affinity. 

> Here are steps to explore the behavior and reproduce the issue.
> online cpus ignoring the default interrupt affinity as well as ignoring
> and overwriting the explicitly set interrupt affinities from userspace.

I just compared with igb and here the affinity mask survives. So it is
just this driver that is doing things different. The igb also removes
all interrupts on down. The affinity remains after changing the number
of queues (which changes the number of used interrupts). 

> Tobias

Sebastian

  parent reply	other threads:[~2025-11-11 14:35 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30 14:20 Control of IRQ Affinities from Userspace Preclik, Tobias
2025-11-03 15:53 ` Sebastian Andrzej Siewior
2025-11-03 17:12   ` Florian Bezdeka
2025-11-05 13:11     ` Preclik, Tobias
2025-11-05 13:18       ` Preclik, Tobias
2025-11-11 14:35         ` bigeasy
2025-11-11 14:34       ` bigeasy [this message]
2025-11-21 13:25         ` Preclik, Tobias
2025-11-24  9:59           ` bigeasy
2025-11-25 11:32             ` Florian Bezdeka
2025-11-25 11:50               ` bigeasy
2025-11-25 14:36                 ` Florian Bezdeka
2025-11-25 16:31                   ` Thomas Gleixner
2025-11-26  9:20                     ` Florian Bezdeka
2025-11-26 14:26                       ` Thomas Gleixner
2025-11-26 15:07                         ` Florian Bezdeka
2025-11-26 19:15                           ` Thomas Gleixner
2025-11-27 14:06                             ` Preclik, Tobias
2025-11-27 14:52                             ` Florian Bezdeka
2025-11-27 18:09                               ` Thomas Gleixner
2025-11-28  7:33                                 ` Florian Bezdeka
2025-11-26 15:45                       ` Frederic Weisbecker
2025-11-26 15:31                 ` Frederic Weisbecker
2025-11-26 15:24               ` Frederic Weisbecker
2025-11-11 13:58     ` 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=20251111143456.YML0ggA7@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=florian.bezdeka@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=tobias.preclik@siemens.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