[libvirt] [PATCH] Don't include non-migratable features in host-model

Jiri Denemark jdenemar at redhat.com
Fri Sep 5 09:31:59 UTC 2014


On Fri, Sep 05, 2014 at 11:04:30 +0200, Jano Tomko wrote:
> Commit fba6bc4 introduced supoprt for the 'invtsc' feature,

s/supoprt/support/

> which blocks migration. We should not include it in the
> host-model CPU by default, because it's intended to be used
> with migration.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1138221
> ---
>  src/cpu/cpu_map.xml |  2 +-
>  src/cpu/cpu_x86.c   | 63 ++++++++++++++++++++++++++++++++++++++++++++++++-----
>  2 files changed, 59 insertions(+), 6 deletions(-)
> 
> diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
> index 12987a0..18c7b0d 100644
> --- a/src/cpu/cpu_map.xml
> +++ b/src/cpu/cpu_map.xml
> @@ -328,7 +328,7 @@
>      </feature>
>  
>      <!-- Advanced Power Management edx features -->
> -    <feature name='invtsc'>
> +    <feature name='invtsc' migratable='no'>
>        <cpuid function='0x80000007' edx='0x00000100'/>
>      </feature>
>  
> diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
> index af2e08e..21a7007 100644
> --- a/src/cpu/cpu_x86.c
> +++ b/src/cpu/cpu_x86.c
...
> @@ -2044,6 +2089,14 @@ x86UpdateHostModel(virCPUDefPtr guest,
>      if (virCPUDefCopyModel(guest, host, true) < 0)
>          goto cleanup;
>  
> +    /* Remove non-migratable features by default */
> +    for (i = 0; i < guest->nfeatures; i++) {
> +        for (feat = map->migrate_blockers; feat; feat = feat->next) {
> +            if (STREQ(feat->name, guest->features[i].name))
> +                VIR_DELETE_ELEMENT_INPLACE(guest->features, i, guest->nfeatures);
> +        }
> +    }
> +

OK, this should be working as long as no CPU model contains invtsc
directly. Since this is currently true, I can live with this simple
solution for now. However, I think it's worth mentioning this limitation
in the comment above.

>      for (i = 0; i < oldguest->nfeatures; i++) {
>          if (virCPUDefUpdateFeature(guest,
>                                     oldguest->features[i].name,

However, a new test should be added to cputest{data,.c} :-)

Jirka




More information about the libvir-list mailing list