[PATCH] irqchip/riscv-imsic: sync-up state before CPU offline

Yong-Xuan Wang posted 1 patch 1 month, 1 week ago
There is a newer version of this series
drivers/irqchip/irq-riscv-imsic-early.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] irqchip/riscv-imsic: sync-up state before CPU offline
Posted by Yong-Xuan Wang 1 month, 1 week ago
The "move_prev" pointer in struct imsic_vector on the new CPU is
cleared only after the old CPU has cleared "move_next". But when
migrating all the interrupts out from an offling CPU, since the CPU
is already marked as "offlined", the IMSIC driver skip to sync-up the
interrupt vector in __imsic_remote_sync(). The "move_pre" pointer of
these interrupts can only be cleared after the old CPU backs to online.
Therefore the affinity of an interrupt that are orignally target an
offlined CPU can't be changed.

This patch force to clear the "move_pre" pointers before the CPU goes
offline.

Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
---
 drivers/irqchip/irq-riscv-imsic-early.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/irqchip/irq-riscv-imsic-early.c b/drivers/irqchip/irq-riscv-imsic-early.c
index ba903fa689bd..a7a1852b548c 100644
--- a/drivers/irqchip/irq-riscv-imsic-early.c
+++ b/drivers/irqchip/irq-riscv-imsic-early.c
@@ -158,6 +158,8 @@ static int imsic_dying_cpu(unsigned int cpu)
 	/* Cleanup IPIs */
 	imsic_ipi_dying_cpu();
 
+	imsic_local_sync_all(false);
+
 	/* Mark per-CPU IMSIC state as offline */
 	imsic_state_offline();
 

---
base-commit: 9b3a2be84803cf18c4b4d1efc695991f0daa153c
change-id: 20260503-imsic-d70c156cb740
Re: [PATCH] irqchip/riscv-imsic: sync-up state before CPU offline
Posted by Thomas Gleixner 1 month, 1 week ago
On Sun, May 03 2026 at 23:05, Yong-Xuan Wang wrote:
> The "move_prev" pointer in struct imsic_vector on the new CPU is
> cleared only after the old CPU has cleared "move_next". But when
> migrating all the interrupts out from an offling CPU, since the CPU
> is already marked as "offlined", the IMSIC driver skip to sync-up the
> interrupt vector in __imsic_remote_sync(). The "move_pre" pointer of
> these interrupts can only be cleared after the old CPU backs to online.
> Therefore the affinity of an interrupt that are orignally target an
> offlined CPU can't be changed.

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#changelog

> This patch force to clear the "move_pre" pointers before the CPU goes
> offline.

# git grep 'This patch' Documentation/process/

Thanks,

        tglx
Re: [PATCH] irqchip/riscv-imsic: sync-up state before CPU offline
Posted by Thomas Gleixner 1 month, 1 week ago
On Tue, May 05 2026 at 21:44, Thomas Gleixner wrote:
> On Sun, May 03 2026 at 23:05, Yong-Xuan Wang wrote:
>> The "move_prev" pointer in struct imsic_vector on the new CPU is
>> cleared only after the old CPU has cleared "move_next". But when
>> migrating all the interrupts out from an offling CPU, since the CPU
>> is already marked as "offlined", the IMSIC driver skip to sync-up the
>> interrupt vector in __imsic_remote_sync(). The "move_pre" pointer of
>> these interrupts can only be cleared after the old CPU backs to online.
>> Therefore the affinity of an interrupt that are orignally target an
>> offlined CPU can't be changed.
>
> https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#changelog
>
>> This patch force to clear the "move_pre" pointers before the CPU goes
>> offline.
>
> # git grep 'This patch' Documentation/process/

This change log also lacks a 'Fixes:' tag