From ad9e39c70f46c5e17b1ed5912e8693454fec1455 Mon Sep 17 00:00:00 2001 From: Tony Luck Date: Wed, 6 Feb 2008 13:57:46 -0800 Subject: [IA64] Wire up timerfd_{create,settime,gettime} syscalls Add ia64 hooks for the new syscalls that were added in commit 4d672e7ac79b5ec5cdc90e450823441e20464691 Signed-off-by: Tony Luck --- include/asm-ia64/unistd.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/asm-ia64') diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h index 315f8de950a..e6031471612 100644 --- a/include/asm-ia64/unistd.h +++ b/include/asm-ia64/unistd.h @@ -299,11 +299,14 @@ #define __NR_signalfd 1307 #define __NR_timerfd 1308 #define __NR_eventfd 1309 +#define __NR_timerfd_create 1310 +#define __NR_timerfd_settime 1311 +#define __NR_timerfd_gettime 1312 #ifdef __KERNEL__ -#define NR_syscalls 286 /* length of syscall table */ +#define NR_syscalls 289 /* length of syscall table */ /* * The following defines stop scripts/checksyscalls.sh from complaining about -- cgit v1.2.3 From 5aa92ffda1b6244b4a248df0b95c07d183ab96d2 Mon Sep 17 00:00:00 2001 From: Petr Tesarik Date: Wed, 12 Dec 2007 15:21:16 +0100 Subject: [IA64] Rename TIF_PERFMON_WORK back to TIF_NOTIFY_RESUME Since the RSE synchronization will need a TIF_ flag, but all work-to-be-done bits are already used, so we have to multiplex TIF_NOTIFY_RESUME again. Signed-off-by: Shaohua Li Signed-off-by: Petr Tesarik Signed-off-by: Tony Luck --- include/asm-ia64/thread_info.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'include/asm-ia64') diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h index d16031e72ef..5a2c4795706 100644 --- a/include/asm-ia64/thread_info.h +++ b/include/asm-ia64/thread_info.h @@ -71,6 +71,9 @@ struct thread_info { #define alloc_task_struct() ((struct task_struct *)__get_free_pages(GFP_KERNEL | __GFP_COMP, KERNEL_STACK_SIZE_ORDER)) #define free_task_struct(tsk) free_pages((unsigned long) (tsk), KERNEL_STACK_SIZE_ORDER) +#define tsk_set_notify_resume(tsk) \ + set_ti_thread_flag(task_thread_info(tsk), TIF_NOTIFY_RESUME) +extern void tsk_clear_notify_resume(struct task_struct *tsk); #endif /* !__ASSEMBLY */ /* @@ -85,7 +88,7 @@ struct thread_info { #define TIF_SYSCALL_AUDIT 3 /* syscall auditing active */ #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ -#define TIF_PERFMON_WORK 6 /* work for pfm_handle_work() */ +#define TIF_NOTIFY_RESUME 6 /* resumption notification requested */ #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ #define TIF_MEMDIE 17 #define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */ @@ -97,7 +100,7 @@ struct thread_info { #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) #define _TIF_SYSCALL_TRACEAUDIT (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP) #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) -#define _TIF_PERFMON_WORK (1 << TIF_PERFMON_WORK) +#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) @@ -106,7 +109,7 @@ struct thread_info { #define _TIF_FREEZE (1 << TIF_FREEZE) /* "work to do on user-return" bits */ -#define TIF_ALLWORK_MASK (_TIF_SIGPENDING|_TIF_PERFMON_WORK|_TIF_SYSCALL_AUDIT|\ +#define TIF_ALLWORK_MASK (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SYSCALL_AUDIT|\ _TIF_NEED_RESCHED| _TIF_SYSCALL_TRACE|\ _TIF_RESTORE_SIGMASK) /* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */ -- cgit v1.2.3 From 3b2ce0b17824c42bc2e46f7dd903b4acf5e9fff9 Mon Sep 17 00:00:00 2001 From: Petr Tesarik Date: Wed, 12 Dec 2007 15:23:34 +0100 Subject: [IA64] Synchronize kernel RSE to user-space and back This is base kernel patch for ptrace RSE bug. It's basically a backport from the utrace RSE patch I sent out several weeks ago. please review. when a thread is stopped (ptraced), debugger might change thread's user stack (change memory directly), and we must avoid the RSE stored in kernel to override user stack (user space's RSE is newer than kernel's in the case). To workaround the issue, we copy kernel RSE to user RSE before the task is stopped, so user RSE has updated data. we then copy user RSE to kernel after the task is resummed from traced stop and kernel will use the newer RSE to return to user. Signed-off-by: Shaohua Li Signed-off-by: Petr Tesarik CC: Roland McGrath Signed-off-by: Tony Luck --- include/asm-ia64/ptrace.h | 7 +++++++ include/asm-ia64/thread_info.h | 2 ++ 2 files changed, 9 insertions(+) (limited to 'include/asm-ia64') diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h index f4ef87a3623..13435f778b0 100644 --- a/include/asm-ia64/ptrace.h +++ b/include/asm-ia64/ptrace.h @@ -292,6 +292,7 @@ struct switch_stack { unsigned long, long); extern void ia64_flush_fph (struct task_struct *); extern void ia64_sync_fph (struct task_struct *); + extern void ia64_sync_krbs(void); extern long ia64_sync_user_rbs (struct task_struct *, struct switch_stack *, unsigned long, unsigned long); @@ -303,6 +304,12 @@ struct switch_stack { extern void ia64_increment_ip (struct pt_regs *pt); extern void ia64_decrement_ip (struct pt_regs *pt); + extern void ia64_ptrace_stop(void); + #define arch_ptrace_stop(code, info) \ + ia64_ptrace_stop() + #define arch_ptrace_stop_needed(code, info) \ + (!test_thread_flag(TIF_RESTORE_RSE)) + #endif /* !__KERNEL__ */ /* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */ diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h index 5a2c4795706..93d83cbe0c8 100644 --- a/include/asm-ia64/thread_info.h +++ b/include/asm-ia64/thread_info.h @@ -94,6 +94,7 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk); #define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */ #define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */ #define TIF_FREEZE 20 /* is freezing for suspend */ +#define TIF_RESTORE_RSE 21 /* user RBS is newer than kernel RBS */ #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) @@ -107,6 +108,7 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk); #define _TIF_MCA_INIT (1 << TIF_MCA_INIT) #define _TIF_DB_DISABLED (1 << TIF_DB_DISABLED) #define _TIF_FREEZE (1 << TIF_FREEZE) +#define _TIF_RESTORE_RSE (1 << TIF_RESTORE_RSE) /* "work to do on user-return" bits */ #define TIF_ALLWORK_MASK (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SYSCALL_AUDIT|\ -- cgit v1.2.3 From aa91a2e90044b88228bdb0620e771f2ea7798804 Mon Sep 17 00:00:00 2001 From: Petr Tesarik Date: Wed, 12 Dec 2007 15:24:25 +0100 Subject: [IA64] Synchronize RBS on PTRACE_ATTACH When attaching to a stopped process, the RSE must be explicitly synced to user-space, so the debugger can read the correct values. Signed-off-by: Petr Tesarik CC: Roland McGrath Signed-off-by: Tony Luck --- include/asm-ia64/ptrace.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/asm-ia64') diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h index 13435f778b0..0bdce7dde1b 100644 --- a/include/asm-ia64/ptrace.h +++ b/include/asm-ia64/ptrace.h @@ -310,6 +310,10 @@ struct switch_stack { #define arch_ptrace_stop_needed(code, info) \ (!test_thread_flag(TIF_RESTORE_RSE)) + extern void ptrace_attach_sync_user_rbs (struct task_struct *); + #define arch_ptrace_attach(child) \ + ptrace_attach_sync_user_rbs(child) + #endif /* !__KERNEL__ */ /* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */ -- cgit v1.2.3