VIR_DEBUG("Setting cgroup for emulator (if required)");
if (qemuSetupCgroupForEmulator(vm) < 0)
goto cleanup;
VIR_DEBUG("Setting affinity of emulator threads");
if (qemuProcessSetEmulatorAffinity(vm) < 0)
goto cleanup;
VIR_DEBUG("Waiting for monitor to show up");
if (qemuProcessWaitForMonitor(driver, vm, asyncJob, priv->qemuCaps, pos) < 0)
goto cleanup;
When running on a 24-CPU host and using vCPU and emulator pinning I've seen cases where the specified emulator pinning isn't applied as expected.
The issue appears to be due to libvirt racing with qemu. Moving the qemuProcessSetEmulatorAffinity() call to after qemuProcessWaitForMonitor() returns seems to fix the problem.
Also, I suspect that qemuSetupCgroupForEmulator() should probably be moved as well.
In qemuProcessStart() the code looks like this:
VIR_ DEBUG(" Setting cgroup for emulator (if required)"); pForEmulator( vm) < 0)
if (qemuSetupCgrou
goto cleanup;
VIR_ DEBUG(" Setting affinity of emulator threads"); EmulatorAffinit y(vm) < 0)
if (qemuProcessSet
goto cleanup;
VIR_ DEBUG(" Waiting for monitor to show up"); tForMonitor( driver, vm, asyncJob, priv->qemuCaps, pos) < 0)
if (qemuProcessWai
goto cleanup;
When running on a 24-CPU host and using vCPU and emulator pinning I've seen cases where the specified emulator pinning isn't applied as expected.
The issue appears to be due to libvirt racing with qemu. Moving the qemuProcessSetE mulatorAffinity () call to after qemuProcessWait ForMonitor( ) returns seems to fix the problem.
Also, I suspect that qemuSetupCgroup ForEmulator( ) should probably be moved as well.