mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0012-launch-libvirt-Don-t-enable-cpu-mode-host-model-on-T.patch

022f11
From 1d7136f27bb842dde00a2ec0dc2943eb16588cb4 Mon Sep 17 00:00:00 2001
022f11
From: "Richard W.M. Jones" <rjones@redhat.com>
022f11
Date: Wed, 14 Aug 2013 15:25:17 +0100
022f11
Subject: [PATCH] launch: libvirt: Don't enable <cpu mode="host-model"> on TCG.
022f11
022f11
It's fairly pointless to do this with TCG, since all we would be doing
022f11
is emulating a more complicated processor slowly.  Also it may be the
022f11
cause of subtle problems we see during testing.
022f11
022f11
This updates commit 6f76fdb41eb6bd124fbc3d084f5c2a3371b37d9b.
022f11
022f11
(cherry picked from commit 46763bcc0b9d04ada367f29ca07bd3e11e264a8e)
022f11
---
022f11
 src/launch-libvirt.c | 24 ++++++++++++++----------
022f11
 1 file changed, 14 insertions(+), 10 deletions(-)
022f11
022f11
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
022f11
index e6f6b0b..ff3d720 100644
022f11
--- a/src/launch-libvirt.c
022f11
+++ b/src/launch-libvirt.c
022f11
@@ -823,17 +823,21 @@ construct_libvirt_xml_cpu (guestfs_h *g,
022f11
   /* It is faster to pass the CPU host model to the appliance,
022f11
    * allowing maximum speed for things like checksums, encryption.
022f11
    * Note this may cause problems on some CPUs.  See: RHBZ#870071.
022f11
+   * Only do this with KVM.  It is broken in subtle ways on TCG, and
022f11
+   * fairly pointless anyway.
022f11
    */
022f11
-  XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "cpu"));
022f11
-  XMLERROR (-1,
022f11
-            xmlTextWriterWriteAttribute (xo, BAD_CAST "mode",
022f11
-                                         BAD_CAST "host-model"));
022f11
-  XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "model"));
022f11
-  XMLERROR (-1,
022f11
-            xmlTextWriterWriteAttribute (xo, BAD_CAST "fallback",
022f11
-                                         BAD_CAST "allow"));
022f11
-  XMLERROR (-1, xmlTextWriterEndElement (xo));
022f11
-  XMLERROR (-1, xmlTextWriterEndElement (xo));
022f11
+  if (params->is_kvm) {
022f11
+    XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "cpu"));
022f11
+    XMLERROR (-1,
022f11
+	      xmlTextWriterWriteAttribute (xo, BAD_CAST "mode",
022f11
+					   BAD_CAST "host-model"));
022f11
+    XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "model"));
022f11
+    XMLERROR (-1,
022f11
+	      xmlTextWriterWriteAttribute (xo, BAD_CAST "fallback",
022f11
+					   BAD_CAST "allow"));
022f11
+    XMLERROR (-1, xmlTextWriterEndElement (xo));
022f11
+    XMLERROR (-1, xmlTextWriterEndElement (xo));
022f11
+  }
022f11
 
022f11
   XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "vcpu"));
022f11
   XMLERROR (-1, xmlTextWriterWriteFormatString (xo, "%d", g->smp));
022f11
-- 
022f11
1.8.3.1
022f11