Re: [PATCH] cpuBaseline: Detect empty set of common features

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

 



On Fri, Jul 02, 2010 at 11:16:16PM +0200, Jiri Denemark wrote:
> In case the set of CPUs has no features in common, report incompatible
> CPUs instead of returning the simplest CPU model with all features
> disabled.
> ---
>  src/cpu/cpu_x86.c |   26 ++++++++++++++++++++++++++
>  1 files changed, 26 insertions(+), 0 deletions(-)
> 
> diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
> index 30a2db6..0266ce9 100644
> --- a/src/cpu/cpu_x86.c
> +++ b/src/cpu/cpu_x86.c
> @@ -233,6 +233,26 @@ x86DataSubtract(union cpuData *data1,
>  }
>  
>  
> +static bool
> +x86DataIsEmpty(union cpuData *data)
> +{
> +    struct cpuX86cpuid zero = { 0, 0, 0, 0, 0 };
> +    unsigned int i;
> +
> +    for (i = 0; i < data->x86.basic_len; i++) {
> +        if (!x86cpuidMatch(data->x86.basic + i, &zero))
> +            return false;
> +    }
> +
> +    for (i = 0; i < data->x86.extended_len; i++) {
> +        if (!x86cpuidMatch(data->x86.extended + i, &zero))
> +            return false;
> +    }
> +
> +    return true;
> +}
> +
> +
>  static union cpuData *
>  x86DataFromModel(const struct x86_model *model)
>  {
> @@ -1363,6 +1383,12 @@ x86Baseline(virCPUDefPtr *cpus,
>      if (!(data = x86DataFromModel(base_model)))
>          goto no_memory;
>  
> +    if (x86DataIsEmpty(data)) {
> +        virCPUReportError(VIR_ERR_OPERATION_FAILED,
> +                "%s", _("CPUs are incompatible"));
> +        goto error;
> +    }
> +
>      if (x86Decode(cpu, data, models, nmodels, NULL) < 0)
>          goto error;
>  

ACK

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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