[libvirt] [PATCH 18/34] conf: Split out logic to determine whether cpupin was provided

John Ferlan jferlan at redhat.com
Mon Jan 18 16:53:18 UTC 2016



On 01/14/2016 11:27 AM, Peter Krempa wrote:
> Add a helper function to do the checking. The check is used when
> determining whether the <cputune> element should be formatted.
> ---
>  src/conf/domain_conf.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index caf5334..29ef357 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -1413,6 +1413,19 @@ virDomainDefGetVcpu(virDomainDefPtr def,
>  }
> 
> 
> +/**
> + * virDomainDefHasVcpusPin:

s/VcpusPin/VcpuPin/

> + * @def: domain definition
> + *
> + * This helper returns true if any of the domain's vcpus has cpu pinning set
> + */
> +static bool
> +virDomainDefHasVcpusPin(const virDomainDef *def)
> +{
> +    return !!def->cputune.nvcpupin;

since you're going with !!, shouldn't this be !!def->cputune.vcpupin?
ncpupin isn't a pointer.

Personally not a fan of !!

I see patch 20 addresses my initial thought that this should be closer
to what virDomainIOThreadIDArrayHasPin does w/r/t looping through all
the def->cputune.nvcpupin and checking if there's a pininfo->cpumask.


> +}
> +
> +
>  virDomainDiskDefPtr
>  virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt)
>  {
> @@ -15303,7 +15316,7 @@ virDomainDefParseXML(xmlDocPtr xml,
>          goto error;
> 
>      if (virDomainNumatuneHasPlacementAuto(def->numa) &&
> -        !def->cpumask && !def->cputune.vcpupin &&
> +        !def->cpumask && !virDomainDefHasVcpusPin(def) &&

This is not the same comparison (!*.vcpupin) vs. (!*.nvcpupin)

John
>          !def->cputune.emulatorpin &&
>          !virDomainIOThreadIDArrayHasPin(def))
>          def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO;
> 




More information about the libvir-list mailing list