kexec: Consolidate machine_kexec_mask_interrupts() implementation
Subsystems (3)
Quoted 8 lines · Thomas Gleixner
Quoted 3 lines
Move the
machine_kexec_mask_interruptsfunction to a common location inkernel/kexec_core.c, removing duplicate implementations from architecture specific files (arch/arm,arch/arm64,arch/powerpc, andarch/riscv).Can you please move this into
kernel/irq/kexec.c?It's pure interrupt core internal code and there is no point to make core internal functions visible to random other code just because.
Done (in v5 series)
Quoted 9 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+void machine_kexec_mask_interrupts(void) +{ + unsigned int i; + struct irq_desc *desc;struct irq_desc *desc; unsigned int i;please
Done (in v5 series)
Quoted 12 lines
Review
Quoted 9 lines
(quoted diff) +9
-0+ for_each_irq_desc(i, desc) { + struct irq_chip *chip; + int check_eoi = 1; + + chip = irq_desc_get_chip(desc); + if (!chip) + continue; + + if (IS_ENABLED(CONFIG_ARM64)) {This should not be
CONFIG_ARM64. Add something like:
Quoted 4 lines
config
GENERIC_IRQ_KEXEC_CLEAR_VM_FORWARD
booland select this from ARM64?
Done (in v5 series)
Quoted 8 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ /* + * First try to remove the active state. If this fails, try to EOI the + * interrupt.This comment does not really explain what this is about. I know you copied it from the ARM64 implementation, but it should explain what this actually means. Something like:
Quoted 5 lines
First try to remove the active state from an interrupt which is forwarded to a VM. If the interrupt is not forwarded, try to EOI the interrupt.
or something like that.
Done (in v5 series)
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ */ + check_eoi = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);Looking deeper. This function actually cannot be called from this context. It does:
Quoted 6 lines
irq_get_desc_buslock(irq, &flags, 0);which means for any interrupt which has an actual buslock implementation it will end up in a sleepable function and deadlock in the worst case.
Marc?
I will wait for Marc's response regarding this issue. Regardless, if any changes are required, I believe it would be better to address them in a separate patch, as this behavior existed before my modification.
Thanks, Eliav
Quoted 6 lines · Eliav Farber
Quoted 5 lines · Thomas Gleixner
Looking deeper. This function actually cannot be called from this context. It does:
irq_get_desc_buslock(irq, &flags, 0);
Quoted 8 lines
Quoted 4 lines
which means for any interrupt which has an actual buslock implementation it will end up in a sleepable function and deadlock in the worst case.
Marc?
I will wait for Marc's response regarding this issue. Regardless, if any changes are required, I believe it would be better to address them in a separate patch, as this behavior existed before my modification.
Correct.