[libvirt] [PATCH 08/13] Introduce virDomainHypervisorPinAdd and virDomainHypervisorPinDel functions

Hu Tao hutao at cn.fujitsu.com
Tue Jul 24 08:25:52 UTC 2012


On Tue, Jul 10, 2012 at 05:17:08PM +0800, tangchen wrote:
> Introduce 2 APIs to support hypervisor threads pin.
>     1) virDomainHypervisorPinAdd: setup hypervisor threads pin with a given cpumap string.
>     2) virDomainHypervisorPinDel: remove all hypervisor threads pin.
> 
> Signed-off-by: Tang Chen <tangchen at cn.fujitsu.com>
> ---
>  src/conf/domain_conf.c   |   76 ++++++++++++++++++++++++++++++++++++++++++++++
>  src/conf/domain_conf.h   |    6 ++++
>  src/libvirt_private.syms |    2 ++
>  3 files changed, 84 insertions(+)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 376c1b5..9bd144a 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -10947,6 +10947,82 @@ virDomainVcpuPinDel(virDomainDefPtr def, int vcpu)
>      return 0;
>  }
>  
> +int
> +virDomainHypervisorPinAdd(virDomainDefPtr def,
> +                          unsigned char *cpumap,
> +                          int maplen)
> +{
> +    virDomainVcpuPinDefPtr hypervisorpin = NULL;
> +    char *cpumask = NULL;
> +    int i;
> +
> +    if (VIR_ALLOC_N(cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0) {
> +        virReportOOMError();
> +        goto cleanup;
> +    }
> +
> +    /* Reset cpumask to all 0s. */
> +    for (i = 0; i < VIR_DOMAIN_CPUMASK_LEN; i++)
> +        cpumask[i] = 0;

No need to do this again, VIR_ALLOC_N has already filled them with zeros.

-- 
Thanks,
Hu Tao




More information about the libvir-list mailing list