Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp585654rwb; Thu, 12 Jan 2023 09:37:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXv1GLhA5HdJrxzItLo8IAprMOgrAlYKGl2WxxYXPSUL2o2nCgpDAxBzN2FsF00qIiijX6OX X-Received: by 2002:a05:6402:685:b0:479:ab7d:1dad with SMTP id f5-20020a056402068500b00479ab7d1dadmr82436110edy.32.1673545056097; Thu, 12 Jan 2023 09:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673545056; cv=none; d=google.com; s=arc-20160816; b=OQQZ8C0OaaijYCx0xy9cYRneVcmcBqECrwIBkhf8Hl1nlrVKfK6FAMQg1kM6c7MPUg F3UHxruYAs1Rh02UTaSis5U1ptQ6jmY2Kx5HgphRMjsOGyuEv9xE7yBcfTL4AQwWZaHj gt0iSeMTLpB1Z/aa6rhzAAZKzvM8KWROJfkY8G4kyuQlbhdZYMDGPJx7gi6tx1htlpDS wr3fjaa1y9qKfOlsyCB7gcwUA7YOC/4I17/M3KOFgi/yK10+0Somma5GNoad4DVfB9Pp LdFVE74z9wAiz5/hdwTLf4qoAGLfFj4wYItzDc9O110Z+Sy+7CtHPNi91H6XYVBNRiSm k+Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uiDFFM+v4f7Rjer8QtDIQgLD24kS6T/Zr4XFYnxYEso=; b=yFVGXXo9TMpCt1T+C4TNkkAfmEbcynqFvoJficIlpFgVdbq6qvaRELLIaabGNXkjR0 5ol5FOPa6ZLHwfinCsx0EBS8YOlwgI2HDYUE053LTQdb/olkhqWn18znPnP5c/qUKiTE bnReFqeC9EVReo8HOSmqQhK7MRbXSHReNaunfHxGPvrpTsi7miJqOIQ5wExFVam7WLz+ nDs4ZS07nH2VkwxjccAnZGilvML+z2PUjUL6C89ISDC0P1xU7hcWViTtvqk+wAAOYG6O q8lgfidrBT9oKGBAGvFfHkr1eR/x0qL+3Mxcgpq6/dxBRqf3DytG5Nue4w7EoEzggpzD CFjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ngXnomQl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y95-20020a50bb68000000b00473204b6c93si18083153ede.372.2023.01.12.09.37.23; Thu, 12 Jan 2023 09:37:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ngXnomQl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240227AbjALRJo (ORCPT + 50 others); Thu, 12 Jan 2023 12:09:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240977AbjALRJJ (ORCPT ); Thu, 12 Jan 2023 12:09:09 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 312FF27183; Thu, 12 Jan 2023 08:47:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673542039; x=1705078039; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lN2sQKQJw+fvb4BXvuf9J5Yol5hJrcIFcz4ejYm1oT4=; b=ngXnomQlVKnBsNdwhxKf++UkUySDbW6mcS+d/kUgROxSgv5VaBJGcIzF 994Cmw4MnXz+oNNbuRzP/AWj7MUP+drSQCaaBHDGw72DNRAO9av+RLLXM ZJvNIYdavP+WJnpmQ+LlQtz2SHAzbZ3+gs0npCzcxDSYDTlPcgG25HnXW Ir9JLWLwKhk5iuHT7WR7jjm47noXXj+sXnGipmFZAnkBn8pHc51c9APn1 2LZ4JnuwHzQbrlcGnRqpj6apw3+iZqDBthO9k0StF72Ami7dPZaFAPDiU gB7yuTq2gPLH6qFK/OBiHaLM6+BeCwwJkb8iqy79+4CzH3+vxLVieCK18 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="323816274" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="323816274" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:44:16 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="986658318" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="986658318" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:44:16 -0800 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack , Xiaoyao Li Subject: [RFC PATCH v3 01/16] KVM: TDP_MMU: Go to next level if smaller private mapping exists Date: Thu, 12 Jan 2023 08:43:53 -0800 Message-Id: <588de42a732a068bdcff46494865c0345d289bb2.1673541292.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Isaku Yamahata --- 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 69e202bd1897..5c2c7e8ea62e 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -1394,7 +1394,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)) disallowed_hugepage_adjust(fault, iter.old_spte, iter.level); /* -- 2.25.1