Re: [PATCH] x86/kvm: Show guest system/user cputime in cpustat

From: Avi Kivity
Date: Sat Mar 13 2010 - 03:26:38 EST


On 03/12/2010 10:53 AM, Qing He wrote:

When Qing(CCed) was working on nested VMX in the past, he found PV
vmread/vmwrite indeed works well(it would write to the virtual vmcs so vmwrite
can also benefit). Though compared to old machine(one our internal patch shows
improve more than 5%), NHM get less benefit due to the reduced vmexit cost.

One of the hurdles to PVize vmread/vmwrite is the fact that the memory
layout of physical vmcs remains unknown. Of course it can use the custom
vmcs layout utilized by nested virtualization, but that looks a little weird,
since different nested virtualization implementation may create different
custom layout.

Note we must use a custom layout and cannot depend on the physical layout, due to live migration. The layout becomes an ABI.

I once used another approach to partially accelerate the vmread/vmwrite
in nested virtualization case, which also gives good performance gain (around
7% on pre-nehalem, based on this, PV vmread/vmwrite had another 7%). That
is to make a shortcut to handle EXIT_REASON_VM{READ,WRITE}, without
even turning on the IF.

Interesting. That means our exit path is inefficient; it seems to imply half the time is spent outside the hardware vmexit path.

A quick profile (on non-Nehalem) shows many atomics and calls into the lapic, as well as update_cr8_intercept which is sometimes unnecessary; these could easily be optimized.

Definitely optimizing the non-paravirt path is preferred to adding more paravirtualization.

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/