Patchwork [3/3] pc: use -cpu host as default for kvm

login
register
mail settings
Submitter Alexander Graf
Date June 14, 2011, 3:29 p.m.
Message ID <1308065389-11945-4-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/100362/
State New
Headers show

Comments

Alexander Graf - June 14, 2011, 3:29 p.m.
When running with KVM, people expect to get the best possible performance
inside the VM. To really get this, the guest needs to know about the CPU
features it can use.

We have a CPU type that exports exactly this information to the guest, but
hasn't been used much, as it wasn't the default. Set it as default for the
PC machine now, so people get good performance without changing options.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/pc.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/pc.c b/hw/pc.c
index a3e8539..475d20e 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -41,6 +41,7 @@ 
 #include "sysemu.h"
 #include "blockdev.h"
 #include "ui/qemu-spice.h"
+#include "kvm.h"
 
 /* output Bochs bios info messages */
 //#define DEBUG_BIOS
@@ -945,11 +946,15 @@  void pc_cpus_init(const char *cpu_model)
 
     /* init CPUs */
     if (cpu_model == NULL) {
+        if (kvm_enabled()) {
+            cpu_model = "host";
+        } else {
 #ifdef TARGET_X86_64
-        cpu_model = "qemu64";
+            cpu_model = "qemu64";
 #else
-        cpu_model = "qemu32";
+            cpu_model = "qemu32";
 #endif
+        }
     }
 
     for(i = 0; i < smp_cpus; i++) {