Re: [PATCH 5/9] qemu_cgroup: put qemu right into emulator sub-cgroup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 23, 2016 at 04:58:40PM +0100, Henning Schild wrote:
> Move qemuSetupCgroupForEmulator up under qemuSetupCgroup. That way
> we move the one main thread right into the emulator cgroup, instead
> of moving multiple threads later on. And we do not actually want any
> threads running in the parent cgroups (cpu cpuacct cpuset).
> 
> Signed-off-by: Henning Schild <henning.schild@xxxxxxxxxxx>
> ---
>  src/qemu/qemu_process.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

ACK, this is the key part of the fix.  With the old code the QEMU
pids are only moved /after/ exec(), with this change, the pids are
moved /before/ exec(), fixing the core problem of threads runing
int the wrong place between 'exec()' and libvirt querying vCPUs.

> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 05cbda2..65f718c 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -4895,6 +4895,10 @@ qemuProcessLaunch(virConnectPtr conn,
>      if (qemuSetupCgroup(driver, vm, nnicindexes, nicindexes) < 0)
>          goto cleanup;
>  
> +    VIR_DEBUG("Setting cgroup for emulator (if required)");
> +    if (qemuSetupCgroupForEmulator(vm) < 0)
> +        goto cleanup;
> +
>      /* This must be done after cgroup placement to avoid resetting CPU
>       * affinity */
>      if (!vm->def->cputune.emulatorpin &&
> @@ -4943,10 +4947,6 @@ qemuProcessLaunch(virConnectPtr conn,
>      if (rv == -1) /* The VM failed to start */
>          goto cleanup;
>  
> -    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;
> -- 
> 2.4.10
> 

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]