Re: [libvirt PATCH v5 7/7] ch_driver: emulator threadinfo & pinning callbacks

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

 



On 1/25/22 17:19, Praveen K Paladugu wrote:
> Signed-off-by: Praveen K Paladugu <prapal@xxxxxxxxxxxxxxxxxxx>
> ---
>  src/ch/ch_driver.c | 154 +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 154 insertions(+)
> 
> diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
> index d257c025ef..d60ff468f0 100644
> --- a/src/ch/ch_driver.c
> +++ b/src/ch/ch_driver.c
> @@ -1303,6 +1303,158 @@ chDomainPinVcpu(virDomainPtr dom,
>                                    VIR_DOMAIN_AFFECT_LIVE);
>  }
>  
> +
> +
> +static int
> +chDomainGetEmulatorPinInfo(virDomainPtr dom,
> +                           unsigned char *cpumaps,
> +                           int maplen,
> +                           unsigned int flags)
> +{
> +    virDomainObj *vm = NULL;
> +    virDomainDef *def;
> +    virCHDomainObjPrivate *priv;
> +    bool live;
> +    int ret = -1;
> +    virBitmap *cpumask = NULL;
> +    g_autoptr(virBitmap) bitmap = NULL;
> +    virBitmap *autoCpuset = NULL;
> +
> +    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
> +                  VIR_DOMAIN_AFFECT_CONFIG, -1);
> +
> +    if (!(vm = chDomObjFromDomain(dom)))

This needs to be virCHDomainObjFromDomain(). And in the other function too.

> +        goto cleanup;
> +
> +    if (virDomainGetEmulatorPinInfoEnsureACL(dom->conn, vm->def) < 0)
> +        goto cleanup;
> +
> +    if (!(def = virDomainObjGetOneDefState(vm, flags, &live)))
> +        goto cleanup;
> +
> +    if (live) {
> +        priv = vm->privateData;
> +        autoCpuset = priv->autoCpuset;
> +    }
> +    if (def->cputune.emulatorpin) {
> +        cpumask = def->cputune.emulatorpin;
> +    } else if (def->cpumask) {
> +        cpumask = def->cpumask;
> +    } else if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO &&
> +               autoCpuset) {
> +        cpumask = autoCpuset;
> +    } else {
> +        if (!(bitmap = virHostCPUGetAvailableCPUsBitmap()))
> +            goto cleanup;
> +        cpumask = bitmap;
> +    }
> +
> +    virBitmapToDataBuf(cpumask, cpumaps, maplen);
> +
> +    ret = 1;
> +
> + cleanup:
> +    virDomainObjEndAPI(&vm);
> +    return ret;
> +}
> +

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux