|
|
99cbc7 |
From 893e9283b1ff2334309ab96e6bdf1ac2d325ad22 Mon Sep 17 00:00:00 2001
|
|
|
99cbc7 |
Message-Id: <893e9283b1ff2334309ab96e6bdf1ac2d325ad22@dist-git>
|
|
|
99cbc7 |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
99cbc7 |
Date: Mon, 15 Apr 2019 17:33:03 +0200
|
|
|
99cbc7 |
Subject: [PATCH] resctrl: Set MBA defaults properly
|
|
|
99cbc7 |
MIME-Version: 1.0
|
|
|
99cbc7 |
Content-Type: text/plain; charset=UTF-8
|
|
|
99cbc7 |
Content-Transfer-Encoding: 8bit
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Similarly to CAT, when you set some values in an group, remove the group and
|
|
|
99cbc7 |
recreate it, the previous values will be kept there. In order to not get values
|
|
|
99cbc7 |
from a previous setting (a previous VM, for example), we need to set them to
|
|
|
99cbc7 |
sensible defaults. The same way we do that for CAT, just set the same values as
|
|
|
99cbc7 |
the default group has.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
99cbc7 |
(cherry picked from commit ceb6725d945490a7153cf8b10ad3cd972d3f1c16)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1468650
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
99cbc7 |
Message-Id: <25defb79bad13f027d7125e70f2cc6b09f817474.1555342313.git.phrdina@redhat.com>
|
|
|
99cbc7 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
99cbc7 |
---
|
|
|
99cbc7 |
src/util/virresctrl.c | 39 +++++++++++++++++++++++++++++++++++++++
|
|
|
99cbc7 |
1 file changed, 39 insertions(+)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
|
|
|
99cbc7 |
index f5e4bef7dc..92953dadf9 100644
|
|
|
99cbc7 |
--- a/src/util/virresctrl.c
|
|
|
99cbc7 |
+++ b/src/util/virresctrl.c
|
|
|
99cbc7 |
@@ -1829,6 +1829,42 @@ virResctrlAllocMemoryBandwidth(virResctrlInfoPtr resctrl,
|
|
|
99cbc7 |
}
|
|
|
99cbc7 |
|
|
|
99cbc7 |
|
|
|
99cbc7 |
+static int
|
|
|
99cbc7 |
+virResctrlAllocCopyMemBW(virResctrlAllocPtr dst,
|
|
|
99cbc7 |
+ virResctrlAllocPtr src)
|
|
|
99cbc7 |
+{
|
|
|
99cbc7 |
+ size_t i = 0;
|
|
|
99cbc7 |
+ virResctrlAllocMemBWPtr dst_bw = NULL;
|
|
|
99cbc7 |
+ virResctrlAllocMemBWPtr src_bw = src->mem_bw;
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ if (!src->mem_bw)
|
|
|
99cbc7 |
+ return 0;
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ if (!dst->mem_bw &&
|
|
|
99cbc7 |
+ VIR_ALLOC(dst->mem_bw) < 0)
|
|
|
99cbc7 |
+ return -1;
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ dst_bw = dst->mem_bw;
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ if (src_bw->nbandwidths > dst_bw->nbandwidths &&
|
|
|
99cbc7 |
+ VIR_EXPAND_N(dst_bw->bandwidths, dst_bw->nbandwidths,
|
|
|
99cbc7 |
+ src_bw->nbandwidths - dst_bw->nbandwidths) < 0)
|
|
|
99cbc7 |
+ return -1;
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ for (i = 0; i < src_bw->nbandwidths; i++) {
|
|
|
99cbc7 |
+ if (dst_bw->bandwidths[i]) {
|
|
|
99cbc7 |
+ *dst_bw->bandwidths[i] = 123;
|
|
|
99cbc7 |
+ continue;
|
|
|
99cbc7 |
+ }
|
|
|
99cbc7 |
+ if (VIR_ALLOC(dst_bw->bandwidths[i]) < 0)
|
|
|
99cbc7 |
+ return -1;
|
|
|
99cbc7 |
+ *dst_bw->bandwidths[i] = *src_bw->bandwidths[i];
|
|
|
99cbc7 |
+ }
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ return 0;
|
|
|
99cbc7 |
+}
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
static int
|
|
|
99cbc7 |
virResctrlAllocCopyMasks(virResctrlAllocPtr dst,
|
|
|
99cbc7 |
virResctrlAllocPtr src)
|
|
|
99cbc7 |
@@ -1896,6 +1932,9 @@ virResctrlAllocAssign(virResctrlInfoPtr resctrl,
|
|
|
99cbc7 |
if (virResctrlAllocCopyMasks(alloc, alloc_default) < 0)
|
|
|
99cbc7 |
goto cleanup;
|
|
|
99cbc7 |
|
|
|
99cbc7 |
+ if (virResctrlAllocCopyMemBW(alloc, alloc_default) < 0)
|
|
|
99cbc7 |
+ goto cleanup;
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
for (level = 0; level < alloc->nlevels; level++) {
|
|
|
99cbc7 |
virResctrlAllocPerLevelPtr a_level = alloc->levels[level];
|
|
|
99cbc7 |
virResctrlAllocPerLevelPtr f_level = NULL;
|
|
|
99cbc7 |
--
|
|
|
99cbc7 |
2.21.0
|
|
|
99cbc7 |
|