Commit d98094aa authored by Jan Kiszka's avatar Jan Kiszka

ipipe: Introduce ptrace resume notifier

This I-pipe hook reports the desired resumption mode to the subscriber:
resume all process tasks or just single-step a particular one? The use
case is to enable synchronous stopping / resuming of all head tasks of
a ptraced real-time process.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 9b11a9f0
......@@ -111,6 +111,7 @@ struct ipipe_trap_data {
#define IPIPE_KEVT_HOSTRT 6
#define IPIPE_KEVT_CLOCKFREQ 7
#define IPIPE_KEVT_USERINTRET 8
#define IPIPE_KEVT_PTRESUME 9
struct ipipe_vm_notifier {
void (*handler)(struct ipipe_vm_notifier *nfy);
......@@ -234,6 +235,21 @@ do { \
#define __ipipe_report_clockfreq_update(freq) \
__ipipe_notify_kevent(IPIPE_KEVT_CLOCKFREQ, &(freq))
struct ipipe_ptrace_resume_data {
struct task_struct *task;
long request;
};
#define __ipipe_report_ptrace_resume(__p, __request) \
do { \
struct ipipe_ptrace_resume_data d = { \
.task = (__p), \
.request = (__request), \
}; \
if (ipipe_notifier_enabled_p(__p)) \
__ipipe_notify_kevent(IPIPE_KEVT_PTRESUME, &d); \
} while (0)
void __ipipe_notify_vm_preemption(void);
void __ipipe_call_mayday(struct pt_regs *regs);
......@@ -310,6 +326,9 @@ static inline void __ipipe_report_exit(struct task_struct *p) { }
static inline void __ipipe_report_cleanup(struct mm_struct *mm) { }
static inline void __ipipe_report_ptrace_resume(struct task_struct *p,
long request) { }
#define __ipipe_report_trap(exception, regs) 0
static inline void __ipipe_init_taskinfo(struct task_struct *p) { }
......
......@@ -771,6 +771,8 @@ static int ptrace_resume(struct task_struct *child, long request,
user_disable_single_step(child);
}
__ipipe_report_ptrace_resume(child, request);
/*
* Change ->exit_code and ->state under siglock to avoid the race
* with wait_task_stopped() in between; a non-zero ->exit_code will
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment