All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH] lttng: Trace syscall exits
@ 2009-02-25 18:30 Jan Kiszka
  2009-02-25 18:38 ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2009-02-25 18:30 UTC (permalink / raw)
  To: xenomai-core

Add proper marks for the end of Xenomai's syscall handling, just like
LTTng provides for Linux syscall. That is helpful to keep the overview
of current context and the time spent there. And it allows to track the
return code.

Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
---

 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index e2f2968..b9303b2 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -1924,7 +1924,7 @@ static inline int do_hisyscall_event(unsigned event, unsigned domid, void *data)
 	muxid = __xn_mux_id(regs);
 	muxop = __xn_mux_op(regs);
 
-	trace_mark(xn_nucleus, syscall_histage,
+	trace_mark(xn_nucleus, syscall_histage_entry,
 		   "thread %p thread_name %s muxid %d muxop %d",
 		   thread, thread ? xnthread_name(thread) : NULL,
 		   muxid, muxop);
@@ -1932,14 +1932,14 @@ static inline int do_hisyscall_event(unsigned event, unsigned domid, void *data)
 	if (muxid < 0 || muxid > XENOMAI_MUX_NR ||
 	    muxop < 0 || muxop >= muxtable[muxid].props->nrcalls) {
 		__xn_error_return(regs, -ENOSYS);
-		return RTHAL_EVENT_STOP;
+		goto ret_handled;
 	}
 
 	sysflags = muxtable[muxid].props->systab[muxop].flags;
 
 	if ((sysflags & __xn_exec_shadow) != 0 && !thread) {
 		__xn_error_return(regs, -EPERM);
-		return RTHAL_EVENT_STOP;
+		goto ret_handled;
 	}
 
 	if ((sysflags & __xn_exec_conforming) != 0)
@@ -2018,6 +2018,10 @@ static inline int do_hisyscall_event(unsigned event, unsigned domid, void *data)
 	else if ((sysflags & __xn_exec_switchback) != 0 && switched)
 		xnshadow_harden();	/* -EPERM will be trapped later if needed. */
 
+      ret_handled:
+
+	trace_mark(xn_nucleus, syscall_histage_exit,
+		   "ret %ld", __xn_reg_rval(regs));
 	return RTHAL_EVENT_STOP;
 
       linux_syscall:
@@ -2115,7 +2119,7 @@ static inline int do_losyscall_event(unsigned event, unsigned domid, void *data)
 	muxid = __xn_mux_id(regs);
 	muxop = __xn_mux_op(regs);
 
-	trace_mark(xn_nucleus, syscall_lostage,
+	trace_mark(xn_nucleus, syscall_lostage_entry,
 		   "thread %p thread_name %s muxid %d muxop %d",
 		   xnpod_active_p() ? xnpod_current_thread() : NULL,
 		   xnpod_active_p() ? xnthread_name(xnpod_current_thread()) : NULL,
@@ -2137,7 +2141,7 @@ static inline int do_losyscall_event(unsigned event, unsigned domid, void *data)
 		   syscall. */
 		if ((err = xnshadow_harden()) != 0) {
 			__xn_error_return(regs, err);
-			return RTHAL_EVENT_STOP;
+			goto ret_handled;
 		}
 
 		switched = 1;
@@ -2165,6 +2169,9 @@ static inline int do_losyscall_event(unsigned event, unsigned domid, void *data)
 	else if ((sysflags & __xn_exec_switchback) != 0 && switched)
 		xnshadow_relax(0);
 
+      ret_handled:
+	trace_mark(xn_nucleus, syscall_lostage_exit,
+		   "ret %ld", __xn_reg_rval(regs));
 	return RTHAL_EVENT_STOP;
 }
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Xenomai-core] [PATCH] lttng: Trace syscall exits
  2009-02-25 18:30 [Xenomai-core] [PATCH] lttng: Trace syscall exits Jan Kiszka
@ 2009-02-25 18:38 ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2009-02-25 18:38 UTC (permalink / raw)
  Cc: xenomai-core

Jan Kiszka wrote:
> Add proper marks for the end of Xenomai's syscall handling, just like
> LTTng provides for Linux syscall. That is helpful to keep the overview
> of current context and the time spent there. And it allows to track the
> return code.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
> ---
> 
>  0 files changed, 0 insertions(+), 0 deletions(-)

What a marvelous patch: improvement without changes...

 ksrc/nucleus/shadow.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

(stgit bug: don't call "stg mail" while in an untracked directory)

> 
> diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
> index e2f2968..b9303b2 100644
> --- a/ksrc/nucleus/shadow.c
> +++ b/ksrc/nucleus/shadow.c
> @@ -1924,7 +1924,7 @@ static inline int do_hisyscall_event(unsigned event, unsigned domid, void *data)
>  	muxid = __xn_mux_id(regs);
>  	muxop = __xn_mux_op(regs);
>  
> -	trace_mark(xn_nucleus, syscall_histage,
> +	trace_mark(xn_nucleus, syscall_histage_entry,
>  		   "thread %p thread_name %s muxid %d muxop %d",
>  		   thread, thread ? xnthread_name(thread) : NULL,
>  		   muxid, muxop);
> @@ -1932,14 +1932,14 @@ static inline int do_hisyscall_event(unsigned event, unsigned domid, void *data)
>  	if (muxid < 0 || muxid > XENOMAI_MUX_NR ||
>  	    muxop < 0 || muxop >= muxtable[muxid].props->nrcalls) {
>  		__xn_error_return(regs, -ENOSYS);
> -		return RTHAL_EVENT_STOP;
> +		goto ret_handled;
>  	}
>  
>  	sysflags = muxtable[muxid].props->systab[muxop].flags;
>  
>  	if ((sysflags & __xn_exec_shadow) != 0 && !thread) {
>  		__xn_error_return(regs, -EPERM);
> -		return RTHAL_EVENT_STOP;
> +		goto ret_handled;
>  	}
>  
>  	if ((sysflags & __xn_exec_conforming) != 0)
> @@ -2018,6 +2018,10 @@ static inline int do_hisyscall_event(unsigned event, unsigned domid, void *data)
>  	else if ((sysflags & __xn_exec_switchback) != 0 && switched)
>  		xnshadow_harden();	/* -EPERM will be trapped later if needed. */
>  
> +      ret_handled:
> +
> +	trace_mark(xn_nucleus, syscall_histage_exit,
> +		   "ret %ld", __xn_reg_rval(regs));
>  	return RTHAL_EVENT_STOP;
>  
>        linux_syscall:
> @@ -2115,7 +2119,7 @@ static inline int do_losyscall_event(unsigned event, unsigned domid, void *data)
>  	muxid = __xn_mux_id(regs);
>  	muxop = __xn_mux_op(regs);
>  
> -	trace_mark(xn_nucleus, syscall_lostage,
> +	trace_mark(xn_nucleus, syscall_lostage_entry,
>  		   "thread %p thread_name %s muxid %d muxop %d",
>  		   xnpod_active_p() ? xnpod_current_thread() : NULL,
>  		   xnpod_active_p() ? xnthread_name(xnpod_current_thread()) : NULL,
> @@ -2137,7 +2141,7 @@ static inline int do_losyscall_event(unsigned event, unsigned domid, void *data)
>  		   syscall. */
>  		if ((err = xnshadow_harden()) != 0) {
>  			__xn_error_return(regs, err);
> -			return RTHAL_EVENT_STOP;
> +			goto ret_handled;
>  		}
>  
>  		switched = 1;
> @@ -2165,6 +2169,9 @@ static inline int do_losyscall_event(unsigned event, unsigned domid, void *data)
>  	else if ((sysflags & __xn_exec_switchback) != 0 && switched)
>  		xnshadow_relax(0);
>  
> +      ret_handled:
> +	trace_mark(xn_nucleus, syscall_lostage_exit,
> +		   "ret %ld", __xn_reg_rval(regs));
>  	return RTHAL_EVENT_STOP;
>  }

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-25 18:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25 18:30 [Xenomai-core] [PATCH] lttng: Trace syscall exits Jan Kiszka
2009-02-25 18:38 ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.