Gentoo Archives: gentoo-user

From: Kerin Millar <kerframil@×××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Recommendation for CPU type in QEMU?
Date: Tue, 06 Aug 2013 13:14:43
Message-Id: 5200F6B8.1090809@fastmail.co.uk
In Reply to: Re: [gentoo-user] Recommendation for CPU type in QEMU? by Marc Joliet
1 On 03/08/2013 15:55, Marc Joliet wrote:
2 > Am Wed, 31 Jul 2013 13:12:01 +0100
3 > schrieb Kerin Millar <kerframil@×××××××××××.uk>:
4 >
5 >> On 31/07/2013 12:31, Marc Joliet wrote:
6 >>
7 >> [snip]
8 >>
9 >>>
10 >>> There's also "-cpu host", which simply passes your CPU through to the guest.
11 >>> That's what I use for my 32 bit WinXP VM. You can use it if you don't mind not
12 >>> being able to migrate your guest, but it sounds to me like you're doing this on
13 >>> a desktop machine, so I suspect guest migration doesn't matter to you.
14 >>>
15 >>
16 >> I thought the same until very recently but it's not the case. The -cpu
17 >> host feature exposes all feature bits supported by qemu. Those may
18 >> include features that aren't supported in hardware by the host CPU, in
19 >> which case qemu has to resort to (slow) emulation if they are used.
20 >>
21 >> --Kerin
22 >
23 > Just a follow up: the most authoritative answer I could find is this:
24 >
25 > http://thread.gmane.org/gmane.comp.emulators.kvm.devel/84227/focus=90541
26 >
27 > Furthermore, the Linux KVM tuning page also defines "-cpu host" as I understand
28 > it:
29 >
30 > http://www.linux-kvm.org/page/Tuning_KVM
31 >
32 > From the above I conclude that "-cpu host" should *not* activate CPU features
33 > that the host CPU does not support.
34 >
35 > Otherwise I could only find out the following:
36 >
37 > - the Gentoo and Arch wikis both recommend "-cpu host" in conjunction with KVM
38 > (see, e.g., http://wiki.gentoo.org/wiki/QEMU/Options)
39 > - in contrast, http://wiki.qemu.org/Features/CPUModels#-cpu_host_vs_-cpu_best
40 > seems to match your statement
41 > - some guy on serverfault.com says this
42 > (http://serverfault.com/questions/404195/kvm-which-cpu-features-make-vms-run-better):
43 >
44 > "Qemu doesn't work in the same way many other hypervisors do. For starters, it
45 > can provide full emulation. That means you can run x86 code on an ARM
46 > processor, for example. When in KVM mode, as you're using it, it doesn't
47 > actually do that... the processor is exposed no matter what, but what is
48 > reported to the OS will be changed by the -cpu flag."
49 >
50 > If that's correct, "-cpu host" might mean different things when in KVM
51 > mode vs. when not. However I'm not going to blindly trust that statement.
52 >
53 > How/where did you find out that "-cpu host" also exposes non-host CPU features?
54 >
55
56 I checked the code and you're right. I had obtained the information from
57 the qemu wiki but can now only assume that the content was discussing
58 the feature before its implementation became concrete. Lesson to self:
59 don't believe everything one reads in wikis (even official ones).
60
61 --Kerin

Replies

Subject Author
Re: [gentoo-user] Recommendation for CPU type in QEMU? Marc Joliet <marcec@×××.de>