Re: [PATCH] kvm: optimize ISR lookups

Thomas Gleixner
2012-05-22T17:26:45Z

On Tue, 22 May 2012, Avi Kivity wrote:
> On 05/22/2012 12:04 AM, Thomas Gleixner wrote:
> > The only justification for having the same layout as the actual
> > hardware is when you are going to map the memory into the guest space,
> > which is not the case here.
>
> The APIC page is in fact mapped to the hardware (not the guest, but vmx
> microcode does access it). Only one register, the TPR, is ever used.
> It's possible to re-layout the data structure so that the TPR stays in
> the same place while everything else becomes contiguous, but we'll have
> to do it again if the hardware starts mapping more registers.

I would avoid that by having a compressed version which reflects the
SW state and the mapped one which allows the vmx microcode to fiddle
with the TPR. If you need more registers in the HW page then you don't
have to worry about the layout and just have a proper accessor for
that.

Thanks,

tglx