Skip to contentSkip to conversation

KVM: VMX: Notify if VMX is already in use

PATCH In review Sasha Levin 2 participants 3 messages Dec 7, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 KVM: VMX: Notify if VMX is already in use

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.

---
 arch/x86/kvm/vmx.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kvm/vmx.c +4 -1
index 4ceced2..0ef59ed 100644
@@ -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_once(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);
Signature · 1 line
1.7.8
#1 lore raw

PATCH v2 2/2 KVM: SVM: Notify if SVM is already in use

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.

---
 arch/x86/kvm/svm.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kvm/svm.c +4 -1
index e32243e..8d1a066 100644
@@ -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_once(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",
Signature · 1 line
1.7.8
#2 lore raw
In reply to Sasha Levin

Am 07.12.2011 15:34, schrieb Sasha Levin:

Quoted 7 lines

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.

Being more verbose is a good move.

Quoted 10 lines
---
 arch/x86/kvm/vmx.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kvm/vmx.c +0 -0
index 4ceced2..0ef59ed 100644

arch/x86/kvm/vmx.c static int hardware_enable(void *garbage) · line 2305

Quoted 7 lines
arch/x86/kvm/vmx.c +3 -1
@@ -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_once(KERN_ERR "hardware_enable: VMX already in use on CPU%d. "
+				"Are you already another hypervisor?\n", cpu);

Since this question addresses the user, it should read:
"Are you already using another hypervisor?\n" (or the like)

Applies to 2/2 as well.

Andreas

Quoted 5 lines
arch/x86/kvm/vmx.c +1 -0
 		return -EBUSY;
+	}
 
 	INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu));
 	rdmsrl(MSR_IA32_FEATURE_CONTROL, old);
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg