于 2011年03月21日 16:49, Zvi Dubitzky 写道: > Zvi Dubitzky > Email:dubi@xxxxxxxxxx > IBM Haifa Research Laboratory Phone: +972-4-8296182 > Haifa, 31905, ISRAEL > > > > Osier Yang<jyang@xxxxxxxxxx> wrote on 21/03/2011 10:27:07: > >> From: Osier Yang<jyang@xxxxxxxxxx> >> To: Zvi Dubitzky/Haifa/IBM@IBMIL >> Cc: libvirt-users@xxxxxxxxxx >> Date: 21/03/2011 10:27 >> Subject: Re: using more than 1 core by a virtual > machine >> >> 于 2011年03月17日 02:04, Zvi Dubitzky 写道: >>> My virtual machine xml file has<vcpu>2</vcpu> clause while the host > has >>> 2 physical cpus (cores). >>> Is this enough to cause a VM running 2 endless loop threads to use > the 2 >>> cores ? >>> In my case the VM running reports (cat /roc/cpuinfo) that it has 2 > vcpus >>> but it uses only 1 core (at a time) because >>> the 'top' at the host shows 100%cpu (out of total 200%) used by the >>> endless loop application >>> Also virsh vcpuinfo<vm> shows only 1 CPU and 1 vcpu >> >> Is it really only 1 vcpu is showed? it should be two, that's >> strange if you specified two vcpus, but only 1 is showed. >> and by default, if you don't specify "cpuset" in<vcpu>, it uses >> all the physical cpus, if I'm right, so you should be able to >> see something like: >> >> CPU Affinity: yy >> >> Could you try specify "cpuset" explicitly like: >> >> <vcpu cpuset="0,1">2</vcpu> >> >> And see what it happens? >> > > NO. There 2 vcpus in the VM screen . I pasted only one of them . yes there > is > PU Affinity: yy anyhow in 'virsh vcpuinfo<domain> even before fixing > the problem as below. > > I solved the problem : The BIOS did not have VT enabled although > multiprocessing item was already enabled in the BIOS and also some item > called "virtualization " was already enabled . But that was not enough : > I also had to drop the following clause from the VM xml file: > '<emulator>/usr/local/bin/qemu-system-x86_64</emulator>' > Anyhow: I do not understand why using multicore under a VM is dependent on > the VT enabled > > Now the 'top' utility (at the host) shows qemu-kvm is the running process > instead of qemu-system-x86_64 as before the fix . On the another Debian > system I did not have to drop the<emulator> clause from the xml and the > VM was still using all the cores though ! But the libvirt at the Debian > was newer (0.8.6) while the fedora14 was running libvirt 0.8.3 > > Do you know what is exactly qemu-system-x86_64 vs. qemu-kvm . Simpley speaking, qemu-kvm is with kvm support, while qemu-system-x86-64 is not. Does the > latter appear only if > HW virtualization is active in the BIOS ? > Not sure what your exact meaning, but I guess you mean it appears in domain xml. If so: libvirt contruct the capability of qemu driver when libvirtd starts, if your host doesn't enable VT support, then kvm module is not loaded, libvirt inspects if "/dev/kvm" is accessiable to determine whether to use "qemu-kvm" as emulator in the capability xml or not. That's why it's not <emulator>/usr/libexec/qemu-kvm</emulator> in your domain xml. It's not the detailed explaination, but simply makes sense for you. To see the qemu guest capabilities your host supports: # virsh -c qemu:///system capabilities And anyway, I don't think multicore for VM relates with the emulator, if qemu-kvm is used, vcpus are virtualized by KVM, if qemu-system-x86_64 is used, they are emulated. Regards Osier