Some Dovetail/I-pipe unification
cover Some Dovetail/I-pipe unification
See patches for details.
Jan
Jan Kiszka (2):
cobalt/ipipe: Drop tests for IPIPE_KEVT_*
cobalt: Move common debug handling code out of pipeline diversion
again
kernel/cobalt/dovetail/kevents.c | 75 ++-------------------- kernel/cobalt/ipipe/kevents.c | 105 +++---------------------------- kernel/cobalt/ipipe/sched.c | 2 - kernel/cobalt/posix/process.c | 63 +++++++++++++++++++ kernel/cobalt/posix/process.h | 6 ++ 5 files changed, 82 insertions(+), 169 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 cobalt/ipipe: Drop tests for IPIPE_KEVT_*
From: Jan Kiszka <[email protected]>
All those events have been added long ago to I-pipe versions we want to support with the next release. Time to drop the tests which will also allow sharing some code with dovetail.
--- kernel/cobalt/ipipe/kevents.c | 28 ---------------------------- kernel/cobalt/ipipe/sched.c | 2 -- 2 files changed, 30 deletions(-)
kernel/cobalt/ipipe/kevents.c +0 -28
@@ -32,8 +32,6 @@ process_from_thread(struct xnthread *thread) return container_of(thread, struct cobalt_thread, threadbase)->process; } -#ifdef IPIPE_KEVT_PTRESUME -static void stop_debugged_process (struct xnthread *thread) {struct cobalt_process *process =process_from_thread (thread);
@@ -64,18 +62,6 @@ static void resume_debugged_process(struct cobalt_process *process)xnsched_unlock (); } -#else /* !IPIPE_KEVT_PTRESUME */ - -static inline void stop_debugged_process (struct xnthread *thread) -{ -} - -static inline void resume_debugged_process (struct cobalt_process *process) -{ -} - -#endif /* !IPIPE_KEVT_PTRESUME */ -/* called with nklock held */ static void register_debugged_thread (struct xnthread *thread) {
@@ -117,7 +103,6 @@ static inline int handle_exception(struct ipipe_trap_data *d)if (xnthread_test_state (thread,XNROOT ))return 0 ; -#ifdef IPIPE_KEVT_USERINTRET if (xnarch_fault_bp_p (d) &&user_mode (d->regs)) {spl_t s;
@@ -129,7 +114,6 @@ static inline int handle_exception(struct ipipe_trap_data *d)xnlock_put_irqrestore (&nklock, s);xnsched_run (); } -#endif if (xnarch_fault_fpu_p (d)) {#ifdef CONFIG_XENO_ARCH_FPU
@@ -359,7 +343,6 @@ void ipipe_migration_hook(struct task_struct *p) /* hw IRQs off */if (affinity_ok (p))xnthread_resume (thread,XNRELAX ); -#ifdef IPIPE_KEVT_USERINTRET /* * In case we migrated independently of the user return notifier, clear * XNCONTHI here and also disable the notifier - we are already done.
@@ -368,7 +351,6 @@ void ipipe_migration_hook(struct task_struct *p) /* hw IRQs off */xnthread_clear_info (thread,XNCONTHI );ipipe_disable_user_intret_notifier (); } -#endif /* Unregister as debugged thread in case we postponed this. */ if (unlikely (xnthread_test_state (thread,XNSSTEP )))
@@ -681,7 +663,6 @@ static inline int handle_clockfreq_event(unsigned int *p)return KEVENT_PROPAGATE ; } -#ifdef IPIPE_KEVT_USERINTRET static int handle_user_return (struct task_struct *task) {struct xnthread *thread;
@@ -715,9 +696,7 @@ static int handle_user_return(struct task_struct *task)return KEVENT_PROPAGATE ; } -#endif /* IPIPE_KEVT_USERINTRET */ -#ifdef IPIPE_KEVT_PTRESUME int handle_ptrace_resume (struct ipipe_ptrace_resume_data *resume) {struct xnthread *thread;
@@ -739,7 +718,6 @@ int handle_ptrace_resume(struct ipipe_ptrace_resume_data *resume)return KEVENT_PROPAGATE ; } -#endif /* IPIPE_KEVT_PTRESUME */ int ipipe_kevent_hook (int kevent,void *data) {
@@ -766,21 +744,15 @@ int ipipe_kevent_hook(int kevent, void *data) ret =handle_hostrt_event (data);break ;#endif -#ifdef IPIPE_KEVT_CLOCKFREQ case IPIPE_KEVT_CLOCKFREQ : ret =handle_clockfreq_event (data);break ; -#endif -#ifdef IPIPE_KEVT_USERINTRET case IPIPE_KEVT_USERINTRET : ret =handle_user_return (data);break ; -#endif -#ifdef IPIPE_KEVT_PTRESUME case IPIPE_KEVT_PTRESUME : ret =handle_ptrace_resume (data);break ; -#endif default : ret =KEVENT_PROPAGATE ; }
kernel/cobalt/ipipe/sched.c +0 -2
@@ -158,7 +158,6 @@ int pipeline_leave_oob_prepare(void)set_current_state (p->state & ~TASK_NOWAKEUP ); -#ifdef IPIPE_KEVT_USERINTRET /* * If current is being debugged, record that it should migrate * back in case it resumes in userspace. If it resumes in
@@ -171,7 +170,6 @@ int pipeline_leave_oob_prepare(void)ipipe_enable_user_intret_notifier (); suspmask |=XNDBGSTOP ; } -#endif /* * Return the suspension bits the caller should pass to * xnthread_suspend().
Signature · 1 line
2.26.2
PATCH 2/2 cobalt: Move common debug handling code out of pipeline diversion again
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
Those functions are identical now, with the variations due to some older I-pipe releases removed.
--- kernel/cobalt/dovetail/kevents.c | 75 +++---------------------------- kernel/cobalt/ipipe/kevents.c | 77 +++----------------------------- kernel/cobalt/posix/process.c | 63 ++++++++++++++++++++++++++ kernel/cobalt/posix/process.h | 6 +++ 4 files changed, 82 insertions(+), 139 deletions(-)
kernel/cobalt/dovetail/kevents.c +6 -69
@@ -24,69 +24,6 @@static void detach_current (void ); -static inline struct cobalt_process * -process_from_thread (struct xnthread *thread) -{ - return container_of(thread, struct cobalt_thread, threadbase)->process; -} - -static inline void stop_debugged_process (struct xnthread *thread) -{ -struct cobalt_process *process =process_from_thread (thread); -struct cobalt_thread *cth; - -if (process->debugged_threads >0 ) -return ; - -list_for_each_entry (cth, &process->thread_list, next) { -if (&cth->threadbase == thread) -continue ; - -xnthread_suspend (&cth->threadbase,XNDBGSTOP ,XN_INFINITE , -XN_RELATIVE ,NULL ); - } -} - -static inline void resume_debugged_process (struct cobalt_process *process) -{ -struct cobalt_thread *cth; - -xnsched_lock (); - -list_for_each_entry (cth, &process->thread_list, next) -if (xnthread_test_state (&cth->threadbase,XNDBGSTOP )) -xnthread_resume (&cth->threadbase,XNDBGSTOP ); - -xnsched_unlock (); -} - -/* called with nklock held */ -static void register_debugged_thread (struct xnthread *thread) -{ -struct cobalt_process *process =process_from_thread (thread); - -xnthread_set_state (thread,XNSSTEP ); - -stop_debugged_process (thread); - process->debugged_threads++; - -if (xnthread_test_state (thread,XNRELAX )) -xnthread_suspend (thread,XNDBGSTOP ,XN_INFINITE ,XN_RELATIVE , -NULL ); -} - -/* called with nklock held */ -static void unregister_debugged_thread (struct xnthread *thread) -{ -struct cobalt_process *process =process_from_thread (thread); - - process->debugged_threads--; -xnthread_clear_state (thread,XNSSTEP ); - -if (process->debugged_threads ==0 ) -resume_debugged_process (process); -} -void arch_inband_task_init (struct task_struct *tsk) {struct cobalt_threadinfo *p =dovetail_task_state (tsk);
@@ -117,7 +54,7 @@ void handle_oob_trap_entry(unsigned int trapnr, struct pt_regs *regs)xnlock_get_irqsave (&nklock, s);xnthread_set_info (thread,XNCONTHI );dovetail_request_ucall (current); -stop_debugged_process (thread); +cobalt_stop_debugged_process (thread);xnlock_put_irqrestore (&nklock, s);xnsched_run (); }
@@ -288,7 +225,7 @@ static void __handle_taskexit_event(struct task_struct *p)xnlock_get_irqsave (&nklock, s);if (xnthread_test_state (thread,XNSSTEP )) -unregister_debugged_thread (thread); +cobalt_unregister_debugged_thread (thread);xnsched_run ();
@@ -386,7 +323,7 @@ static int handle_sigwake_event(struct task_struct *p)if (sigismember (&pending,SIGTRAP ) ||sigismember (&pending,SIGSTOP ) ||sigismember (&pending,SIGINT )) -register_debugged_thread (thread); +cobalt_register_debugged_thread (thread); }if (xnthread_test_state (thread,XNRELAX ))
@@ -472,7 +409,7 @@ int handle_ptrace_resume(struct task_struct *tracee)xnlock_get_irqsave (&nklock, s);xnthread_resume (thread,XNDBGSTOP ); -unregister_debugged_thread (thread); +cobalt_unregister_debugged_thread (thread);xnlock_put_irqrestore (&nklock, s); }
@@ -489,7 +426,7 @@ static void handle_ptrace_cont(void)if (xnthread_test_state (curr,XNSSTEP )) {if (!xnthread_test_info (curr,XNCONTHI )) -unregister_debugged_thread (curr); +cobalt_unregister_debugged_thread (curr);xnthread_set_localinfo (curr,XNHICCUP );
@@ -608,7 +545,7 @@ void resume_oob_task(struct task_struct *p) /* inband, oob stage stalled *//* Unregister as debugged thread in case we postponed this. */ if (unlikely (xnthread_test_state (thread,XNSSTEP ))) -unregister_debugged_thread (thread); +cobalt_unregister_debugged_thread (thread);xnlock_put (&nklock);
kernel/cobalt/ipipe/kevents.c +7 -70
122 lines not on this page · raw message
kernel/cobalt/posix/process.c +63 -0
69 lines not on this page · raw message
kernel/cobalt/posix/process.h +6 -0
@@ -151,6 +151,12 @@ void cobalt_remove_process(struct cobalt_process *process);void cobalt_signal_yield (void ); +void cobalt_stop_debugged_process (struct xnthread *thread); + +void cobalt_register_debugged_thread (struct xnthread *thread); + +void cobalt_unregister_debugged_thread (struct xnthread *thread); +extern struct xnthread_personality *cobalt_personalities[];extern struct xnthread_personality cobalt_personality;
Signature · 1 line
2.26.2