From: Binbin Wu <binbin.wu@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: isaku.yamahata@intel.com, seanjc@google.com, xiaoyao.li@intel.com
Subject: Re: [PATCH v5 6/7] KVM: x86: Implement kvm_arch_vcpu_pre_fault_memory()
Date: Thu, 11 Jul 2024 13:36:56 +0800 [thread overview]
Message-ID: <cd52fe00-b57b-495c-b55c-54fd381f7c66@linux.intel.com> (raw)
In-Reply-To: <20240710174031.312055-7-pbonzini@redhat.com>
On 7/11/2024 1:40 AM, Paolo Bonzini wrote:
> Wire KVM_PRE_FAULT_MEMORY ioctl to __kvm_mmu_do_page_fault() to populate guest
__kvm_mmu_do_page_fault() -> kvm_mmu_do_page_fault()
> memory. It can be called right after KVM_CREATE_VCPU creates a vCPU,
> since at that point kvm_mmu_create() and kvm_init_mmu() are called and
> the vCPU is ready to invoke the KVM page fault handler.
>
> The helper function kvm_mmu_map_tdp_page take care of the logic to
kvm_mmu_map_tdp_page -> kvm_tdp_map_page()?
> process RET_PF_* return values and convert them to success or errno.
>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> Message-ID: <9b866a0ae7147f96571c439e75429a03dcb659b6.1712785629.git.isaku.yamahata@intel.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> arch/x86/kvm/Kconfig | 1 +
> arch/x86/kvm/mmu/mmu.c | 73 ++++++++++++++++++++++++++++++++++++++++++
> arch/x86/kvm/x86.c | 3 ++
> 3 files changed, 77 insertions(+)
>
> diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
> index 80e5afde69f4..4287a8071a3a 100644
> --- a/arch/x86/kvm/Kconfig
> +++ b/arch/x86/kvm/Kconfig
> @@ -44,6 +44,7 @@ config KVM
> select KVM_VFIO
> select HAVE_KVM_PM_NOTIFIER if PM
> select KVM_GENERIC_HARDWARE_ENABLING
> + select KVM_GENERIC_PRE_FAULT_MEMORY
> select KVM_WERROR if WERROR
> help
> Support hosting fully virtualized guest machines using hardware
[...]
> index ba0ad76f53bc..a6968eadd418 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -4705,6 +4705,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> case KVM_CAP_MEMORY_FAULT_INFO:
> r = 1;
> break;
> + case KVM_CAP_PRE_FAULT_MEMORY:
> + r = tdp_enabled;
> + break;
If !CONFIG_KVM_GENERIC_PRE_FAULT_MEMORY, this should return 0.
> case KVM_CAP_EXIT_HYPERCALL:
> r = KVM_EXIT_HYPERCALL_VALID_MASK;
> break;
next prev parent reply other threads:[~2024-07-11 5:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-10 17:40 [PATCH v5 0/7] KVM: Guest Memory Pre-Population API Paolo Bonzini
2024-07-10 17:40 ` [PATCH v5 1/7] KVM: Document KVM_PRE_FAULT_MEMORY ioctl Paolo Bonzini
2024-07-10 17:40 ` [PATCH v5 2/7] KVM: Add KVM_PRE_FAULT_MEMORY vcpu ioctl to pre-populate guest memory Paolo Bonzini
2024-07-10 20:46 ` Anish Moorthy
2024-07-10 21:56 ` Sean Christopherson
2024-07-10 22:04 ` Paolo Bonzini
2024-07-10 17:40 ` [PATCH v5 3/7] KVM: x86/mmu: Bump pf_taken stat only in the "real" page fault handler Paolo Bonzini
2024-07-10 17:40 ` [PATCH v5 4/7] KVM: x86/mmu: Account pf_{fixed,emulate,spurious} in callers of "do page fault" Paolo Bonzini
2024-07-10 17:40 ` [PATCH v5 5/7] KVM: x86/mmu: Make kvm_mmu_do_page_fault() return mapped level Paolo Bonzini
2024-07-10 17:40 ` [PATCH v5 6/7] KVM: x86: Implement kvm_arch_vcpu_pre_fault_memory() Paolo Bonzini
2024-07-11 5:36 ` Binbin Wu [this message]
2024-07-11 8:30 ` Paolo Bonzini
2024-07-10 17:40 ` [PATCH v5 7/7] KVM: selftests: x86: Add test for KVM_PRE_FAULT_MEMORY Paolo Bonzini
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=cd52fe00-b57b-495c-b55c-54fd381f7c66@linux.intel.com \
--to=binbin.wu@linux.intel.com \
--cc=isaku.yamahata@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=xiaoyao.li@intel.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