qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC 5/6] pseries: Allow HPT resizing on PR KVM


From: David Gibson
Subject: [Qemu-devel] [RFC 5/6] pseries: Allow HPT resizing on PR KVM
Date: Mon, 21 Mar 2016 15:42:51 +1100

The initial implementation of PAPR hash page table (HPT) resizing is based
on TCG and will not work with KVM.  Eventually, of course, we want to
implement this in KVM as well.

Long term that will require a new kernel capability flag to let qemu know
if it's capable of handling HPT resizing.  However, the "PR" KVM
implementation already supports HPT resizing, since it has the HPT
managed by QEMU - the TCG implementation will work for PR KVM as well.

This patch adds code to detect PR KVM and permit HPT resizing in this case.
Explicitly detecting PR KVM, rather than using a capability relevant to
the feature at hand is frowned upon, but this should be adequate as a
fallback until that flag is added to the kernel.

Signed-off-by: David Gibson <address@hidden>
---
 target-ppc/kvm.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 989e1d1..562e9fa 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -2208,6 +2208,7 @@ int kvmppc_reset_htab(int shift_hint)
         /* Full emulation, tell caller to allocate htab itself */
         return 0;
     }
+
     if (kvm_check_extension(kvm_state, KVM_CAP_PPC_ALLOC_HTAB)) {
         int ret;
         ret = kvm_vm_ioctl(kvm_state, KVM_PPC_ALLOCATE_HTAB, &shift);
@@ -2579,8 +2580,12 @@ void kvmppc_check_papr_resize_hpt(Error **errp)
         return;
     }
 
-    /* KVM will need to advertise capability for HPT resizing once
-     * implemented, for now we assume that it's not possible with
-     * KVM */
-    error_setg(errp, "Hash page table resizing not available with KVM");
+    /* TODO: Check specific capabilities for HPT resize aware host kernels */
+
+    /* Fall back to checking if we have PR or HV KVM */
+    if (!kvm_vm_check_extension(kvm_state, KVM_CAP_PPC_GET_PVINFO)) {
+        error_setg(errp, "Hash page table resizing not available with HV KVM");
+    }
+
+    /* PR KVM, we should be ok */
 }
-- 
2.5.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]