[libvirt] [PATCH v2 2/6] util: Use default group's mask for unspecified resctrl allocations

Martin Kletzander mkletzan at redhat.com
Thu Feb 1 13:18:35 UTC 2018


On Thu, Feb 01, 2018 at 06:27:38AM -0500, John Ferlan wrote:
>
>
>On 01/31/2018 08:36 AM, Martin Kletzander wrote:
>> Introduce virResctrlAllocCopyMasks() and use that to initially copy the default
>> group schemata to the allocation before reserving any parts of the cache.  The
>> reason for this is that when new group is created the schemata will have unknown
>> data in it.  If there was previously group with the same CLoS ID, it will have
>> the previous valies, if not it will have all bits set.  And we need to set all
>> unspecified (in the XML) allocations to the same one as the default group.
>>
>> Some non-Linux functions now need to be made public due to this change.
>>
>> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1289368
>>
>> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
>> ---
>>  src/util/virresctrl.c | 72 +++++++++++++++++++++++++++++++++++----------------
>>  1 file changed, 50 insertions(+), 22 deletions(-)
>>
>
>[...]
>
>Coverity was fairly grumpy this morning...
>
>> @@ -1430,11 +1449,19 @@ virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl,
>>      int ret = -1;
>>      unsigned int level = 0;
>>      virResctrlAllocPtr alloc_free = NULL;
>> +    virResctrlAllocPtr alloc_default = NULL;
>>
>>      alloc_free = virResctrlAllocGetUnused(resctrl);
>>      if (!alloc_free)
>>          return -1;
>>
>> +    alloc_default = virResctrlAllocGetDefault(resctrl);
>> +    if (!alloc_default)
>> +        return -1;
>
>So does this leak alloc_free possibly?
>
>> +
>> +    if (virResctrlAllocCopyMasks(alloc, alloc_default) < 0)
>> +        return -1;
>> +
>
>and does this leak both alloc_free and alloc_default possibly?
>

Yes, thanks, what a stupid error.

>John
>
>>      for (level = 0; level < alloc->nlevels; level++) {
>>          virResctrlAllocPerLevelPtr a_level = alloc->levels[level];
>>          virResctrlAllocPerLevelPtr f_level = NULL;
>> @@ -1482,6 +1509,7 @@ virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl,
>>      ret = 0;
>>   cleanup:
>>      virObjectUnref(alloc_free);
>> +    virObjectUnref(alloc_default);
>>      return ret;
>>  }
>>
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180201/31ad5c63/attachment-0001.sig>


More information about the libvir-list mailing list