render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
397dc2
From 7a964b43185f4d818eec0c39197bde17371f4c2b Mon Sep 17 00:00:00 2001
397dc2
Message-Id: <7a964b43185f4d818eec0c39197bde17371f4c2b@dist-git>
397dc2
From: Pavel Hrdina <phrdina@redhat.com>
397dc2
Date: Thu, 21 Jan 2021 10:24:03 -0300
397dc2
Subject: [PATCH] qemu: move cgroup cpu period and quota defines to vircgroup.h
397dc2
397dc2
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
397dc2
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
397dc2
(cherry picked from commit a818e3f6f02ffc9c1c9ea6e8131c307213fa18ec)
397dc2
397dc2
Conflicts:  src/qemu/qemu_driver.c
397dc2
    Context due to lots of changes upstream in the file.
397dc2
397dc2
https://bugzilla.redhat.com/1915733
397dc2
397dc2
Signed-off-by: Daniel Henrique Barboza <dbarboza@redhat.com>
397dc2
Message-Id: <20210121132406.337681-2-dbarboza@redhat.com>
397dc2
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
397dc2
---
397dc2
 src/qemu/qemu_driver.c | 21 ++++++++-------------
397dc2
 src/util/vircgroup.h   |  5 +++++
397dc2
 2 files changed, 13 insertions(+), 13 deletions(-)
397dc2
397dc2
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
397dc2
index 80a4a43e2e..a1103a96dd 100644
397dc2
--- a/src/qemu/qemu_driver.c
397dc2
+++ b/src/qemu/qemu_driver.c
397dc2
@@ -122,11 +122,6 @@ VIR_LOG_INIT("qemu.qemu_driver");
397dc2
 
397dc2
 #define QEMU_NB_NUMA_PARAM 2
397dc2
 
397dc2
-#define QEMU_SCHED_MIN_PERIOD              1000LL
397dc2
-#define QEMU_SCHED_MAX_PERIOD           1000000LL
397dc2
-#define QEMU_SCHED_MIN_QUOTA               1000LL
397dc2
-#define QEMU_SCHED_MAX_QUOTA  18446744073709551LL
397dc2
-
397dc2
 #define QEMU_GUEST_VCPU_MAX_ID 4096
397dc2
 
397dc2
 #define QEMU_NB_BLKIO_PARAM  6
397dc2
@@ -10655,7 +10650,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
397dc2
 
397dc2
         } else if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_VCPU_PERIOD)) {
397dc2
             SCHED_RANGE_CHECK(value_ul, VIR_DOMAIN_SCHEDULER_VCPU_PERIOD,
397dc2
-                              QEMU_SCHED_MIN_PERIOD, QEMU_SCHED_MAX_PERIOD);
397dc2
+                              VIR_CGROUP_CPU_PERIOD_MIN, VIR_CGROUP_CPU_PERIOD_MAX);
397dc2
 
397dc2
             if (def && value_ul) {
397dc2
                 if ((rc = qemuSetVcpusBWLive(vm, priv->cgroup, value_ul, 0)))
397dc2
@@ -10675,7 +10670,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
397dc2
 
397dc2
         } else if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_VCPU_QUOTA)) {
397dc2
             SCHED_RANGE_CHECK(value_l, VIR_DOMAIN_SCHEDULER_VCPU_QUOTA,
397dc2
-                              QEMU_SCHED_MIN_QUOTA, QEMU_SCHED_MAX_QUOTA);
397dc2
+                              VIR_CGROUP_CPU_QUOTA_MIN, VIR_CGROUP_CPU_QUOTA_MAX);
397dc2
 
397dc2
             if (def && value_l) {
397dc2
                 if ((rc = qemuSetVcpusBWLive(vm, priv->cgroup, 0, value_l)))
397dc2
@@ -10695,7 +10690,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
397dc2
 
397dc2
         } else if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD)) {
397dc2
             SCHED_RANGE_CHECK(value_ul, VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD,
397dc2
-                              QEMU_SCHED_MIN_PERIOD, QEMU_SCHED_MAX_PERIOD);
397dc2
+                              VIR_CGROUP_CPU_PERIOD_MIN, VIR_CGROUP_CPU_PERIOD_MAX);
397dc2
 
