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

Re: [libvirt] [PATCH v8 10/14] conf: Allocate/release 'uid' and 'fid' in PCI address




On 11/8/18 6:00 AM, Yi Min Zhao wrote:
> This patch adds new functions for reservation, assignment and release
> to handle the uid/fid. If the uid/fid is defined in the domain XML,
> they will be reserved directly in the collecting phase. If any of them
> is not defined, we will find out an available value for them from the
> zPCI address hashtable, and reserve them. For the hotplug case there
> might not be a zPCI definition. So allocate and reserve uid/fid the
> case. Assign if needed and reserve uid/fid for the defined case.
> 
> Signed-off-by: Yi Min Zhao <zyimin linux ibm com>
> Reviewed-by: Bjoern Walk <bwalk linux ibm com>
> Reviewed-by: Boris Fiuczynski <fiuczy linux ibm com>
> ---
>  src/conf/device_conf.c         |  16 +++
>  src/conf/device_conf.h         |   3 +
>  src/conf/domain_addr.c         | 244 +++++++++++++++++++++++++++++++++
>  src/conf/domain_addr.h         |  12 ++
>  src/libvirt_private.syms       |   5 +
>  src/qemu/qemu_domain_address.c |  59 +++++++-
>  6 files changed, 338 insertions(+), 1 deletion(-)
> 

[...]

> +static int
> +virDomainPCIAddressExtensionEnsureAddr(virDomainPCIAddressSetPtr addrs,
> +                                       virPCIDeviceAddressPtr addr)
> +{
> +    if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) {
> +        virZPCIDeviceAddressPtr zpci = &addr->zpci;
> +
> +        if (virZPCIDeviceAddressIsEmpty(zpci))
> +            return virDomainZPCIAddressReserveNextAddr(addrs->zpciIds, zpci);
> +        else
> +            return virDomainZPCIAddressReserveAddr(addrs->zpciIds, zpci);
> +    }
> +
> +    return 0;
> +}
> +
> +
>  virDomainPCIConnectFlags
>  virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model)
>  {
> @@ -715,12 +947,24 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
>          ret = virDomainPCIAddressReserveNextAddr(addrs, dev, flags, -1);
>      }
>  
> +    dev->addr.pci.extFlags = dev->pciAddrExtFlags;
> +    ret = virDomainPCIAddressExtensionEnsureAddr(addrs, &dev->addr.pci);
> +
>   cleanup:
>      VIR_FREE(addrStr);
>      return ret;
>  }
>  

Coverity has complained to me this morning that you're overwriting the
@ret variable (twice) here.

I think your best option is right after the if {} else {} add a if (ret
< 0) goto cleanup;

John


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