Re: KVM: VMX: cache exit_intr_info

Yang, Sheng
2008-06-30T12:43:10Z

On Saturday 28 June 2008 13:35:27 Marcelo Tosatti wrote:
> On Sat, Jun 28, 2008 at 11:20:47AM +0800, Yang, Sheng wrote:
> > On Saturday 28 June 2008 02:05:19 Marcelo Tosatti wrote:
> > > exit_intr_info is read-only in nature, so once read it can be
> > > cached similarly to idtv_vectoring_inf.
> > >
> > > Reduces guest re-entry in about 50 cycles on my machine (the
> > > exception path should be similar, but haven't measured).
> > >
> > > Applies on top of register accessor patch.
> > >
> > > Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> >
> > Thanks for the patches! :)
> >
> > And I realized there are also too much vmcs_read32
> > (CPU_BASED_VM_EXEC_CONTROL)(though not read only). I'd like to
> > post another patch to optimize it later.
>
> GUEST_INTERRUPTIBILITY_INFO is also a candidate, with significant
> wins (used by skip_emulated_instruction which is often used in the
> exit handlers).
>
> GUEST_RFLAGS is another register read multiple times in the fast
> path, but seems trickier.
>
> Do you have a better suggestion instead of
> vmcs_cache_read32/vmcs_cache_write32 below for this caching
> optimizations?

I think we may include more MSRs, though not all of them in the
critical path. GUEST_INTERRUPTIABILITY_INFO is on the critical path,
as well as VM_ENTRY_INTR_INFO_FIELD. The GUEST_RFLAGS and
CPU_BASED_VM_EXEC_CONTROL also been used very frequently. Of course
the latter three MSR I mentioned need write cache support, I'd like
to go the similar way as kvm_cache_regs did.

>
> With these three patches applied gettimeofday() microbenchmark is
> 5% faster.

I will test if we include these write cache MSR, how much benefit we
can get. Can you provide some detail on how can you get the
performance data? :)

--
Thanks
Yang, Sheng