[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871pjtg91b.ffs@tglx>
Date: Tue, 13 Jan 2026 10:24:16 +0100
From: Thomas Gleixner <tglx@...nel.org>
To: Imran Khan <imran.f.khan@...cle.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2] genirq/cpuhotpug: notify of irq affinity change
for offlined cpu.
On Sat, Jan 03 2026 at 00:53, Imran Khan wrote:
> 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@...cle.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);
> + }
> + }
No, we are not doing random copy&pasta.
Split out the functionality into a function and use it both here and in
irq_set_affinity_locked().
Thanks,
tglx
Powered by blists - more mailing lists