Skip to contentSkip to conversation

Patch "arm/arm64: KVM: Fix and refactor unmap_range" has been added to the 3.14-stable tree

PATCH [email protected] 1 participant 1 message Jun 27, 2015

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

arm/arm64: KVM: Fix and refactor unmap_range

to the 3.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
arm-arm64-kvm-fix-and-refactor-unmap_range.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 4f853a714bf16338ff5261128e6c7ae2569e9505 Mon Sep 17 00:00:00 2001

From: Christoffer Dall <[email protected]>
Date: Fri, 9 May 2014 23:31:31 +0200
Subject: arm/arm64: KVM: Fix and refactor unmap_range

From: Christoffer Dall <[email protected]>

commit 4f853a714bf16338ff5261128e6c7ae2569e9505 upstream.

unmap_range() was utterly broken, to quote Marc, and broke in all sorts of situations. It was also quite complicated to follow and didn't follow the usual scheme of having a separate iterating function for each level of page tables.

Address this by refactoring the code and introduce a pgd_clear() function.

---
 arch/arm/include/asm/kvm_mmu.h   |   12 +++
 arch/arm/kvm/mmu.c               |  156 +++++++++++++++++++++------------------
 arch/arm64/include/asm/kvm_mmu.h |   15 +++
 3 files changed, 111 insertions(+), 72 deletions(-)
arch/arm/include/asm/kvm_mmu.h +12 -0
@@ -127,6 +127,18 @@ static inline void kvm_set_s2pmd_writabl
 	(__boundary - 1 < (end) - 1)? __boundary: (end);		\
 })
 
+static inline bool kvm_page_empty(void *ptr)
+{
+	struct page *ptr_page = virt_to_page(ptr);
+	return page_count(ptr_page) == 1;
+}
+
+
+#define kvm_pte_table_empty(ptep) kvm_page_empty(ptep)
+#define kvm_pmd_table_empty(pmdp) kvm_page_empty(pmdp)
+#define kvm_pud_table_empty(pudp) (0)
+
+
 struct kvm;
 
 #define kvm_flush_dcache_to_poc(a,l)	__cpuc_flush_dcache_area((a), (l))
arch/arm/kvm/mmu.c +84 -72

187 lines not on this page · raw message

arch/arm64/include/asm/kvm_mmu.h +15 -0
@@ -125,6 +125,21 @@ static inline void kvm_set_s2pmd_writabl
 #define kvm_pud_addr_end(addr, end)	pud_addr_end(addr, end)
 #define kvm_pmd_addr_end(addr, end)	pmd_addr_end(addr, end)
 
+static inline bool kvm_page_empty(void *ptr)
+{
+	struct page *ptr_page = virt_to_page(ptr);
+	return page_count(ptr_page) == 1;
+}
+
+#define kvm_pte_table_empty(ptep) kvm_page_empty(ptep)
+#ifndef CONFIG_ARM64_64K_PAGES
+#define kvm_pmd_table_empty(pmdp) kvm_page_empty(pmdp)
+#else
+#define kvm_pmd_table_empty(pmdp) (0)
+#endif
+#define kvm_pud_table_empty(pudp) (0)
+
+
 struct kvm;
 
 #define kvm_flush_dcache_to_poc(a,l)	__flush_dcache_area((a), (l))

Patches currently in stable-queue which might be from [email protected] are

queue-3.14/arm-kvm-user_mem_abort-support-stage-2-mmio-page-mapping.patch queue-3.14/kvm-arm-arm64-avoid-returning-negative-error-code-as-bool.patch queue-3.14/arm-kvm-unmap-ipa-on-memslot-delete-move.patch queue-3.14/kvm-arm-arm64-fix-non-const-declaration-of-function-returning-const.patch queue-3.14/arm64-kvm-store-kvm_vcpu_fault_info-est_el2-as-word.patch queue-3.14/kvm-vgic-return-int-instead-of-bool-when-checking-i-o-ranges.patch queue-3.14/kvm-arm-arm64-fix-broken-__percpu-annotation.patch queue-3.14/arm64-kvm-export-demux-regids-as-kvm_reg_arm64.patch queue-3.14/arm-arm64-kvm-fix-and-refactor-unmap_range.patch