summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuo Ren <guoren@linux.alibaba.com>2020-01-27 12:57:29 +0100
committerGuo Ren <guoren@linux.alibaba.com>2020-02-21 08:43:24 +0100
commitcc1f6563a92ced0889775d0587316d725b6e1a68 (patch)
tree2338b9a232542393b39987b2a6bb5b16951c8ef0
parentcsky: Enable defer flush_dcache_page for abiv2 cpus (807/810/860) (diff)
downloadlinux-cc1f6563a92ced0889775d0587316d725b6e1a68.tar.xz
linux-cc1f6563a92ced0889775d0587316d725b6e1a68.zip
csky: Optimize abiv2 copy_to_user_page with VM_EXEC
Only when vma is for VM_EXEC, we need sync dcache & icache. eg: - gdb ptrace modify user space instruction code area. Add VM_EXEC condition to reduce unnecessary cache flush. The abiv1 cpus' cache are all VIPT, so we still need to deal with dcache aliasing problem. But there is optimized way to use cache color, just like what's done in arch/csky/abiv1/inc/abi/page.h. Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
-rw-r--r--arch/csky/abiv2/inc/abi/cacheflush.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/csky/abiv2/inc/abi/cacheflush.h b/arch/csky/abiv2/inc/abi/cacheflush.h
index acd7c6c55d61..28b7c3233175 100644
--- a/arch/csky/abiv2/inc/abi/cacheflush.h
+++ b/arch/csky/abiv2/inc/abi/cacheflush.h
@@ -37,7 +37,9 @@ static inline void flush_dcache_page(struct page *page)
#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
do { \
memcpy(dst, src, len); \
- cache_wbinv_range((unsigned long)dst, (unsigned long)dst + len); \
+ if (vma->vm_flags & VM_EXEC) \
+ cache_wbinv_range((unsigned long)dst, \
+ (unsigned long)dst + len); \
} while (0)
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
memcpy(dst, src, len)