All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: Pekka Enberg <penberg@kernel.org>
Cc: Sasha Levin <levinsasha928@gmail.com>,
	mingo@elte.hu, asias.hejun@gmail.com, kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] kvm tools: set the HYPERVISOR flag in cpuid
Date: Wed, 20 Jun 2012 11:37:39 +0400	[thread overview]
Message-ID: <20120620073739.GA1950@moon> (raw)
In-Reply-To: <alpine.LFD.2.02.1206201023010.2019@tux.localdomain>

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@gmail.com>
> > 
> > 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@gmail.com>
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@gmail.com>
[gorcunov@: Add comments on bits]
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 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:

  reply	other threads:[~2012-06-20  7:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-15 11:34 [PATCH 1/2] kvm tools: set the HYPERVISOR flag in cpuid Sasha Levin
2012-06-15 11:34 ` [PATCH 2/2] kvm tools: support 9p flush command Sasha Levin
2012-06-20  7:23   ` Pekka Enberg
2012-06-15 11:38 ` [PATCH 1/2] kvm tools: set the HYPERVISOR flag in cpuid Cyrill Gorcunov
2012-06-20  7:23   ` Pekka Enberg
2012-06-20  7:37     ` Cyrill Gorcunov [this message]
2012-06-20  7:59       ` Pekka Enberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120620073739.GA1950@moon \
    --to=gorcunov@openvz.org \
    --cc=asias.hejun@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.