linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mips: Re-introduce copy_user_page
@ 2015-01-31  5:23 Guenter Roeck
  2015-02-03 18:40 ` Leonid Yegoshin
  0 siblings, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2015-01-31  5:23 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: linux-mips, linux-kernel, Guenter Roeck, Atsushi Nemoto, Matthew Wilcox

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 <anemo@mba.ocn.ne.jp>
Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
4927b7d77c00 is in -next.

 arch/mips/include/asm/page.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index 154b70a..69c2f19 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -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);
-- 
2.1.0


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

* Re: mips: Re-introduce copy_user_page
  2015-01-31  5:23 [PATCH] mips: Re-introduce copy_user_page Guenter Roeck
@ 2015-02-03 18:40 ` Leonid Yegoshin
  2015-02-04  3:33   ` Guenter Roeck
  2015-02-04 16:25   ` Wilcox, Matthew R
  0 siblings, 2 replies; 4+ messages in thread
From: Leonid Yegoshin @ 2015-02-03 18:40 UTC (permalink / raw)
  To: Guenter Roeck, Ralf Baechle
  Cc: linux-mips, linux-kernel, Atsushi Nemoto, Matthew Wilcox

On 01/30/2015 09:23 PM, Guenter Roeck wrote:
> 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 <anemo@mba.ocn.ne.jp>
> Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>

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.


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

* Re: mips: Re-introduce copy_user_page
  2015-02-03 18:40 ` Leonid Yegoshin
@ 2015-02-04  3:33   ` Guenter Roeck
  2015-02-04 16:25   ` Wilcox, Matthew R
  1 sibling, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2015-02-04  3:33 UTC (permalink / raw)
  To: Leonid Yegoshin, Ralf Baechle
  Cc: linux-mips, linux-kernel, Atsushi Nemoto, Matthew Wilcox

On 02/03/2015 10:40 AM, Leonid Yegoshin wrote:
> On 01/30/2015 09:23 PM, Guenter Roeck wrote:
>> 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 <anemo@mba.ocn.ne.jp>
>> Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>>
>
> 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


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

* RE: mips: Re-introduce copy_user_page
  2015-02-03 18:40 ` Leonid Yegoshin
  2015-02-04  3:33   ` Guenter Roeck
@ 2015-02-04 16:25   ` Wilcox, Matthew R
  1 sibling, 0 replies; 4+ messages in thread
From: Wilcox, Matthew R @ 2015-02-04 16:25 UTC (permalink / raw)
  To: Leonid Yegoshin, Guenter Roeck, Ralf Baechle
  Cc: linux-mips, linux-kernel, Atsushi Nemoto

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:Leonid.Yegoshin@imgtec.com] 
Sent: Tuesday, February 03, 2015 10:40 AM
To: Guenter Roeck; Ralf Baechle
Cc: linux-mips@linux-mips.org; linux-kernel@vger.kernel.org; Atsushi Nemoto; Wilcox, Matthew R
Subject: Re: mips: Re-introduce copy_user_page

On 01/30/2015 09:23 PM, Guenter Roeck wrote:
> 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 <anemo@mba.ocn.ne.jp>
> Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>

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.


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

end of thread, other threads:[~2015-02-04 16:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-31  5:23 [PATCH] mips: Re-introduce copy_user_page Guenter Roeck
2015-02-03 18:40 ` Leonid Yegoshin
2015-02-04  3:33   ` Guenter Roeck
2015-02-04 16:25   ` Wilcox, Matthew R

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).