[libvirt PATCH 1/5] conf: Add bus-lock-ratelimit

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

 



QEMU recently introduced a way to limit the rate of VM bus locks.
Add libvirt support.

Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/domain_conf.c   | 34 ++++++++++++++++++++++++++++++++++
 src/conf/domain_conf.h   |  2 ++
 src/qemu/qemu_validate.c |  1 +
 3 files changed, 37 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bdcc3dc2c1..d2202fb6c6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -172,6 +172,7 @@ VIR_ENUM_IMPL(virDomainFeature,
               "cfpc",
               "sbbc",
               "ibs",
+              "bus-lock-ratelimit",
 );
 
 VIR_ENUM_IMPL(virDomainCapabilitiesPolicy,
@@ -17860,6 +17861,13 @@ virDomainFeaturesDefParse(virDomainDef *def,
             break;
         }
 
+        case VIR_DOMAIN_FEATURE_BUS_LOCK_RATELIMIT:
+            if (virXMLPropULongLong(nodes[i], "value", 0, VIR_XML_PROP_REQUIRED,
+                                    &def->bus_lock_ratelimit) < 0)
+                return -1;
+            def->features[val] = VIR_TRISTATE_SWITCH_ON;
+            break;
+
         case VIR_DOMAIN_FEATURE_LAST:
             break;
         }
@@ -21666,6 +21674,23 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
         case VIR_DOMAIN_FEATURE_MSRS:
             break;
 
+        case VIR_DOMAIN_FEATURE_BUS_LOCK_RATELIMIT:
+            if (src->features[i] != dst->features[i] ||
+                src->bus_lock_ratelimit != dst->bus_lock_ratelimit) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("State of feature '%s' differs: "
+                                 "source: '%s,%s=%llu', destination: '%s,%s=%llu'"),
+                               featureName,
+                               virTristateSwitchTypeToString(src->features[i]),
+                               "bus_lock_ratelimit",
+                               src->bus_lock_ratelimit,
+                               virTristateSwitchTypeToString(dst->features[i]),
+                               "bus_lock_ratelimit",
+                               dst->bus_lock_ratelimit);
+                return false;
+            }
+            break;
+
         case VIR_DOMAIN_FEATURE_LAST:
             break;
         }
@@ -27972,6 +27997,15 @@ virDomainDefFormatFeatures(virBuffer *buf,
                               virDomainIBSTypeToString(def->features[i]));
             break;
 
+        case VIR_DOMAIN_FEATURE_BUS_LOCK_RATELIMIT:
+            if (def->features[i] == VIR_TRISTATE_SWITCH_ON) {
+                virBufferAsprintf(&childBuf,
+                                  "<%s value='%llu'/>\n",
+                                  virDomainFeatureTypeToString(i),
+                                  def->bus_lock_ratelimit);
+            }
+            break;
+
         case VIR_DOMAIN_FEATURE_LAST:
             break;
         }
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index c0c07ea6ba..80bf7f4395 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2054,6 +2054,7 @@ typedef enum {
     VIR_DOMAIN_FEATURE_CFPC,
     VIR_DOMAIN_FEATURE_SBBC,
     VIR_DOMAIN_FEATURE_IBS,
+    VIR_DOMAIN_FEATURE_BUS_LOCK_RATELIMIT,
 
     VIR_DOMAIN_FEATURE_LAST
 } virDomainFeature;
@@ -2824,6 +2825,7 @@ struct _virDomainDef {
     unsigned long long hpt_maxpagesize; /* Stored in KiB */
     char *hyperv_vendor_id;
     virTristateSwitch apic_eoi;
+    unsigned long long bus_lock_ratelimit;
 
     bool tseg_specified;
     unsigned long long tseg_size;
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 1de6e05101..e1068ad68a 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -304,6 +304,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
         case VIR_DOMAIN_FEATURE_PRIVNET:
         case VIR_DOMAIN_FEATURE_CAPABILITIES:
         case VIR_DOMAIN_FEATURE_MSRS:
+        case VIR_DOMAIN_FEATURE_BUS_LOCK_RATELIMIT:
         case VIR_DOMAIN_FEATURE_LAST:
             break;
         }
-- 
2.31.1




[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]

  Powered by Linux