diff mbox

[3.8.y.z,extended,stable] Patch "ARM: 7755/1: handle user space mapped pages in" has been added to staging queue

Message ID 1372198806-19008-1-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa June 25, 2013, 10:20 p.m. UTC
This is a note to let you know that I have just added a patch titled

    ARM: 7755/1: handle user space mapped pages in

to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.8.y-queue

This patch is scheduled to be released in version 3.8.13.4.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.8.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

From d2cf66ae44d94f0aae8b7d002cfc130a555712be Mon Sep 17 00:00:00 2001
From: Simon Baatz <gmbnomis@gmail.com>
Date: Mon, 10 Jun 2013 21:10:12 +0100
Subject: ARM: 7755/1: handle user space mapped pages in
 flush_kernel_dcache_page

commit 1bc39742aab09248169ef9d3727c9def3528b3f3 upstream.

Commit f8b63c1 made flush_kernel_dcache_page a no-op assuming that
the pages it needs to handle are kernel mapped only.  However, for
example when doing direct I/O, pages with user space mappings may
occur.

Thus, continue to do lazy flushing if there are no user space
mappings.  Otherwise, flush the kernel cache lines directly.

Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/include/asm/cacheflush.h |  4 +---
 arch/arm/mm/flush.c               | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 3 deletions(-)

--
1.8.1.2

Comments

Simon Baatz June 26, 2013, 10:44 p.m. UTC | #1
Hi Kamal,

On Tue, Jun 25, 2013 at 03:20:06PM -0700, Kamal Mostafa wrote:
> This is a note to let you know that I have just added a patch titled
> 
>     ARM: 7755/1: handle user space mapped pages in
> 
> to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
> which can be found at:
> 
>  http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.8.y-queue
> 
> This patch is scheduled to be released in version 3.8.13.4.
> 
> If you, or anyone else, feels it should not be added to this tree, please 
> reply to this email.
 
This patch breaks building certain ARM configs (noMMU). A followup
patch is needed to fix this and is already available upstream: 

Commit 63384fd (ARM: 7772/1: Fix missing flush_kernel_dcache_page()
for noMMU)

Thus, please add that patch as well. If it is too late to do this, my
suggestion would be to queue both of them together for the next
cycle.

- Simon
Kamal Mostafa June 26, 2013, 11:15 p.m. UTC | #2
On Thu, 2013-06-27 at 00:44 +0200, Simon Baatz wrote:
> Hi Kamal,
> 
> On Tue, Jun 25, 2013 at 03:20:06PM -0700, Kamal Mostafa wrote:
> > This is a note to let you know that I have just added a patch titled
> > 
> >     ARM: 7755/1: handle user space mapped pages in
> > 
> > to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
> > which can be found at:
> > 
> >  http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.8.y-queue
> > 
> > This patch is scheduled to be released in version 3.8.13.4.
> > 
> > If you, or anyone else, feels it should not be added to this tree, please 
> > reply to this email.
>  
> This patch breaks building certain ARM configs (noMMU). A followup
> patch is needed to fix this and is already available upstream: 
> 
> Commit 63384fd (ARM: 7772/1: Fix missing flush_kernel_dcache_page()
> for noMMU)
> 
> Thus, please add that patch as well. If it is too late to do this, my
> suggestion would be to queue both of them together for the next
> cycle.
> 
> - Simon
> 


Thanks very much for the heads-up, Simon.  It's not too late -- I'll
queue up the fix patch along with the first one, for 3.8.13.4.

 -Kamal
diff mbox

Patch

diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index e1489c5..738fcba 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -320,9 +320,7 @@  static inline void flush_anon_page(struct vm_area_struct *vma,
 }

 #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
-static inline void flush_kernel_dcache_page(struct page *page)
-{
-}
+extern void flush_kernel_dcache_page(struct page *);

 #define flush_dcache_mmap_lock(mapping) \
 	spin_lock_irq(&(mapping)->tree_lock)
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 1c8f7f5..b5ae9fd 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -298,6 +298,39 @@  void flush_dcache_page(struct page *page)
 EXPORT_SYMBOL(flush_dcache_page);

 /*
+ * Ensure cache coherency for the kernel mapping of this page. We can
+ * assume that the page is pinned via kmap.
+ *
+ * If the page only exists in the page cache and there are no user
+ * space mappings, this is a no-op since the page was already marked
+ * dirty at creation.  Otherwise, we need to flush the dirty kernel
+ * cache lines directly.
+ */
+void flush_kernel_dcache_page(struct page *page)
+{
+	if (cache_is_vivt() || cache_is_vipt_aliasing()) {
+		struct address_space *mapping;
+
+		mapping = page_mapping(page);
+
+		if (!mapping || mapping_mapped(mapping)) {
+			void *addr;
+
+			addr = page_address(page);
+			/*
+			 * kmap_atomic() doesn't set the page virtual
+			 * address for highmem pages, and
+			 * kunmap_atomic() takes care of cache
+			 * flushing already.
+			 */
+			if (!IS_ENABLED(CONFIG_HIGHMEM) || addr)
+				__cpuc_flush_dcache_area(addr, PAGE_SIZE);
+		}
+	}
+}
+EXPORT_SYMBOL(flush_kernel_dcache_page);
+
+/*
  * Flush an anonymous page so that users of get_user_pages()
  * can safely access the data.  The expected sequence is:
  *