From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Preclik, Tobias" <tobias.preclik@siemens.com>
Cc: "linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>
Subject: Re: Control of IRQ Affinities from Userspace
Date: Mon, 3 Nov 2025 16:53:22 +0100 [thread overview]
Message-ID: <20251103155322.Aw9MSNYv@linutronix.de> (raw)
In-Reply-To: <a0cad8314124ca98d7c6763e3e08d7192598cf92.camel@siemens.com>
On 2025-10-30 14:20:01 [+0000], Preclik, Tobias wrote:
> Dear Linux RT Experts,
>
> the Linux kernel exposes two userspace interfaces to control IRQ
> affinities in the procfs [1]. First, /proc/irq/default_smp_affinity
> specifies the default affinity mask which gets applied as initial
> affinity mask for newly registering IRQs. Second,
> /proc/irq/${IRQ_NO}/smp_affinity which can be used to specify an
> affinity mask for a given IRQ.
>
> For tuning the I/O path of RT applications we use the second interface
> to relocate IRQs to cores dedicated to run RT applications. However, we
> have observed that certain situations, such as interface bring-up or
> loading BPF/XDP programs, can cause the IRQ affinity mask to be lost.
> Specifically, some network drivers, particularly those based on stmmac,
> ignore the IRQ affinity mask set from userspace and overwrite it with
> decisions from IRQ rebalancing [2]. This driver behavior prevents
> consistent control of IRQ affinities from userspace, impacting the
> tuning of the I/O path for RT applications.
>
> I would greatly appreciate any comments or guidance on this issue.
The usage of irq_set_affinity_hint() is not uncommon within the
networking drivers. It is probably a pity if the request happens on each
ifdown/ up but in this case it happens each time you add/ remove a XDP
program.
But the interrupt should be managed by the kernel. Looking at
irq_do_set_affinity() there is:
| if (irqd_affinity_is_managed(data) &&
| housekeeping_enabled(HK_TYPE_MANAGED_IRQ)) {
| const struct cpumask *hk_mask;
|
| hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ);
|
| cpumask_and(tmp_mask, mask, hk_mask);
| if (!cpumask_intersects(tmp_mask, cpu_online_mask))
| prog_mask = mask;
| else
| prog_mask = tmp_mask;
| } else {
so if the IRQ is managed and you have IRQ isolation enabled then it
should exclude the non-isolated CPUs. Would that work?
> Best regards,
> Tobias Preclik
Sebastian
next prev parent reply other threads:[~2025-11-03 15:53 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 [this message]
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
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=20251103155322.Aw9MSNYv@linutronix.de \
--to=bigeasy@linutronix.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.