* [PATCH v2] irqchip/riscv-imsic: sync-up state before CPU offline
@ 2026-05-08 9:31 Yong-Xuan Wang
2026-05-11 13:27 ` [tip: irq/urgent] irqchip/riscv-imsic: Clear interrupt move state during CPU offlining tip-bot2 for Yong-Xuan Wang
0 siblings, 1 reply; 2+ messages in thread
From: Yong-Xuan Wang @ 2026-05-08 9:31 UTC (permalink / raw)
To: Anup Patel, Thomas Gleixner, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti
Cc: linux-riscv, linux-kernel, greentime.hu, vincent.chen, zong.li,
Yong-Xuan Wang
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_prev" pointer of
these interrupts can only be cleared after the old CPU backs to online.
Therefore, the affinity of interrupts originally targeting an offlined
CPU cannot be updated.
Clear the "move_prev" pointers in the CPU hotplug offline path to avoid
stale migration state on offlined CPUs.
Fixes: 0f67911e821c ("irqchip/riscv-imsic: Separate next and previous pointers in IMSIC vector")
Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
---
Changes in v2:
- Update the description and add the fixes tag (Thomas)
- Link to v1: https://patch.msgid.link/20260503-imsic-v1-1-aa8330bd1c34@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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [tip: irq/urgent] irqchip/riscv-imsic: Clear interrupt move state during CPU offlining
2026-05-08 9:31 [PATCH v2] irqchip/riscv-imsic: sync-up state before CPU offline Yong-Xuan Wang
@ 2026-05-11 13:27 ` tip-bot2 for Yong-Xuan Wang
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Yong-Xuan Wang @ 2026-05-11 13:27 UTC (permalink / raw)
To: linux-tip-commits
Cc: Yong-Xuan Wang, Thomas Gleixner, stable, x86, linux-kernel, maz
The following commit has been merged into the irq/urgent branch of tip:
Commit-ID: cefafbd561402b0fe6447449364a30315b9b1570
Gitweb: https://git.kernel.org/tip/cefafbd561402b0fe6447449364a30315b9b1570
Author: Yong-Xuan Wang <yongxuan.wang@sifive.com>
AuthorDate: Fri, 08 May 2026 02:31:21 -07:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Mon, 11 May 2026 15:23:11 +02:00
irqchip/riscv-imsic: Clear interrupt move state during CPU offlining
Affinity changes of IMSIC interrupts have to be careful to not lose an
interrupt in the process. Each vector keeps track of an affinity change in
progress with two pointers in struct imsic_vector.
imsic_vector::move_prev points to the previous CPU target data and
imsic_vector::move_next to the designated new CPU target data.
imsic_vector::move_prev on the new CPU can only be cleared after the
previous CPU has cleared imsic_vector::move_next, which ususally happens in
__imsic_remote_sync().
In case of CPU hot-unplug __imsic_remote_sync() is not invoked because the
CPU is already marked offline. That means imsic_vector::move_prev becomes
stale until the CPU is onlined again.
The stale pointer prevents further affinity changes for the affected
interrupts.
Solve this by clearing the imsic_vector::move_prev pointers in the CPU
hotplug offline path.
[ tglx: Replace word salad in change log ]
Fixes: 0f67911e821c ("irqchip/riscv-imsic: Separate next and previous pointers in IMSIC vector")
Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260508-imsic-v2-1-e9f08dd46cf5@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 ba903fa..a7a1852 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();
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-11 13:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-08 9:31 [PATCH v2] irqchip/riscv-imsic: sync-up state before CPU offline Yong-Xuan Wang
2026-05-11 13:27 ` [tip: irq/urgent] irqchip/riscv-imsic: Clear interrupt move state during CPU offlining tip-bot2 for Yong-Xuan Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox