From: Alexander Graf Subject: Re: [PATCH 2/2] Allow the SVM CPUID bit in a VM Date: Wed, 3 Sep 2008 10:04:54 +0200 Message-ID: References: <1220270342-15769-1-git-send-email-agraf@suse.de> <1220270342-15769-2-git-send-email-agraf@suse.de> <1220270342-15769-3-git-send-email-agraf@suse.de> <48BBF570.9070301@qumranet.com> <4EE967D1-3CB5-45C4-B480-0D230242D476@suse.de> <484561CE-F0E6-45E9-BBF0-7DBDB8571873@suse.de> <48BE42F8.3040902@redhat.com> Mime-Version: 1.0 (Apple Message framework v926) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Cc: Avi Kivity , kvm@vger.kernel.org, joro@8bytes.org, anthony@codemonkey.ws To: Gerd Hoffmann Return-path: Received: from ns2.suse.de ([195.135.220.15]:34832 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751134AbYICIE5 (ORCPT ); Wed, 3 Sep 2008 04:04:57 -0400 In-Reply-To: <48BE42F8.3040902@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sep 3, 2008, at 9:55 AM, Gerd Hoffmann wrote: > Hi, > >> On a sidenote I'm really not fond of the userspace CPUID capability >> restrictions in the first place. Shouldn't this all be determined >> in the >> kernel module? It doesn't make since IMHO to restrict NX usage from >> userspace. The kernel module knows best what it's capable of. > > I think cpuid handling will be a quite interesting when it comes to > merging qemu and kvm. Doing it completely in the kernel isn't going > to > work. There are several reasons why you might want to change the > cpuid > presented to the guest. > > First, you might want to mask out cpuid bits not supported by all > machines in your pool, for migration compatibility. > > Second, you might want to present a specific CPU to the guest (like > qemu > -cpu pentium). At least as close as possible, of course there are > some > restrictions. I think even if you mask out the sse cpuid bit sse > instructions will actually work. Also having a virtual intel cpu on > amd > and visa versa probably isn't going to work unless we'll fall back to > the emulator for the missing instructions. > > Third, there is the hypervisor cpuid range (0x40000000+). That one > needs to be configurable by userspace as well. I guess I didn't express myself correctly, sorry for that :-). I think that kvm kernel module capabilities should be masked out in the kernel module, while "other" stuff, like migration masking or additional CPUIDs (do these work atm?) should of course reside in the userspace. The code I was referring to was the removal of the NX bit and the SVM bit. These are definitely kernel capabilities. If the kernel module doesn't implement these, it should just mask them out instead of having userspace figure out what's there and what isn't. I hope I didn't completely confuse everybody now :-). On a sidenote: We really need to switch to the newer cpuid kernel<->userspace interface. The way it currently is, CPUID 4 is severely broken. Alex