Gentoo Archives: gentoo-user

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

Attachments

File name MIME type
signature.asc application/pgp-signature