[libvirt] [PATCH v2 10/21] conf: Store cpu pinning data in def->vcpus

Ján Tomko jtomko at redhat.com
Tue Feb 2 15:45:53 UTC 2016


On Fri, Jan 29, 2016 at 05:02:05PM +0100, Peter Krempa wrote:
> Now with the new struct the data can be stored in a much saner place.
> ---
> 
> Notes:
>     v2:
>     - clear bitmap pointer after free to avoid use after free
> 
>  src/conf/domain_conf.c   | 136 ++++++++++++++++++--------------------------
>  src/conf/domain_conf.h   |   3 +-
>  src/libxl/libxl_domain.c |  17 +++---
>  src/libxl/libxl_driver.c |  39 ++++++-------
>  src/qemu/qemu_cgroup.c   |  15 ++---
>  src/qemu/qemu_driver.c   | 143 ++++++++++++++++++++++-------------------------
>  src/qemu/qemu_process.c  |  36 ++++++------
>  src/test/test_driver.c   |  43 ++++++--------
>  8 files changed, 186 insertions(+), 246 deletions(-)

prlsdkCheckUnsupportedParams still references def->cputune.vcpupin

> @@ -21815,15 +21783,19 @@ virDomainDefFormatInternal(virDomainDefPtr def,
>                            "</emulator_quota>\n",
>                            def->cputune.emulator_quota);
> 
> -    for (i = 0; i < def->cputune.nvcpupin; i++) {
> +    for (i = 0; i < def->maxvcpus; i++) {
>          char *cpumask;
> -        virBufferAsprintf(&childrenBuf, "<vcpupin vcpu='%u' ",
> -                          def->cputune.vcpupin[i]->id);
> +        virDomainVcpuInfoPtr vcpu = def->vcpus + i;

def->vcpus[i], please.

> 
> -        if (!(cpumask = virBitmapFormat(def->cputune.vcpupin[i]->cpumask)))
> +        if (!vcpu->cpumask)
> +            continue;
> +
> +        if (!(cpumask = virBitmapFormat(vcpu->cpumask)))
>              goto error;

> @@ -2360,10 +2361,16 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
>      /* Make sure coverity knows targetDef is valid at this point. */
>      sa_assert(targetDef);
> 
> -    pcpumap = virBitmapNewData(cpumap, maplen);
> -    if (!pcpumap)
> +    if (!(pcpumap = virBitmapNewData(cpumap, maplen)))
>          goto endjob;

Unrelated style change.

> @@ -5088,9 +5091,11 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
>      virCgroupPtr cgroup_vcpu = NULL;
>      int ret = -1;
>      qemuDomainObjPrivatePtr priv;
> -    size_t newVcpuPinNum = 0;
> -    virDomainPinDefPtr *newVcpuPin = NULL;
>      virBitmapPtr pcpumap = NULL;
> +    virBitmapPtr pcpumaplive = NULL;
> +    virBitmapPtr pcpumappersist = NULL;
> +    virDomainVcpuInfoPtr vcpuinfolive = NULL;
> +    virDomainVcpuInfoPtr vcpuinfopersist = NULL;

These identifiers could use a word separator.

>      virQEMUDriverConfigPtr cfg = NULL;
>      virObjectEventPtr event = NULL;
>      char paramField[VIR_TYPED_PARAM_FIELD_LENGTH] = "";

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160202/4c51137a/attachment-0001.sig>


More information about the libvir-list mailing list