mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-07 21:17:55 +03:00
qemu_process: fix starting VMs if machine group has limited cpuset.cpus
Commit <f136b83139c63f20de0df3285d9e82df2fb97bfc> reworked process affinity setting but did not take cgroups into account which introduced an issue when starting VM with custom cpuset.cpus for the whole machine group. If the machine group is limited to some pCPUs libvirt should not try to set a VM to run on all pCPUs as it will result in permission denied when writing to cpuset.cpus. To fix this the affinity has to be set separately from cgroups cpuset. Resolves: <https://bugzilla.redhat.com/show_bug.cgi?id=1746517> Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
02bf7cc68b
commit
4c0398b528
@ -2622,6 +2622,7 @@ qemuProcessSetupPid(virDomainObjPtr vm,
|
|||||||
virDomainNumatuneMemMode mem_mode;
|
virDomainNumatuneMemMode mem_mode;
|
||||||
virCgroupPtr cgroup = NULL;
|
virCgroupPtr cgroup = NULL;
|
||||||
virBitmapPtr use_cpumask = NULL;
|
virBitmapPtr use_cpumask = NULL;
|
||||||
|
virBitmapPtr afinity_cpumask = NULL;
|
||||||
g_autoptr(virBitmap) hostcpumap = NULL;
|
g_autoptr(virBitmap) hostcpumap = NULL;
|
||||||
char *mem_mask = NULL;
|
char *mem_mask = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -2647,7 +2648,7 @@ qemuProcessSetupPid(virDomainObjPtr vm,
|
|||||||
* its config file */
|
* its config file */
|
||||||
if (qemuProcessGetAllCpuAffinity(&hostcpumap) < 0)
|
if (qemuProcessGetAllCpuAffinity(&hostcpumap) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
use_cpumask = hostcpumap;
|
afinity_cpumask = hostcpumap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2688,8 +2689,11 @@ qemuProcessSetupPid(virDomainObjPtr vm,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!afinity_cpumask)
|
||||||
|
afinity_cpumask = use_cpumask;
|
||||||
|
|
||||||
/* Setup legacy affinity. */
|
/* Setup legacy affinity. */
|
||||||
if (use_cpumask && virProcessSetAffinity(pid, use_cpumask) < 0)
|
if (afinity_cpumask && virProcessSetAffinity(pid, afinity_cpumask) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Set scheduler type and priority, but not for the main thread. */
|
/* Set scheduler type and priority, but not for the main thread. */
|
||||||
|
Loading…
Reference in New Issue
Block a user