[libvirt] virsh vcpuinfo with tcg

Daniel P. Berrange berrange at redhat.com
Tue Feb 10 16:13:52 UTC 2015


On Mon, Feb 09, 2015 at 04:01:55PM +0000, Daniel P. Berrange wrote:
> 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.

I've found another bug in fact. It seems that when the XML parser sees
<vcpu cpuset='0-1'>4</vcpu>, it will also create a fake <cputune>
config of

      <cputune>
        <vcpupin cpuset='0-1' vcpu='0'/>
        <vcpupin cpuset='0-1' vcpu='1'/>
        <vcpupin cpuset='0-1' vcpu='2'/>
        <vcpupin cpuset='0-1' vcpu='3'/>
      </cputune>

So although my intent was to prevent use of per-VCPU pining only,
it seems we've in fact prevented use of VM level pinning too :-(
I'll send a patch to try and fix that

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