Starting with version 2.9.0, qemu can use:
qemu-system-x86_64 -M accel=tcg -cpu host
without breaking. This only applies to x86 (i386 or x86_64) at the
moment. If we detect these conditions, pass -cpu host
unconditionally.
This should hopefully address problems where other hypervisors
(eg. VirtualBox) are running, which breaks KVM in a way that we cannot
detect, and consequently breaks libguestfs.
---
src/appliance-cpu.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/appliance-cpu.c b/src/appliance-cpu.c
index a7cf1eb..fa7e941 100644
--- a/src/appliance-cpu.c
+++ b/src/appliance-cpu.c
@@ -63,7 +63,7 @@
*
* We don't know for sure if KVM will work, but C<-cpu host> is broken
* with TCG, so we almost always pass a broken C<-cpu> flag if KVM is
- * semi-broken in any way.
+ * semi-broken in any way. (This is fixed in qemu 2.9, thanks Eduardo!)
*
* =back
*/
@@ -77,6 +77,14 @@ guestfs_int_get_cpu_model (int kvm, const struct version
*qemu_version)
else
return "cortex-a57";
#else
+#if defined(__i386__) || defined(__x86_64__)
+ /* Eduardo added the ability to use -cpu host with TCG on x86 in
+ * qemu 2.9.
+ */
+ if (guestfs_int_version_ge (qemu_version, 2, 9, 0))
+ return "host";
+ /* otherwise fallthrough */
+#endif
/* On most architectures, it is faster to pass the CPU host model to
* the appliance, allowing maximum speed for things like checksums
* and encryption. Only do this with KVM. It is broken in subtle
--
2.10.2