[Patch]QEMU: Add "-ple-gap" and "-ple-window" options for per domain PLE

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

 



QEMU: Add "-ple-gap" and "-ple-window" options for per domain PLE

Signed-off-by: Xuekun Hu <xuekun.hu@xxxxxxxxx>
---
 linux-headers/linux/kvm.h |    3 +++
 qemu-options.hx           |   16 ++++++++++++++++
 sysemu.h                  |    2 ++
 target-i386/kvm.c         |   13 +++++++++++++
 vl.c                      |   29 +++++++++++++++++++++++++++++
 5 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 4b9e575..a32c68a 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -618,6 +618,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_PPC_GET_SMMU_INFO 78
 #define KVM_CAP_S390_COW 79
 #define KVM_CAP_PPC_ALLOC_HTAB 80
+#define KVM_CAP_PLE 83
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -769,6 +770,8 @@ struct kvm_msi {
 					struct kvm_userspace_memory_region)
 #define KVM_SET_TSS_ADDR          _IO(KVMIO,   0x47)
 #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO,  0x48, __u64)
+#define KVM_SET_PLE_GAP           _IOW(KVMIO,  0x49, __u32)
+#define KVM_SET_PLE_WINDOW        _IOW(KVMIO,  0x4a, __u32)
 
 /* enable ucontrol for s390 */
 struct kvm_s390_ucas_mapping {
diff --git a/qemu-options.hx b/qemu-options.hx
index 3cd9243..c1c5c7b 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -98,6 +98,22 @@ given, the total number of CPUs @var{n} can be omitted. @var{maxcpus}
 specifies the maximum number of hotpluggable CPUs.
 ETEXI
 
+DEF("ple-gap", HAS_ARG, QEMU_OPTION_ple_gap,
+    "-ple-gap n Set ple_gap per vm\n", QEMU_ARCH_I386)
+STEXI
+@item -ple-gap @var{n}
+@findex -ple-gap
+Set ple_gap to vm.
+ETEXI
+
+DEF("ple-window", HAS_ARG, QEMU_OPTION_ple_window,
+    "-ple-window n Set ple_window per vm\n", QEMU_ARCH_I386)
+STEXI
+@item -ple-window @var{n}
+@findex -ple-window
+Set ple_gap to vm.
+ETEXI
+
 DEF("numa", HAS_ARG, QEMU_OPTION_numa,
     "-numa node[,mem=size][,cpus=cpu[-cpu]][,nodeid=node]\n", QEMU_ARCH_ALL)
 STEXI
diff --git a/sysemu.h b/sysemu.h
index b38b1a3..e25d111 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -130,6 +130,8 @@ extern uint8_t *boot_splash_filedata;
 extern int boot_splash_filedata_size;
 extern uint8_t qemu_extra_params_fw[2];
 extern QEMUClock *rtc_clock;
+extern int32_t ple_gap;
+extern int32_t ple_window;
 
 #define MAX_NODES 64
 #define MAX_CPUMASK_BITS 255
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 5b18383..12e0b2a 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -724,6 +724,19 @@ int kvm_arch_init(KVMState *s)
             }
         }
     }
+
+    if (kvm_check_extension(s, KVM_CAP_PLE) && (ple_gap != 0)) {
+        ret = kvm_vm_ioctl(s, KVM_SET_PLE_GAP, ple_gap);
+        if (ret < 0) {
+            fprintf(stderr, "kvm_set_ple_gap failed\n");
+                return ret;
+        }
+        ret = kvm_vm_ioctl(s, KVM_SET_PLE_WINDOW, ple_window);
+        if (ret < 0) {
+            fprintf(stderr, "kvm_set_ple_window failed\n");
+                return ret;
+        }
+    }
     return 0;
 }
 
diff --git a/vl.c b/vl.c
index a1c0aa7..96dbc4b 100644
--- a/vl.c
+++ b/vl.c
@@ -234,6 +234,9 @@ uint8_t *boot_splash_filedata;
 int boot_splash_filedata_size;
 uint8_t qemu_extra_params_fw[2];
 
+int32_t ple_gap = 0;
+int32_t ple_window = 0;
+
 typedef struct FWBootEntry FWBootEntry;
 
 struct FWBootEntry {
@@ -2590,6 +2593,32 @@ int main(int argc, char **argv, char **envp)
                     }
                 }
                 break;
+            case QEMU_OPTION_ple_gap:
+                {
+                    int32_t value;
+                    char *end;
+
+                    value = strtol(optarg, &end, 10);
+                    if (value < 0 || *end) {
+                        fprintf(stderr, "qemu: invalid ple_gap vaule: %s\n", optarg);
+                        exit(1);
+                    }
+                    ple_gap = value;
+                }
+                break;
+            case QEMU_OPTION_ple_window:
+                {
+                    int32_t value;
+                    char *end;
+
+                    value = strtol(optarg, &end, 10);
+                    if (value < 0 || *end) {
+                        fprintf(stderr, "qemu: invalid ple_gap vaule: %s\n", optarg);
+                        exit(1);
+                    }
+                    ple_window = value;
+                }
+                break;
             case QEMU_OPTION_numa:
                 if (nb_numa_nodes >= MAX_NODES) {
                     fprintf(stderr, "qemu: too many NUMA nodes\n");
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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