Re: [PATCH 5/5] qemu: Ensure reported VCPU state is current in driver API

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

 



On Thu, Jul 14, 2016 at 16:35:42 +0200, Viktor Mihajlovski wrote:
> Refresh the VCPU halted states in API functions returning domain
> VCPU state information to make sure it's current. This affects
> qemuDomainGetVcpus and  qemuDomainGetStatsVcpu
> 
> Signed-off-by: Viktor Mihajlovski <mihajlov@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
> 

[..]

> @@ -5283,6 +5288,13 @@ qemuDomainGetVcpus(virDomainPtr dom,
>          goto cleanup;
>      }
>  
> +    if (qemuDomainRefreshVcpuHalted(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) {

APIs calling the monitor need to enter a job since monitor calls unlock
the domain. There wouldn't be anything guarding the API.

> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       "%s",
> +                       _("could not refresh CPU states"));
> +        return -1;

This skips cleanup section where the VM object needs to be unlocked.

> +    }
> +
>      ret = qemuDomainHelperGetVcpus(vm, info, NULL, maxinfo, cpumaps, maplen);
>  
>   cleanup:


> @@ -18565,6 +18577,13 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
>          VIR_ALLOC_N(cpuwait, virDomainDefGetVcpus(dom->def)) < 0)
>          goto cleanup;

[1]

>  
> +    if (qemuDomainRefreshVcpuHalted(driver, dom, QEMU_ASYNC_JOB_NONE) < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       "%s",
> +                       _("could not refresh CPU states"));
> +        return -1;

This would leak memory allocated just above this hunk.

> +    }
> +

I've fixed the problems mentioned above and tweaked the code to comply
with changes done to previous patches. I've also dropped the reviewed-by
tag since I'll be sending this for review again due to the changes
needed.

Peter

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]