]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Add MBA check to virResctrlInfoGetCache
authorBing Niu <bing.niu@intel.com>
Mon, 30 Jul 2018 03:12:29 +0000 (11:12 +0800)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 13 Aug 2018 18:19:41 +0000 (14:19 -0400)
If we have some membw_info data, then we need to calculate the number
of MBA controllers on the system. The value cannot be obtained from a
direct query to the RDT kernel module, but it is the same as the last
level cache value which is calculated by traversing the cache hierarchy
of host(/sys/bus/cpu/devices/cpuX/cache/).

Signed-off-by: Bing Niu <bing.niu@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/util/virresctrl.c

index b12a05cb0ffced8cd7b6120845e0941db7d66ca9..f454868f1e3fb90081ba4bf8344e617a9d9edd43 100644 (file)
@@ -608,6 +608,20 @@ virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
     if (virResctrlInfoIsEmpty(resctrl))
         return 0;
 
+    /* Let's take the opportunity to update the number of last level
+     * cache. This number of memory bandwidth controller is same with
+     * last level cache */
+    if (resctrl->membw_info) {
+        virResctrlInfoMemBWPtr membw_info = resctrl->membw_info;
+
+        if (level > membw_info->last_level_cache) {
+            membw_info->last_level_cache = level;
+            membw_info->max_id = 0;
+        } else if (membw_info->last_level_cache == level) {
+            membw_info->max_id++;
+        }
+    }
+
     if (level >= resctrl->nlevels)
         return 0;