]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util, conf: Handle default monitor group of an allocation properly
authorWang Huaqiang <huaqiang.wang@intel.com>
Tue, 11 Jun 2019 03:31:06 +0000 (11:31 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 5 Aug 2019 17:41:11 +0000 (19:41 +0200)
'default monitor of an allocation' is defined as the resctrl
monitor group that created along with an resctrl allocation,
which is created by resctrl file system. If the monitor group
specified in domain configuration file is happened to be a
default monitor group of an allocation, then it is not necessary
to create monitor group since it is already created. But if
an monitor group is not an allocation default group, you
should create the group under folder
'/sys/fs/resctrl/mon_groups' and fill the vcpu PIDs to 'tasks'
file.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/libvirt_private.syms
src/qemu/qemu_process.c
src/util/virresctrl.c

index c323f679b3ced05a09d7d7227dbd40a293445a00..00c519b5581f50b55a15a2e003501245806827f0 100644 (file)
@@ -2820,6 +2820,7 @@ virResctrlAllocForeachMemory;
 virResctrlAllocFormat;
 virResctrlAllocGetID;
 virResctrlAllocGetUnused;
+virResctrlAllocIsEmpty;
 virResctrlAllocNew;
 virResctrlAllocRemove;
 virResctrlAllocSetCacheSize;
index 0ba04b48e64a51509a533af1033c3a1b524c5728..1ed56457b186f1a2522d492f2c29e9536b72f1af 100644 (file)
@@ -5781,7 +5781,8 @@ qemuProcessSetupVcpu(virDomainObjPtr vm,
             for (j = 0; j < ct->nmonitors; j++) {
                 mon = ct->monitors[j];
 
-                if (virBitmapEqual(ct->vcpus, mon->vcpus))
+                if (virBitmapEqual(ct->vcpus, mon->vcpus) &&
+                    !virResctrlAllocIsEmpty(ct->alloc))
                     continue;
 
                 if (virBitmapIsBitSet(mon->vcpus, vcpuid)) {
index 90532cf1ccba50ed37f70db8fa3ad6751c2185e7..fb66ea3d4938903793a40d13b920343b6dd17911 100644 (file)
@@ -2560,7 +2560,8 @@ virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor,
         return -1;
     }
 
-    if (STREQ_NULLABLE(monitor->id, monitor->alloc->id)) {
+    if (!virResctrlAllocIsEmpty(monitor->alloc) &&
+        STREQ_NULLABLE(monitor->id, monitor->alloc->id)) {
         if (VIR_STRDUP(monitor->path, monitor->alloc->path) < 0)
             return -1;
         return 0;