Linux PARISC architecture development
 help / color / mirror / Atom feed
* [PATCH] parisc: improve vmap flush/invalidate
@ 2011-01-20 18:54 James Bottomley
  2011-02-08 17:15 ` [PATCH] parisc: Improve dcache flush on PA8800/PA8900 John David Anglin
  0 siblings, 1 reply; 29+ messages in thread
From: James Bottomley @ 2011-01-20 18:54 UTC (permalink / raw)
  To: Parisc List

On parisc, we never implemented invalidate_kernel_vmap_range() because
it was unnecessary for the xfs use case.  However, we do need to
implement an invalidate for the opposite use case (which occurred in a
recent NFS change) where the user wants to read through the vmap range
and write via the kernel address.  There's an additional complexity to
this in that if the page has no userspace mappings, it might have dirty
cache lines in the kernel (indicated by the PG_dcache_dirty bit).  In
order to get full coherency, we need to flush these pages through the
kernel mapping before invalidating the vmap range.

James

---

diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h
index f388a85..df6c56d 100644
--- a/arch/parisc/include/asm/cacheflush.h
+++ b/arch/parisc/include/asm/cacheflush.h
@@ -37,6 +37,13 @@ void flush_cache_all_local(void);
 void flush_cache_all(void);
 void flush_cache_mm(struct mm_struct *mm);
 
+#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
+void flush_kernel_dcache_page_addr(void *addr);
+static inline void flush_kernel_dcache_page(struct page *page)
+{
+	flush_kernel_dcache_page_addr(page_address(page));
+}
+
 #define flush_kernel_dcache_range(start,size) \
 	flush_kernel_dcache_range_asm((start), (start)+(size));
 /* vmap range flushes and invalidates.  Architecturally, we don't need
@@ -50,6 +57,16 @@ static inline void flush_kernel_vmap_range(void *vaddr, int size)
 }
 static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
 {
+	unsigned long start = (unsigned long)vaddr;
+	void *cursor = vaddr;
+
+	for ( ; cursor < vaddr + size; cursor += PAGE_SIZE) {
+		struct page *page = vmalloc_to_page(cursor);
+
+		if (test_and_clear_bit(PG_dcache_dirty, &page->flags))
+			flush_kernel_dcache_page(page);
+	}
+	flush_kernel_dcache_range_asm(start, start + size);
 }
 
 #define flush_cache_vmap(start, end)		flush_cache_all()
@@ -98,13 +115,6 @@ flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vma
 		flush_user_dcache_page(vmaddr);
 }
 
-#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
-void flush_kernel_dcache_page_addr(void *addr);
-static inline void flush_kernel_dcache_page(struct page *page)
-{
-	flush_kernel_dcache_page_addr(page_address(page));
-}

^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2011-02-22 16:27 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-20 18:54 [PATCH] parisc: improve vmap flush/invalidate James Bottomley
2011-02-08 17:15 ` [PATCH] parisc: Improve dcache flush on PA8800/PA8900 John David Anglin
2011-02-08 17:29   ` James Bottomley
2011-02-08 18:45     ` John David Anglin
2011-02-10 16:03       ` James Bottomley
2011-02-10 17:00         ` John David Anglin
2011-02-10 20:00           ` John David Anglin
2011-02-12 16:18             ` John David Anglin
2011-02-13 19:39               ` John David Anglin
2011-02-15  1:58                 ` John David Anglin
2011-02-15 15:13                   ` Carlos O'Donell
2011-02-15 16:47                     ` John David Anglin
2011-02-15 16:58                       ` James Bottomley
2011-02-15 17:09                         ` John David Anglin
2011-02-17  0:37                         ` John David Anglin
2011-02-17  0:30                     ` binutils change break glibc build John David Anglin
2011-02-17  1:09                       ` John David Anglin
2011-02-17  1:17                         ` John David Anglin
2011-02-17  4:13                           ` John David Anglin
2011-02-18  3:29                             ` John David Anglin
2011-02-18  5:32                         ` Mike Frysinger
2011-02-18 14:39                           ` John David Anglin
2011-02-18 15:28                             ` Carlos O'Donell
2011-02-18 18:40                       ` John David Anglin
2011-02-18 19:31                         ` Mike Frysinger
2011-02-18 19:39                         ` Carlos O'Donell
2011-02-22  0:13                           ` John David Anglin
2011-02-22 15:07                             ` Carlos O'Donell
2011-02-22 16:27                               ` John David Anglin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox