libvirt/SOURCES/libvirt-qemu-move-cgroup-cpu-period-and-quota-defines-to-vircgroup.h.patch

131 lines
6.1 KiB
Diff

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