Re: [PATCH] KVM: VMX: Enable memory mappedTPR shadow(FlexPriority)

Avi Kivity
2007-10-31T00:47:26Z

Dong, Eddie wrote:
>> Yes. FlexPriority will be both faster and safer for those who have it
>> than my hack.
>>
>> It may turn out that patching can improve performance even with
>> FlexPriority: we can patch the APIC EOI write to look if any
>> interrupts are pending, and only exit if the EOI will result in a new
>> interrupt being injected. But it is very possible that this will not
>> be necessary if we can achieve good interrupt mitigation with virtio.
>>
>>
> Mmm, I won't say so. The issues is: A guest EOI (level triggered IRQ)
> need to clear remote IRR bit in IOAPIC side and resample that pin in
> IOAPIC side.
> This one is not easy to do in patched code.
>
>

Hmm...

The patched code needs to answer the question "what will happen if I EOI
this vector now"? I think kvm can prepare the answer for that question,
since it knows the irq is still asserted and that the mode is
level-triggered.

Basically the kvm lapic code has to calculate the IRR for a "speculative
EOI" and post that in the shared memory block. If something changes
(the IRQ line is de-asserted, for example) again it has to recalculate it.

So yes, it will not be easy.

--
Any sufficiently difficult bug is indistinguishable from a feature.