Skip to contentSkip to conversation

arm64: compat: align cacheflush syscall with arch/arm

PATCH New Vladimir Murzin 2 participants 3 messages Nov 12, 2014 – Nov 13, 2014 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: compat: align cacheflush syscall with arch/arm

Update handling of cacheflush syscall with changes made in arch/arm counterpart:
- return error to userspace when flushing syscall fails
- split user cache-flushing into interruptible chunks
- don't bother rounding to nearest vma

---
 arch/arm64/include/asm/cacheflush.h  |    2 +-
 arch/arm64/include/asm/thread_info.h |   12 ++++++
 arch/arm64/kernel/sys_compat.c       |   77 ++++++++++++++++++++++++----------
 arch/arm64/mm/cache.S                |    6 ++-
 4 files changed, 74 insertions(+), 23 deletions(-)
arch/arm64/include/asm/cacheflush.h +1 -1
index 689b637..7ae31a2 100644
@@ -73,7 +73,7 @@ extern void flush_cache_all(void);
 extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
 extern void flush_icache_range(unsigned long start, unsigned long end);
 extern void __flush_dcache_area(void *addr, size_t len);
-extern void __flush_cache_user_range(unsigned long start, unsigned long end);
+extern long __flush_cache_user_range(unsigned long start, unsigned long end);
 
 static inline void flush_cache_mm(struct mm_struct *mm)
 {
arch/arm64/include/asm/thread_info.h +12 -0
index 459bf8e..61ea595 100644
@@ -39,6 +39,15 @@ struct exec_domain;
 
 typedef unsigned long mm_segment_t;
 
+struct compat_restart_block {
+	union {
+		/* For user cache flushing */
+		struct {
+			unsigned long start;
+			unsigned long end;
+		} cache;
+	};
+};
 /*
  * low level task data that entry.S needs immediate access to.
  * __switch_to() assumes cpu_context follows immediately after cpu_domain.
@@ -51,6 +60,9 @@ struct thread_info {
 	struct restart_block	restart_block;
 	int			preempt_count;	/* 0 => preemptable, <0 => bug */
 	int			cpu;		/* cpu */
+#ifdef CONFIG_COMPAT
+	struct compat_restart_block     compat_restart_block;
+#endif
 };
 
 #define INIT_THREAD_INFO(tsk)						\
arch/arm64/kernel/sys_compat.c +56 -21

93 lines not on this page · raw message

arch/arm64/mm/cache.S +5 -1
index 2366383..d41899f 100644
@@ -17,6 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/errno.h>
 #include <linux/linkage.h>
 #include <linux/init.h>
 #include <asm/assembler.h>
@@ -138,9 +139,12 @@ USER(9f, ic	ivau, x4	)		// invalidate I line PoU
 	add	x4, x4, x2
 	cmp	x4, x1
 	b.lo	1b
-9:						// ignore any faulting cache operation
 	dsb	ish
 	isb
+	mov	x0, #0
+	ret
+9:
+	mov	x0, #-EFAULT
 	ret
 ENDPROC(flush_icache_range)
 ENDPROC(__flush_cache_user_range)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 arm64: compat: align cacheflush syscall with arch/arm

Hi Vladimir,

Quoted 6 lines · Vladimir Murzin

Update handling of cacheflush syscall with changes made in arch/arm counterpart:
- return error to userspace when flushing syscall fails
- split user cache-flushing into interruptible chunks
- don't bother rounding to nearest vma

Quoted 8 lines
---
 arch/arm64/include/asm/cacheflush.h  |    2 +-
 arch/arm64/include/asm/thread_info.h |   12 ++++++
 arch/arm64/kernel/sys_compat.c       |   77 ++++++++++++++++++++++++----------
 arch/arm64/mm/cache.S                |    6 ++-
 4 files changed, 74 insertions(+), 23 deletions(-)

We should hold off on this patch until the EINTR issue has been resolved:

http://lists.infradead.org/pipermail/linux-arm-kernel/2014-November/302105.html

Will

#2 lore raw

PATCH 1/1 arm64: compat: align cacheflush syscall with arch/arm

Quoted 18 lines · Will Deacon

Hi Vladimir,

Quoted 6 lines · Vladimir Murzin

Update handling of cacheflush syscall with changes made in arch/arm counterpart:
- return error to userspace when flushing syscall fails
- split user cache-flushing into interruptible chunks
- don't bother rounding to nearest vma

Quoted 8 lines
---
 arch/arm64/include/asm/cacheflush.h  |    2 +-
 arch/arm64/include/asm/thread_info.h |   12 ++++++
 arch/arm64/kernel/sys_compat.c       |   77 ++++++++++++++++++++++++----------
 arch/arm64/mm/cache.S                |    6 ++-
 4 files changed, 74 insertions(+), 23 deletions(-)
Quoted 4 lines

We should hold off on this patch until the EINTR issue has been resolved:

http://lists.infradead.org/pipermail/linux-arm-kernel/2014-November/302105.html

Sure, no problem.

Vladimir

Quoted 4 lines

Will