From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [RFC 0/2] GET_EMULATED_CPUID support with "allow-emulation" option Date: Thu, 05 Jun 2014 18:40:25 +0200 Message-ID: <53909D79.1070609@suse.de> References: <1401984741-26882-1-git-send-email-ehabkost@redhat.com> <539099B6.2090000@suse.de> <53909A41.1060800@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Borislav Petkov , "Gabriel L. Somlo" , kvm@vger.kernel.org, "Michael S. Tsirkin" , Michael Mueller , Christian Borntraeger , "Jason J. Herne" , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= To: Paolo Bonzini , Eduardo Habkost , qemu-devel@nongnu.org Return-path: Received: from cantor2.suse.de ([195.135.220.15]:36860 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752111AbaFEQk3 (ORCPT ); Thu, 5 Jun 2014 12:40:29 -0400 In-Reply-To: <53909A41.1060800@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05.06.14 18:26, Paolo Bonzini wrote: > Il 05/06/2014 18:24, Alexander Graf ha scritto: >> >> On 05.06.14 18:12, Eduardo Habkost wrote: >>> This implements GET_SUPPORTED_CPUID support using an explicit option >>> for it: >>> "allow-emulation". We don't want any emulated feature to be enabled by >>> accident, >>> so they will be enabled only if the user explicitly wants to allow >>> them. >> >> So is this an all-or-nothing approach? I would really prefer to override >> individual bits. > > You can still disable them with "cpu foo,-movbe,allow-emulation". > >> Also, I don't think the line "emulated" is the right one to draw. We >> "emulate" SVM or VMX too, but still enable them by default as soon as we >> think they're ready enough. > > Well, I disagreed with the whole KVM_GET_EMULATED_CPUID concept for > MOVBE too for example. It seemed overengineered to me, sooner or > later we might graduate MOVBE out of KVM_GET_EMULATED_CPUID as well. > > However, for MONITOR/MWAIT it makes some sense. I honestly think what we want for MONITOR/MWAIT is a cpuid-override bit. cpuid = user_specified_cpuids(); cpuid &= kvm_capable_cpuids() cpuid |= user_override_cpuids(); kvm_set_cpuid(cpuid); If the user knows what he's doing, he can set the force bit. If the kernel happens to emulate that instruction, he's happy. If the kernel doesn't emulate it, it will fail and he will realize that he did something stupid. But ok, we do have this awesome GET_EMULATE_CPUID ioctl now, so we can as well use it - even though I consider it superfluous: cpuid = user_specified_cpuids(); cpuid &= kvm_capable_cpuids() cpuid |= user_override_cpuids() & kvm_emulated_cpuid(); kvm_set_cpuid(cpuid); but enabling all experimental features inside KVM just because we want one or two of them is very counter-intuitive. Imagine we'd introduce emulation support for AVX. Suddenly allow-emulation (which I'd need for Mac OS X 10.5) would enable AVX as well which I really don't want enabled. Also, while we can't change the ioctl name anymore, please let's use "experimental" rather than "emulated" as the name everywhere. Maybe we'll never bump individual features from experimental to fully supported, but there's no reason we wouldn't have emulated features that are not part of this bitmap and there's no reason we wouldn't have real hardware features that are not ready yet and part of this bitmap. Alex