Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp207507rdb; Thu, 16 Nov 2023 17:05:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEqfNWr9HtlTB+KtFquShzVcedLsV24NmepXXPanZGM5ghQoXe3e/8y73oixWGMjkt0hU2Y X-Received: by 2002:a05:6a20:144c:b0:187:cd93:aea1 with SMTP id a12-20020a056a20144c00b00187cd93aea1mr3640468pzi.30.1700183142196; Thu, 16 Nov 2023 17:05:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700183142; cv=none; d=google.com; s=arc-20160816; b=n7gneKQis020hOwBbYknOYmbhj6ipkwkjdTikdTmpAOEp+Qe3Ji+uMxX4DxDrskxeK +vy1avYJzedPtjtQjGwxYIO0GwmdZtmFw+K+JbPoo0aegcnYcEfUneIQTzAlydHnTthZ UvRbRjr/l6lB1w9NmIbA2IMfydIZXQGYMbZ1kKpaHp8ACRJZrFYo7scHDKnVAIaAhYkS ssaMYcre7+wW9T/Brtj9XJoHyI9wG1DFy01og48n8nQxL90K3wmBRJrksT7O8mx5n+9Z dKW12z1yhC0KN/7UXO8v0GJXl4EPqTC+dblpoeIr6Iffs2h92C6c5DWuFHulbaZJurmq 3E7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BECo/Htycke9vFgVa854PCF2/Lb3dNhKQNpSZ6coUXs=; fh=1Be8UynfIG+Duu9kbImSJDV1BXKOznS5Lf0DQgUMWfI=; b=FEzkxQ3SoJRvPo5CRoFBYwb/+X2mIWJ9rE8jOIHqIo6vnquNyHs/eUravoSCFTLlVN uFfrT7Eay55JwCyeHT0mJYc6IX7WBxCz1FZY9rOtz8yMLtai9YO1tfFIKmda4yX9/sRE aJG00vhpHTv2/HLpLY1Z/pLS19yC6KR9Y71vDALPzOJIKOYklz5iPoXFGrw4HY20dSpB NKntibMxKRq9jk6ld7LjwGFrAzvpZmhZ70Qx2zX2VP6TaF5w72WfhkMnZ2HutoomYBES j2x2/c9+vF20IjfY3S7t9eN8JS+Mg8x8Xm2pq0nRmkubHIuc5hq+btIzWzSFdjCj6nMJ 49cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Csa+cC9F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id f28-20020a63511c000000b00577f67a0614si643022pgb.879.2023.11.16.17.05.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 17:05:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Csa+cC9F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9324C8236271; Thu, 16 Nov 2023 17:05:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229840AbjKQBF1 (ORCPT + 99 others); Thu, 16 Nov 2023 20:05:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjKQBF0 (ORCPT ); Thu, 16 Nov 2023 20:05:26 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12FC3129; Thu, 16 Nov 2023 17:05:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700183123; x=1731719123; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=ZyZe8XVOWfINF/HMRNgqPyY01tqqlcNLwl5nCO+VM18=; b=Csa+cC9FY4NvZWVfvAZPa1KG0b4TCEO7wFi1dNJ69XtOJ+fJlE1vvEMP AccI/EwZL7whWKFm+q8mFxrz5djQfddveGqy/5x0qZO0Yx8i4G7MtsnSQ NqsDal1fhczvLZjvsWLUUe56/UR7D2Np9CFHU2mx97PxylTjscftVwmhf g0sZDh74FGoUbPH861+ypkz1Pr3hfknzmZu/z1t4w8PDVjuce2mWwTksH 1w/kYZlH1hbjcBcrTjmoVOBkZ8kQf4HsPXeZkgMAIyLspsPkdBN5CAsNF Qj8/2VkoHFgQKGO8m78HH94sTUxioZgmxSKwCUXlNFbX59f2SA4mlRuCC A==; X-IronPort-AV: E=McAfee;i="6600,9927,10896"; a="12761721" X-IronPort-AV: E=Sophos;i="6.04,205,1695711600"; d="scan'208";a="12761721" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2023 17:05:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10896"; a="741931030" X-IronPort-AV: E=Sophos;i="6.04,205,1695711600"; d="scan'208";a="741931030" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2023 17:05:22 -0800 Date: Thu, 16 Nov 2023 17:05:21 -0800 From: Isaku Yamahata To: Binbin Wu Cc: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack , Kai Huang , Zhi Wang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, Xiaoyao Li , isaku.yamahata@linux.intel.com Subject: Re: [PATCH v6 01/16] KVM: TDP_MMU: Go to next level if smaller private mapping exists Message-ID: <20231117010521.GE1277973@ls.amr.corp.intel.com> References: <439c7be59c35a03bced88a44567431e721fab3da.1699368363.git.isaku.yamahata@intel.com> <52b01c03-15eb-4151-b94b-2433a117cf3d@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <52b01c03-15eb-4151-b94b-2433a117cf3d@linux.intel.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 16 Nov 2023 17:05:38 -0800 (PST) On Thu, Nov 16, 2023 at 09:32:22AM +0800, Binbin Wu wrote: > > > On 11/7/2023 11:00 PM, isaku.yamahata@intel.com wrote: > > From: Xiaoyao Li > > > > Cannot map a private page as large page if any smaller mapping exists. > > > > It has to wait for all the not-mapped smaller page to be mapped and > > promote it to larger mapping. > > > > Signed-off-by: Xiaoyao Li > > --- > > arch/x86/kvm/mmu/tdp_mmu.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c > > index 2c5257628881..d806574f7f2d 100644 > > --- a/arch/x86/kvm/mmu/tdp_mmu.c > > +++ b/arch/x86/kvm/mmu/tdp_mmu.c > > @@ -1287,7 +1287,8 @@ int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) > > tdp_mmu_for_each_pte(iter, mmu, is_private, raw_gfn, raw_gfn + 1) { > > int r; > > - if (fault->nx_huge_page_workaround_enabled) > > + if (fault->nx_huge_page_workaround_enabled || > > + kvm_gfn_shared_mask(vcpu->kvm)) > As I mentioned in https://lore.kernel.org/kvm/fef75d54-e319-5170-5f76-f5abc4856315@linux.intel.com/, > The change of this patch will not take effect. > If "fault->nx_huge_page_workaround_enabled" is false, the condition > "spte_to_child_sp(spte)->nx_huge_page_disallowed" will not be true. > > IIUC, the function disallowed_hugepage_adjust() currently is only to handle > nx_huge_page_workaround, it seems no special handling needed for TD. > > disallowed_hugepage_adjust(fault, iter.old_spte, iter.level); > > /* You're correct. Now guest memfd memory attributes takes care of large page mapping, this patch is uncessary. Will drop this patch. -- Isaku Yamahata