Skip to contentSkip to conversation

arm: highmem: Add support for flushing kmap_atomic mappings

RFC PATCH New Laura Abbott 1 participant 2 messages Apr 10, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 1/2 arm: highmem: Add support for flushing kmap_atomic mappings

The highmem code provides kmap_flush_unused to ensure all kmap mappings are really removed if they are unused. This code does not handle kmap_atomic mappings since they are managed separately. This prevents an issue for any code which relies on having absolutely no mappings for a particular page. Rather than pay the penalty of having CONFIG_DEBUG_HIGHMEM on all the time, add functionality to remove the kmap_atomic mappings in a similar way to kmap_flush_unused.

---
 arch/arm/Kconfig      |    3 ++
 arch/arm/mm/highmem.c |   57 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 0 deletions(-)
arch/arm/Kconfig +3 -0
index 1cacda4..d926d46 100644
@@ -207,6 +207,9 @@ config NEED_RET_TO_USER
 config ARCH_MTD_XIP
 	bool
 
+config ARCH_WANT_KMAP_ATOMIC_FLUSH
+	bool
+
 config VECTORS_BASE
 	hex
 	default 0xffff0000 if MMU || CPU_HIGH_VECTOR
arch/arm/mm/highmem.c +57 -0

66 lines not on this page · raw message

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#1 lore raw

RFC PATCH v2 2/2 mm: highmem: Add definitions for kmap_atomic_flush_unused

kmap_flush_unused does not flush kmap_atomic mappings which are handled separately. Architectures may have use cases to require these to be flushed. Add an option to let archtectures define kmap_atomic flushing to get rid of extra mappings.

---
 include/linux/highmem.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
include/linux/highmem.h +7 -0
index 7fb31da..e666549 100644
@@ -39,6 +39,12 @@ extern unsigned long totalhigh_pages;
 
 void kmap_flush_unused(void);
 
+#ifdef CONFIG_ARCH_WANT_KMAP_ATOMIC_FLUSH
+void kmap_atomic_flush_unused(void);
+#else
+static inline void kmap_atomic_flush_unused(void) { }
+#endif
+
 struct page *kmap_to_page(void *addr);
 
 #else /* CONFIG_HIGHMEM */
@@ -79,6 +85,7 @@ static inline void __kunmap_atomic(void *addr)
 #define kmap_atomic_to_page(ptr)	virt_to_page(ptr)
 
 #define kmap_flush_unused()	do {} while(0)
+#define kmap_atomic_flush_unused()	do {} while(0)
 #endif
 
 #endif /* CONFIG_HIGHMEM */
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation