RE: [PATCH] fix x2apic defect that Linux kernel doesn't mask 8259Ainterrupt during the time window between changing VT-d table base addressand initializing these VT-d entries(smpboot.c and apic.c )

From: Zhang, Lin-Bao (Linux Kernel R&D)
Date: Tue Oct 09 2012 - 20:28:09 EST


Hi Suresh,

Thanks very much for your reply!
I tested this patch in 2.6.32 with our machine , it can indeed can resolve current issue. that 's good.
I also check 3.x version of kernel source , for example , 3.3.8 and 3.0.0 , they indeed include similar patch ,
I think the key action is this line :
+ /*
+ * The number of IO-APIC IRQ registers (== #pins):
+ */
+ nr_ioapic_registers[idx] = entries;

In 3.3.8 , it is like this:
/*
4011 * The number of IO-APIC IRQ registers (== #pins):
4012 */
4013 ioapics[idx].nr_registers = entries;
I also use 3.3.8 to test , no modification don't reproduce our issue.
If I comment this line (ioapics[idx].nr_registers = entries;) , it will reproduce the problem that occurs in 2.6.32.
so this can prove that your patch should work for 2.6.x kernel.

But I am not sure why it can work. Let's discuss again. I am researching the whole source again.
It seems that we have 2 directions to fix current problem :
a) your patch : all the IO-APIC RTE's are masked between the time we enable interrupt-remapping to the time
> when the IO-APIC RTE's are configured correctly.
b) my patch mask interrupt during VT-d table base address changing and VT-d entries initialized successfully.
I suppose during the time window , we should disable 8259A interrupt.

> As I mentioned earlier, the current design already ensures that all the IO-APIC
> RTE's are masked between the time we enable interrupt-remapping to the time
> when the IO-APIC RTE's are configured correctly.
>
So , we can think ,as your patch , during the window , IO-apic is useless or we can think IO-APIC doesn't exist ?
Could you mind please sharing your design details ? thanks very much!

> So I looked at why you are seeing the problem with v2.6.32 but not with the
> recent kernels. And I think I found out the reason.
>
> 2.6.32 kernel is missing this fix,
>
Yes, 2.6.32 doesn't have this patch. 3.x.x indeed have it.

> Because of this, in v2.6.32, mask_IO_APIC_setup() is not working as expected
> as nr_ioapic_registers[] are not yet initialized and thus the io-apic RTE's are not
> masked as expected.
>
> We just need the last hunk of that patch, I think.
>
> Can you please apply the appended patch to 2.6.32 kernel and see if the issue
> you mentioned gets fixed? If so, we can ask the -stable and OSV's teams to
> pick up this fix.
Yes , it can resolve current issue.
N‹§²æìr¸›yúèšØb²X¬¶ÇvØ^–)Þ{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü}©ž²ÆzÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ßf”ù^jÇy§m…á@A«a¶Úÿ 0¶ìh®å’i