Skip to content

Commit cc1f656

Browse files
committed
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 <[email protected]>
1 parent d936a7e commit cc1f656

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/csky/abiv2/inc/abi/cacheflush.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ static inline void flush_dcache_page(struct page *page)
3737
#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
3838
do { \
3939
memcpy(dst, src, len); \
40-
cache_wbinv_range((unsigned long)dst, (unsigned long)dst + len); \
40+
if (vma->vm_flags & VM_EXEC) \
41+
cache_wbinv_range((unsigned long)dst, \
42+
(unsigned long)dst + len); \
4143
} while (0)
4244
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
4345
memcpy(dst, src, len)

0 commit comments

Comments
 (0)