Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2631594rdg; Mon, 16 Oct 2023 09:56:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEO53r1XotcMCNYSrWkFiiADPW/Jjl+qXWrbRfSInhnpAh/aIU5P0bX7AWBLBccq/Kkocw3 X-Received: by 2002:a05:6871:220f:b0:1e9:9833:daad with SMTP id sc15-20020a056871220f00b001e99833daadmr15429329oab.4.1697475370957; Mon, 16 Oct 2023 09:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697475370; cv=none; d=google.com; s=arc-20160816; b=V/H2lDkkWJVWQ0sRQWALeHn8HpJcfT65gONu6mWo+vgJn9F+Av/71cyMslZ9723OWE ZyP/1BeDI52dnmA/hptRBmQv/xYQUF9jpBGzIFOymdS6fvsccbnVlM1wgnV4uucGDEfG 7yBxWd9Nr2nDa+/k/DjAbB6EBf4eH3Fn3UcAnJDwp34cl6hRrwA9THOzZ7n6C7RDUx6+ 38INdQ6Ds62NWKAQHwhURAhRraga4dEws4VxbHdaPlM8ENMDXy145S3JgR0cB+98kW5f dh6S2c32PLsfo7lLwW1ABKOKR9a9009wyj0eCFInPGBGpnEJ1roCF32yDhE7UNUzxJpf aZKA== 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=ex0kODtHi9a901JmvSVJQJA1kaQQ12YPQQiX5uN9jdA=; fh=PgPONM/W1VtmLglMgmd5Kb29Va4E/NEsDAvR3ZLGW2Y=; b=bJ/0CInRJvhwYbkRPKvj/r1STQ2PG1Qm+aoGC5Ucu9yzlaSb9kd5HhMaAj4kDUvXUT 46y8xF1spYjmeZ86z48vqkqSgWwI7yLHeS08kb6PkN02NwqbZGjTZoceqTFA3b8ZPwM6 rREHrSDaZGFNuwpsgPDQg1Y5JTkAYy67GJFQBPh3jYFH/LIZ/S3cv//EVIMSz7+ceTO5 m79KOTYpSuzrMOeejbPucTv1l23bPtevZL49NhSNn7J4vKd+fucfxQz6KvUJ/cxZ/rTT ssZ3bKiisF7GVonsUgUpfi7woIZMzZpotC0V6vjzUmzHtbsNNL2qXUUllwSB/OJO7d/Q WuEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=chEkuZW4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id by19-20020a056a02059300b005657ba564bdsi8160897pgb.826.2023.10.16.09.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:56:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=chEkuZW4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id A423880A7707; Mon, 16 Oct 2023 09:56:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234444AbjJPQzt (ORCPT + 99 others); Mon, 16 Oct 2023 12:55:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231302AbjJPQze (ORCPT ); Mon, 16 Oct 2023 12:55:34 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B3827EF7; Mon, 16 Oct 2023 09:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697473391; x=1729009391; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a3eY264RkIk2rIxUpnKkNG2x5Y8gzvyqjfJuV3d5wUs=; b=chEkuZW4X8hN0GA26GY1G9Or4c/8yGuT5Bn1s/wX90eCba2vh390y0XV W0jHJYkj6Shw6WOTtHMXtF8s6AVPWL2Jo3ACkwnRGcat/05AoJGqQt5Z2 impATT9P76us5sCmuIu0tcu0KtyYIeXmEhOuApZHn9wfi/9hsjquF8YD7 LeS9eXuAkwvJgP1XUPDksIJa3igoByTEEjrEPKBjPEH84/5NEzUz6UO0/ bkOOww8leFqc48nR50BVv91A8HZNihnQwJgClAoWX3RfzRAhQYRkrXtb0 tjmiiqQcFIZJpNbaQlM75pO3LzRjTV/EcUQejR1rJire89uwSkTyGHmX0 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="471793109" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="471793109" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 09:21:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="899569212" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="899569212" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 09:19:11 -0700 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 , Kai Huang , Zhi Wang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, Xiaoyao Li Subject: [RFC PATCH v5 01/16] KVM: TDP_MMU: Go to next level if smaller private mapping exists Date: Mon, 16 Oct 2023 09:20:52 -0700 Message-Id: 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=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Mon, 16 Oct 2023 09:56:06 -0700 (PDT) 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 4f58edbb8c06..012f270cfb6f 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -1414,7 +1414,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