Skip to content

Commit c562ba7

Browse files
Song Shuaipalmer-dabbelt
authored andcommitted
riscv: kexec: Avoid deadlock in kexec crash path
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]>
1 parent 393da6c commit c562ba7

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

arch/riscv/kernel/machine_kexec.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,12 @@ static void machine_kexec_mask_interrupts(void)
121121

122122
for_each_irq_desc(i, desc) {
123123
struct irq_chip *chip;
124-
int ret;
125124

126125
chip = irq_desc_get_chip(desc);
127126
if (!chip)
128127
continue;
129128

130-
/*
131-
* First try to remove the active state. If this
132-
* fails, try to EOI the interrupt.
133-
*/
134-
ret = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);
135-
136-
if (ret && irqd_irq_inprogress(&desc->irq_data) &&
137-
chip->irq_eoi)
129+
if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
138130
chip->irq_eoi(&desc->irq_data);
139131

140132
if (chip->irq_mask)

0 commit comments

Comments
 (0)