[libvirt] [PATCH v2 03/21] cgroup: Prepare for sparse vCPU topologies in virCgroupGetPercpuStats

Ján Tomko jtomko at redhat.com
Mon Feb 1 15:35:52 UTC 2016


On Fri, Jan 29, 2016 at 05:01:58PM +0100, Peter Krempa wrote:
> Pass a bitmap of enabled guest vCPUs to virCgroupGetPercpuStats so that
> un-continuous vCPU topologies can be used.

non-contiguous

> ---
>  src/lxc/lxc_driver.c   |  2 +-
>  src/qemu/qemu_driver.c |  7 ++++++-
>  src/util/vircgroup.c   | 16 ++++++++--------
>  src/util/vircgroup.h   |  3 ++-
>  tests/vircgrouptest.c  |  2 +-
>  5 files changed, 18 insertions(+), 12 deletions(-)
> 

> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index abcdbe6..0fa7d13 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -18173,6 +18173,7 @@ qemuDomainGetCPUStats(virDomainPtr domain,
>      virDomainObjPtr vm = NULL;
>      int ret = -1;
>      qemuDomainObjPrivatePtr priv;
> +    virBitmapPtr guestvcpus = NULL;
> 
>      virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
> 
> @@ -18196,13 +18197,17 @@ qemuDomainGetCPUStats(virDomainPtr domain,
>          goto cleanup;
>      }
> 
> +    if (!(guestvcpus = virDomainDefGetOnlineVcpumap(vm->def)))
> +        goto cleanup;
> +
>      if (start_cpu == -1)
>          ret = virCgroupGetDomainTotalCpuStats(priv->cgroup,
>                                                params, nparams);
>      else
>          ret = virCgroupGetPercpuStats(priv->cgroup, params, nparams,
> -                                      start_cpu, ncpus, priv->nvcpupids);
> +                                      start_cpu, ncpus, guestvcpus);

These are not equivalent. A type='qemu' domain can have multiple online
CPUs while ncpupids == 0.

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160201/09f7a5fa/attachment-0001.sig>


More information about the libvir-list mailing list