From: Imran Khan <imran.f.khan@oracle.com>
To: tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org
Subject: [RFC PATCH v2] genirq/cpuhotpug: notify of irq affinity change for offlined cpu.
Date: Sat, 3 Jan 2026 00:53:08 +0800 [thread overview]
Message-ID: <20260102165308.76290-1-imran.f.khan@oracle.com> (raw)
During cpu offlining the irqs with broken_affinity are affined
to other CPU but this affinity change is not accounted for by
desc::affinity_notify (if available).
This can leave users of irq_set_affinity_notifier, with old
affinity information.
Signed-off-by: Imran Khan <imran.f.khan@oracle.com>
---
v1 -> v2:
- Fix compilation error due to missed parenthesis around scoped_guard
kernel/irq/cpuhotplug.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c
index 755346ea98196..30153be1a4cca 100644
--- a/kernel/irq/cpuhotplug.c
+++ b/kernel/irq/cpuhotplug.c
@@ -177,9 +177,17 @@ void irq_migrate_all_off_this_cpu(void)
bool affinity_broken;
desc = irq_to_desc(irq);
- scoped_guard(raw_spinlock, &desc->lock)
+ scoped_guard(raw_spinlock_irqsave, &desc->lock) {
affinity_broken = migrate_one_irq(desc);
-
+ if (affinity_broken && desc->affinity_notify) {
+ kref_get(&desc->affinity_notify->kref);
+ if (!schedule_work(&desc->affinity_notify->work)) {
+ /* Work was already scheduled, drop our extra ref */
+ kref_put(&desc->affinity_notify->kref,
+ desc->affinity_notify->release);
+ }
+ }
+ }
if (affinity_broken) {
pr_debug_ratelimited("IRQ %u: no longer affine to CPU%u\n",
irq, smp_processor_id());
base-commit: f8f9c1f4d0c7a64600e2ca312dec824a0bc2f1da
--
2.34.1
next reply other threads:[~2026-01-02 16:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-02 16:53 Imran Khan [this message]
2026-01-13 9:24 ` Thomas Gleixner
2026-01-13 9:24 ` Thomas Gleixner
2026-01-13 14:41 ` imran.f.khan
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=20260102165308.76290-1-imran.f.khan@oracle.com \
--to=imran.f.khan@oracle.com \
--cc=linux-kernel@vger.kernel.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®