* [PATCH 1/2] KVM: VMX: Notify if VMX is already in use
@ 2011-12-01 18:30 Sasha Levin
2011-12-01 18:30 ` [PATCH 2/2] KVM: SVM: Notify if SVM " Sasha Levin
2011-12-07 14:17 ` [PATCH 1/2] KVM: VMX: Notify if VMX " Avi Kivity
0 siblings, 2 replies; 11+ messages in thread
From: Sasha Levin @ 2011-12-01 18:30 UTC (permalink / raw)
To: linux-kernel; +Cc: Sasha Levin, Joerg Roedel, Avi Kivity, Marcelo Tosatti, kvm
Currently we silently fail if VMX is already in use by a different
virtualization technology.
This is bad since it's non-obvious for the user, and its not too uncommon
for users to have several of these installed on same host.
This patch adds a message to notify the user of the problem.
Cc: Joerg Roedel <joerg.roedel@amd.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
arch/x86/kvm/vmx.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 4ceced2..0ef59ed 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2300,8 +2300,11 @@ static int hardware_enable(void *garbage)
u64 phys_addr = __pa(per_cpu(vmxarea, cpu));
u64 old, test_bits;
- if (read_cr4() & X86_CR4_VMXE)
+ if (read_cr4() & X86_CR4_VMXE) {
+ printk(KERN_ERR "hardware_enable: VMX already in use on CPU%d. "
+ "Are you already another hypervisor?\n", cpu);
return -EBUSY;
+ }
INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu));
rdmsrl(MSR_IA32_FEATURE_CONTROL, old);
--
1.7.8.rc4
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 2/2] KVM: SVM: Notify if SVM is already in use
2011-12-01 18:30 [PATCH 1/2] KVM: VMX: Notify if VMX is already in use Sasha Levin
@ 2011-12-01 18:30 ` Sasha Levin
2011-12-02 8:53 ` Joerg Roedel
2011-12-07 14:17 ` [PATCH 1/2] KVM: VMX: Notify if VMX " Avi Kivity
1 sibling, 1 reply; 11+ messages in thread
From: Sasha Levin @ 2011-12-01 18:30 UTC (permalink / raw)
To: linux-kernel; +Cc: Sasha Levin, Joerg Roedel, Avi Kivity, Marcelo Tosatti, kvm
Currently we silently fail if SVM is already in use by a different
virtualization technology.
This is bad since it's non-obvious for the user, and its not too uncommon
for users to have several of these installed on same host.
This patch adds a message to notify the user of the problem.
Cc: Joerg Roedel <joerg.roedel@amd.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
arch/x86/kvm/svm.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index e32243e..8d1a066 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -587,8 +587,11 @@ static int svm_hardware_enable(void *garbage)
int me = raw_smp_processor_id();
rdmsrl(MSR_EFER, efer);
- if (efer & EFER_SVME)
+ if (efer & EFER_SVME) {
+ printk(KERN_ERR "svm_hardware_enable: SVM already in use on CPU%d. "
+ "Are you already another hypervisor?\n", me);
return -EBUSY;
+ }
if (!has_svm()) {
printk(KERN_ERR "svm_hardware_enable: err EOPNOTSUPP on %d\n",
--
1.7.8.rc4
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 2/2] KVM: SVM: Notify if SVM is already in use
2011-12-01 18:30 ` [PATCH 2/2] KVM: SVM: Notify if SVM " Sasha Levin
@ 2011-12-02 8:53 ` Joerg Roedel
0 siblings, 0 replies; 11+ messages in thread
From: Joerg Roedel @ 2011-12-02 8:53 UTC (permalink / raw)
To: Sasha Levin; +Cc: linux-kernel, Avi Kivity, Marcelo Tosatti, kvm
On Thu, Dec 01, 2011 at 08:30:18PM +0200, Sasha Levin wrote:
> Currently we silently fail if SVM is already in use by a different
> virtualization technology.
>
> This is bad since it's non-obvious for the user, and its not too uncommon
> for users to have several of these installed on same host.
>
> This patch adds a message to notify the user of the problem.
>
> Cc: Joerg Roedel <joerg.roedel@amd.com>
> Cc: Avi Kivity <avi@redhat.com>
> Cc: Marcelo Tosatti <mtosatti@redhat.com>
> Cc: kvm@vger.kernel.org
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
> arch/x86/kvm/svm.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index e32243e..8d1a066 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -587,8 +587,11 @@ static int svm_hardware_enable(void *garbage)
> int me = raw_smp_processor_id();
>
> rdmsrl(MSR_EFER, efer);
> - if (efer & EFER_SVME)
> + if (efer & EFER_SVME) {
> + printk(KERN_ERR "svm_hardware_enable: SVM already in use on CPU%d. "
> + "Are you already another hypervisor?\n", me);
Hmm, this can nicely flood dmesg on a machine with many cores :) How
about removing the CPU%d part of the message and using printk_once?
Joerg
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] KVM: VMX: Notify if VMX is already in use
2011-12-01 18:30 [PATCH 1/2] KVM: VMX: Notify if VMX is already in use Sasha Levin
2011-12-01 18:30 ` [PATCH 2/2] KVM: SVM: Notify if SVM " Sasha Levin
@ 2011-12-07 14:17 ` Avi Kivity
2011-12-07 14:18 ` Sasha Levin
1 sibling, 1 reply; 11+ messages in thread
From: Avi Kivity @ 2011-12-07 14:17 UTC (permalink / raw)
To: Sasha Levin; +Cc: linux-kernel, Joerg Roedel, Marcelo Tosatti, kvm
On 12/01/2011 08:30 PM, Sasha Levin wrote:
> Currently we silently fail if VMX is already in use by a different
> virtualization technology.
>
> This is bad since it's non-obvious for the user, and its not too uncommon
> for users to have several of these installed on same host.
>
> This patch adds a message to notify the user of the problem.
>
Does this actually happen? With which hypervisor?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] KVM: VMX: Notify if VMX is already in use
2011-12-07 14:17 ` [PATCH 1/2] KVM: VMX: Notify if VMX " Avi Kivity
@ 2011-12-07 14:18 ` Sasha Levin
2011-12-07 14:23 ` Avi Kivity
0 siblings, 1 reply; 11+ messages in thread
From: Sasha Levin @ 2011-12-07 14:18 UTC (permalink / raw)
To: Avi Kivity; +Cc: linux-kernel, Joerg Roedel, Marcelo Tosatti, kvm
On Wed, 2011-12-07 at 16:17 +0200, Avi Kivity wrote:
> On 12/01/2011 08:30 PM, Sasha Levin wrote:
> > Currently we silently fail if VMX is already in use by a different
> > virtualization technology.
> >
> > This is bad since it's non-obvious for the user, and its not too uncommon
> > for users to have several of these installed on same host.
> >
> > This patch adds a message to notify the user of the problem.
> >
>
> Does this actually happen? With which hypervisor?
vbox
It turns VMX/SVM on when it loads, regardless of whether it's running a
guest or not.
--
Sasha.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] KVM: VMX: Notify if VMX is already in use
2011-12-07 14:18 ` Sasha Levin
@ 2011-12-07 14:23 ` Avi Kivity
2011-12-07 14:24 ` Sasha Levin
0 siblings, 1 reply; 11+ messages in thread
From: Avi Kivity @ 2011-12-07 14:23 UTC (permalink / raw)
To: Sasha Levin; +Cc: linux-kernel, Joerg Roedel, Marcelo Tosatti, kvm
On 12/07/2011 04:18 PM, Sasha Levin wrote:
> On Wed, 2011-12-07 at 16:17 +0200, Avi Kivity wrote:
> > On 12/01/2011 08:30 PM, Sasha Levin wrote:
> > > Currently we silently fail if VMX is already in use by a different
> > > virtualization technology.
> > >
> > > This is bad since it's non-obvious for the user, and its not too uncommon
> > > for users to have several of these installed on same host.
> > >
> > > This patch adds a message to notify the user of the problem.
> > >
> >
> > Does this actually happen? With which hypervisor?
>
> vbox
>
> It turns VMX/SVM on when it loads, regardless of whether it's running a
> guest or not.
That's odd. IIRC when we discussed this with them, they were executing
VMXON/VMXOFF dynamically. Looks like they changed this.
Anyway, please adjust according to Joerg's comment (and add the word
"using"), and I'll apply.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] KVM: VMX: Notify if VMX is already in use
2011-12-07 14:23 ` Avi Kivity
@ 2011-12-07 14:24 ` Sasha Levin
2011-12-07 14:26 ` Avi Kivity
0 siblings, 1 reply; 11+ messages in thread
From: Sasha Levin @ 2011-12-07 14:24 UTC (permalink / raw)
To: Avi Kivity; +Cc: linux-kernel, Joerg Roedel, Marcelo Tosatti, kvm
On Wed, 2011-12-07 at 16:23 +0200, Avi Kivity wrote:
> On 12/07/2011 04:18 PM, Sasha Levin wrote:
> > On Wed, 2011-12-07 at 16:17 +0200, Avi Kivity wrote:
> > > On 12/01/2011 08:30 PM, Sasha Levin wrote:
> > > > Currently we silently fail if VMX is already in use by a different
> > > > virtualization technology.
> > > >
> > > > This is bad since it's non-obvious for the user, and its not too uncommon
> > > > for users to have several of these installed on same host.
> > > >
> > > > This patch adds a message to notify the user of the problem.
> > > >
> > >
> > > Does this actually happen? With which hypervisor?
> >
> > vbox
> >
> > It turns VMX/SVM on when it loads, regardless of whether it's running a
> > guest or not.
>
> That's odd. IIRC when we discussed this with them, they were executing
> VMXON/VMXOFF dynamically. Looks like they changed this.
>
> Anyway, please adjust according to Joerg's comment (and add the word
> "using"), and I'll apply.
I've seen it the day before I've sent those patches. vbox driver loaded,
kvm silently failed and rdmsr showed SVME turned on.
Will resend.
--
Sasha.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] KVM: VMX: Notify if VMX is already in use
2011-12-07 14:24 ` Sasha Levin
@ 2011-12-07 14:26 ` Avi Kivity
2011-12-07 14:42 ` Sasha Levin
2011-12-07 15:15 ` Sasha Levin
0 siblings, 2 replies; 11+ messages in thread
From: Avi Kivity @ 2011-12-07 14:26 UTC (permalink / raw)
To: Sasha Levin; +Cc: linux-kernel, Joerg Roedel, Marcelo Tosatti, kvm
On 12/07/2011 04:24 PM, Sasha Levin wrote:
> >
> > That's odd. IIRC when we discussed this with them, they were executing
> > VMXON/VMXOFF dynamically. Looks like they changed this.
> >
> > Anyway, please adjust according to Joerg's comment (and add the word
> > "using"), and I'll apply.
>
> I've seen it the day before I've sent those patches. vbox driver loaded,
> kvm silently failed and rdmsr showed SVME turned on.
>
> Will resend.
Ah, maybe they do it differently on AMD. Or they changed things.
btw, was it really silent? Didn't modprobe complain?
The patch makes sense in any case.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] KVM: VMX: Notify if VMX is already in use
2011-12-07 14:26 ` Avi Kivity
@ 2011-12-07 14:42 ` Sasha Levin
2011-12-07 15:15 ` Sasha Levin
1 sibling, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2011-12-07 14:42 UTC (permalink / raw)
To: Avi Kivity; +Cc: linux-kernel, Joerg Roedel, Marcelo Tosatti, kvm
On Wed, 2011-12-07 at 16:26 +0200, Avi Kivity wrote:
> On 12/07/2011 04:24 PM, Sasha Levin wrote:
> > >
> > > That's odd. IIRC when we discussed this with them, they were executing
> > > VMXON/VMXOFF dynamically. Looks like they changed this.
> > >
> > > Anyway, please adjust according to Joerg's comment (and add the word
> > > "using"), and I'll apply.
> >
> > I've seen it the day before I've sent those patches. vbox driver loaded,
> > kvm silently failed and rdmsr showed SVME turned on.
> >
> > Will resend.
>
> Ah, maybe they do it differently on AMD. Or they changed things.
>
> btw, was it really silent? Didn't modprobe complain?
>
> The patch makes sense in any case.
Not totally silent, there was an error about KVM failing to enable
hardware virtualization, but it was generic and didn't really point to
the problem.
--
Sasha.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] KVM: VMX: Notify if VMX is already in use
2011-12-07 14:26 ` Avi Kivity
2011-12-07 14:42 ` Sasha Levin
@ 2011-12-07 15:15 ` Sasha Levin
2011-12-07 15:31 ` Avi Kivity
1 sibling, 1 reply; 11+ messages in thread
From: Sasha Levin @ 2011-12-07 15:15 UTC (permalink / raw)
To: Avi Kivity; +Cc: linux-kernel, Joerg Roedel, Marcelo Tosatti, kvm
On Wed, 2011-12-07 at 16:26 +0200, Avi Kivity wrote:
> On 12/07/2011 04:24 PM, Sasha Levin wrote:
> > >
> > > That's odd. IIRC when we discussed this with them, they were executing
> > > VMXON/VMXOFF dynamically. Looks like they changed this.
> > >
> > > Anyway, please adjust according to Joerg's comment (and add the word
> > > "using"), and I'll apply.
> >
> > I've seen it the day before I've sent those patches. vbox driver loaded,
> > kvm silently failed and rdmsr showed SVME turned on.
> >
> > Will resend.
>
> Ah, maybe they do it differently on AMD. Or they changed things.
I've grabbed their code just to see whats going on there and traced the
vmxon calls back to module init.
Are you sure it ever happened on-demand and not on init? If you are,
I'll actually build that module and give it a go :)
--
Sasha.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] KVM: VMX: Notify if VMX is already in use
2011-12-07 15:15 ` Sasha Levin
@ 2011-12-07 15:31 ` Avi Kivity
0 siblings, 0 replies; 11+ messages in thread
From: Avi Kivity @ 2011-12-07 15:31 UTC (permalink / raw)
To: Sasha Levin; +Cc: linux-kernel, Joerg Roedel, Marcelo Tosatti, kvm
On 12/07/2011 05:15 PM, Sasha Levin wrote:
> > Ah, maybe they do it differently on AMD. Or they changed things.
>
> I've grabbed their code just to see whats going on there and traced the
> vmxon calls back to module init.
>
> Are you sure it ever happened on-demand and not on init? If you are,
> I'll actually build that module and give it a go :)
I'm pretty sure, but they likely changed things. vmxon/off all the time
is not very performant.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-12-07 15:31 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-01 18:30 [PATCH 1/2] KVM: VMX: Notify if VMX is already in use Sasha Levin
2011-12-01 18:30 ` [PATCH 2/2] KVM: SVM: Notify if SVM " Sasha Levin
2011-12-02 8:53 ` Joerg Roedel
2011-12-07 14:17 ` [PATCH 1/2] KVM: VMX: Notify if VMX " Avi Kivity
2011-12-07 14:18 ` Sasha Levin
2011-12-07 14:23 ` Avi Kivity
2011-12-07 14:24 ` Sasha Levin
2011-12-07 14:26 ` Avi Kivity
2011-12-07 14:42 ` Sasha Levin
2011-12-07 15:15 ` Sasha Levin
2011-12-07 15:31 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).