From patchwork Mon Mar 13 21:43:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= X-Patchwork-Id: 9622183 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AA9CC604CC for ; Mon, 13 Mar 2017 21:44:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B041284CB for ; Mon, 13 Mar 2017 21:44:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FD302850E; Mon, 13 Mar 2017 21:44:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.9 required=2.0 tests=BAYES_00,HK_RANDOM_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44408284CB for ; Mon, 13 Mar 2017 21:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754132AbdCMVoG (ORCPT ); Mon, 13 Mar 2017 17:44:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45408 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754036AbdCMVoA (ORCPT ); Mon, 13 Mar 2017 17:44:00 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9115D81F07; Mon, 13 Mar 2017 21:44:00 +0000 (UTC) Received: from potion (dhcp-1-208.brq.redhat.com [10.34.1.208]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id v2DLhuJ9018015; Mon, 13 Mar 2017 17:43:57 -0400 Received: by potion (sSMTP sendmail emulation); Mon, 13 Mar 2017 22:43:55 +0100 Date: Mon, 13 Mar 2017 22:43:55 +0100 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, Paolo Bonzini , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [PATCH] kvm: better MWAIT emulation for guests Message-ID: <20170313214355.GC4547@potion> References: <1489098555-23856-1-git-send-email-mst@redhat.com> <20170313154618.GA4547@potion> <20170313180046-mutt-send-email-mst@kernel.org> <20170313193910.GB4547@potion> <20170313215016-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170313215016-mutt-send-email-mst@kernel.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 13 Mar 2017 21:44:00 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 2017-03-13 22:03+0200, Michael S. Tsirkin: > On Mon, Mar 13, 2017 at 08:39:11PM +0100, Radim Krčmář wrote: > > 2017-03-13 18:08+0200, Michael S. Tsirkin: > > > On Mon, Mar 13, 2017 at 04:46:20PM +0100, Radim Krčmář wrote: >> >> What about keeping just the last hunk to improve OS X, for now? >> > >> > IMHO if we have a new functionality we are better of creating >> > some way for guests to discover it is there. >> > >> > Do we really have to argue about a single bit in HV leaf? >> > What harm does it do? >> >> It adds code to both guest and hosts and needs documentation ... >> The bit is acceptable. I just see no point in having it when there >> already is a detection mechanism for mwait. > > We don't want to use that standard detection mechanism IMHO at least > not in all cases. Enabling mwait by default would make sense if the guest OS monitored its steal time and disabled mwait when it detects that it is not the main user of the CPU, because mwait then hurts the host as well as the guest. This would warrant some kind of paravirt as we still wouldn't want to have standard mwait by default. My problem is that the paravirt flag alone is not enough for a normal mwait use on Intel. >> In any case, this patch should also remove VM exits under SVM > > AMD does not have MWAIT AFAIK. In any case, I don't see > why can't SVM be a separate patch. AMD just doesn't have MWAIT hints. (AMD has even MWAIT in userspace and MWAITX, but they are not supported by KVM.) The separate patch would have to be part of the same series as we don't want to have vendor-specific detection, so I'd just remove these two in the same patch to simplify handling: Thanks. diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index d1efe2c62b3f..18e53bc185d6 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1198,8 +1198,6 @@ static void init_vmcb(struct vcpu_svm *svm) set_intercept(svm, INTERCEPT_CLGI); set_intercept(svm, INTERCEPT_SKINIT); set_intercept(svm, INTERCEPT_WBINVD); - set_intercept(svm, INTERCEPT_MONITOR); - set_intercept(svm, INTERCEPT_MWAIT); set_intercept(svm, INTERCEPT_XSETBV); control->iopm_base_pa = iopm_base;