Skip to contentSkip to conversation

kvm-20 release

ANNOUNCE Avi Kivity 3 participants 9 messages Apr 22, 2007 – Apr 24, 2007 8 messages not in the archive KVM

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

Significant cpu performance improvements (esp. for 32-bit guests on 64-bit hosts), as well as Windows 2000 support (without acpi).

Changes from kvm-19:
- Windows 2000 support
- performance enhancements
- patch against latest kernel tree included in tarball
- fix oops with 32-bit nonpae guests

Note that if you use the modules from Linux 2.6.20, you need to use kvm-12. You can use kvm-20 with Linux 2.6.20, provided you use the external module included in kvm-20. API/ABI stability is planned for Linux 2.6.22.

http://kvm.qumranet.com

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): 462B372C.4050207-atKUWr5tajBWk0Htik3J/[email protected]

#2 lore raw
Quoted 2 lines · Avi Kivity

Significant cpu performance improvements (esp. for 32-bit guests on 64-bit hosts), as well as Windows 2000 support (without acpi).

Avi,

Ecountered the following error with kvm-20 (external modules) on Linux-2.6.21-rc7.

kvm_run: failed entry, reason 7
kvm_run returned -8

Runs fine with kvm-19 (external modules).

Am I missing something?

Thanks,
Jeff.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): b6a2187b0704230652q27bf8178q2c8b0b55807085ad-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#4 lore raw
Quoted 9 lines · Jeff Chua
Quoted 2 lines · Avi Kivity

Significant cpu performance improvements (esp. for 32-bit guests on 64-bit hosts), as well as Windows 2000 support (without acpi).

Avi,

Ecountered the following error with kvm-20 (external modules) on Linux-2.6.21-rc7.

Quoted 7 lines

kvm_run: failed entry, reason 7
kvm_run returned -8

Runs fine with kvm-19 (external modules).

Am I missing something?

I'm missing something:

- what host cpu?

- what host bitness?

- what guest OS?

Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): 462DC453.7000608-atKUWr5tajBWk0Htik3J/[email protected]

#6 lore raw
Quoted 17 lines · Avi Kivity
Quoted 9 lines · Jeff Chua
Quoted 2 lines · Avi Kivity

Significant cpu performance improvements (esp. for 32-bit guests on 64-bit hosts), as well as Windows 2000 support (without acpi).

Avi,

Ecountered the following error with kvm-20 (external modules) on Linux-2.6.21-rc7.

Quoted 6 lines

kvm_run: failed entry, reason 7
kvm_run returned -8

Runs fine with kvm-19 (external modules).

Am I missing something?

Quoted 7 lines

I'm missing something:

- what host cpu?

- what host bitness?

- what guest OS?

Hi Avi,

same here, so I will answer in place:

Samsung X11 with Intel Core Duo T2300 with Gentoo Linux and Kernel 2.6.21-rc7
+ kvm-20. Guest OS is Win XP.

Additionally I've patched my kernel with cfs v5 now. I thought that could be the problem... Jeff, are you running cfs or any non mainline scheduler as well?

Signature · 2 lines
Regards,
Chris

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#8 lore raw
Quoted 32 lines · Christian Hesse
Quoted 19 lines · Avi Kivity
Quoted 10 lines · Jeff Chua
Quoted 3 lines · Avi Kivity

Significant cpu performance improvements (esp. for 32-bit guests on 64-bit hosts), as well as Windows 2000 support (without acpi).

Avi,

Ecountered the following error with kvm-20 (external modules) on Linux-2.6.21-rc7.

Quoted 7 lines

kvm_run: failed entry, reason 7
kvm_run returned -8

Runs fine with kvm-19 (external modules).

Am I missing something?

Quoted 8 lines

I'm missing something:

- what host cpu?

- what host bitness?

- what guest OS?

Hi Avi,

Quoted 9 lines

same here, so I will answer in place:

Samsung X11 with Intel Core Duo T2300 with Gentoo Linux and Kernel 2.6.21-rc7
+ kvm-20. Guest OS is Win XP.

Additionally I've patched my kernel with cfs v5 now. I thought that could be the problem... Jeff, are you running cfs or any non mainline scheduler as well?

It may be the cpuid strangeness that Rusty saw. Can you try the attached patch?

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
qemu/qemu-kvm.c +47 -31
index e00b0f3..46b0b99 100644
@@ -682,6 +682,49 @@ void kvm_qemu_destroy(void)
     kvm_finalize(kvm_context);
 }
 
