render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
0a7476
From 95f014690bab53caa5eac8859c03917ba96466dc Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <95f014690bab53caa5eac8859c03917ba96466dc@dist-git>
0a7476
From: Bing Niu <bing.niu@intel.com>
0a7476
Date: Mon, 15 Apr 2019 17:32:48 +0200
0a7476
Subject: [PATCH] util: Add MBA check to virResctrlInfoGetCache
0a7476
MIME-Version: 1.0
0a7476
Content-Type: text/plain; charset=UTF-8
0a7476
Content-Transfer-Encoding: 8bit
0a7476
0a7476
If we have some membw_info data, then we need to calculate the number
0a7476
of MBA controllers on the system. The value cannot be obtained from a
0a7476
direct query to the RDT kernel module, but it is the same as the last
0a7476
level cache value which is calculated by traversing the cache hierarchy
0a7476
of host(/sys/bus/cpu/devices/cpuX/cache/).
0a7476
0a7476
Signed-off-by: Bing Niu <bing.niu@intel.com>
0a7476
Reviewed-by: John Ferlan <jferlan@redhat.com>
0a7476
(cherry picked from commit 5aae2b3968c3e474e288cff68547f7aedac86921)
0a7476
0a7476
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1468650
0a7476
0a7476
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
0a7476
Message-Id: <bbacef44dd5c6d0a2d3760f4414e6e2701bd5175.1555342313.git.phrdina@redhat.com>
0a7476
Reviewed-by: Ján Tomko <jtomko@redhat.com>
0a7476
---
0a7476
 src/util/virresctrl.c | 14 ++++++++++++++
0a7476
 1 file changed, 14 insertions(+)
0a7476
0a7476
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
0a7476
index b12a05cb0f..f454868f1e 100644
0a7476
--- a/src/util/virresctrl.c
0a7476
+++ b/src/util/virresctrl.c
0a7476
@@ -608,6 +608,20 @@ virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
0a7476
     if (virResctrlInfoIsEmpty(resctrl))
0a7476
         return 0;
0a7476
 
0a7476
+    /* Let's take the opportunity to update the number of last level
0a7476
+     * cache. This number of memory bandwidth controller is same with
0a7476
+     * last level cache */
0a7476
+    if (resctrl->membw_info) {
0a7476
+        virResctrlInfoMemBWPtr membw_info = resctrl->membw_info;
0a7476
+
0a7476
+        if (level > membw_info->last_level_cache) {
0a7476
+            membw_info->last_level_cache = level;
0a7476
+            membw_info->max_id = 0;
0a7476
+        } else if (membw_info->last_level_cache == level) {
0a7476
+            membw_info->max_id++;
0a7476
+        }
0a7476
+    }
0a7476
+
0a7476
     if (level >= resctrl->nlevels)
0a7476
         return 0;
0a7476
 
0a7476
-- 
0a7476
2.21.0
0a7476