From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: CPUID emulation Date: Thu, 31 May 2007 11:39:04 +0300 Message-ID: <465E89A8.9020201@qumranet.com> References: <20070531082006.GB22798@frankl.hpl.hp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: eranian-sDzT885Ts8HQT0dZR+AlfA@public.gmane.org Return-path: In-Reply-To: <20070531082006.GB22798-HU54gidqsKnWxDs0y9d3MAC/G2K4zDHf@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Stephane Eranian wrote: > Hello, > > Looking at kvm-26, it seems that the CPUID values as seen by the guest OS > are still hardcoded for i386/x86-64 at least. > > For performance counter virtualization, the guest needs to see the *actual* > family/model information in order to correctly program the counters. > > It would be fairly simple to grab that information from /proc/cpuinfo > at init time in qemu. > > However, I am wondering if there would be side effects of using the > actual CPUID which could cause troubles to KVM or the guest. > > The main issue is migration (and save/restore). If you migrate to a host with fewer capabilities, applications may fail when they use unavailable instructions that they successfully detected earlier. I think the best solution is to default to the host's capabilities, but allow command line switches to override them. This way a management application in a server farm can set a site-wide least common denominator, while a home user can enjoy the latest and greatest instructions on their machine. Upstream qemu already has a -cpu (or similar) switch for non-x86; we can probably use that. (there's another possible issue - some future features may require support from the hypervisor - that may conflict with defaulting to to the host feature set. maybe kvm should mask out any unknown features) -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/