[libvirt] [PATCH 2/2] Also filter out non-migratable features out of host-passthrough

Ján Tomko jtomko at redhat.com
Tue Sep 30 08:45:39 UTC 2014


On 09/30/2014 01:09 AM, John Ferlan wrote:
> On 09/29/2014 10:27 AM, Ján Tomko wrote:
>> https://bugzilla.redhat.com/show_bug.cgi?id=1147584
> 
> Could this be expanded a bit - so one doesn't have to chase into the bz
> in order to understand what is/was being fixed?
> 
>> ---
>>  src/cpu/cpu_x86.c | 14 ++++++--------
>>  1 file changed, 6 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
>> index a98a847..57f343c 100644
>> --- a/src/cpu/cpu_x86.c
>> +++ b/src/cpu/cpu_x86.c
>> @@ -2068,7 +2068,8 @@ x86UpdateCustom(virCPUDefPtr guest,
>>  
>>  static int
>>  x86UpdateHostModel(virCPUDefPtr guest,
>> -                   const virCPUDef *host)
>> +                   const virCPUDef *host,
>> +                   bool passthrough)
>>  {
>>      virCPUDefPtr oldguest = NULL;
>>      const struct x86_map *map;
>> @@ -2076,8 +2077,6 @@ x86UpdateHostModel(virCPUDefPtr guest,
>>      size_t i;
>>      int ret = -1;
>>  
>> -    guest->match = VIR_CPU_MATCH_EXACT;
>> -
>>      if (!(map = virCPUx86GetMap()))
>>          goto cleanup;
>>  
>> @@ -2100,8 +2099,7 @@ x86UpdateHostModel(virCPUDefPtr guest,
>>              }
>>          }
>>      }
> 
> So if I understand correctly the above loop removes not migrate-able
> features - from the passed in migrated cpu and the loop below is
> updating features for anything left.
> 
> So given my question from patch 1/2 - it seems if features weren't
> allowed for host-passthrough, well then neither of these would be
> necessary.

The features aren't allowed for host-passthrough, which is why the loop below
is only done when !passthrough.

> 
> In any case - even if we added something that removed features, the
> incoming, saved/restore, etc. guest with host-passthrough could still
> have it so this would be necessary - which I guess means it's an ACK
> (typing and thinking).

Thanks, I fixed the segfault in 1/2 and will push the series shortly after
expanding the commit message.

Jan

> 
> John
>> -
>> -    for (i = 0; i < oldguest->nfeatures; i++) {
>> +    for (i = 0; !passthrough && i < oldguest->nfeatures; i++) {
>>          if (virCPUDefUpdateFeature(guest,
>>                                     oldguest->features[i].name,
>>                                     oldguest->features[i].policy) < 0)
>> @@ -2125,12 +2123,12 @@ x86Update(virCPUDefPtr guest,
>>          return x86UpdateCustom(guest, host);
>>  
>>      case VIR_CPU_MODE_HOST_MODEL:
>> -        return x86UpdateHostModel(guest, host);
>> +        guest->match = VIR_CPU_MATCH_EXACT;
>> +        return x86UpdateHostModel(guest, host, false);
>>  
>>      case VIR_CPU_MODE_HOST_PASSTHROUGH:
>>          guest->match = VIR_CPU_MATCH_MINIMUM;
>> -        virCPUDefFreeModel(guest);
>> -        return virCPUDefCopyModel(guest, host, true);
>> +        return x86UpdateHostModel(guest, host, true);
>>  
>>      case VIR_CPU_MODE_LAST:
>>          break;
>>
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140930/c075d87d/attachment-0001.sig>


More information about the libvir-list mailing list