summaryrefslogtreecommitdiffstats
path: root/patches/boot_time_opt_guest/0152-x86-kvm-Notify-host-to-release-pages.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/boot_time_opt_guest/0152-x86-kvm-Notify-host-to-release-pages.patch')
-rw-r--r--patches/boot_time_opt_guest/0152-x86-kvm-Notify-host-to-release-pages.patch57
1 files changed, 29 insertions, 28 deletions
diff --git a/patches/boot_time_opt_guest/0152-x86-kvm-Notify-host-to-release-pages.patch b/patches/boot_time_opt_guest/0152-x86-kvm-Notify-host-to-release-pages.patch
index 5f44930..7197ce7 100644
--- a/patches/boot_time_opt_guest/0152-x86-kvm-Notify-host-to-release-pages.patch
+++ b/patches/boot_time_opt_guest/0152-x86-kvm-Notify-host-to-release-pages.patch
@@ -1,4 +1,4 @@
1From d28921b5f797829e4e676f7968ae688ef96b7992 Mon Sep 17 00:00:00 2001 1From c08f0e4d768db796098c8bdc64c3358baee076e7 Mon Sep 17 00:00:00 2001
2From: Sebastien Boeuf <sebastien.boeuf@intel.com> 2From: Sebastien Boeuf <sebastien.boeuf@intel.com>
3Date: Mon, 23 Jan 2017 15:08:55 -0800 3Date: Mon, 23 Jan 2017 15:08:55 -0800
4Subject: [PATCH 152/154] x86: kvm: Notify host to release pages 4Subject: [PATCH 152/154] x86: kvm: Notify host to release pages
@@ -37,15 +37,15 @@ Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
37 include/uapi/linux/kvm_para.h | 3 +++ 37 include/uapi/linux/kvm_para.h | 3 +++
38 kernel/sysctl.c | 7 +++++++ 38 kernel/sysctl.c | 7 +++++++
39 mm/Makefile | 2 +- 39 mm/Makefile | 2 +-
40 mm/kvm.c | 25 +++++++++++++++++++++++++ 40 mm/kvm.c | 26 ++++++++++++++++++++++++++
41 6 files changed, 58 insertions(+), 1 deletion(-) 41 6 files changed, 59 insertions(+), 1 deletion(-)
42 create mode 100644 mm/kvm.c 42 create mode 100644 mm/kvm.c
43 43
44diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c 44diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
45index 582c75311f95..683a94dd5f03 100644 45index 0e846f0cb83b..7bd380ff8dfa 100644
46--- a/arch/x86/kvm/x86.c 46--- a/arch/x86/kvm/x86.c
47+++ b/arch/x86/kvm/x86.c 47+++ b/arch/x86/kvm/x86.c
48@@ -46,6 +46,7 @@ 48@@ -45,6 +45,7 @@
49 #include <linux/user-return-notifier.h> 49 #include <linux/user-return-notifier.h>
50 #include <linux/srcu.h> 50 #include <linux/srcu.h>
51 #include <linux/slab.h> 51 #include <linux/slab.h>
@@ -53,7 +53,7 @@ index 582c75311f95..683a94dd5f03 100644
53 #include <linux/perf_event.h> 53 #include <linux/perf_event.h>
54 #include <linux/uaccess.h> 54 #include <linux/uaccess.h>
55 #include <linux/hash.h> 55 #include <linux/hash.h>
56@@ -6019,6 +6020,19 @@ static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int apicid) 56@@ -6206,6 +6207,19 @@ static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int apicid)
57 kvm_irq_delivery_to_apic(kvm, NULL, &lapic_irq, NULL); 57 kvm_irq_delivery_to_apic(kvm, NULL, &lapic_irq, NULL);
58 } 58 }
59 59
@@ -73,10 +73,10 @@ index 582c75311f95..683a94dd5f03 100644
73 void kvm_vcpu_deactivate_apicv(struct kvm_vcpu *vcpu) 73 void kvm_vcpu_deactivate_apicv(struct kvm_vcpu *vcpu)
74 { 74 {
75 vcpu->arch.apicv_active = false; 75 vcpu->arch.apicv_active = false;
76@@ -6065,6 +6079,9 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) 76@@ -6257,6 +6271,9 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
77 kvm_pv_kick_cpu_op(vcpu->kvm, a0, a1); 77 ret = kvm_pv_clock_pairing(vcpu, a0, a1);
78 ret = 0;
79 break; 78 break;
79 #endif
80+ case KVM_HC_RETURN_MEM: 80+ case KVM_HC_RETURN_MEM:
81+ ret = kvm_pv_return_mem_op(vcpu->kvm, a0, a1); 81+ ret = kvm_pv_return_mem_op(vcpu->kvm, a0, a1);
82+ break; 82+ break;
@@ -84,10 +84,10 @@ index 582c75311f95..683a94dd5f03 100644
84 ret = -KVM_ENOSYS; 84 ret = -KVM_ENOSYS;
85 break; 85 break;
86diff --git a/include/linux/mm.h b/include/linux/mm.h 86diff --git a/include/linux/mm.h b/include/linux/mm.h
87index 925ec25f99a8..833f23d98baa 100644 87index bf52e0498247..d8bcf5c4b996 100644
88--- a/include/linux/mm.h 88--- a/include/linux/mm.h
89+++ b/include/linux/mm.h 89+++ b/include/linux/mm.h
90@@ -2303,6 +2303,11 @@ extern bool process_shares_mm(struct task_struct *p, struct mm_struct *mm); 90@@ -2406,6 +2406,11 @@ extern bool process_shares_mm(struct task_struct *p, struct mm_struct *mm);
91 extern int sysctl_drop_caches; 91 extern int sysctl_drop_caches;
92 int drop_caches_sysctl_handler(struct ctl_table *, int, 92 int drop_caches_sysctl_handler(struct ctl_table *, int,
93 void __user *, size_t *, loff_t *); 93 void __user *, size_t *, loff_t *);
@@ -100,13 +100,13 @@ index 925ec25f99a8..833f23d98baa 100644
100 100
101 void drop_slab(void); 101 void drop_slab(void);
102diff --git a/include/uapi/linux/kvm_para.h b/include/uapi/linux/kvm_para.h 102diff --git a/include/uapi/linux/kvm_para.h b/include/uapi/linux/kvm_para.h
103index bf6cd7d5cac2..7d90f77d87d0 100644 103index fed506aeff62..ebc482ce7d38 100644
104--- a/include/uapi/linux/kvm_para.h 104--- a/include/uapi/linux/kvm_para.h
105+++ b/include/uapi/linux/kvm_para.h 105+++ b/include/uapi/linux/kvm_para.h
106@@ -23,6 +23,9 @@ 106@@ -25,6 +25,9 @@
107 #define KVM_HC_MIPS_GET_CLOCK_FREQ 6
108 #define KVM_HC_MIPS_EXIT_VM 7 107 #define KVM_HC_MIPS_EXIT_VM 7
109 #define KVM_HC_MIPS_CONSOLE_OUTPUT 8 108 #define KVM_HC_MIPS_CONSOLE_OUTPUT 8
109 #define KVM_HC_CLOCK_PAIRING 9
110+#define KVM_HC_RETURN_MEM 10 110+#define KVM_HC_RETURN_MEM 10
111+ 111+
112+#define KVM_MAX_RET_MEM_SIZE (1 << 22) // 4MiB 112+#define KVM_MAX_RET_MEM_SIZE (1 << 22) // 4MiB
@@ -114,10 +114,10 @@ index bf6cd7d5cac2..7d90f77d87d0 100644
114 /* 114 /*
115 * hypercalls use architecture specific 115 * hypercalls use architecture specific
116diff --git a/kernel/sysctl.c b/kernel/sysctl.c 116diff --git a/kernel/sysctl.c b/kernel/sysctl.c
117index c1095cdc0fe2..d8ae774fa042 100644 117index 4dfba1a76cc3..771a930cadfa 100644
118--- a/kernel/sysctl.c 118--- a/kernel/sysctl.c
119+++ b/kernel/sysctl.c 119+++ b/kernel/sysctl.c
120@@ -1398,6 +1398,13 @@ static struct ctl_table vm_table[] = { 120@@ -1387,6 +1387,13 @@ static struct ctl_table vm_table[] = {
121 .extra1 = &one, 121 .extra1 = &one,
122 .extra2 = &four, 122 .extra2 = &four,
123 }, 123 },
@@ -132,25 +132,26 @@ index c1095cdc0fe2..d8ae774fa042 100644
132 { 132 {
133 .procname = "compact_memory", 133 .procname = "compact_memory",
134diff --git a/mm/Makefile b/mm/Makefile 134diff --git a/mm/Makefile b/mm/Makefile
135index 295bd7a..6455723 100644 135index 026f6a828a50..28d95bed7e1d 100644
136--- a/mm/Makefile 136--- a/mm/Makefile
137+++ b/mm/Makefile 137+++ b/mm/Makefile
138@@ -47,6 +47,8 @@ else 138@@ -39,7 +39,7 @@ obj-y := filemap.o mempool.o oom_kill.o \
139 obj-y += bootmem.o 139 mm_init.o mmu_context.o percpu.o slab_common.o \
140 endif 140 compaction.o vmacache.o swap_slots.o \
141 interval_tree.o list_lru.o workingset.o \
142- debug.o $(mmu-y)
143+ debug.o kvm.o $(mmu-y)
144
145 obj-y += init-mm.o
141 146
142+obj-y += kvm.o
143+
144 obj-$(CONFIG_ADVISE_SYSCALLS) += fadvise.o
145 ifdef CONFIG_MMU
146 obj-$(CONFIG_ADVISE_SYSCALLS) += madvise.o
147diff --git a/mm/kvm.c b/mm/kvm.c 147diff --git a/mm/kvm.c b/mm/kvm.c
148new file mode 100644 148new file mode 100644
149index 000000000000..8945f6a311b9 149index 000000000000..1c5600788221
150--- /dev/null 150--- /dev/null
151+++ b/mm/kvm.c 151+++ b/mm/kvm.c
152@@ -0,0 +1,25 @@ 152@@ -0,0 +1,26 @@
153+#include <linux/mman.h> 153+#include <linux/mman.h>
154+#include <linux/sysctl.h>
154+ 155+
155+int sysctl_kvm_madv_instant_free; 156+int sysctl_kvm_madv_instant_free;
156+ 157+
@@ -176,5 +177,5 @@ index 000000000000..8945f6a311b9
176+ return 0; 177+ return 0;
177+} 178+}
178-- 179--
1792.12.1 1802.13.2
180 181