Re: 2.6.19-rc <-> ThinkPads

Andi Kleen
2006-11-01T19:34:05Z

On Wednesday 01 November 2006 19:25, Linus Torvalds wrote:
>
> On Wed, 1 Nov 2006, Andi Kleen wrote:
> >
> > Ok please revert the i386 patch for now then if it fixes the ThinkPads.
> > The x86-64 version should be probably fixed too, but doesn't cleanly. I will
> > send you later a patch to fix this there properly.
>
> Actually, I should have just fixed the ordering. I did some cleanups too,
> but those are unrelated (except in the sense that I wanted to look at the
> assembly code, and the cleanups made the code generation at least half-way
> sane!)

Thanks.

Some of them are still different than the old code now, but that's probably
ok.

But the irq race you pointed out is still there (unless you fixed it in a differnet patch)
I don't know if it makes
a difference, but here is a patch to fix it.

-Andi

Fix race in IO-APIC routing entry setup.

Interrupt could happen between setting the IO-APIC entry
and setting its interrupt data.

Pointed out by Linus.

Signed-off-by: Andi Kleen <ak@suse.de>

Index: linux/arch/i386/kernel/io_apic.c
===================================================================
--- linux.orig/arch/i386/kernel/io_apic.c
+++ linux/arch/i386/kernel/io_apic.c
@@ -1298,10 +1298,12 @@ static void __init setup_IO_APIC_irqs(vo
if (!apic && (irq < 16))
disable_8259A_irq(irq);
}
+ local_irq_save(flags);
ioapic_write_entry(apic, pin, entry);
- spin_lock_irqsave(&ioapic_lock, flags);
+ spin_lock(&ioapic_lock);
set_native_irq_info(irq, TARGET_CPUS);
- spin_unlock_irqrestore(&ioapic_lock, flags);
+ spin_unlock(&ioapic_lock);
+ local_irq_restore(flags);
}
}