Re: [PATCH v3 5/8] KVM: x86/mmu: Add a field to control memslot rmap allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07.05.21 01:44, Ben Gardon wrote:
On Thu, May 6, 2021 at 11:43 AM Ben Gardon <bgardon@xxxxxxxxxx> wrote:

Add a field to control whether new memslots should have rmaps allocated
for them. As of this change, it's not safe to skip allocating rmaps, so
the field is always set to allocate rmaps. Future changes will make it
safe to operate without rmaps, using the TDP MMU. Then further changes
will allow the rmaps to be allocated lazily when needed for nested
oprtation.

No functional change expected.

Signed-off-by: Ben Gardon <bgardon@xxxxxxxxxx>
---
  arch/x86/include/asm/kvm_host.h |  8 ++++++++
  arch/x86/kvm/mmu/mmu.c          |  2 ++
  arch/x86/kvm/x86.c              | 18 +++++++++++++-----
  3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index ad22d4839bcc..00065f9bbc5e 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1122,6 +1122,12 @@ struct kvm_arch {
          */
         spinlock_t tdp_mmu_pages_lock;
  #endif /* CONFIG_X86_64 */
+
+       /*
+        * If set, rmaps have been allocated for all memslots and should be
+        * allocated for any newly created or modified memslots.
+        */
+       bool memslots_have_rmaps;
  };

  struct kvm_vm_stat {
@@ -1853,4 +1859,6 @@ static inline int kvm_cpu_get_apicid(int mps_cpu)

  int kvm_cpu_dirty_log_size(void);

+inline bool kvm_memslots_have_rmaps(struct kvm *kvm);

Woops, this shouldn't be marked inline as it creates build problems
for the next patch with some configs.

With that fixed

Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>


--
Thanks,

David / dhildenb




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux