Re: [PATCH v2 3/5] Implement VIR_CONNECT_BASELINE_CPU_MIGRATABLE in the x86 cpu driver

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

 



Oops, I started looking at this patch the moment you sent it but got
distracted and never finished the review. Sorry about this.

On Thu, Feb 19, 2015 at 16:22:38 +0100, Ján Tomko wrote:
> Filter out non-migratable features if
> VIR_CONNECT_BASELINE_CPU_MIGRATABLE was specified.
> ---
> v2: use the existing migrate_blocker field
> This removes the need for patch 1/5.
...
> diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
> index 45be262..2a568aa 100644
> --- a/src/cpu/cpu_x86.c
> +++ b/src/cpu/cpu_x86.c
...
> @@ -1633,6 +1634,21 @@ x86Decode(virCPUDefPtr cpu,
>          goto out;
>      }
>  
> +    /* Remove non-migratable features by default

Well, the features are removed on request rather than by default.

> +     * Note: this only works as long as no CPU model contains non-migratable
> +     * features directly */
> +    if (flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) {
> +        for (i = 0; i < cpuModel->nfeatures; i++) {
> +            const struct x86_feature *feat;
> +            for (feat = map->migrate_blockers; feat; feat = feat->next) {
> +                if (STREQ(feat->name, cpuModel->features[i].name)) {
> +                    VIR_FREE(cpuModel->features[i].name);
> +                    VIR_DELETE_ELEMENT_INPLACE(cpuModel->features, i, cpuModel->nfeatures);
> +                }
> +            }
> +        }
> +    }
> +
>      if (flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) {
>          if (!(copy = x86DataCopy(cpuData)) ||
>              !(features = x86DataFromCPUFeatures(cpuModel, map)))
> @@ -1915,6 +1931,9 @@ x86Baseline(virCPUDefPtr *cpus,
>      const char *modelName;
>      bool matchingNames = true;
>  
> +    virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
> +                  VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
> +
>      if (!(map = virCPUx86GetMap()))
>          goto error;
>  
> @@ -1996,7 +2015,9 @@ x86Baseline(virCPUDefPtr *cpus,
>      if (vendor && virCPUx86DataAddCPUID(base_model->data, &vendor->cpuid) < 0)
>          goto error;
>  
> -    if (x86Decode(cpu, base_model->data, models, nmodels, modelName, flags) < 0)
> +    if (x86Decode(cpu, base_model->data, models, nmodels, modelName,
> +                  flags & (VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
> +                           VIR_CONNECT_BASELINE_CPU_MIGRATABLE)) < 0)

No need to filter the features as x86Baseline does not support any
additional feature. Looks like a leftover from v1.

>          goto error;
>  
>      if (STREQ_NULLABLE(cpu->model, modelName))

ACK with the nits fixed.

Jirka

--
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]