Re: [PATCH v3 2/3] PowerPC : Add support for launching VMs in 'compat' mode.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26.10.2014 12:07, Prerna Saxena wrote:

From c3572e59f1e56322ba92ab35e31da48dd63b7cec Mon Sep 17 00:00:00 2001
From: Prerna Saxena <prerna@xxxxxxxxxxxxxxxxxx>
Date: Tue, 21 Oct 2014 01:06:51 -0400

PowerISA allows processors to run VMs in binary compatibility ("compat")
mode supporting an older version of ISA. QEMU has recently added support to
explicitly denote a VM running in compatibility mode through commit 6d9412ea
& 8dfa3a5e85.
Now, a "compat" mode VM can be run by invoking this qemu commandline on a
POWER8 host:  -cpu host,compat=power7.

This patch allows libvirt to extend the "fallback" semantics of cpu model to
describe this new mode for PowerKVM guests.
As an example:
When a user wants to request a power7 vm to run in compatibility mode on
a Power8 host, this can be described in XML as follows :
   <cpu mode='host-model'>
     <model fallback='compat'>power7</model>
   </cpu>

Signed-off-by: Prerna Saxena <prerna@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Li Zhang <zhlcindy@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Pradipta Kr. Banerjee <bpradip@xxxxxxxxxx>
---
  docs/schemas/domaincommon.rng |  1 +
  src/conf/cpu_conf.c           |  4 +++-
  src/conf/cpu_conf.h           |  1 +
  src/cpu/cpu_powerpc.c         | 14 ++++----------
  src/qemu/qemu_command.c       | 11 ++++++++++-
  5 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 20d81ae..ebab482 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4067,6 +4067,7 @@
            <choice>
              <value>allow</value>
              <value>forbid</value>
+            <value>compat</value>
            </choice>
          </attribute>
        </optional>

Each RNG change should go hand in hand with docs change. Therefore I can't ACK this one.

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 9b7fbb0..e12d3db 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -47,7 +47,8 @@ VIR_ENUM_IMPL(virCPUMatch, VIR_CPU_MATCH_LAST,

  VIR_ENUM_IMPL(virCPUFallback, VIR_CPU_FALLBACK_LAST,
                "allow",
-              "forbid")
+              "forbid",
+              "compat")

  VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST,
                "force",
@@ -619,6 +620,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
          return 0;

      formatModel = (def->mode == VIR_CPU_MODE_CUSTOM ||
+                   def->mode == VIR_CPU_MODE_HOST_MODEL ||
                     (flags & VIR_DOMAIN_XML_UPDATE_CPU));
      formatFallback = (def->type == VIR_CPU_TYPE_GUEST &&
                        (def->mode == VIR_CPU_MODE_HOST_MODEL ||
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index d45210b..69d8584 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -65,6 +65,7 @@ VIR_ENUM_DECL(virCPUMatch)
  typedef enum {
      VIR_CPU_FALLBACK_ALLOW,
      VIR_CPU_FALLBACK_FORBID,
+    VIR_CPU_FALLBACK_COMPAT,

      VIR_CPU_FALLBACK_LAST
  } virCPUFallback;
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index d591c18..ad887fe 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -479,7 +479,8 @@ ppcDecode(virCPUDefPtr cpu,
          goto cleanup;
      }

-    if (!cpuModelIsAllowed(model->name, models, nmodels)) {
+    if (cpu->fallback != VIR_CPU_FALLBACK_COMPAT &&
+          !cpuModelIsAllowed(model->name, models, nmodels)) {

Indentation's off.

          virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                         _("CPU model %s is not supported by hypervisor"),
                         model->name);
@@ -562,8 +563,8 @@ ppcUpdate(virCPUDefPtr guest,
  static virCPUDefPtr
  ppcBaseline(virCPUDefPtr *cpus,
              unsigned int ncpus,
-            const char **models,
-            unsigned int nmodels,
+            const char **models ATTRIBUTE_UNUSED,
+            unsigned int nmodels ATTRIBUTE_UNUSED,
              unsigned int flags)
  {


Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]