Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp308326rwb; Tue, 25 Jul 2023 16:26:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlFL3Q0BpnYgW2mlgM6SsoF2FJ2icMfyoOeRlBCfb+0QeZ5RSH0YbtJ/sjQPRMlJwStYsFqE X-Received: by 2002:a05:6e02:1354:b0:346:d51:9922 with SMTP id k20-20020a056e02135400b003460d519922mr431583ilr.13.1690327618117; Tue, 25 Jul 2023 16:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690327618; cv=none; d=google.com; s=arc-20160816; b=e3r7vSf4wFZTR2G0KnXaBXDJgDDhXw/OYBaIwN/nm9I9mzNGBHbAiJDvhCcQ1BMHDx hPB0Oa3CHfHpnKa4OfzpB9CYsmLauqI4pcRaPNsJaNQf2zaEjI/9sI45hUzbmBnjslV2 WaILXYMiV+KeKH2Ue1KCsqMzHqrsYW6G+z6xTKdc026o9x1wseKUXb9Jary58ufN8Nkd qUgYIST8ZDqP+ZjnXg8GnWqjPR1ITeknGGVG/EW52MWyrd04TNL+BN3RowNUGy+NseZm Rc3RZGhosZD0QtFlRsjFDevl6TrktnMiIvjhUTcQtyWumkrxg7Gj0wJGRFYzI2G4Ow+O MvoA== 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=MCaGM45V8taUhsaNjIT7N1+ge6WScqrymW/ivUGORwk=; fh=E1bxw31VVcEBr76WIqXfdV5vG/YqvWMYjFMgvHDq2Zc=; b=0AWjg+ASXDeI5SqXahywtGlbFKe5lJ+cKFGZysrA2XHNRysChjIdmLi54NWn97vqSA sauhGrVcW81s4oElxbsUymKTwWJ7zdMxnEYpvwnqNHPaddWZUBmd8iI2rMifJpK8W8/9 EpUi5zqgHIJuXcI87fc1aoFv3/vhxDvFghtvK9VKXAIuhAGUp4rFiLf0dyadOPlR3c1q Qsb1ig6WnA3zwNZe2DYQG/oJODaMUzSijOqYryhMJC8JSzjyLiLumwC3Lu/3E74ewxrh UW/a6eeXCqF79URRSzE3kmUe/fTR5yT/mA3Lw7F4O4ialL7BsB0INFQQhAFoNzpVtswF /NSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g52T9Dq0; 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 g3-20020a63e603000000b0055c66f42eebsi12308682pgh.512.2023.07.25.16.26.44; Tue, 25 Jul 2023 16:26:58 -0700 (PDT) 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=g52T9Dq0; 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 S232913AbjGYWgE (ORCPT + 99 others); Tue, 25 Jul 2023 18:36:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232662AbjGYWfp (ORCPT ); Tue, 25 Jul 2023 18:35:45 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8706E7EFE; Tue, 25 Jul 2023 15:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690324153; x=1721860153; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rx9dwk2lAPW9PMmwKd6pOhDzr4Hbk1uw/BKlfzz6TM0=; b=g52T9Dq0bSDdwG4lZ4hr1VB/id4qO7XeixDmO7O0/+XErqCs3uE6cdvx r0IXWyoOXK84G01IVwBUaq5bu0wdCdC1rHxcEcnKMeupb543q5MpLVqp6 PJZ1fBa0tZMymuk7750ZahzH8z3aNglUoMk1vNYdYdf/IUDbEQ3nt1IND XyDayPpgyusZv7qp9iH/ckv3uvpTOvfpc/0UpdiLL2+5wFBcKzirvvNQa DigF58kyoBz984XpvLEZhea8E8HuFfrCYUM+ThKMUmoFljcp4lztjIdie 8VqIFeRONhcIqSlaEwlD2rE1UEQ58vK3B8YI+zl1u3doy29hrORLr36zV Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="371467097" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="371467097" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 15:24:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="972855781" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="972855781" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 15:24:08 -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 v4 01/16] KVM: TDP_MMU: Go to next level if smaller private mapping exists Date: Tue, 25 Jul 2023 15:23:47 -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=-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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 95ba78944712..a9f0f4ade2d0 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -1293,7 +1293,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