397dc2
             if (def && value_ul) {
397dc2
                 if ((rc = qemuSetGlobalBWLive(priv->cgroup, value_ul, 0)))
397dc2
@@ -10715,7 +10710,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
397dc2
 
397dc2
         } else if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA)) {
397dc2
             SCHED_RANGE_CHECK(value_l, VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA,
397dc2
-                              QEMU_SCHED_MIN_QUOTA, QEMU_SCHED_MAX_QUOTA);
397dc2
+                              VIR_CGROUP_CPU_QUOTA_MIN, VIR_CGROUP_CPU_QUOTA_MAX);
397dc2
 
397dc2
             if (def && value_l) {
397dc2
                 if ((rc = qemuSetGlobalBWLive(priv->cgroup, 0, value_l)))
397dc2
@@ -10735,7 +10730,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
397dc2
 
397dc2
         } else if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD)) {
397dc2
             SCHED_RANGE_CHECK(value_ul, VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD,
397dc2
-                              QEMU_SCHED_MIN_PERIOD, QEMU_SCHED_MAX_PERIOD);
397dc2
+                              VIR_CGROUP_CPU_PERIOD_MIN, VIR_CGROUP_CPU_PERIOD_MAX);
397dc2
 
397dc2
             if (def && value_ul) {
397dc2
                 if ((rc = qemuSetEmulatorBandwidthLive(priv->cgroup,
397dc2
@@ -10756,7 +10751,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
397dc2
 
397dc2
         } else if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA)) {
397dc2
             SCHED_RANGE_CHECK(value_l, VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA,
397dc2
-                              QEMU_SCHED_MIN_QUOTA, QEMU_SCHED_MAX_QUOTA);
397dc2
+                              VIR_CGROUP_CPU_QUOTA_MIN, VIR_CGROUP_CPU_QUOTA_MAX);
397dc2
 
397dc2
             if (def && value_l) {
397dc2
                 if ((rc = qemuSetEmulatorBandwidthLive(priv->cgroup,
397dc2
@@ -10777,7 +10772,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
397dc2
 
397dc2
         } else if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD)) {
397dc2
             SCHED_RANGE_CHECK(value_ul, VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD,
397dc2
-                              QEMU_SCHED_MIN_PERIOD, QEMU_SCHED_MAX_PERIOD);
397dc2
+                              VIR_CGROUP_CPU_PERIOD_MIN, VIR_CGROUP_CPU_PERIOD_MAX);
397dc2
 
397dc2
             if (def && value_ul) {
397dc2
                 if ((rc = qemuSetIOThreadsBWLive(vm, priv->cgroup, value_ul, 0)))
397dc2
@@ -10797,7 +10792,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
397dc2
 
397dc2
         } else if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA)) {
397dc2
             SCHED_RANGE_CHECK(value_l, VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA,
397dc2
-                              QEMU_SCHED_MIN_QUOTA, QEMU_SCHED_MAX_QUOTA);
397dc2
+                              VIR_CGROUP_CPU_QUOTA_MIN, VIR_CGROUP_CPU_QUOTA_MAX);
397dc2
 
397dc2
             if (def && value_l) {
397dc2
                 if ((rc = qemuSetIOThreadsBWLive(vm, priv->cgroup, 0, value_l)))
397dc2
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
397dc2
index 3eefe78787..83fa74840f 100644
397dc2
--- a/src/util/vircgroup.h
397dc2
+++ b/src/util/vircgroup.h
397dc2
@@ -243,6 +243,11 @@ virCgroupGetDomainTotalCpuStats(virCgroupPtr group,
397dc2
 int virCgroupSetCpuShares(virCgroupPtr group, unsigned long long shares);
397dc2
 int virCgroupGetCpuShares(virCgroupPtr group, unsigned long long *shares);
397dc2
 
397dc2
+#define VIR_CGROUP_CPU_PERIOD_MIN 1000LL
397dc2
+#define VIR_CGROUP_CPU_PERIOD_MAX 1000000LL
397dc2
+#define VIR_CGROUP_CPU_QUOTA_MIN 1000LL
397dc2
+#define VIR_CGROUP_CPU_QUOTA_MAX 18446744073709551LL
397dc2
+
397dc2
 int virCgroupSetCpuCfsPeriod(virCgroupPtr group, unsigned long long cfs_period);
397dc2
 int virCgroupGetCpuCfsPeriod(virCgroupPtr group, unsigned long long *cfs_period);
397dc2
 
397dc2
-- 
397dc2
2.30.0
397dc2