Comment 0 for bug 1441781

Revision history for this message
Chris Friesen (cbf123) wrote : qemuProcessSetEmulatorAffinity() called before emulator process actually running

In qemuProcessStart() the code looks like this:

    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.