Skip to content

Commit

Permalink
csky: Optimize abiv2 copy_to_user_page with VM_EXEC
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Guo Ren committed Feb 21, 2020
1 parent d936a7e commit cc1f656
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/csky/abiv2/inc/abi/cacheflush.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cc1f656

Please sign in to comment.