Re: [Qemu-devel] expose host CPU features to guests: Take 3

J. Mayer
2007-09-25T11:09:21Z

On Tue, 2007-09-25 at 12:40 +0200, Avi Kivity wrote:
> Avi Kivity wrote:
> >>>
> >>>
> >> I've got a remark about this: why this has to be added to the Qemu
> >> code ?
> >> Imho, all is needed is an implementation of the -cpu option for
> >> x86/x86_64 target. Then, an external tool (even a shell script) can be
> >> used to determine what is the host CPU if you want to select the exact
> >> same CPU to be emulated in Qemu. It seems to me that trying to do so is
> >> out of the scope of Qemu code and just add unneeded complexity.
> >>
> >>
> >
> > Indeed for regular qemu this is useless. But it is useful for kqemu
> > (for which there is support in mainline qemu), and for kvm (which we
> > hope to merge one day).
> >
> >
>
> Actually (as Izik Eidus reminds me), this isn't very useful for kqemu as
> it can't trap cpuid in all circumstances.
>
> So this is mainly useful for kvm. I hope it will be applied regardless
> of that, as there is agreement that kvm support should be merged. I'd
> much rather pull the feature from qemu rather than carry it as an
> additional patch.

Still I don't understand why it's usefull to put it inside the emulator
and why:
# qemu -cpu `guess_host_cpu`
would not do the work properly. Adding a specific case for '-cpu host'
seems useless to me.
And this way of doing potentially work for any family of emulated
targets, without any modification in Qemu. If the string returned by
'guess_host_cpu' is not recognized for the specific target you used it
with, Qemu just stops telling it cannot find this CPU model, no more, no
less.
The only case it could be interresting, imho, is if you do not allow the
-cpu option in KVM case and force the cpu model instead using this
function. This behavior does not seem to be great idea to me.

Or maybe I missed something ?

--
J. Mayer <l_indien-nJJpUPIbDOA@public.gmane.org>
Never organized