mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: isaku.yamahata@intel.com, seanjc@google.com,
	binbin.wu@linux.intel.com, xiaoyao.li@intel.com
Subject: [PATCH v5 0/7] KVM: Guest Memory Pre-Population API
Date: Wed, 10 Jul 2024 13:40:24 -0400	[thread overview]
Message-ID: <20240710174031.312055-1-pbonzini@redhat.com> (raw)

Pre-population has been requested several times to mitigate KVM page faults
during guest boot or after live migration.  It is also required by TDX
before filling in the initial guest memory with measured contents.
Introduce it as a generic API.

Paolo

v4->v5:
- add EIO as possible error
- do not introduce __kvm_mmu_do_page_fault(), instead update stats in callers
- remove goto
- fix commit message to not mention weak symbol
- return error if range->size is 0
- fix comment to explain TDP restriction
- fix guest_test_phys_mem > guest_test_virt_mem case in test

Isaku Yamahata (3):
  KVM: Document KVM_PRE_FAULT_MEMORY ioctl
  KVM: Add KVM_PRE_FAULT_MEMORY vcpu ioctl to pre-populate guest memory
  KVM: selftests: x86: Add test for KVM_PRE_FAULT_MEMORY

Paolo Bonzini (2):
  KVM: x86/mmu: Make kvm_mmu_do_page_fault() return mapped level
  KVM: x86: Implement kvm_arch_vcpu_pre_fault_memory()

Sean Christopherson (2):
  KVM: x86/mmu: Bump pf_taken stat only in the "real" page fault handler
  KVM: x86/mmu: Account pf_{fixed,emulate,spurious} in callers of "do
    page fault"

 Documentation/virt/kvm/api.rst                |  55 +++++++
 arch/x86/kvm/Kconfig                          |   1 +
 arch/x86/kvm/mmu/mmu.c                        |  96 +++++++++++-
 arch/x86/kvm/mmu/mmu_internal.h               |  26 +---
 arch/x86/kvm/x86.c                            |   3 +
 include/linux/kvm_host.h                      |   5 +
 include/uapi/linux/kvm.h                      |  10 ++
 tools/include/uapi/linux/kvm.h                |  14 +-
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../selftests/kvm/pre_fault_memory_test.c     | 146 ++++++++++++++++++
 virt/kvm/Kconfig                              |   3 +
 virt/kvm/kvm_main.c                           |  60 +++++++
 12 files changed, 394 insertions(+), 26 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/pre_fault_memory_test.c

-- 
2.43.0


             reply	other threads:[~2024-07-10 17:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10 17:40 Paolo Bonzini [this message]
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
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=20240710174031.312055-1-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=binbin.wu@linux.intel.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®