On Wed, Jun 20, 2012 at 10:23:06AM +0300, Pekka Enberg wrote: > On Fri, 15 Jun 2012, Cyrill Gorcunov wrote: > > > On Fri, Jun 15, 2012 at 01:34:16PM +0200, Sasha Levin wrote: > > > We need to set the HYPERVISOR flag to let the kernel know we're running > > > under a hypervisor. > > > > > > This makes the kernel enable all sorts of para-virtualization options > > > such as kvm-clock. > > > > > > Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx> > > > > OK, looks good, but please Sasha, add a comment into the code > > itself about the bitflag enabled (or maybe Pekka would add at > > merge time). > > Sasha? I think it should be something like below Cyrill --- From: Sasha Levin <levinsasha928@xxxxxxxxx> Subject: [PATCH] kvm tools: set the HYPERVISOR flag in cpuid We need to set the HYPERVISOR flag to let the kernel know we're running under a hypervisor. This makes the kernel enable all sorts of para-virtualization options such as kvm-clock. Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx> [gorcunov@: Add comments on bits] Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx> --- tools/kvm/x86/cpuid.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) Index: linux-2.6.git/tools/kvm/x86/cpuid.c =================================================================== --- linux-2.6.git.orig/tools/kvm/x86/cpuid.c +++ linux-2.6.git/tools/kvm/x86/cpuid.c @@ -21,8 +21,13 @@ static void filter_cpuid(struct kvm_cpui struct kvm_cpuid_entry2 *entry = &kvm_cpuid->entries[i]; switch (entry->function) { + case 1: + /* Set X86_FEATURE_HYPERVISOR */ + if (entry->index == 0) + entry->ecx |= (1 << 31); + break; case 6: - /* Clear presence of IA32_ENERGY_PERF_BIAS */ + /* Clear X86_FEATURE_EPB */ entry->ecx = entry->ecx & ~(1 << 3); break; case CPUID_FUNC_PERFMON: -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html