public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Fabrice Bellard <fabrice-+Yn2HnRVxb5AfugRpC6u6w@public.gmane.org>
To: qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org
Cc: kvm-devel
	<kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	"J. Mayer" <l_indien-nJJpUPIbDOA@public.gmane.org>
Subject: Re: [Qemu-devel] expose host CPU features	to	guests: Take 3
Date: Tue, 25 Sep 2007 14:05:21 +0200	[thread overview]
Message-ID: <46F8F981.8020800@bellard.org> (raw)
In-Reply-To: <46F8F2B8.1080203-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Avi Kivity wrote:
> J. Mayer wrote:
> 
>>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.
>>  
> 
> 
> It's a usability issue.  I agree your suggestion would work, but I'd
> like the default for kvm to be using the host cpu features, whereas
> managed environments would specify some subset to enable live migration.
> 
> 
>>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.
>>  
> 
> 
> I think we can move the host cpu checks to kvm-specific code, since it
> is not useful for kqemu.
> 
> So, running qemu without any parameters would use host capabilities if
> kvm is available and the default qemu cpu if not.  The -cpu option can
> be used to override this if necessary.

Rectification: this is useful for kqemu too. I strongly suggest to look 
at kqemu.c:kqemu_update_cpuid() !

Moreover I believe that using the same CPU as host can be useful for 
pure emulation too, for example if code to do cache profiling is added.

Regards,

Fabrice.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  parent reply	other threads:[~2007-09-25 12:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-05 17:45 expose host CPU features to guests danken-atKUWr5tajBWk0Htik3J/w
     [not found] ` <20070905174530.GA3945-iWbx9bcAnq+Hk9JtIoIkgNBPR1lH4CV8@public.gmane.org>
2007-09-05 19:26   ` Anthony Liguori
2007-09-05 19:34     ` Avi Kivity
     [not found]       ` <46DF04D5.5000807-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-05 19:44         ` Daniel P. Berrange
     [not found]           ` <20070905194448.GN5503-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2007-09-06  0:30             ` [Qemu-devel] " Paul Brook
2007-09-06  8:46               ` Re: [kvm-devel] " Avi Kivity
2007-09-07 10:47     ` [Qemu-devel] " Jamie Lokier
     [not found]       ` <20070907104738.GA14723-tp2ajI7sM85Y6zH9YvfY1x2eb7JE58TQ@public.gmane.org>
2007-09-09  7:51         ` Avi Kivity
     [not found]           ` <46E3A618.7030505-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-09 12:47             ` Jamie Lokier
     [not found]               ` <20070909124718.GE24240-tp2ajI7sM85Y6zH9YvfY1x2eb7JE58TQ@public.gmane.org>
2007-09-09 12:55                 ` Avi Kivity
     [not found]                   ` <46E3ED2B.6080606-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-09 13:07                     ` Jamie Lokier
2007-09-09 13:14                       ` [kvm-devel] " Avi Kivity
     [not found]                       ` <20070909130725.GF24240-tp2ajI7sM85Y6zH9YvfY1x2eb7JE58TQ@public.gmane.org>
2007-09-09 15:25                         ` [Qemu-devel] " Paul Brook
2007-09-09 15:29                           ` [kvm-devel] " Avi Kivity
2007-09-09 15:47                             ` Jamie Lokier
2007-09-09 16:12                             ` Paul Brook
     [not found]                               ` <200709091712.15743.paul-qD8j1LwMmJjtCj0u4l0SBw@public.gmane.org>
2007-09-09 16:38                                 ` [Qemu-devel] " Avi Kivity
2007-09-10 16:53                                 ` Jamie Lokier
2007-09-10  7:40 ` expose host CPU features to guests: Take 2 Dan Kenigsberg
     [not found]   ` <20070910074005.GA26869-iWbx9bcAnq+Hk9JtIoIkgNBPR1lH4CV8@public.gmane.org>
2007-09-24 17:41     ` expose host CPU features to guests: Take 3 Dan Kenigsberg
     [not found]       ` <20070924174129.GA4507-iWbx9bcAnq+Hk9JtIoIkgNBPR1lH4CV8@public.gmane.org>
2007-09-25  1:28         ` [Qemu-devel] " andrzej zaborowski
     [not found]           ` <fb249edb0709241828pb6b9fd4v1d1d8d4a3495f040-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-09-25  8:48             ` Dan Kenigsberg
     [not found]               ` <20070925084842.GA14221-iWbx9bcAnq+Hk9JtIoIkgNBPR1lH4CV8@public.gmane.org>
2007-09-25  9:01                 ` Avi Kivity
     [not found]                   ` <46F8CE52.3080502-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-25  9:19                     ` J. Mayer
2007-09-25  9:31                       ` Avi Kivity
     [not found]                         ` <46F8D577.3020306-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-25 10:40                           ` Avi Kivity
     [not found]                             ` <46F8E5A2.30906-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-25 11:09                               ` J. Mayer
2007-09-25 11:36                                 ` Avi Kivity
     [not found]                                   ` <46F8F2B8.1080203-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-25 12:05                                     ` Fabrice Bellard [this message]
2007-09-25 13:07                                     ` Jocelyn Mayer
     [not found]                                       ` <1190725664.13490.14.camel-JEa2SU7BmVsPEyPTZiGI+UEOCMrvLtNR@public.gmane.org>
2007-09-25 13:12                                         ` Avi Kivity
2007-09-25 13:27                                         ` Dan Kenigsberg
2007-09-25 12:51                           ` Paul Brook
     [not found]                             ` <200709251351.55481.paul-qD8j1LwMmJjtCj0u4l0SBw@public.gmane.org>
2007-09-25 13:13                               ` Avi Kivity
2007-10-07 12:38         ` x86 -cpu option: Take 4 Dan Kenigsberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46F8F981.8020800@bellard.org \
    --to=fabrice-+yn2hnrvxb5afugrpc6u6w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=l_indien-nJJpUPIbDOA@public.gmane.org \
    --cc=qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox