util, conf: Handle default monitor group of an allocation properly

'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>
This commit is contained in:
Wang Huaqiang 2019-06-11 11:31:06 +08:00 committed by Michal Privoznik
parent 0f68e1c9ba
commit 816cef0783
3 changed files with 5 additions and 2 deletions

View File

@ -2820,6 +2820,7 @@ virResctrlAllocForeachMemory;
virResctrlAllocFormat; virResctrlAllocFormat;
virResctrlAllocGetID; virResctrlAllocGetID;
virResctrlAllocGetUnused; virResctrlAllocGetUnused;
virResctrlAllocIsEmpty;
virResctrlAllocNew; virResctrlAllocNew;
virResctrlAllocRemove; virResctrlAllocRemove;
virResctrlAllocSetCacheSize; virResctrlAllocSetCacheSize;

View File

@ -5781,7 +5781,8 @@ qemuProcessSetupVcpu(virDomainObjPtr vm,
for (j = 0; j < ct->nmonitors; j++) { for (j = 0; j < ct->nmonitors; j++) {
mon = ct->monitors[j]; mon = ct->monitors[j];
if (virBitmapEqual(ct->vcpus, mon->vcpus)) if (virBitmapEqual(ct->vcpus, mon->vcpus) &&
!virResctrlAllocIsEmpty(ct->alloc))
continue; continue;
if (virBitmapIsBitSet(mon->vcpus, vcpuid)) { if (virBitmapIsBitSet(mon->vcpus, vcpuid)) {

View File

@ -2560,7 +2560,8 @@ virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor,
return -1; 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) if (VIR_STRDUP(monitor->path, monitor->alloc->path) < 0)
return -1; return -1;
return 0; return 0;