[libvirt] virsh vcpuinfo with tcg

Daniel P. Berrange berrange at redhat.com
Mon Feb 9 16:01:55 UTC 2015


On Mon, Feb 09, 2015 at 03:20:28PM +0000, Serge Hallyn wrote:
> Hi,
> 
> 'virsh vcpuinfo' in 1.2.12 returns an empty line for VMs using tcg.  I
> assume this is due to commit b07f3d821dfb11 which explicitly sets
> nvcpupids to 0 now.  Is 'virsh vcpuinfo' returning nothing just an
> unfortunate but expected side-effect, or is it a bug and it should
> return info anyway?  My impression is that qemu_driver.c should be
> using vm->def->vcpus rather than priv->nvcpupids to determine the
> # of cpus to show?

The virsh vcpuinfo command calls virDomainGetVcpus() which in QEMU
ends up calling qemuDomainHelperGetVcpus. This method in turn
iterates over the vCPUs calling qemuGetProcessInfo to determine
the CPU time & CPU affinity of the vCPU vs host pCPUs. This only
works if there are threads for each vCPU in QEMU. The QEMU TCG
emulator is single threaded, so we cannot get the data for individual
vCPUs when using TCG.

The previous code would result in virDomainGetVcpus() returning
only a single vCPU record even when the guest have multiple vCPUs,
which is just incorrect.

For some reason though qemuDomainHelperGetVcpus just returns
no data at all now, when it should be returning an error
message "cpu affinity is not available". this just looks like
a logic error there.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list