Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753446AbdDDNNW (ORCPT ); Tue, 4 Apr 2017 09:13:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56182 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752292AbdDDNNU (ORCPT ); Tue, 4 Apr 2017 09:13:20 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2A06B3DBC2 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=rkrcmar@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2A06B3DBC2 Date: Tue, 4 Apr 2017 15:13:09 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Alexander Graf Cc: Jim Mattson , "Michael S. Tsirkin" , LKML , "Gabriel L. Somlo" , Paolo Bonzini , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , the arch/x86 maintainers , Joerg Roedel , kvm list , linux-doc@vger.kernel.org Subject: Re: [PATCH v5 untested] kvm: better MWAIT emulation for guests Message-ID: <20170404131308.GA9826@potion> References: <1489612895-12799-1-git-send-email-mst@redhat.com> <87f187de-64ef-22a2-7714-a811883bce02@suse.de> <20170328142837.GA21738@potion> <20170329121147.GA5129@potion> <20170404123915.GA9525@potion> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 04 Apr 2017 13:13:20 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1665 Lines: 40 2017-04-04 14:51+0200, Alexander Graf: > On 04/04/2017 02:39 PM, Radim Krčmář wrote: >> 2017-04-03 12:04+0200, Alexander Graf: >> > So coming back to the original patch, is there anything that should keep us >> > from exposing MWAIT straight into the guest at all times? >> Just minor issues: >> * OS X on Core 2 fails for unknown reason if we disable the instruction >> trapping, which is an argument against doing it by default > > So for that we should try and see if changing the exposed CPUID MWAIT leaf > helps. Currently we return 0/0 which is pretty bogus and might be the reason > OSX fails. We have tried to pass host's CPUID MWAIT leaf and it still failed: https://www.spinics.net/lists/kvm/msg146686.html I wouldn't mind breaking that particular combination of OS X and hardware, but I'm worried to do it because we don't understand why it broke, so there could be more ... >> * idling guests would consume host CPU, which is a significant change >> in behavior and shouldn't be done without userspace's involvement > > That's the same as today, as idling guests with MWAIT would also today end > up in a NOP emulated loop. > > Please bear in mind that I do not advocate to expose the MWAIT CPUID flag. > This is only for the instruction trap. Ah, makes sense. >> I think the best compromise is to add a capability for the MWAIT VM-exit >> controls and let userspace expose MWAIT if it wishes to. >> Will send a patch. > > Please see my patch to force enable CPUID bits ;). Nice. MWAIT could also use setting of arbitrary values for its leaf, but a generic interface for that would probably look clunky on the command line ...