mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Binbin Wu <binbin.wu@linux.intel.com>
To: isaku.yamahata@intel.com, Xiaoyao Li <xiaoyao.li@intel.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	isaku.yamahata@gmail.com, Paolo Bonzini <pbonzini@redhat.com>,
	erdemaktas@google.com, Sean Christopherson <seanjc@google.com>,
	Sagi Shahar <sagis@google.com>,
	David Matlack <dmatlack@google.com>,
	Kai Huang <kai.huang@intel.com>,
	Zhi Wang <zhi.wang.linux@gmail.com>,
	chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com
Subject: Re: [RFC PATCH v4 01/16] KVM: TDP_MMU: Go to next level if smaller private mapping exists
Date: Tue, 5 Sep 2023 16:10:33 +0800	[thread overview]
Message-ID: <fef75d54-e319-5170-5f76-f5abc4856315@linux.intel.com> (raw)
In-Reply-To: <b263e32affd62ddd675ae50981a4ae3ef7b3c607.1690323516.git.isaku.yamahata@intel.com>



On 7/26/2023 6:23 AM, isaku.yamahata@intel.com wrote:
> From: Xiaoyao Li <xiaoyao.li@intel.com>
>
> 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 <xiaoyao.li@intel.com>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> ---
>   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);
>   
>   		/*
The implementation of disallowed_hugepage_adjust() is as following:

void disallowed_hugepage_adjust(struct kvm_page_fault *fault, u64 spte, 
int cur_level)
{
     if (cur_level > PG_LEVEL_4K &&
         cur_level == fault->goal_level &&
         is_shadow_present_pte(spte) &&
         !is_large_pte(spte) &&
         spte_to_child_sp(spte)->nx_huge_page_disallowed) {
             ...
     }
}

One condition is spte_to_child_sp(spte)->nx_huge_page_disallowed should be
true to decrease the goal level of the fault.
Does this condition make the change of this patch invalid?


  reply	other threads:[~2023-09-05 15:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 22:23 [RFC PATCH v4 00/16] KVM TDX: TDP MMU: large page support isaku.yamahata
2023-07-25 22:23 ` [RFC PATCH v4 01/16] KVM: TDP_MMU: Go to next level if smaller private mapping exists isaku.yamahata
2023-09-05  8:10   ` Binbin Wu [this message]
2023-07-25 22:23 ` [RFC PATCH v4 02/16] KVM: TDX: Pass page level to cache flush before TDX SEAMCALL isaku.yamahata
2023-07-25 22:23 ` [RFC PATCH v4 03/16] KVM: TDX: Pass KVM page level to tdh_mem_page_add() and tdh_mem_page_aug() isaku.yamahata
2023-07-25 22:23 ` [RFC PATCH v4 04/16] KVM: TDX: Pass size to tdx_measure_page() isaku.yamahata
2023-07-25 22:23 ` [RFC PATCH v4 05/16] KVM: TDX: Pass size to reclaim_page() isaku.yamahata
2023-09-06  1:48   ` Binbin Wu
2023-07-25 22:23 ` [RFC PATCH v4 06/16] KVM: TDX: Update tdx_sept_{set,drop}_private_spte() to support large page isaku.yamahata
2023-07-25 22:23 ` [RFC PATCH v4 07/16] KVM: MMU: Introduce level info in PFERR code isaku.yamahata
2023-07-25 22:23 ` [RFC PATCH v4 08/16] KVM: TDX: Pin pages via get_page() right before ADD/AUG'ed to TDs isaku.yamahata
2023-09-07  5:26   ` Binbin Wu
2023-07-25 22:23 ` [RFC PATCH v4 09/16] KVM: TDX: Pass desired page level in err code for page fault handler isaku.yamahata
2023-07-25 22:23 ` [RFC PATCH v4 10/16] KVM: x86/tdp_mmu: Allocate private page table for large page split isaku.yamahata
2023-07-25 22:23 ` [RFC PATCH v4 11/16] KVM: x86/tdp_mmu: Split the large page when zap leaf isaku.yamahata
2023-07-25 22:23 ` [RFC PATCH v4 12/16] KVM: x86/tdp_mmu, TDX: Split a large page when 4KB page within it converted to shared isaku.yamahata
2023-07-25 22:23 ` [RFC PATCH v4 13/16] KVM: x86/tdp_mmu: Try to merge pages into a large page isaku.yamahata
2023-08-14 20:35   ` Isaku Yamahata
2023-07-25 22:24 ` [RFC PATCH v4 14/16] KVM: x86/tdp_mmu: TDX: Implement " isaku.yamahata
2023-07-25 22:24 ` [RFC PATCH v4 15/16] KVM: x86/mmu: Make kvm fault handler aware of large page of private memslot isaku.yamahata
2023-07-25 22:24 ` [RFC PATCH v4 16/16] KVM: TDX: Allow 2MB large page for TD GUEST isaku.yamahata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fef75d54-e319-5170-5f76-f5abc4856315@linux.intel.com \
    --to=binbin.wu@linux.intel.com \
    --cc=chen.bo@intel.com \
    --cc=dmatlack@google.com \
    --cc=erdemaktas@google.com \
    --cc=hang.yuan@intel.com \
    --cc=isaku.yamahata@gmail.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sagis@google.com \
    --cc=seanjc@google.com \
    --cc=tina.zhang@intel.com \
    --cc=xiaoyao.li@intel.com \
    --cc=zhi.wang.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome