summaryrefslogtreecommitdiffstats
path: root/patches/boot_time_opt/0152-x86-kvm-Notify-host-to-release-pages.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/boot_time_opt/0152-x86-kvm-Notify-host-to-release-pages.patch')
-rw-r--r--patches/boot_time_opt/0152-x86-kvm-Notify-host-to-release-pages.patch60
1 files changed, 32 insertions, 28 deletions
diff --git a/patches/boot_time_opt/0152-x86-kvm-Notify-host-to-release-pages.patch b/patches/boot_time_opt/0152-x86-kvm-Notify-host-to-release-pages.patch
index 5f44930..d3a1553 100644
--- a/patches/boot_time_opt/0152-x86-kvm-Notify-host-to-release-pages.patch
+++ b/patches/boot_time_opt/0152-x86-kvm-Notify-host-to-release-pages.patch
@@ -1,4 +1,4 @@
1From d28921b5f797829e4e676f7968ae688ef96b7992 Mon Sep 17 00:00:00 2001 1From 771ee703122aa119bb662208066040f8b9356986 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
@@ -31,21 +31,24 @@ use it.
31 31
32Suggested-by: Arjan van de Ven <arjan.van.de.ven@intel.com> 32Suggested-by: Arjan van de Ven <arjan.van.de.ven@intel.com>
33Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com> 33Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
34
35Modified for aufs4 enabled kernel
36Signed-off-by: Martin Borg <martin.borg@enea.com>
34--- 37---
35 arch/x86/kvm/x86.c | 17 +++++++++++++++++ 38 arch/x86/kvm/x86.c | 17 +++++++++++++++++
36 include/linux/mm.h | 5 +++++ 39 include/linux/mm.h | 5 +++++
37 include/uapi/linux/kvm_para.h | 3 +++ 40 include/uapi/linux/kvm_para.h | 3 +++
38 kernel/sysctl.c | 7 +++++++ 41 kernel/sysctl.c | 7 +++++++
39 mm/Makefile | 2 +- 42 mm/Makefile | 2 +-
40 mm/kvm.c | 25 +++++++++++++++++++++++++ 43 mm/kvm.c | 26 ++++++++++++++++++++++++++
41 6 files changed, 58 insertions(+), 1 deletion(-) 44 6 files changed, 59 insertions(+), 1 deletion(-)
42 create mode 100644 mm/kvm.c 45 create mode 100644 mm/kvm.c
43 46
44diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c 47diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
45index 582c75311f95..683a94dd5f03 100644 48index 03869eb7fcd6..628bad46b8ad 100644
46--- a/arch/x86/kvm/x86.c 49--- a/arch/x86/kvm/x86.c
47+++ b/arch/x86/kvm/x86.c 50+++ b/arch/x86/kvm/x86.c
48@@ -46,6 +46,7 @@ 51@@ -45,6 +45,7 @@
49 #include <linux/user-return-notifier.h> 52 #include <linux/user-return-notifier.h>
50 #include <linux/srcu.h> 53 #include <linux/srcu.h>
51 #include <linux/slab.h> 54 #include <linux/slab.h>
@@ -53,7 +56,7 @@ index 582c75311f95..683a94dd5f03 100644
53 #include <linux/perf_event.h> 56 #include <linux/perf_event.h>
54 #include <linux/uaccess.h> 57 #include <linux/uaccess.h>
55 #include <linux/hash.h> 58 #include <linux/hash.h>
56@@ -6019,6 +6020,19 @@ static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int apicid) 59@@ -6253,6 +6254,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); 60 kvm_irq_delivery_to_apic(kvm, NULL, &lapic_irq, NULL);
58 } 61 }
59 62
@@ -73,10 +76,10 @@ index 582c75311f95..683a94dd5f03 100644
73 void kvm_vcpu_deactivate_apicv(struct kvm_vcpu *vcpu) 76 void kvm_vcpu_deactivate_apicv(struct kvm_vcpu *vcpu)
74 { 77 {
75 vcpu->arch.apicv_active = false; 78 vcpu->arch.apicv_active = false;
76@@ -6065,6 +6079,9 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) 79@@ -6304,6 +6318,9 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
77 kvm_pv_kick_cpu_op(vcpu->kvm, a0, a1); 80 ret = kvm_pv_clock_pairing(vcpu, a0, a1);
78 ret = 0;
79 break; 81 break;
82 #endif
80+ case KVM_HC_RETURN_MEM: 83+ case KVM_HC_RETURN_MEM:
81+ ret = kvm_pv_return_mem_op(vcpu->kvm, a0, a1); 84+ ret = kvm_pv_return_mem_op(vcpu->kvm, a0, a1);
82+ break; 85+ break;
@@ -84,10 +87,10 @@ index 582c75311f95..683a94dd5f03 100644
84 ret = -KVM_ENOSYS; 87 ret = -KVM_ENOSYS;
85 break; 88 break;
86diff --git a/include/linux/mm.h b/include/linux/mm.h 89diff --git a/include/linux/mm.h b/include/linux/mm.h
87index 925ec25f99a8..833f23d98baa 100644 90index c3153e9ee7ea..15e02bf3a6b3 100644
88--- a/include/linux/mm.h 91--- a/include/linux/mm.h
89+++ b/include/linux/mm.h 92+++ b/include/linux/mm.h
90@@ -2303,6 +2303,11 @@ extern bool process_shares_mm(struct task_struct *p, struct mm_struct *mm); 93@@ -2452,6 +2452,11 @@ extern bool process_shares_mm(struct task_struct *p, struct mm_struct *mm);
91 extern int sysctl_drop_caches; 94 extern int sysctl_drop_caches;
92 int drop_caches_sysctl_handler(struct ctl_table *, int, 95 int drop_caches_sysctl_handler(struct ctl_table *, int,
93 void __user *, size_t *, loff_t *); 96 void __user *, size_t *, loff_t *);
@@ -100,13 +103,13 @@ index 925ec25f99a8..833f23d98baa 100644
100 103
101 void drop_slab(void); 104 void drop_slab(void);
102diff --git a/include/uapi/linux/kvm_para.h b/include/uapi/linux/kvm_para.h 105diff --git a/include/uapi/linux/kvm_para.h b/include/uapi/linux/kvm_para.h
103index bf6cd7d5cac2..7d90f77d87d0 100644 106index dcf629dd2889..85f9422fe59c 100644
104--- a/include/uapi/linux/kvm_para.h 107--- a/include/uapi/linux/kvm_para.h
105+++ b/include/uapi/linux/kvm_para.h 108+++ b/include/uapi/linux/kvm_para.h
106@@ -23,6 +23,9 @@ 109@@ -26,6 +26,9 @@
107 #define KVM_HC_MIPS_GET_CLOCK_FREQ 6
108 #define KVM_HC_MIPS_EXIT_VM 7 110 #define KVM_HC_MIPS_EXIT_VM 7
109 #define KVM_HC_MIPS_CONSOLE_OUTPUT 8 111 #define KVM_HC_MIPS_CONSOLE_OUTPUT 8
112 #define KVM_HC_CLOCK_PAIRING 9
110+#define KVM_HC_RETURN_MEM 10 113+#define KVM_HC_RETURN_MEM 10
111+ 114+
112+#define KVM_MAX_RET_MEM_SIZE (1 << 22) // 4MiB 115+#define KVM_MAX_RET_MEM_SIZE (1 << 22) // 4MiB
@@ -114,10 +117,10 @@ index bf6cd7d5cac2..7d90f77d87d0 100644
114 /* 117 /*
115 * hypercalls use architecture specific 118 * hypercalls use architecture specific
116diff --git a/kernel/sysctl.c b/kernel/sysctl.c 119diff --git a/kernel/sysctl.c b/kernel/sysctl.c
117index c1095cdc0fe2..d8ae774fa042 100644 120index d9c31bc2eaea..9a1611f92a2a 100644
118--- a/kernel/sysctl.c 121--- a/kernel/sysctl.c
119+++ b/kernel/sysctl.c 122+++ b/kernel/sysctl.c
120@@ -1398,6 +1398,13 @@ static struct ctl_table vm_table[] = { 123@@ -1410,6 +1410,13 @@ static struct ctl_table vm_table[] = {
121 .extra1 = &one, 124 .extra1 = &one,
122 .extra2 = &four, 125 .extra2 = &four,
123 }, 126 },
@@ -132,25 +135,26 @@ index c1095cdc0fe2..d8ae774fa042 100644
132 { 135 {
133 .procname = "compact_memory", 136 .procname = "compact_memory",
134diff --git a/mm/Makefile b/mm/Makefile 137diff --git a/mm/Makefile b/mm/Makefile
135index 295bd7a..6455723 100644 138index 4659b93cba43..77b145de8a55 100644
136--- a/mm/Makefile 139--- a/mm/Makefile
137+++ b/mm/Makefile 140+++ b/mm/Makefile
138@@ -47,6 +47,8 @@ else 141@@ -40,7 +40,7 @@ obj-y := filemap.o mempool.o oom_kill.o \
139 obj-y += bootmem.o 142 mm_init.o mmu_context.o percpu.o slab_common.o \
140 endif 143 compaction.o vmacache.o swap_slots.o \
144 interval_tree.o list_lru.o workingset.o \
145- prfile.o debug.o $(mmu-y)
146+ prfile.o debug.o kvm.o $(mmu-y)
147
148 obj-y += init-mm.o
141 149
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 150diff --git a/mm/kvm.c b/mm/kvm.c
148new file mode 100644 151new file mode 100644
149index 000000000000..8945f6a311b9 152index 000000000000..1c5600788221
150--- /dev/null 153--- /dev/null
151+++ b/mm/kvm.c 154+++ b/mm/kvm.c
152@@ -0,0 +1,25 @@ 155@@ -0,0 +1,26 @@
153+#include <linux/mman.h> 156+#include <linux/mman.h>
157+#include <linux/sysctl.h>
154+ 158+
155+int sysctl_kvm_madv_instant_free; 159+int sysctl_kvm_madv_instant_free;
156+ 160+
@@ -176,5 +180,5 @@ index 000000000000..8945f6a311b9
176+ return 0; 180+ return 0;
177+} 181+}
178-- 182--
1792.12.1 1832.15.0
180 184