Skip to contentSkip to conversation

MIPS: Fix get_user_page_fast() for mips with cache alias

PATCH In review Kamal Dasu 3 participants 3 messages Jun 14, 2013 – Jul 19, 2013 MIPS

lore
Share & tools
lore

Kamal Dasu

author
#0 lore raw

PATCH 1/1 MIPS: Fix get_user_page_fast() for mips with cache alias

get_user_pages_fast() is missing cache flushes for MIPS platforms with cache alias. Filesystem failures observed with DirectIO operations due to missing flush_anon_page() that use page coloring logic to work with cache aliases. This fix falls through to take slow_irqon path that calls get_user_pages() that has required logic for platforms where cpu_has_dc_aliases is true.

---
 arch/mips/mm/gup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/mm/gup.c +1 -1
index d4ea5c9..346fb7e 100644
@@ -273,7 +273,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
 	len = (unsigned long) nr_pages << PAGE_SHIFT;
 
 	end = start + len;
-	if (end < start)
+	if (end < start || cpu_has_dc_aliases)
 		goto slow_irqon;
 
 	/* XXX: batch / limit 'nr' */
Signature · 1 line
1.8.2.3
#1 lore raw
Quoted 6 lines · Kamal Dasu

get_user_pages_fast() is missing cache flushes for MIPS platforms with cache alias. Filesystem failures observed with DirectIO operations due to missing flush_anon_page() that use page coloring logic to work with cache aliases. This fix falls through to take slow_irqon path that calls get_user_pages() that has required logic for platforms where cpu_has_dc_aliases is true.

A bit unsatisfying to always fall back to the slow variant yet I like the patch because of it's simplicity but I wonder if there's not a better solution.

Ralf

#2 lore raw
Quoted 9 lines · Ralf Baechle
Quoted 6 lines · Kamal Dasu

get_user_pages_fast() is missing cache flushes for MIPS platforms with cache alias. Filesystem failures observed with DirectIO operations due to missing flush_anon_page() that use page coloring logic to work with cache aliases. This fix falls through to take slow_irqon path that calls get_user_pages() that has required logic for platforms where cpu_has_dc_aliases is true.

Quoted 3 lines

A bit unsatisfying to always fall back to the slow variant yet I like the patch because of it's simplicity but I wonder if there's not a better solution.

Hi Ralf,

What are your thoughts on pushing this fix to the stable tree for 3.4+? Without Kamal's patch, ntfs-3g is completely broken on MIPS platforms that have cache aliases.

Thanks.