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

[libvirt] [PATCH 1/2] conf: qemu: add support for Hyper-V PV IPIs



Qemu-3.1 supports Hyper-V-style PV IPIs making it cheaper for Windows
guests to send an IPI, especially when it targets many CPUs.

Signed-off-by: Vitaly Kuznetsov <vkuznets redhat com>
---
 docs/formatdomain.html.in               | 7 +++++++
 docs/schemas/domaincommon.rng           | 5 +++++
 src/conf/domain_conf.c                  | 6 +++++-
 src/conf/domain_conf.h                  | 1 +
 src/cpu/cpu_x86.c                       | 3 +++
 src/cpu/cpu_x86_data.h                  | 1 +
 src/qemu/qemu_command.c                 | 1 +
 src/qemu/qemu_parse_command.c           | 1 +
 src/qemu/qemu_process.c                 | 1 +
 tests/qemuxml2argvdata/hyperv-off.xml   | 1 +
 tests/qemuxml2argvdata/hyperv.args      | 2 +-
 tests/qemuxml2argvdata/hyperv.xml       | 1 +
 tests/qemuxml2xmloutdata/hyperv-off.xml | 1 +
 tests/qemuxml2xmloutdata/hyperv.xml     | 1 +
 14 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 269741a690..24d4b68d7b 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1981,6 +1981,7 @@
     &lt;frequencies state='on'/&gt;
     &lt;reenlightenment state='on'/&gt;
     &lt;tlbflush state='on'/&gt;
+    &lt;ipi state='on'/&gt;
   &lt;/hyperv&gt;
   &lt;kvm&gt;
     &lt;hidden state='on'/&gt;
@@ -2121,6 +2122,12 @@
           <td> on, off</td>
           <td><span class="since">4.7.0 (QEMU 3.0)</span></td>
         </tr>
+        <tr>
+          <td>ipi</td>
+          <td>Enable PV IPI support</td>
+          <td> on, off</td>
+          <td><span class="since">4.10.0 (QEMU 3.1)</span></td>
+        </tr>
       </table>
       </dd>
       <dt><code>pvspinlock</code></dt>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index b9ac5df479..26019b3279 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5769,6 +5769,11 @@
             <ref name="featurestate"/>
           </element>
         </optional>
+        <optional>
+          <element name="ipi">
+            <ref name="featurestate"/>
+          </element>
+        </optional>
       </interleave>
     </element>
   </define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e8e0adc819..c8cde90808 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -172,7 +172,8 @@ VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
               "vendor_id",
               "frequencies",
               "reenlightenment",
-              "tlbflush")
+              "tlbflush",
+              "ipi")
 
 VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST,
               "hidden")
@@ -19990,6 +19991,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             case VIR_DOMAIN_HYPERV_FREQUENCIES:
             case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
             case VIR_DOMAIN_HYPERV_TLBFLUSH:
+            case VIR_DOMAIN_HYPERV_IPI:
                 break;
 
             case VIR_DOMAIN_HYPERV_SPINLOCKS:
@@ -22184,6 +22186,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
             case VIR_DOMAIN_HYPERV_FREQUENCIES:
             case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
             case VIR_DOMAIN_HYPERV_TLBFLUSH:
+            case VIR_DOMAIN_HYPERV_IPI:
                 if (src->hyperv_features[i] != dst->hyperv_features[i]) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    _("State of HyperV enlightenment "
@@ -27948,6 +27951,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
                     case VIR_DOMAIN_HYPERV_FREQUENCIES:
                     case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
                     case VIR_DOMAIN_HYPERV_TLBFLUSH:
+                    case VIR_DOMAIN_HYPERV_IPI:
                         break;
 
                     case VIR_DOMAIN_HYPERV_SPINLOCKS:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e30a4b2fe7..9eea75548d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1795,6 +1795,7 @@ typedef enum {
     VIR_DOMAIN_HYPERV_FREQUENCIES,
     VIR_DOMAIN_HYPERV_REENLIGHTENMENT,
     VIR_DOMAIN_HYPERV_TLBFLUSH,
+    VIR_DOMAIN_HYPERV_IPI,
 
     VIR_DOMAIN_HYPERV_LAST
 } virDomainHyperv;
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 69a0c8db28..33252e927e 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -114,6 +114,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT,
                 0x40000003, 0x00002000);
 KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_TLBFLUSH,
                 0x40000004, 0x00000004);
+KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_IPI,
+                0x40000004, 0x00000400);
 
 static virCPUx86Feature x86_kvm_features[] =
 {
@@ -137,6 +139,7 @@ static virCPUx86Feature x86_kvm_features[] =
     KVM_FEATURE(VIR_CPU_x86_KVM_HV_FREQUENCIES),
     KVM_FEATURE(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT),
     KVM_FEATURE(VIR_CPU_x86_KVM_HV_TLBFLUSH),
+    KVM_FEATURE(VIR_CPU_x86_KVM_HV_IPI),
 };
 
 typedef struct _virCPUx86Model virCPUx86Model;
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
index e75b3a2d0d..8c51d88e1a 100644
--- a/src/cpu/cpu_x86_data.h
+++ b/src/cpu/cpu_x86_data.h
@@ -65,6 +65,7 @@ struct _virCPUx86CPUID {
 # define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies"
 # define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "__kvm_hv_reenlightenment"
 # define VIR_CPU_x86_KVM_HV_TLBFLUSH  "__kvm_hv_tlbflush"
+# define VIR_CPU_x86_KVM_HV_IPI       "__kvm_hv_ipi"
 
 
 # define VIR_CPU_X86_DATA_INIT { 0 }
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f59cbf559e..6fc8deff00 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6882,6 +6882,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
             case VIR_DOMAIN_HYPERV_FREQUENCIES:
             case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
             case VIR_DOMAIN_HYPERV_TLBFLUSH:
+            case VIR_DOMAIN_HYPERV_IPI:
                 if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
                     virBufferAsprintf(&buf, ",hv_%s",
                                       virDomainHypervTypeToString(i));
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 5b4a378a18..a15f4d1121 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -1539,6 +1539,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
             case VIR_DOMAIN_HYPERV_FREQUENCIES:
             case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
             case VIR_DOMAIN_HYPERV_TLBFLUSH:
+            case VIR_DOMAIN_HYPERV_IPI:
                 if (value) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    _("HyperV feature '%s' should not "
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1850923914..85e2f7046b 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3953,6 +3953,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
         case VIR_DOMAIN_HYPERV_FREQUENCIES:
         case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
         case VIR_DOMAIN_HYPERV_TLBFLUSH:
+        case VIR_DOMAIN_HYPERV_IPI:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("host doesn't support hyperv '%s' feature"),
                            virDomainHypervTypeToString(i));
diff --git a/tests/qemuxml2argvdata/hyperv-off.xml b/tests/qemuxml2argvdata/hyperv-off.xml
index dc5777355f..e51cca45b5 100644
--- a/tests/qemuxml2argvdata/hyperv-off.xml
+++ b/tests/qemuxml2argvdata/hyperv-off.xml
@@ -23,6 +23,7 @@
       <frequencies state='off'/>
       <reenlightenment state='off'/>
       <tlbflush state='off'/>
+      <ipi state='off'/>
     </hyperv>
   </features>
   <clock offset='utc'/>
diff --git a/tests/qemuxml2argvdata/hyperv.args b/tests/qemuxml2argvdata/hyperv.args
index c55204b0c8..0800e4f79d 100644
--- a/tests/qemuxml2argvdata/hyperv.args
+++ b/tests/qemuxml2argvdata/hyperv.args
@@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=none \
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
 -cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\
 hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies,\
-hv_reenlightenment,hv_tlbflush' \
+hv_reenlightenment,hv_tlbflush,hv_ipi' \
 -m 214 \
 -smp 6,sockets=6,cores=1,threads=1 \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/hyperv.xml b/tests/qemuxml2argvdata/hyperv.xml
index 816adf6907..05c7d478f7 100644
--- a/tests/qemuxml2argvdata/hyperv.xml
+++ b/tests/qemuxml2argvdata/hyperv.xml
@@ -23,6 +23,7 @@
       <frequencies state='on'/>
       <reenlightenment state='on'/>
       <tlbflush state='on'/>
+      <ipi state='on'/>
     </hyperv>
   </features>
   <clock offset='utc'/>
diff --git a/tests/qemuxml2xmloutdata/hyperv-off.xml b/tests/qemuxml2xmloutdata/hyperv-off.xml
index 77a8dac810..2282b763b5 100644
--- a/tests/qemuxml2xmloutdata/hyperv-off.xml
+++ b/tests/qemuxml2xmloutdata/hyperv-off.xml
@@ -23,6 +23,7 @@
       <frequencies state='off'/>
       <reenlightenment state='off'/>
       <tlbflush state='off'/>
+      <ipi state='off'/>
     </hyperv>
   </features>
   <clock offset='utc'/>
diff --git a/tests/qemuxml2xmloutdata/hyperv.xml b/tests/qemuxml2xmloutdata/hyperv.xml
index fc8c59a557..97f387c172 100644
--- a/tests/qemuxml2xmloutdata/hyperv.xml
+++ b/tests/qemuxml2xmloutdata/hyperv.xml
@@ -23,6 +23,7 @@
       <frequencies state='on'/>
       <reenlightenment state='on'/>
       <tlbflush state='on'/>
+      <ipi state='on'/>
     </hyperv>
   </features>
   <clock offset='utc'/>
-- 
2.17.2


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