From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH v2] kvm: x86: emulate monitor and mwait instructions as nop Date: Wed, 04 Jun 2014 16:44:13 +0200 Message-ID: <538F30BD.5000501@suse.de> References: <20140507205210.GA30030@ERROL.INI.CMU.EDU> <20140602192530.GC1653@ERROL.INI.CMU.EDU> <538D92BC.4060203@redhat.com> <20140604143941.GF1653@ERROL.INI.CMU.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mst@redhat.com To: "Gabriel L. Somlo" , Paolo Bonzini Return-path: Received: from cantor2.suse.de ([195.135.220.15]:35470 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751644AbaFDOoQ (ORCPT ); Wed, 4 Jun 2014 10:44:16 -0400 In-Reply-To: <20140604143941.GF1653@ERROL.INI.CMU.EDU> Sender: kvm-owner@vger.kernel.org List-ID: On 04.06.14 16:39, Gabriel L. Somlo wrote: > Paolo, > > I noticed the monitor=mwait=nop patch is making its way upstream, so > thanks ! > > I'm still interested in following up with something that would enable > this behavior only conditionally (e.g. following an ioctl call from > userspace to enable it only for the (set of) vcpu(s) belonging to one > guest VM at a time), which should then also include advertising the > feature in CPUID. > > I grep-ed through the kvm sources for KVM_CAP for some inspiration, > and it looks more like KVM_CAP_* is a way to tell userspace what the > kernel supports, but nothing I saw showed me an example of a "tunable" > feature that userspace may ask to be turned on or off (e.g per-vcpu). > > Is there something like that I could use as an example ? Sure, we use it all over the place on PPC :). > Obviously, if you really like the current behavior better you can > always reject whatever patch I'll come up with, but I'd like to at > least try and see what it would look like :) I think it's perfectly fine to leave mwait always implemented as NOP - it's valid behavior. As for the CPUID exposure, that should be a pure QEMU thing. If overriding CPUID bits the kernel mask tells us doesn't work today, we should just make it possible :). Eventually I really think that -cpu foo,+mwait,+monitor or whatever the bits are should override any safety net that KVM gives us on features it thinks are safe to use. Alex