+static void host_cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx,
+		       uint32_t *ecx, uint32_t *edx)
+{
+    uint32_t vec[4];
+
+    vec[0] = function;
+    asm volatile (
+#ifdef __x86_64__
+         "push %0;  push %%rsi \n\t"
+	 "push %%rax; push %%rbx; push %%rcx; push %%rdx \n\t"
+	 "mov 8*5(%%rsp), %%rsi \n\t"
+	 "mov (%%rsi), %%eax \n\t"
+	 "cpuid \n\t"
+	 "mov %%eax, (%%rsi) \n\t"
+	 "mov %%ebx, 4(%%rsi) \n\t"
+	 "mov %%ecx, 8(%%rsi) \n\t"
+	 "mov %%edx, 12(%%rsi) \n\t"
+	 "pop %%rdx; pop %%rcx; pop %%rbx; pop %%rax \n\t"
+	 "pop %%rsi; pop %0 \n\t"
+#else
+         "push %0;  push %%esi \n\t"
+	 "push %%eax; push %%ebx; push %%ecx; push %%edx \n\t"
+	 "mov 4*5(%%esp), %%esi \n\t"
+	 "mov (%%esi), %%eax \n\t"
+	 "cpuid \n\t"
+	 "mov %%eax, (%%esi) \n\t"
+	 "mov %%ebx, 4(%%esi) \n\t"
+	 "mov %%ecx, 8(%%esi) \n\t"
+	 "mov %%edx, 12(%%esi) \n\t"
+	 "pop %%edx; pop %%ecx; pop %%ebx; pop %%eax \n\t"
+	 "pop %%esi; pop %0 \n\t"
+#endif
+	 : : "rm"(vec) : "memory");
+    if (eax)
+	*eax = vec[0];
+    if (ebx)
+	*ebx = vec[1];
+    if (ecx)
+	*ecx = vec[2];
+    if (edx)
+	*edx = vec[3];
+}
+
 static void do_cpuid_ent(struct kvm_cpuid_entry *e, uint32_t function)
 {
     EAX = function;
@@ -694,17 +737,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry *e, uint32_t function)
     if (function == 1)
 	e->edx &= ~(1 << 12); /* disable mtrr support */
     if (function == 0x80000001) {
-	unsigned long h_eax = function, h_edx;
+	uint32_t h_eax, h_edx;
 
-
-	// push/pop hack to workaround gcc 3 register pressure trouble
-	asm (
-#ifdef __x86_64__
-	     "push %%rbx; push %%rcx; cpuid; pop %%rcx; pop %%rbx"
-#else
-	     "push %%ebx; push %%ecx; cpuid; pop %%ecx; pop %%ebx"
-#endif
-	     : "+a"(h_eax), "=d"(h_edx));
+	host_cpuid(function, &h_eax, NULL, NULL, &h_edx);
 
 	// long mode
 	if ((h_edx & 0x20000000) == 0)
@@ -722,27 +757,8 @@ static void do_cpuid_ent(struct kvm_cpuid_entry *e, uint32_t function)
     // is you use compatibility mode.
     if (function == 0) {
 	uint32_t bcd[3];
-	asm (
-#ifdef __x86_64__
-	     "push %%rax; push %%rbx; push %%rcx; push %%rdx \n\t"
-	     "mov $0, %%eax \n\t"
-	     "cpuid \n\t"
-	     "mov (%%rsp), %%rax \n\t"
-	     "mov %%ebx, (%%rax) \n\t"
-	     "mov %%ecx, 4(%%rax) \n\t"
-	     "mov %%edx, 8(%%rax) \n\t"
-	     "pop %%rdx; pop %%rcx; pop %%rbx; pop %%rax"
-#else
-	     "push %%eax; push %%ebx; push %%ecx; push %%edx \n\t"
-	     "mov $0, %%eax \n\t"
-	     "cpuid \n\t"
-	     "mov (%%esp), %%eax \n\t"
-	     "mov %%ebx, (%%eax) \n\t"
-	     "mov %%ecx, 4(%%eax) \n\t"
-	     "mov %%edx, 8(%%eax) \n\t"
-	     "pop %%edx; pop %%ecx; pop %%ebx; pop %%eax"
-#endif
-	     : : "d"(bcd) : "memory");
+
+	host_cpuid(0, NULL, &bcd[0], &bcd[1], &bcd[2]);
 	e->ebx = bcd[0];
 	e->ecx = bcd[1];
 	e->edx = bcd[2];

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): 462DCC66.3000902-atKUWr5tajBWk0Htik3J/[email protected]

#10 lore raw
Quoted 34 lines · Avi Kivity
Quoted 33 lines · Christian Hesse
Quoted 17 lines · Avi Kivity
Quoted 9 lines · Jeff Chua
Quoted 2 lines · Avi Kivity

Significant cpu performance improvements (esp. for 32-bit guests on 64-bit hosts), as well as Windows 2000 support (without acpi).

Avi,

Ecountered the following error with kvm-20 (external modules) on Linux-2.6.21-rc7.

Quoted 6 lines

kvm_run: failed entry, reason 7
kvm_run returned -8

Runs fine with kvm-19 (external modules).

Am I missing something?

Quoted 7 lines

I'm missing something:

- what host cpu?

- what host bitness?

- what guest OS?

Hi Avi,

same here, so I will answer in place:

Samsung X11 with Intel Core Duo T2300 with Gentoo Linux and Kernel 2.6.21-rc7 + kvm-20. Guest OS is Win XP.

Quoted 6 lines
Quoted 3 lines

Additionally I've patched my kernel with cfs v5 now. I thought that could be the problem... Jeff, are you running cfs or any non mainline scheduler as well?

It may be the cpuid strangeness that Rusty saw. Can you try the attached patch?

No, that does not help.

Signature · 2 lines
Regards,
Chris

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#12 lore raw
Quoted 6 lines · Christian Hesse
Quoted 3 lines

It may be the cpuid strangeness that Rusty saw. Can you try the attached patch?

No, that does not help.

Ah, I see it. The Core processor does not have the STAR msr.

Can you try backing out the attached patch?

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

commit 5c828f83928f186320d74627089122ebc9ea98ce

Author: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/[email protected]>
Date:   Thu Apr 19 14:28:44 2007 +0300

KVM: VMX: Only save/restore MSR_K6_STAR if necessary

Intel hosts only support syscall/sysret in long more (and only if efer.sce is enabled), so only reload the related MSR_K6_STAR if the guest will actually be able to use it.

This reduces vmexit cost by about 500 cycles (6400 -> 5870) on my setup.

drivers/kvm/vmx.c +10 -0
index b61d4dd..3f43f50 100644
@@ -323,6 +323,16 @@ static void setup_msrs(struct kvm_vcpu *vcpu)
 		nr_skip = NR_64BIT_MSRS;
 	nr_good_msrs = vcpu->nmsrs - nr_skip;
 
+	/*
+	 * MSR_K6_STAR is only needed on long mode guests, and only
+	 * if efer.sce is enabled.
+	 */
+	--nr_good_msrs;
+#if CONFIG_X86_64
+	if (is_long_mode(vcpu) && (vcpu->shadow_efer & EFER_SCE))
+		++nr_good_msrs;
+#endif
+
 	vmcs_writel(VM_ENTRY_MSR_LOAD_ADDR,
 		    virt_to_phys(vcpu->guest_msrs + nr_skip));
 	vmcs_writel(VM_EXIT_MSR_STORE_ADDR,

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): 462DD964.8060204-atKUWr5tajBWk0Htik3J/[email protected]

#14 lore raw
Quoted 9 lines · Avi Kivity
Quoted 4 lines · Christian Hesse
Quoted 2 lines

It may be the cpuid strangeness that Rusty saw. Can you try the attached patch?

No, that does not help.

Ah, I see it. The Core processor does not have the STAR msr.

Can you try backing out the attached patch?

Yes, it works now. Thanks a lot!

Signature · 2 lines
Regards,
Chris

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw
Quoted 5 lines · Christian Hesse
Quoted 4 lines · Avi Kivity
Quoted 3 lines · Christian Hesse
Quoted 2 lines

It may be the cpuid strangeness that Rusty saw. Can you try the attached patch?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

No, that does not help.

Ah, I see it. The Core processor does not have the STAR msr.

Can you try backing out the attached patch?

Yes, it works now. Thanks a lot!

Tested, and that works for me as well.

CPU is Intel Core Duo CPU L2500 @ 1.83GHz

Thanks,
Jeff.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/