From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A908EC3F2D7 for ; Tue, 3 Mar 2020 16:01:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8A1D9215A4 for ; Tue, 3 Mar 2020 16:01:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730222AbgCCQAz (ORCPT ); Tue, 3 Mar 2020 11:00:55 -0500 Received: from mga09.intel.com ([134.134.136.24]:33796 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729543AbgCCQAy (ORCPT ); Tue, 3 Mar 2020 11:00:54 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2020 08:00:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,511,1574150400"; d="scan'208";a="274254851" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by fmsmga002.fm.intel.com with ESMTP; 03 Mar 2020 08:00:53 -0800 Date: Tue, 3 Mar 2020 08:00:52 -0800 From: Sean Christopherson To: Paolo Bonzini Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Xiaoyao Li Subject: Re: [PATCH v2 61/66] KVM: x86: Don't propagate MMU lpage support to memslot.disallow_lpage Message-ID: <20200303160052.GI1439@linux.intel.com> References: <20200302235709.27467-1-sean.j.christopherson@intel.com> <20200302235709.27467-62-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tue, Mar 03, 2020 at 04:31:15PM +0100, Paolo Bonzini wrote: > On 03/03/20 00:57, Sean Christopherson wrote: > > Stop propagating MMU large page support into a memslot's disallow_lpage > > now that the MMU's max_page_level handles the scenario where VMX's EPT is > > enabled and EPT doesn't support 2M pages. > > > > No functional change intended. > > > > Reviewed-by: Vitaly Kuznetsov > > Signed-off-by: Sean Christopherson > > --- > > arch/x86/kvm/vmx/vmx.c | 3 --- > > arch/x86/kvm/x86.c | 6 ++---- > > 2 files changed, 2 insertions(+), 7 deletions(-) > > > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > > index f8eb081b63fe..1fbe54dc3263 100644 > > --- a/arch/x86/kvm/vmx/vmx.c > > +++ b/arch/x86/kvm/vmx/vmx.c > > @@ -7698,9 +7698,6 @@ static __init int hardware_setup(void) > > if (!cpu_has_vmx_tpr_shadow()) > > kvm_x86_ops->update_cr8_intercept = NULL; > > > > - if (enable_ept && !cpu_has_vmx_ept_2m_page()) > > - kvm_disable_largepages(); > > - > > #if IS_ENABLED(CONFIG_HYPERV) > > if (ms_hyperv.nested_features & HV_X64_NESTED_GUEST_MAPPING_FLUSH > > && enable_ept) { > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > index 4fdf5b04f148..cc9b543d210b 100644 > > --- a/arch/x86/kvm/x86.c > > +++ b/arch/x86/kvm/x86.c > > @@ -9863,11 +9863,9 @@ static int kvm_alloc_memslot_metadata(struct kvm_memory_slot *slot, > > ugfn = slot->userspace_addr >> PAGE_SHIFT; > > /* > > * If the gfn and userspace address are not aligned wrt each > > - * other, or if explicitly asked to, disable large page > > - * support for this slot > > + * other, disable large page support for this slot. > > */ > > - if ((slot->base_gfn ^ ugfn) & (KVM_PAGES_PER_HPAGE(level) - 1) || > > - !kvm_largepages_enabled()) { > > + if ((slot->base_gfn ^ ugfn) & (KVM_PAGES_PER_HPAGE(level) - 1)) { > > unsigned long j; > > > > for (j = 0; j < lpages; ++j) > > > > This should technically go in the next patch. Hmm, yeah, I agree. IIRC I split it this way so that the next patch didn't touch any arch code, but removing only the call to kvm_disable_largepages() would be cleaner.