Skip to contentSkip to conversation

mips: Re-introduce copy_user_page

PATCH In review Guenter Roeck 3 participants 4 messages Jan 31, 2015 – Feb 4, 2015 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mips: Re-introduce copy_user_page

Commit bcd022801ee5 ("MIPS: Fix COW D-cache aliasing on fork") replaced the inline function copy_user_page for mips with an external reference, but neglected to introduce the actual non-inline function. Restore it.

Fixes bcd022801ee5 ("MIPS: Fix COW D-cache aliasing on fork")
Fixes 4927b7d77c00 ("dax,ext2: replace the XIP page fault handler with the DAX page fault handler")
Cc Atsushi Nemoto <[email protected]>
Cc Matthew Wilcox <[email protected]>

---
4927b7d77c00 is in -next.

 arch/mips/include/asm/page.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/mips/include/asm/page.h +11 -2
index 154b70a..69c2f19 100644
@@ -105,8 +105,17 @@ static inline void clear_user_page(void *addr, unsigned long vaddr,
 		flush_data_cache_page((unsigned long)addr);
 }
 
-extern void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
-	struct page *to);
+static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
+				  struct page *to)
+{
+	extern void (*flush_data_cache_page)(unsigned long addr);
+
+	copy_page(vto, vfrom);
+	if (!cpu_has_ic_fills_f_dc || pages_do_alias((unsigned long)vto,
+						     vaddr & PAGE_MASK))
+		flush_data_cache_page((unsigned long)vto);
+}
+
 struct vm_area_struct;
 extern void copy_user_highpage(struct page *to, struct page *from,
 	unsigned long vaddr, struct vm_area_struct *vma);
Signature · 1 line
2.1.0
#1 lore raw
Quoted 10 lines · Guenter Roeck

Commit bcd022801ee5 ("MIPS: Fix COW D-cache aliasing on fork") replaced the inline function copy_user_page for mips with an external reference, but neglected to introduce the actual non-inline function. Restore it.

Fixes bcd022801ee5 ("MIPS: Fix COW D-cache aliasing on fork")
Fixes 4927b7d77c00 ("dax,ext2: replace the XIP page fault handler with the DAX page fault handler")
Cc Atsushi Nemoto <[email protected]>
Cc Matthew Wilcox <[email protected]>

Why do you use copy_user_page?
It doesn't work properly in HIGHMEM environment and it is excluded from MIPS because of that, I believe.

You should use copy_user_highpage() for user pages.

- Leonid.

#2 lore raw
Quoted 12 lines · Leonid Yegoshin
Quoted 10 lines · Guenter Roeck

Commit bcd022801ee5 ("MIPS: Fix COW D-cache aliasing on fork") replaced the inline function copy_user_page for mips with an external reference, but neglected to introduce the actual non-inline function. Restore it.

Fixes bcd022801ee5 ("MIPS: Fix COW D-cache aliasing on fork")
Fixes 4927b7d77c00 ("dax,ext2: replace the XIP page fault handler with the DAX page fault handler")
Cc Atsushi Nemoto <[email protected]>
Cc Matthew Wilcox <[email protected]>
Quoted 5 lines

Why do you use copy_user_page?
It doesn't work properly in HIGHMEM environment and it is excluded from MIPS because of that, I believe.

You should use copy_user_highpage() for user pages.

Then maybe mips should not declare it the function external, the commit log of the patch removing it should have mentioned that and why it was removed, and there should be a clear statement somewhere stating that copy_user_page shall not be used. I don't find such a statement anywhere in the kernel.

Guenter

#3 lore raw
In reply to Leonid Yegoshin

There is no 'struct page' for the source of this data. We have a kernel address for it; that's all.

-----Original Message-----
From: Leonid Yegoshin [mailto:[email protected]]
Sent: Tuesday, February 03, 2015 10:40 AM
To: Guenter Roeck; Ralf Baechle
Cc: [email protected]; [email protected]; Atsushi Nemoto; Wilcox, Matthew R
Subject: Re: mips: Re-introduce copy_user_page

Quoted 10 lines · Guenter Roeck

Commit bcd022801ee5 ("MIPS: Fix COW D-cache aliasing on fork") replaced the inline function copy_user_page for mips with an external reference, but neglected to introduce the actual non-inline function. Restore it.

Fixes bcd022801ee5 ("MIPS: Fix COW D-cache aliasing on fork")
Fixes 4927b7d77c00 ("dax,ext2: replace the XIP page fault handler with the DAX page fault handler")
Cc Atsushi Nemoto <[email protected]>
Cc Matthew Wilcox <[email protected]>

Why do you use copy_user_page?
It doesn't work properly in HIGHMEM environment and it is excluded from MIPS because of that, I believe.

You should use copy_user_highpage() for user pages.

- Leonid.