From e4b8b3f33fcaa0ed6e6b5482a606091d8cd20beb Mon Sep 17 00:00:00 2001 From: Jan Glauber Date: Tue, 31 Jul 2012 10:52:05 +0200 Subject: s390: add support for runtime instrumentation Allow user-space threads to use runtime instrumentation (RI). To enable RI for a thread there is a new s390 specific system call, sys_s390_runtime_instr, that takes as parameter a realtime signal number. If the RI facility is available the system call sets up a control block for the calling thread with the appropriate permissions for the thread to modify the control block. The user-space thread can then use the store and modify RI instructions to alter the control block and start/stop the instrumentation via RION/RIOFF. If the user specified program buffer runs full RI triggers an external interrupt. The external interrupt is translated to a real-time signal that is delivered to the thread that enabled RI on that CPU. The number of the real-time signal is the number specified in the RI system call. So, user-space can select any available real-time signal number in case the application itself uses real-time signals for other purposes. The kernel saves the RI control blocks on task switch only if the running thread was enabled for RI. Therefore, the performance impact on task switch should be negligible if RI is not used. RI is only enabled for user-space mode and is disabled for the supervisor state. Reviewed-by: Heiko Carstens Signed-off-by: Jan Glauber Signed-off-by: Martin Schwidefsky --- arch/s390/kernel/compat_wrapper.S | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arch/s390/kernel/compat_wrapper.S') diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 2d82cfcbce5..5f7928fe34c 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S @@ -1646,3 +1646,8 @@ ENTRY(compat_sys_process_vm_writev_wrapper) llgf %r0,164(%r15) # unsigned long stg %r0,160(%r15) jg compat_sys_process_vm_writev + +ENTRY(sys_s390_runtime_instr_wrapper) + lgfr %r2,%r2 # int + lgfr %r3,%r3 # int + jg sys_s390_runtime_instr -- cgit v1.2.3-70-g09d2 From c0162b07b34ce8b33548f4b2658ec3133f960e71 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Thu, 13 Sep 2012 15:55:38 +0200 Subject: s390/syscalls: wire up kcmp system call Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky --- arch/s390/include/asm/unistd.h | 3 ++- arch/s390/kernel/compat_wrapper.S | 8 ++++++++ arch/s390/kernel/syscalls.S | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'arch/s390/kernel/compat_wrapper.S') diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h index da2c2f4f764..4e64b5cd155 100644 --- a/arch/s390/include/asm/unistd.h +++ b/arch/s390/include/asm/unistd.h @@ -278,7 +278,8 @@ #define __NR_process_vm_readv 340 #define __NR_process_vm_writev 341 #define __NR_s390_runtime_instr 342 -#define NR_syscalls 343 +#define __NR_kcmp 343 +#define NR_syscalls 344 /* * There are some system calls that are not present on 64 bit, some diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 5f7928fe34c..3afba804fe9 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S @@ -1651,3 +1651,11 @@ ENTRY(sys_s390_runtime_instr_wrapper) lgfr %r2,%r2 # int lgfr %r3,%r3 # int jg sys_s390_runtime_instr + +ENTRY(sys_kcmp_wrapper) + lgfr %r2,%r2 # pid_t + lgfr %r3,%r3 # pid_t + lgfr %r4,%r4 # int + llgfr %r5,%r5 # unsigned long + llgfr %r6,%r6 # unsigned long + jg sys_kcmp diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 539f0a7701e..48174850f3b 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S @@ -351,3 +351,4 @@ SYSCALL(sys_setns,sys_setns,sys_setns_wrapper) SYSCALL(sys_process_vm_readv,sys_process_vm_readv,compat_sys_process_vm_readv_wrapper) /* 340 */ SYSCALL(sys_process_vm_writev,sys_process_vm_writev,compat_sys_process_vm_writev_wrapper) SYSCALL(sys_ni_syscall,sys_s390_runtime_instr,sys_s390_runtime_instr_wrapper) +SYSCALL(sys_kcmp,sys_kcmp,sys_kcmp_wrapper) -- cgit v1.2.3-70-g09d2