2012-02-20 15:20:51

by Seiji Aguchi

[permalink] [raw]
Subject: RE: [PATCH] x86, kdump, ioapic: Fix kdump race with migrating irq

> -void disable_IO_APIC(void)
> +void disable_IO_APIC(int force)
> {
> /*
>+ * Use force to bust the io_apic spinlock
>+ *
>+ * There is a case where kdump can race with irq
>+ * migration such that kdump will inject an NMI
>+ * while another cpu holds the ioapic_lock to
>+ * migrate the irq. This would cause a deadlock.
>+ *
>+ * Because kdump stops all the cpus, we can safely
>+ * bust the spinlock as we are just clearing the
>+ * io apic anyway.
>+ */
>+ if (force && spin_is_locked(&ioapic_lock))
>+ /* only one cpu should be running now */
>+ spin_lock_init(&ioapic_lock);
>+
>+ /*

Hmm...

This patch solves the kdump race, but it may make us confuse when we analyze vmcore,
Because it clears value of ioapic_lock without notice.

It kernel panic is related to IO_APIC, they will check value of ioapic_lock.

So, it is better if we can restore the value of ioapic_lock after calling disable_IO_APIC(),
IOW, my idea is following.
- Backup value of ioapic_lock
- Bust ioapic_lock
- Call disable_IO_APIC()
- Restore value of ioapic_lock

But, as you are discussing with Eric, we don't need to worry about this if we can completely remove disable_IO_APIC().

Seiji