[libvirt-users] Setting CPU type for a vm

I have a Windows XP vm and would like to know how should I set its cpu so it is seen by the vm as a proper 32bit one. In its xml file, I have <os> <type arch='i686' machine='rhel6.2.0'>hvm</type> <boot dev='cdrom'/> <boot dev='hd'/> <bootmenu enable='yes'/> </os> And this is the machine I have (an intel i5): [root@vmhost ~]# virsh nodeinfo CPU model: x86_64 CPU(s): 4 CPU frequency: 1600 MHz CPU socket(s): 1 Core(s) per socket: 4 Thread(s) per core: 1 NUMA cell(s): 1 Memory size: 5904548 kB and this is what virsh thinks my vm has: [root@vmhost ~]# virsh vcpuinfo xp VCPU: 0 CPU: 2 State: running CPU time: 521.3s CPU Affinity: yyyy [root@vmhost ~]# But, the vm reports it not only as a 286 but also claims not to have the right drivers for it. How can I make the vm see it as a 686 or something like that?

On 07/18/2012 08:45 PM, Mauricio Tavares wrote:
I have a Windows XP vm and would like to know how should I set its cpu so it is seen by the vm as a proper 32bit one. In its xml file, I have
<os> <type arch='i686' machine='rhel6.2.0'>hvm</type>
That's the correct way.
and this is what virsh thinks my vm has:
[root@vmhost ~]# virsh vcpuinfo xp VCPU: 0
This looks like a bug - a guest cannot exist without at least one vcpu.
CPU: 2
That only says your host has 2 cpus that the guest can utilize; it says nothing about what type of cpu the guest will see.
But, the vm reports it not only as a 286 but also claims not to have the right drivers for it. How can I make the vm see it as a 686 or something like that?
Huh? The guest should be seeing it's CPU as a 686. What is the actual error message you are seeing? Also, note that you need not constrain your guest cpu to i686 unless you specifically plan to migrate your guest to a different host where the host is running in 32-bit mode instead of the more typical 64-bit mode; all 32-bit operating systems will run equally well on x86_64 cpus. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Thu, Jul 19, 2012 at 07:54:49AM -0600, Eric Blake wrote:
On 07/18/2012 08:45 PM, Mauricio Tavares wrote:
I have a Windows XP vm and would like to know how should I set its cpu so it is seen by the vm as a proper 32bit one. In its xml file, I have
<os> <type arch='i686' machine='rhel6.2.0'>hvm</type>
That's the correct way.
and this is what virsh thinks my vm has:
[root@vmhost ~]# virsh vcpuinfo xp VCPU: 0
This looks like a bug - a guest cannot exist without at least one vcpu.
CPU: 2
That only says your host has 2 cpus that the guest can utilize; it says nothing about what type of cpu the guest will see.
You're mis-interpreting the data here. 'vpucinfo' info repeats these four lines of data per VCPU. So this is saying that the first vCPU, #0, is running running on host CPU #2. The total number of guest CPUs is shown by 'virsh dominfo' The total number of host CPUs is shown by 'virsh nodeinfo' 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 :|

On Thu, Jul 19, 2012 at 10:01 AM, Daniel P. Berrange <berrange@redhat.com> wrote:
On Thu, Jul 19, 2012 at 07:54:49AM -0600, Eric Blake wrote:
On 07/18/2012 08:45 PM, Mauricio Tavares wrote:
I have a Windows XP vm and would like to know how should I set its cpu so it is seen by the vm as a proper 32bit one. In its xml file, I have
<os> <type arch='i686' machine='rhel6.2.0'>hvm</type>
That's the correct way.
and this is what virsh thinks my vm has:
[root@vmhost ~]# virsh vcpuinfo xp VCPU: 0
This looks like a bug - a guest cannot exist without at least one vcpu.
CPU: 2
That only says your host has 2 cpus that the guest can utilize; it says nothing about what type of cpu the guest will see.
You're mis-interpreting the data here. 'vpucinfo' info repeats these four lines of data per VCPU.
So this is saying that the first vCPU, #0, is running running on host CPU #2.
The total number of guest CPUs is shown by 'virsh dominfo'
The total number of host CPUs is shown by 'virsh nodeinfo'
Cool. I do take I can specify which cpu I want to use, right? later on I need to read up on how to scale up the number of CPUs given to a vm based on its load.
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 :|

On Thu, Jul 19, 2012 at 9:54 AM, Eric Blake <eblake@redhat.com> wrote:
But, the vm reports it not only as a 286 but also claims not to have the right drivers for it. How can I make the vm see it as a 686 or something like that?
Huh? The guest should be seeing it's CPU as a 686. What is the actual error message you are seeing?
When I set it as above and then cpu as qemu32, XP reports it is a Intel Pentium II Processor. Here is the message seen in Windows itself (Control Panel->System->Processors): Windows cannot load the device driver for this hardware. The driver may be corrupted or missing. (Code 39) I also tried something like (still keeping arch='i686' ): <cpu match='exact'> <model fallback='allow'>coreduo</model> <topology sockets='1' cores='2' threads='1'/> </cpu> Which led to "A driver (service) for this device has been disabled. An alternate driver may be providing this functionality. (Code 32)"
Also, note that you need not constrain your guest cpu to i686 unless you specifically plan to migrate your guest to a different host where the host is running in 32-bit mode instead of the more typical 64-bit mode; all 32-bit operating systems will run equally well on x86_64 cpus.
That is good to know. I was actually wondering if you were building code inside the VM and asked it to optimize to whatever cpu you specify, it would do so. Another reason is that some stuff I want to move into vms is using specific cpus and I want to make the vm as close to the original setup as I reasonably can.
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Mauricio Tavares