Skip to content

Commit 225f340

Browse files
Song ShuaiSasha Levin
Song Shuai
authored and
Sasha Levin
committed
riscv: kexec: Avoid deadlock in kexec crash path
[ Upstream commit c562ba7 ] If the kexec crash code is called in the interrupt context, the machine_kexec_mask_interrupts() function will trigger a deadlock while trying to acquire the irqdesc spinlock and then deactivate irqchip in irq_set_irqchip_state() function. Unlike arm64, riscv only requires irq_eoi handler to complete EOI and keeping irq_set_irqchip_state() will only leave this possible deadlock without any use. So we simply remove it. Link: https://lore.kernel.org/linux-riscv/[email protected]/ Fixes: b17d19a ("riscv: kexec: Fixup irq controller broken in kexec crash path") Signed-off-by: Song Shuai <[email protected]> Reviewed-by: Ryo Takakura <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 806b9b1 commit 225f340

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

arch/riscv/kernel/machine_kexec.c

+1-9
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,12 @@ static void machine_kexec_mask_interrupts(void)
163163

164164
for_each_irq_desc(i, desc) {
165165
struct irq_chip *chip;
166-
int ret;
167166

168167
chip = irq_desc_get_chip(desc);
169168
if (!chip)
170169
continue;
171170

172-
/*
173-
* First try to remove the active state. If this
174-
* fails, try to EOI the interrupt.
175-
*/
176-
ret = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);
177-
178-
if (ret && irqd_irq_inprogress(&desc->irq_data) &&
179-
chip->irq_eoi)
171+
if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
180172
chip->irq_eoi(&desc->irq_data);
181173

182174
if (chip->irq_mask)

0 commit comments

Comments
 (0)