From paulmck at linux.vnet.ibm.com Sat Sep 1 20:59:11 2012 From: paulmck at linux.vnet.ibm.com (Paul E. McKenney) Date: Sat, 1 Sep 2012 17:59:11 -0700 Subject: [lttng-dev] [PATCH] Ensure that read-side functions meet 10-line LGPL criterion Message-ID: <20120902005911.GA26326@linux.vnet.ibm.com> This commit ensures that all read-side functions meet the 10-line LGPL criterion that permits them to be expanded directly into non-LGPL code, without function-call instructions. It also documents this as the intent. Signed-off-by: Paul E. McKenney diff --git a/urcu/static/urcu-bp.h b/urcu/static/urcu-bp.h index e7b2eda..881b4a4 100644 --- a/urcu/static/urcu-bp.h +++ b/urcu/static/urcu-bp.h @@ -6,8 +6,8 @@ * * Userspace RCU header. * - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking - * dynamically with the userspace rcu library. + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. * * Copyright (c) 2009 Mathieu Desnoyers * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. @@ -162,32 +162,48 @@ static inline int rcu_old_gp_ongoing(long *value) ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); } +/* + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as + * the per-thread rcu_reader.ctr) has the upper bits containing a count of + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in + * _rcu_read_lock() happen before the subsequent read-side critical section. + */ +static inline void _rcu_read_lock_help(unsigned long tmp) +{ + if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); + cmm_smp_mb(); + } else + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); +} + +/* + * Enter an RCU read-side critical section. + * + * The first cmm_barrier() call ensures that the compiler does not reorder + * the body of _rcu_read_lock() with a mutex. + * + * This function and its helper are both less than 10 lines long. The + * intent is that this function meets the 10-line criterion in LGPL, + * allowing this function to be invoked directly from non-LGPL code. + */ static inline void _rcu_read_lock(void) { long tmp; - /* Check if registered */ if (caa_unlikely(!URCU_TLS(rcu_reader))) - rcu_bp_register(); - + rcu_bp_register(); /* If not yet registered. */ cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ tmp = URCU_TLS(rcu_reader)->ctr; - /* - * rcu_gp_ctr is - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) - */ - if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); - /* - * Set active readers count for outermost nesting level before - * accessing the pointer. - */ - cmm_smp_mb(); - } else { - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); - } + _rcu_read_lock_help(tmp); } +/* + * Exit an RCU read-side critical section. This function is less than + * 10 lines of code, and is intended to be usable by non-LGPL code, as + * called out in LGPL. + */ static inline void _rcu_read_unlock(void) { /* diff --git a/urcu/static/urcu-pointer.h b/urcu/static/urcu-pointer.h index 48dc5bf..0ddf6a1 100644 --- a/urcu/static/urcu-pointer.h +++ b/urcu/static/urcu-pointer.h @@ -6,8 +6,8 @@ * * Userspace RCU header. Operations on pointers. * - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-pointer.h for - * linking dynamically with the userspace rcu library. + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. * * Copyright (c) 2009 Mathieu Desnoyers * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. @@ -59,8 +59,11 @@ extern "C" { * addition to forthcoming C++ standard. * * Should match rcu_assign_pointer() or rcu_xchg_pointer(). + * + * This macro is less than 10 lines long. The intent is that this macro + * meets the 10-line criterion in LGPL, allowing this function to be + * expanded directloy in non-LGPL code. */ - #define _rcu_dereference(p) ({ \ __typeof__(p) _________p1 = CMM_LOAD_SHARED(p); \ cmm_smp_read_barrier_depends(); \ @@ -73,8 +76,11 @@ extern "C" { * data structure, which can be safely freed after waiting for a quiescent state * using synchronize_rcu(). If fails (unexpected value), returns old (which * should not be freed !). + * + * This macro is less than 10 lines long. The intent is that this macro + * meets the 10-line criterion in LGPL, allowing this function to be + * expanded directloy in non-LGPL code. */ - #define _rcu_cmpxchg_pointer(p, old, _new) \ ({ \ __typeof__(*p) _________pold = (old); \ @@ -89,8 +95,11 @@ extern "C" { * _rcu_xchg_pointer - same as rcu_assign_pointer, but returns the previous * pointer to the data structure, which can be safely freed after waiting for a * quiescent state using synchronize_rcu(). + * + * This macro is less than 10 lines long. The intent is that this macro + * meets the 10-line criterion in LGPL, allowing this function to be + * expanded directloy in non-LGPL code. */ - #define _rcu_xchg_pointer(p, v) \ ({ \ __typeof__(*p) _________pv = (v); \ @@ -121,8 +130,11 @@ extern "C" { * data structure before its publication. * * Should match rcu_dereference_pointer(). + * + * This macro is less than 10 lines long. The intent is that this macro + * meets the 10-line criterion in LGPL, allowing this function to be + * expanded directloy in non-LGPL code. */ - #define _rcu_assign_pointer(p, v) _rcu_set_pointer(&(p), v) #ifdef __cplusplus diff --git a/urcu/static/urcu-qsbr.h b/urcu/static/urcu-qsbr.h index 22908a4..5580092 100644 --- a/urcu/static/urcu-qsbr.h +++ b/urcu/static/urcu-qsbr.h @@ -6,8 +6,8 @@ * * Userspace RCU QSBR header. * - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-qsbr.h for linking - * dynamically with the userspace rcu QSBR library. + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. * * Copyright (c) 2009 Mathieu Desnoyers * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. @@ -157,15 +157,36 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) return v && (v != rcu_gp_ctr); } +/* + * Enter an RCU read-side critical section. + * + * This function is less than 10 lines long. The intent is that this + * function meets the 10-line criterion for LGPL, allowing this function + * to be invoked directly from non-LGPL code. + */ static inline void _rcu_read_lock(void) { rcu_assert(URCU_TLS(rcu_reader).ctr); } +/* + * Exit an RCU read-side critical section. + * + * This function is less than 10 lines long. The intent is that this + * function meets the 10-line criterion for LGPL, allowing this function + * to be invoked directly from non-LGPL code. + */ static inline void _rcu_read_unlock(void) { } +/* + * Inform RCU of a quiescent state. + * + * This function is less than 10 lines long. The intent is that this + * function meets the 10-line criterion for LGPL, allowing this function + * to be invoked directly from non-LGPL code. + */ static inline void _rcu_quiescent_state(void) { cmm_smp_mb(); @@ -175,6 +196,14 @@ static inline void _rcu_quiescent_state(void) cmm_smp_mb(); } +/* + * Take a thread offline, prohibiting it from entering further RCU + * read-side critical sections. + * + * This function is less than 10 lines long. The intent is that this + * function meets the 10-line criterion for LGPL, allowing this function + * to be invoked directly from non-LGPL code. + */ static inline void _rcu_thread_offline(void) { cmm_smp_mb(); @@ -184,6 +213,14 @@ static inline void _rcu_thread_offline(void) cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ } +/* + * Bring a thread online, allowing it to once again enter RCU + * read-side critical sections. + * + * This function is less than 10 lines long. The intent is that this + * function meets the 10-line criterion for LGPL, allowing this function + * to be invoked directly from non-LGPL code. + */ static inline void _rcu_thread_online(void) { cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ diff --git a/urcu/static/urcu.h b/urcu/static/urcu.h index f27f8b6..fe3194f 100644 --- a/urcu/static/urcu.h +++ b/urcu/static/urcu.h @@ -6,8 +6,8 @@ * * Userspace RCU header. * - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking - * dynamically with the userspace rcu library. + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. * * Copyright (c) 2009 Mathieu Desnoyers * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. @@ -252,46 +252,71 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); } -static inline void _rcu_read_lock(void) +/* + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as + * the per-thread rcu_reader.ctr) has the upper bits containing a count of + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in + * _rcu_read_lock() happen before the subsequent read-side critical section. + */ +static inline void _rcu_read_lock_help(unsigned long tmp) { - unsigned long tmp; - - cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ - tmp = URCU_TLS(rcu_reader).ctr; - /* - * rcu_gp_ctr is - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) - */ if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); - /* - * Set active readers count for outermost nesting level before - * accessing the pointer. See smp_mb_master(). - */ smp_mb_slave(RCU_MB_GROUP); - } else { + } else _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, tmp + RCU_GP_COUNT); - } } -static inline void _rcu_read_unlock(void) +/* + * Enter an RCU read-side critical section. + * + * The first cmm_barrier() call ensures that the compiler does not reorder + * the body of _rcu_read_lock() with a mutex. + * + * This function and its helper are both less than 10 lines long. The + * intent is that this function meets the 10-line criterion in LGPL, + * allowing this function to be invoked directly from non-LGPL code. + */ +static inline void _rcu_read_lock(void) { unsigned long tmp; + cmm_barrier(); tmp = URCU_TLS(rcu_reader).ctr; - /* - * Finish using rcu before decrementing the pointer. - * See smp_mb_master(). - */ + _rcu_read_lock_help(tmp); +} + +/* + * This is a helper function for _rcu_read_unlock(). + * + * The first smp_mb_slave() call ensures that the critical section is + * seen to preced the store to rcu_reader.ctr. + * The second smp_mb_slave() call ensures that we write to rcu_reader.ctr + * before reading the update-side futex. + */ +static inline void _rcu_read_unlock_help(unsigned long tmp) +{ if (caa_likely((tmp & RCU_GP_CTR_NEST_MASK) == RCU_GP_COUNT)) { smp_mb_slave(RCU_MB_GROUP); _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); - /* write URCU_TLS(rcu_reader).ctr before read futex */ smp_mb_slave(RCU_MB_GROUP); wake_up_gp(); - } else { + } else _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); - } +} + +/* + * Exit an RCU read-side crtical section. Both this function and its + * helper are smaller than 10 lines of code, and are intended to be + * usable by non-LGPL code, as called out in LGPL. + */ +static inline void _rcu_read_unlock(void) +{ + unsigned long tmp; + + tmp = URCU_TLS(rcu_reader).ctr; + _rcu_read_unlock_help(tmp); cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ } From josh at joshtriplett.org Sun Sep 2 01:13:55 2012 From: josh at joshtriplett.org (Josh Triplett) Date: Sat, 1 Sep 2012 22:13:55 -0700 Subject: [lttng-dev] [rp] [PATCH] Ensure that read-side functions meet 10-line LGPL criterion In-Reply-To: <20120902005911.GA26326@linux.vnet.ibm.com> References: <20120902005911.GA26326@linux.vnet.ibm.com> Message-ID: <20120902051355.GA7767@leaf> On Sat, Sep 01, 2012 at 05:59:11PM -0700, Paul E. McKenney wrote: > This commit ensures that all read-side functions meet the 10-line LGPL > criterion that permits them to be expanded directly into non-LGPL code, > without function-call instructions. It also documents this as the intent. > > Signed-off-by: Paul E. McKenney s/directloy/directly/g in the comments. Also, this seems inordinately silly. :) Assuming you don't plan to copy other LGPLed code into this library (or more specifically the header file), you might consider just adding an explicit exception at the top, saying that the inline functions in this file may be assumed to qualify for the relevant clause of the LGPL, regardless of their length. (You'd probably want to limit that exception to only the code in the header, not any other code in the library, so someone couldn't just copy the whole library into the headers.) > diff --git a/urcu/static/urcu-bp.h b/urcu/static/urcu-bp.h > index e7b2eda..881b4a4 100644 > --- a/urcu/static/urcu-bp.h > +++ b/urcu/static/urcu-bp.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU header. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking > - * dynamically with the userspace rcu library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -162,32 +162,48 @@ static inline int rcu_old_gp_ongoing(long *value) > ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); > } > > +/* > + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as > + * the per-thread rcu_reader.ctr) has the upper bits containing a count of > + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero > + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in > + * _rcu_read_lock() happen before the subsequent read-side critical section. > + */ > +static inline void _rcu_read_lock_help(unsigned long tmp) > +{ > + if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > + cmm_smp_mb(); > + } else > + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); > +} > + > +/* > + * Enter an RCU read-side critical section. > + * > + * The first cmm_barrier() call ensures that the compiler does not reorder > + * the body of _rcu_read_lock() with a mutex. > + * > + * This function and its helper are both less than 10 lines long. The > + * intent is that this function meets the 10-line criterion in LGPL, > + * allowing this function to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_read_lock(void) > { > long tmp; > > - /* Check if registered */ > if (caa_unlikely(!URCU_TLS(rcu_reader))) > - rcu_bp_register(); > - > + rcu_bp_register(); /* If not yet registered. */ > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > tmp = URCU_TLS(rcu_reader)->ctr; > - /* > - * rcu_gp_ctr is > - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) > - */ > - if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > - /* > - * Set active readers count for outermost nesting level before > - * accessing the pointer. > - */ > - cmm_smp_mb(); > - } else { > - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); > - } > + _rcu_read_lock_help(tmp); > } > > +/* > + * Exit an RCU read-side critical section. This function is less than > + * 10 lines of code, and is intended to be usable by non-LGPL code, as > + * called out in LGPL. > + */ > static inline void _rcu_read_unlock(void) > { > /* > diff --git a/urcu/static/urcu-pointer.h b/urcu/static/urcu-pointer.h > index 48dc5bf..0ddf6a1 100644 > --- a/urcu/static/urcu-pointer.h > +++ b/urcu/static/urcu-pointer.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU header. Operations on pointers. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-pointer.h for > - * linking dynamically with the userspace rcu library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -59,8 +59,11 @@ extern "C" { > * addition to forthcoming C++ standard. > * > * Should match rcu_assign_pointer() or rcu_xchg_pointer(). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directloy in non-LGPL code. > */ > - > #define _rcu_dereference(p) ({ \ > __typeof__(p) _________p1 = CMM_LOAD_SHARED(p); \ > cmm_smp_read_barrier_depends(); \ > @@ -73,8 +76,11 @@ extern "C" { > * data structure, which can be safely freed after waiting for a quiescent state > * using synchronize_rcu(). If fails (unexpected value), returns old (which > * should not be freed !). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directloy in non-LGPL code. > */ > - > #define _rcu_cmpxchg_pointer(p, old, _new) \ > ({ \ > __typeof__(*p) _________pold = (old); \ > @@ -89,8 +95,11 @@ extern "C" { > * _rcu_xchg_pointer - same as rcu_assign_pointer, but returns the previous > * pointer to the data structure, which can be safely freed after waiting for a > * quiescent state using synchronize_rcu(). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directloy in non-LGPL code. > */ > - > #define _rcu_xchg_pointer(p, v) \ > ({ \ > __typeof__(*p) _________pv = (v); \ > @@ -121,8 +130,11 @@ extern "C" { > * data structure before its publication. > * > * Should match rcu_dereference_pointer(). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directloy in non-LGPL code. > */ > - > #define _rcu_assign_pointer(p, v) _rcu_set_pointer(&(p), v) > > #ifdef __cplusplus > diff --git a/urcu/static/urcu-qsbr.h b/urcu/static/urcu-qsbr.h > index 22908a4..5580092 100644 > --- a/urcu/static/urcu-qsbr.h > +++ b/urcu/static/urcu-qsbr.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU QSBR header. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-qsbr.h for linking > - * dynamically with the userspace rcu QSBR library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -157,15 +157,36 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) > return v && (v != rcu_gp_ctr); > } > > +/* > + * Enter an RCU read-side critical section. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_read_lock(void) > { > rcu_assert(URCU_TLS(rcu_reader).ctr); > } > > +/* > + * Exit an RCU read-side critical section. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_read_unlock(void) > { > } > > +/* > + * Inform RCU of a quiescent state. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_quiescent_state(void) > { > cmm_smp_mb(); > @@ -175,6 +196,14 @@ static inline void _rcu_quiescent_state(void) > cmm_smp_mb(); > } > > +/* > + * Take a thread offline, prohibiting it from entering further RCU > + * read-side critical sections. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_thread_offline(void) > { > cmm_smp_mb(); > @@ -184,6 +213,14 @@ static inline void _rcu_thread_offline(void) > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > } > > +/* > + * Bring a thread online, allowing it to once again enter RCU > + * read-side critical sections. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_thread_online(void) > { > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > diff --git a/urcu/static/urcu.h b/urcu/static/urcu.h > index f27f8b6..fe3194f 100644 > --- a/urcu/static/urcu.h > +++ b/urcu/static/urcu.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU header. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking > - * dynamically with the userspace rcu library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -252,46 +252,71 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) > ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); > } > > -static inline void _rcu_read_lock(void) > +/* > + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as > + * the per-thread rcu_reader.ctr) has the upper bits containing a count of > + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero > + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in > + * _rcu_read_lock() happen before the subsequent read-side critical section. > + */ > +static inline void _rcu_read_lock_help(unsigned long tmp) > { > - unsigned long tmp; > - > - cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > - tmp = URCU_TLS(rcu_reader).ctr; > - /* > - * rcu_gp_ctr is > - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) > - */ > if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > - /* > - * Set active readers count for outermost nesting level before > - * accessing the pointer. See smp_mb_master(). > - */ > smp_mb_slave(RCU_MB_GROUP); > - } else { > + } else > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, tmp + RCU_GP_COUNT); > - } > } > > -static inline void _rcu_read_unlock(void) > +/* > + * Enter an RCU read-side critical section. > + * > + * The first cmm_barrier() call ensures that the compiler does not reorder > + * the body of _rcu_read_lock() with a mutex. > + * > + * This function and its helper are both less than 10 lines long. The > + * intent is that this function meets the 10-line criterion in LGPL, > + * allowing this function to be invoked directly from non-LGPL code. > + */ > +static inline void _rcu_read_lock(void) > { > unsigned long tmp; > > + cmm_barrier(); > tmp = URCU_TLS(rcu_reader).ctr; > - /* > - * Finish using rcu before decrementing the pointer. > - * See smp_mb_master(). > - */ > + _rcu_read_lock_help(tmp); > +} > + > +/* > + * This is a helper function for _rcu_read_unlock(). > + * > + * The first smp_mb_slave() call ensures that the critical section is > + * seen to preced the store to rcu_reader.ctr. > + * The second smp_mb_slave() call ensures that we write to rcu_reader.ctr > + * before reading the update-side futex. > + */ > +static inline void _rcu_read_unlock_help(unsigned long tmp) > +{ > if (caa_likely((tmp & RCU_GP_CTR_NEST_MASK) == RCU_GP_COUNT)) { > smp_mb_slave(RCU_MB_GROUP); > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); > - /* write URCU_TLS(rcu_reader).ctr before read futex */ > smp_mb_slave(RCU_MB_GROUP); > wake_up_gp(); > - } else { > + } else > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); > - } > +} > + > +/* > + * Exit an RCU read-side crtical section. Both this function and its > + * helper are smaller than 10 lines of code, and are intended to be > + * usable by non-LGPL code, as called out in LGPL. > + */ > +static inline void _rcu_read_unlock(void) > +{ > + unsigned long tmp; > + > + tmp = URCU_TLS(rcu_reader).ctr; > + _rcu_read_unlock_help(tmp); > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > } > > > > _______________________________________________ > rp mailing list > rp at svcs.cs.pdx.edu > http://svcs.cs.pdx.edu/mailman/listinfo/rp From paulmck at linux.vnet.ibm.com Sun Sep 2 12:07:33 2012 From: paulmck at linux.vnet.ibm.com (Paul E. McKenney) Date: Sun, 2 Sep 2012 09:07:33 -0700 Subject: [lttng-dev] [rp] [PATCH] Ensure that read-side functions meet 10-line LGPL criterion In-Reply-To: <20120902051355.GA7767@leaf> References: <20120902005911.GA26326@linux.vnet.ibm.com> <20120902051355.GA7767@leaf> Message-ID: <20120902160733.GZ30381@linux.vnet.ibm.com> On Sat, Sep 01, 2012 at 10:13:55PM -0700, Josh Triplett wrote: > On Sat, Sep 01, 2012 at 05:59:11PM -0700, Paul E. McKenney wrote: > > This commit ensures that all read-side functions meet the 10-line LGPL > > criterion that permits them to be expanded directly into non-LGPL code, > > without function-call instructions. It also documents this as the intent. > > > > Signed-off-by: Paul E. McKenney > > s/directloy/directly/g in the comments. Good catch, fixed. > Also, this seems inordinately silly. :) > > Assuming you don't plan to copy other LGPLed code into this library (or > more specifically the header file), you might consider just adding an > explicit exception at the top, saying that the inline functions in this > file may be assumed to qualify for the relevant clause of the LGPL, > regardless of their length. (You'd probably want to limit that > exception to only the code in the header, not any other code in the > library, so someone couldn't just copy the whole library into the > headers.) I believe that it is important to allow LGPL code to flow easily between these headers and other LGPL projects. This commit represents a trivial change, admittedly, but one that could save a large amount of bookkeeping and license-compatibility hassle down the road. Thanx, Paul > > diff --git a/urcu/static/urcu-bp.h b/urcu/static/urcu-bp.h > > index e7b2eda..881b4a4 100644 > > --- a/urcu/static/urcu-bp.h > > +++ b/urcu/static/urcu-bp.h > > @@ -6,8 +6,8 @@ > > * > > * Userspace RCU header. > > * > > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking > > - * dynamically with the userspace rcu library. > > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > > * > > * Copyright (c) 2009 Mathieu Desnoyers > > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > > @@ -162,32 +162,48 @@ static inline int rcu_old_gp_ongoing(long *value) > > ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); > > } > > > > +/* > > + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as > > + * the per-thread rcu_reader.ctr) has the upper bits containing a count of > > + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero > > + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in > > + * _rcu_read_lock() happen before the subsequent read-side critical section. > > + */ > > +static inline void _rcu_read_lock_help(unsigned long tmp) > > +{ > > + if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > > + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > > + cmm_smp_mb(); > > + } else > > + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); > > +} > > + > > +/* > > + * Enter an RCU read-side critical section. > > + * > > + * The first cmm_barrier() call ensures that the compiler does not reorder > > + * the body of _rcu_read_lock() with a mutex. > > + * > > + * This function and its helper are both less than 10 lines long. The > > + * intent is that this function meets the 10-line criterion in LGPL, > > + * allowing this function to be invoked directly from non-LGPL code. > > + */ > > static inline void _rcu_read_lock(void) > > { > > long tmp; > > > > - /* Check if registered */ > > if (caa_unlikely(!URCU_TLS(rcu_reader))) > > - rcu_bp_register(); > > - > > + rcu_bp_register(); /* If not yet registered. */ > > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > > tmp = URCU_TLS(rcu_reader)->ctr; > > - /* > > - * rcu_gp_ctr is > > - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) > > - */ > > - if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > > - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > > - /* > > - * Set active readers count for outermost nesting level before > > - * accessing the pointer. > > - */ > > - cmm_smp_mb(); > > - } else { > > - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); > > - } > > + _rcu_read_lock_help(tmp); > > } > > > > +/* > > + * Exit an RCU read-side critical section. This function is less than > > + * 10 lines of code, and is intended to be usable by non-LGPL code, as > > + * called out in LGPL. > > + */ > > static inline void _rcu_read_unlock(void) > > { > > /* > > diff --git a/urcu/static/urcu-pointer.h b/urcu/static/urcu-pointer.h > > index 48dc5bf..0ddf6a1 100644 > > --- a/urcu/static/urcu-pointer.h > > +++ b/urcu/static/urcu-pointer.h > > @@ -6,8 +6,8 @@ > > * > > * Userspace RCU header. Operations on pointers. > > * > > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-pointer.h for > > - * linking dynamically with the userspace rcu library. > > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > > * > > * Copyright (c) 2009 Mathieu Desnoyers > > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > > @@ -59,8 +59,11 @@ extern "C" { > > * addition to forthcoming C++ standard. > > * > > * Should match rcu_assign_pointer() or rcu_xchg_pointer(). > > + * > > + * This macro is less than 10 lines long. The intent is that this macro > > + * meets the 10-line criterion in LGPL, allowing this function to be > > + * expanded directloy in non-LGPL code. > > */ > > - > > #define _rcu_dereference(p) ({ \ > > __typeof__(p) _________p1 = CMM_LOAD_SHARED(p); \ > > cmm_smp_read_barrier_depends(); \ > > @@ -73,8 +76,11 @@ extern "C" { > > * data structure, which can be safely freed after waiting for a quiescent state > > * using synchronize_rcu(). If fails (unexpected value), returns old (which > > * should not be freed !). > > + * > > + * This macro is less than 10 lines long. The intent is that this macro > > + * meets the 10-line criterion in LGPL, allowing this function to be > > + * expanded directloy in non-LGPL code. > > */ > > - > > #define _rcu_cmpxchg_pointer(p, old, _new) \ > > ({ \ > > __typeof__(*p) _________pold = (old); \ > > @@ -89,8 +95,11 @@ extern "C" { > > * _rcu_xchg_pointer - same as rcu_assign_pointer, but returns the previous > > * pointer to the data structure, which can be safely freed after waiting for a > > * quiescent state using synchronize_rcu(). > > + * > > + * This macro is less than 10 lines long. The intent is that this macro > > + * meets the 10-line criterion in LGPL, allowing this function to be > > + * expanded directloy in non-LGPL code. > > */ > > - > > #define _rcu_xchg_pointer(p, v) \ > > ({ \ > > __typeof__(*p) _________pv = (v); \ > > @@ -121,8 +130,11 @@ extern "C" { > > * data structure before its publication. > > * > > * Should match rcu_dereference_pointer(). > > + * > > + * This macro is less than 10 lines long. The intent is that this macro > > + * meets the 10-line criterion in LGPL, allowing this function to be > > + * expanded directloy in non-LGPL code. > > */ > > - > > #define _rcu_assign_pointer(p, v) _rcu_set_pointer(&(p), v) > > > > #ifdef __cplusplus > > diff --git a/urcu/static/urcu-qsbr.h b/urcu/static/urcu-qsbr.h > > index 22908a4..5580092 100644 > > --- a/urcu/static/urcu-qsbr.h > > +++ b/urcu/static/urcu-qsbr.h > > @@ -6,8 +6,8 @@ > > * > > * Userspace RCU QSBR header. > > * > > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-qsbr.h for linking > > - * dynamically with the userspace rcu QSBR library. > > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > > * > > * Copyright (c) 2009 Mathieu Desnoyers > > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > > @@ -157,15 +157,36 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) > > return v && (v != rcu_gp_ctr); > > } > > > > +/* > > + * Enter an RCU read-side critical section. > > + * > > + * This function is less than 10 lines long. The intent is that this > > + * function meets the 10-line criterion for LGPL, allowing this function > > + * to be invoked directly from non-LGPL code. > > + */ > > static inline void _rcu_read_lock(void) > > { > > rcu_assert(URCU_TLS(rcu_reader).ctr); > > } > > > > +/* > > + * Exit an RCU read-side critical section. > > + * > > + * This function is less than 10 lines long. The intent is that this > > + * function meets the 10-line criterion for LGPL, allowing this function > > + * to be invoked directly from non-LGPL code. > > + */ > > static inline void _rcu_read_unlock(void) > > { > > } > > > > +/* > > + * Inform RCU of a quiescent state. > > + * > > + * This function is less than 10 lines long. The intent is that this > > + * function meets the 10-line criterion for LGPL, allowing this function > > + * to be invoked directly from non-LGPL code. > > + */ > > static inline void _rcu_quiescent_state(void) > > { > > cmm_smp_mb(); > > @@ -175,6 +196,14 @@ static inline void _rcu_quiescent_state(void) > > cmm_smp_mb(); > > } > > > > +/* > > + * Take a thread offline, prohibiting it from entering further RCU > > + * read-side critical sections. > > + * > > + * This function is less than 10 lines long. The intent is that this > > + * function meets the 10-line criterion for LGPL, allowing this function > > + * to be invoked directly from non-LGPL code. > > + */ > > static inline void _rcu_thread_offline(void) > > { > > cmm_smp_mb(); > > @@ -184,6 +213,14 @@ static inline void _rcu_thread_offline(void) > > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > > } > > > > +/* > > + * Bring a thread online, allowing it to once again enter RCU > > + * read-side critical sections. > > + * > > + * This function is less than 10 lines long. The intent is that this > > + * function meets the 10-line criterion for LGPL, allowing this function > > + * to be invoked directly from non-LGPL code. > > + */ > > static inline void _rcu_thread_online(void) > > { > > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > > diff --git a/urcu/static/urcu.h b/urcu/static/urcu.h > > index f27f8b6..fe3194f 100644 > > --- a/urcu/static/urcu.h > > +++ b/urcu/static/urcu.h > > @@ -6,8 +6,8 @@ > > * > > * Userspace RCU header. > > * > > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking > > - * dynamically with the userspace rcu library. > > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > > * > > * Copyright (c) 2009 Mathieu Desnoyers > > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > > @@ -252,46 +252,71 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) > > ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); > > } > > > > -static inline void _rcu_read_lock(void) > > +/* > > + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as > > + * the per-thread rcu_reader.ctr) has the upper bits containing a count of > > + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero > > + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in > > + * _rcu_read_lock() happen before the subsequent read-side critical section. > > + */ > > +static inline void _rcu_read_lock_help(unsigned long tmp) > > { > > - unsigned long tmp; > > - > > - cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > > - tmp = URCU_TLS(rcu_reader).ctr; > > - /* > > - * rcu_gp_ctr is > > - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) > > - */ > > if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > > - /* > > - * Set active readers count for outermost nesting level before > > - * accessing the pointer. See smp_mb_master(). > > - */ > > smp_mb_slave(RCU_MB_GROUP); > > - } else { > > + } else > > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, tmp + RCU_GP_COUNT); > > - } > > } > > > > -static inline void _rcu_read_unlock(void) > > +/* > > + * Enter an RCU read-side critical section. > > + * > > + * The first cmm_barrier() call ensures that the compiler does not reorder > > + * the body of _rcu_read_lock() with a mutex. > > + * > > + * This function and its helper are both less than 10 lines long. The > > + * intent is that this function meets the 10-line criterion in LGPL, > > + * allowing this function to be invoked directly from non-LGPL code. > > + */ > > +static inline void _rcu_read_lock(void) > > { > > unsigned long tmp; > > > > + cmm_barrier(); > > tmp = URCU_TLS(rcu_reader).ctr; > > - /* > > - * Finish using rcu before decrementing the pointer. > > - * See smp_mb_master(). > > - */ > > + _rcu_read_lock_help(tmp); > > +} > > + > > +/* > > + * This is a helper function for _rcu_read_unlock(). > > + * > > + * The first smp_mb_slave() call ensures that the critical section is > > + * seen to preced the store to rcu_reader.ctr. > > + * The second smp_mb_slave() call ensures that we write to rcu_reader.ctr > > + * before reading the update-side futex. > > + */ > > +static inline void _rcu_read_unlock_help(unsigned long tmp) > > +{ > > if (caa_likely((tmp & RCU_GP_CTR_NEST_MASK) == RCU_GP_COUNT)) { > > smp_mb_slave(RCU_MB_GROUP); > > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); > > - /* write URCU_TLS(rcu_reader).ctr before read futex */ > > smp_mb_slave(RCU_MB_GROUP); > > wake_up_gp(); > > - } else { > > + } else > > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); > > - } > > +} > > + > > +/* > > + * Exit an RCU read-side crtical section. Both this function and its > > + * helper are smaller than 10 lines of code, and are intended to be > > + * usable by non-LGPL code, as called out in LGPL. > > + */ > > +static inline void _rcu_read_unlock(void) > > +{ > > + unsigned long tmp; > > + > > + tmp = URCU_TLS(rcu_reader).ctr; > > + _rcu_read_unlock_help(tmp); > > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > > } > > > > > > > > _______________________________________________ > > rp mailing list > > rp at svcs.cs.pdx.edu > > http://svcs.cs.pdx.edu/mailman/listinfo/rp > > _______________________________________________ > rp mailing list > rp at svcs.cs.pdx.edu > http://svcs.cs.pdx.edu/mailman/listinfo/rp > From josh at joshtriplett.org Sun Sep 2 17:19:24 2012 From: josh at joshtriplett.org (Josh Triplett) Date: Sun, 2 Sep 2012 14:19:24 -0700 Subject: [lttng-dev] [rp] [PATCH] Ensure that read-side functions meet 10-line LGPL criterion In-Reply-To: <20120902160733.GZ30381@linux.vnet.ibm.com> References: <20120902005911.GA26326@linux.vnet.ibm.com> <20120902051355.GA7767@leaf> <20120902160733.GZ30381@linux.vnet.ibm.com> Message-ID: <20120902211923.GC9534@leaf> On Sun, Sep 02, 2012 at 09:07:33AM -0700, Paul E. McKenney wrote: > On Sat, Sep 01, 2012 at 10:13:55PM -0700, Josh Triplett wrote: > > On Sat, Sep 01, 2012 at 05:59:11PM -0700, Paul E. McKenney wrote: > > > This commit ensures that all read-side functions meet the 10-line LGPL > > > criterion that permits them to be expanded directly into non-LGPL code, > > > without function-call instructions. It also documents this as the intent. > > > > > > Signed-off-by: Paul E. McKenney > > > > s/directloy/directly/g in the comments. > > Good catch, fixed. > > > Also, this seems inordinately silly. :) > > > > Assuming you don't plan to copy other LGPLed code into this library (or > > more specifically the header file), you might consider just adding an > > explicit exception at the top, saying that the inline functions in this > > file may be assumed to qualify for the relevant clause of the LGPL, > > regardless of their length. (You'd probably want to limit that > > exception to only the code in the header, not any other code in the > > library, so someone couldn't just copy the whole library into the > > headers.) > > I believe that it is important to allow LGPL code to flow easily between > these headers and other LGPL projects. This commit represents a trivial > change, admittedly, but one that could save a large amount of bookkeeping > and license-compatibility hassle down the road. Fair enough. Incidentally, LGPLv3 (specifically, clause 3) seems much saner in this regard: exceeding the ten-line limit doesn't cause any issue other than needing to include a copy of the license and give notice about the usage of the library, which you'd have to do anyway when linking to the library. Of course, LGPLv3 wouldn't necessarily satisfy your goal of interoperability with other LGPL (v2.1) projects. - Josh Triplett From mathieu.desnoyers at efficios.com Mon Sep 3 13:53:37 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 3 Sep 2012 13:53:37 -0400 Subject: [lttng-dev] [PATCH] lttng-gen-tp: Allow generation from templates in subdirectories In-Reply-To: <1346272799-23183-1-git-send-email-sbohrer@rgmadvisors.com> References: <1346272799-23183-1-git-send-email-sbohrer@rgmadvisors.com> Message-ID: <20120903175337.GD13776@Krystal> * Shawn Bohrer (sbohrer at rgmadvisors.com) wrote: > If a template is located in a subdirectory as is common in large > software projects then the include guard will contain forward slash > characters which are not allowed. This replaces those characters with > an underscore. Additional the include guards previously started with > an underscore and capital letter which is reserved thus this > additionally removes the leading underscore. [for lttng-tools] Acked-by: Mathieu Desnoyers > > Fixes: #298 > > Signed-off-by: Shawn Bohrer > --- > tools/lttng-gen-tp | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/tools/lttng-gen-tp b/tools/lttng-gen-tp > index d54559a..8cd3191 100755 > --- a/tools/lttng-gen-tp > +++ b/tools/lttng-gen-tp > @@ -61,7 +61,7 @@ extern "C"{{ > > def write(self): > outputFile = open(self.outputFilename,"w") > - includeGuard = "_"+self.outputFilename.upper().replace(".","_") > + includeGuard = self.outputFilename.upper().replace(".","_").replace("/","_") > > outputFile.write(HeaderFile.HEADER_TPL.format(providerName=self.template.domain, > includeGuard = includeGuard, > -- > 1.7.7.6 > > > -- > > --------------------------------------------------------------- > This email, along with any attachments, is confidential. If you > believe you received this message in error, please contact the > sender immediately and delete all copies of the message. > Thank you. > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Mon Sep 3 14:03:00 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 3 Sep 2012 14:03:00 -0400 Subject: [lttng-dev] [PATCH] Ensure that read-side functions meet 10-line LGPL criterion In-Reply-To: <20120902005911.GA26326@linux.vnet.ibm.com> References: <20120902005911.GA26326@linux.vnet.ibm.com> Message-ID: <20120903180300.GA14133@Krystal> * Paul E. McKenney (paulmck at linux.vnet.ibm.com) wrote: > This commit ensures that all read-side functions meet the 10-line LGPL > criterion that permits them to be expanded directly into non-LGPL code, > without function-call instructions. It also documents this as the intent. > > Signed-off-by: Paul E. McKenney > > diff --git a/urcu/static/urcu-bp.h b/urcu/static/urcu-bp.h > index e7b2eda..881b4a4 100644 > --- a/urcu/static/urcu-bp.h > +++ b/urcu/static/urcu-bp.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU header. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking > - * dynamically with the userspace rcu library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -162,32 +162,48 @@ static inline int rcu_old_gp_ongoing(long *value) > ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); > } > > +/* > + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as > + * the per-thread rcu_reader.ctr) has the upper bits containing a count of > + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero > + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in > + * _rcu_read_lock() happen before the subsequent read-side critical section. > + */ > +static inline void _rcu_read_lock_help(unsigned long tmp) could we rename the "_rcu_read_lock_help" to "_rcu_read_lock_update" ? I think it would fit better the role of this function in the algorithm. As Josh pointed out, "directloy" -> "directly" below, The rest looks good. I'll wait for an updated version. Thanks ! Mathieu > +{ > + if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > + cmm_smp_mb(); > + } else > + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); > +} > + > +/* > + * Enter an RCU read-side critical section. > + * > + * The first cmm_barrier() call ensures that the compiler does not reorder > + * the body of _rcu_read_lock() with a mutex. > + * > + * This function and its helper are both less than 10 lines long. The > + * intent is that this function meets the 10-line criterion in LGPL, > + * allowing this function to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_read_lock(void) > { > long tmp; > > - /* Check if registered */ > if (caa_unlikely(!URCU_TLS(rcu_reader))) > - rcu_bp_register(); > - > + rcu_bp_register(); /* If not yet registered. */ > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > tmp = URCU_TLS(rcu_reader)->ctr; > - /* > - * rcu_gp_ctr is > - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) > - */ > - if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > - /* > - * Set active readers count for outermost nesting level before > - * accessing the pointer. > - */ > - cmm_smp_mb(); > - } else { > - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); > - } > + _rcu_read_lock_help(tmp); > } > > +/* > + * Exit an RCU read-side critical section. This function is less than > + * 10 lines of code, and is intended to be usable by non-LGPL code, as > + * called out in LGPL. > + */ > static inline void _rcu_read_unlock(void) > { > /* > diff --git a/urcu/static/urcu-pointer.h b/urcu/static/urcu-pointer.h > index 48dc5bf..0ddf6a1 100644 > --- a/urcu/static/urcu-pointer.h > +++ b/urcu/static/urcu-pointer.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU header. Operations on pointers. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-pointer.h for > - * linking dynamically with the userspace rcu library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -59,8 +59,11 @@ extern "C" { > * addition to forthcoming C++ standard. > * > * Should match rcu_assign_pointer() or rcu_xchg_pointer(). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directloy in non-LGPL code. > */ > - > #define _rcu_dereference(p) ({ \ > __typeof__(p) _________p1 = CMM_LOAD_SHARED(p); \ > cmm_smp_read_barrier_depends(); \ > @@ -73,8 +76,11 @@ extern "C" { > * data structure, which can be safely freed after waiting for a quiescent state > * using synchronize_rcu(). If fails (unexpected value), returns old (which > * should not be freed !). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directloy in non-LGPL code. > */ > - > #define _rcu_cmpxchg_pointer(p, old, _new) \ > ({ \ > __typeof__(*p) _________pold = (old); \ > @@ -89,8 +95,11 @@ extern "C" { > * _rcu_xchg_pointer - same as rcu_assign_pointer, but returns the previous > * pointer to the data structure, which can be safely freed after waiting for a > * quiescent state using synchronize_rcu(). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directloy in non-LGPL code. > */ > - > #define _rcu_xchg_pointer(p, v) \ > ({ \ > __typeof__(*p) _________pv = (v); \ > @@ -121,8 +130,11 @@ extern "C" { > * data structure before its publication. > * > * Should match rcu_dereference_pointer(). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directloy in non-LGPL code. > */ > - > #define _rcu_assign_pointer(p, v) _rcu_set_pointer(&(p), v) > > #ifdef __cplusplus > diff --git a/urcu/static/urcu-qsbr.h b/urcu/static/urcu-qsbr.h > index 22908a4..5580092 100644 > --- a/urcu/static/urcu-qsbr.h > +++ b/urcu/static/urcu-qsbr.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU QSBR header. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-qsbr.h for linking > - * dynamically with the userspace rcu QSBR library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -157,15 +157,36 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) > return v && (v != rcu_gp_ctr); > } > > +/* > + * Enter an RCU read-side critical section. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_read_lock(void) > { > rcu_assert(URCU_TLS(rcu_reader).ctr); > } > > +/* > + * Exit an RCU read-side critical section. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_read_unlock(void) > { > } > > +/* > + * Inform RCU of a quiescent state. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_quiescent_state(void) > { > cmm_smp_mb(); > @@ -175,6 +196,14 @@ static inline void _rcu_quiescent_state(void) > cmm_smp_mb(); > } > > +/* > + * Take a thread offline, prohibiting it from entering further RCU > + * read-side critical sections. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_thread_offline(void) > { > cmm_smp_mb(); > @@ -184,6 +213,14 @@ static inline void _rcu_thread_offline(void) > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > } > > +/* > + * Bring a thread online, allowing it to once again enter RCU > + * read-side critical sections. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_thread_online(void) > { > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > diff --git a/urcu/static/urcu.h b/urcu/static/urcu.h > index f27f8b6..fe3194f 100644 > --- a/urcu/static/urcu.h > +++ b/urcu/static/urcu.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU header. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking > - * dynamically with the userspace rcu library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -252,46 +252,71 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) > ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); > } > > -static inline void _rcu_read_lock(void) > +/* > + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as > + * the per-thread rcu_reader.ctr) has the upper bits containing a count of > + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero > + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in > + * _rcu_read_lock() happen before the subsequent read-side critical section. > + */ > +static inline void _rcu_read_lock_help(unsigned long tmp) > { > - unsigned long tmp; > - > - cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > - tmp = URCU_TLS(rcu_reader).ctr; > - /* > - * rcu_gp_ctr is > - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) > - */ > if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > - /* > - * Set active readers count for outermost nesting level before > - * accessing the pointer. See smp_mb_master(). > - */ > smp_mb_slave(RCU_MB_GROUP); > - } else { > + } else > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, tmp + RCU_GP_COUNT); > - } > } > > -static inline void _rcu_read_unlock(void) > +/* > + * Enter an RCU read-side critical section. > + * > + * The first cmm_barrier() call ensures that the compiler does not reorder > + * the body of _rcu_read_lock() with a mutex. > + * > + * This function and its helper are both less than 10 lines long. The > + * intent is that this function meets the 10-line criterion in LGPL, > + * allowing this function to be invoked directly from non-LGPL code. > + */ > +static inline void _rcu_read_lock(void) > { > unsigned long tmp; > > + cmm_barrier(); > tmp = URCU_TLS(rcu_reader).ctr; > - /* > - * Finish using rcu before decrementing the pointer. > - * See smp_mb_master(). > - */ > + _rcu_read_lock_help(tmp); > +} > + > +/* > + * This is a helper function for _rcu_read_unlock(). > + * > + * The first smp_mb_slave() call ensures that the critical section is > + * seen to preced the store to rcu_reader.ctr. > + * The second smp_mb_slave() call ensures that we write to rcu_reader.ctr > + * before reading the update-side futex. > + */ > +static inline void _rcu_read_unlock_help(unsigned long tmp) > +{ > if (caa_likely((tmp & RCU_GP_CTR_NEST_MASK) == RCU_GP_COUNT)) { > smp_mb_slave(RCU_MB_GROUP); > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); > - /* write URCU_TLS(rcu_reader).ctr before read futex */ > smp_mb_slave(RCU_MB_GROUP); > wake_up_gp(); > - } else { > + } else > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); > - } > +} > + > +/* > + * Exit an RCU read-side crtical section. Both this function and its > + * helper are smaller than 10 lines of code, and are intended to be > + * usable by non-LGPL code, as called out in LGPL. > + */ > +static inline void _rcu_read_unlock(void) > +{ > + unsigned long tmp; > + > + tmp = URCU_TLS(rcu_reader).ctr; > + _rcu_read_unlock_help(tmp); > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > } > > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From ashok.vinu at gmail.com Tue Sep 4 03:18:09 2012 From: ashok.vinu at gmail.com (Ashoka K) Date: Tue, 4 Sep 2012 12:48:09 +0530 Subject: [lttng-dev] Need help to install LTTng on Ubunto 10.04 Message-ID: Hi, I have tried the below commands to install LTT on VMware running Ubuntu 10.04, but got the following error. Please help. >From link : https://launchpad.net/~lttng/+archive/ppa $ sudo apt-add-repository ppa:lttng/ppa $ sudo apt-get update $ sudo apt-get install lttng-tools lttng-modules-dkms babeltrace user at usr:~$ sudo apt-add-repository ppa:lttng/ppa Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv C541B13BD43FA44A287E4161F4A7DFFC33739778 gpg: requesting key 33739778 from hkp server keyserver.ubuntu.com gpg: unable to execute program `/usr/local/libexec/gnupg/gpgkeys_curl': No such file or directory gpg: no handler for keyserver scheme `hkp' gpg: keyserver receive failed: keyserver error user at usr:~$ user at usr:~$ sudo apt-get update ..... $ user at usr:~$ sudo apt-get install lttng-tools lttng-modules-dkms babeltrace Reading package lists... Done Building dependency tree Reading state information... Done E: Couldn't find package lttng-tools user at usr:~$ My systemm details: user at usr:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=10.04 DISTRIB_CODENAME=lucid DISTRIB_DESCRIPTION="Ubuntu 10.04.4 LTS" user at usr:~$ user at usr:~$ user at usr:~$ uname -a Linux usr 2.6.32-42-generic #95-Ubuntu SMP Wed Jul 25 15:57:54 UTC 2012 i686 GNU/Linux user at usr:~$ Regards Ashoka. K -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexmonthy at voxpopuli.im Tue Sep 4 03:43:41 2012 From: alexmonthy at voxpopuli.im (Alexandre Montplaisir) Date: Tue, 04 Sep 2012 03:43:41 -0400 Subject: [lttng-dev] Need help to install LTTng on Ubunto 10.04 In-Reply-To: References: Message-ID: <5045B12D.4010503@voxpopuli.im> On 12-09-04 03:18 AM, Ashoka K wrote: > Hi, > > I have tried the below commands to install LTT on VMware running Ubuntu > 10.04, but got the following error. Please help. Hi, The PPA only offers packages for 11.10 (Oneiric) and 12.04 (Precise). One of the main reasons being that the LTTng kernel tracer requires at least Linux 2.6.38. Ubuntu 10.04 comes with 2.6.32 by default. If you cannot upgrade your distro, you could always install a more recent kernel (from the package called "linux-image-generic-lts-backport-oneiric" in the main repo, for example) and compile/install the tools by hand. The 12.04 packages probably won't work on 10.04, since the latter didn't have multiarch. Cheers, -- Alexandre Montplaisir DORSAL lab, ?cole Polytechnique de Montr?al From wade_farnsworth at mentor.com Tue Sep 4 11:33:43 2012 From: wade_farnsworth at mentor.com (Wade Farnsworth) Date: Tue, 4 Sep 2012 08:33:43 -0700 Subject: [lttng-dev] babeltrace assertion "`pos->offset <= pos->content_size' failed" Message-ID: <50461F57.5010401@mentor.com> Hi, I'm occasionally seeing the following error when I pass a trace through babeltrace: babeltrace: ../../include/babeltrace/ctf/types.h:203: ctf_pos_get_event: Assertion `pos->offset <= pos->content_size' failed. Aborted Here are my platform details: Board: ARM Pandaboard Kernel: v3.1.0 from git://dev.omapzoom.org/pub/scm/integration/kernel-ubuntu.git lttng-modules: v2.0.5 lttng-tools: v2.0.3 babeltrace: 1.0.0-rc5 Now, I'm not very familiar with the internal workings of, but it seems like this situation should be prevented by the call to v_cmpxchg in lib_ring_buffer_check_deliver() which claims to have exclusive subbuffer access when the content_size field is written. Is this understanding correct? Does anyone have any suggestions on where the problem might be? Any help you might be able to give me would be appreciated. Thanks, Wade Farnsworth From dgoulet at efficios.com Tue Sep 4 11:34:48 2012 From: dgoulet at efficios.com (David Goulet) Date: Tue, 04 Sep 2012 11:34:48 -0400 Subject: [lttng-dev] [lttng-tools PATCH] lttng-tools python module v3 In-Reply-To: <1344525842-10176-1-git-send-email-danny.serres@efficios.com> References: <1344525842-10176-1-git-send-email-danny.serres@efficios.com> Message-ID: <50461F98.9070703@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 I've finally merge this patch. Thanks! David Danny Serres: > The lttng-tools Python module can be used to directly control the > lttng-tools API inside Python, using 'import lttng'. > > Therefore, it becomes possible to create a trace, add events, > start/stop tracing, destroy a session and so on from within > Python. > > The module does not include URI-related functions. > > SWIG >= 2.0 is used to create the wrapper and its 'warning md > variable unused' bug is patched in Makefile.am. > > In the interface file, struct and enum are directly copied from > lttng.h (all changes must be made in both files). > > To install with python bingings, configure using > --enable-python-bindings > > Signed-off-by: Danny Serres > Signed-off-by: Yannick Brosseau --- > .gitignore | 4 + Makefile.am > | 1 + README | 15 + > config/ax_pkg_swig.m4 | 135 ++++ > configure.ac | 48 ++ > doc/python-howto.txt | 70 ++ > extras/Makefile.am | 1 + > extras/bindings/Makefile.am | 1 + > extras/bindings/swig/Makefile.am | 3 + > extras/bindings/swig/python/Makefile.am | 25 + > extras/bindings/swig/python/lttng.i.in | 1029 > ++++++++++++++++++++++++++ > extras/bindings/swig/python/tests/example.py | 109 +++ > extras/bindings/swig/python/tests/run.sh | 1 + > extras/bindings/swig/python/tests/tests.py | 310 ++++++++ 14 > files changed, 1752 insertions(+) create mode 100644 > config/ax_pkg_swig.m4 create mode 100644 doc/python-howto.txt > create mode 100644 extras/Makefile.am create mode 100644 > extras/bindings/Makefile.am create mode 100644 > extras/bindings/swig/Makefile.am create mode 100644 > extras/bindings/swig/python/Makefile.am create mode 100644 > extras/bindings/swig/python/lttng.i.in create mode 100644 > extras/bindings/swig/python/tests/example.py create mode 100644 > extras/bindings/swig/python/tests/run.sh create mode 100644 > extras/bindings/swig/python/tests/tests.py > > diff --git a/.gitignore b/.gitignore index 6d04272..c94f759 100644 > --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,10 @@ > src/lib/lttng-ctl/filter-parser.c > src/lib/lttng-ctl/filter-parser.h > src/lib/lttng-ctl/filter-parser.output > > +extras/bindings/swig/python/lttng.i > +extras/bindings/swig/python/lttng.py > +extras/bindings/swig/python/lttng_wrap.c + # Tests test_sessions > test_kernel_data_trace diff --git a/Makefile.am b/Makefile.am index > 13d3f93..b0537ce 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,6 > +2,7 @@ ACLOCAL_AMFLAGS = -I config > > SUBDIRS = src \ tests \ + extras \ include \ doc > > diff --git a/README b/README index fe9e4c2..1898af9 100644 --- > a/README +++ b/README @@ -28,6 +28,16 @@ REQUIREMENTS: > > * Debian/Ubuntu package: libpopt-dev > > + - SWIG >= 2.0 (optional) + Needed for Python bindings + + > * Debian/Ubuntu package: swig2.0 + + - python-dev (optional) + > Python headers + + * Debian/Ubuntu package: python-dev + - For > kernel tracing: modprobe > > For developers using the git tree: @@ -62,6 +72,8 @@ INSTALLATION > INSTRUCTIONS: If compiling from the git repository, run ./bootstrap > before running the configure script, to generate it. > > + If you want Python bindings, run ./configure > --enable-python-bindings. + USAGE: > > Please see doc/quickstart.txt to help you start tracing. You can > also use the @@ -71,6 +83,9 @@ lttng enable-event -h). A network > streaming HOWTO can be found in doc/streaming-howto.txt which > quickly helps you understand how to stream a LTTng 2.0 trace. > > +A Python HOWTO can be found in doc/python-howto.txt which quickly > +helps you understand how to use the Python module to control the > LTTng API. + PACKAGE CONTENTS: > > This package contains the following elements: diff --git > a/config/ax_pkg_swig.m4 b/config/ax_pkg_swig.m4 new file mode > 100644 index 0000000..e112f3d --- /dev/null +++ > b/config/ax_pkg_swig.m4 @@ -0,0 +1,135 @@ +# > =========================================================================== > > +# http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html > +# > =========================================================================== > > +# > +# SYNOPSIS +# +# AX_PKG_SWIG([major.minor.micro], > [action-if-found], [action-if-not-found]) +# +# DESCRIPTION +# +# > This macro searches for a SWIG installation on your system. If > found, +# then SWIG is AC_SUBST'd; if not found, then $SWIG is > empty. If SWIG is +# found, then SWIG_LIB is set to the SWIG > library path, and AC_SUBST'd. +# +# You can use the optional > first argument to check if the version of the +# available SWIG > is greater than or equal to the value of the argument. It +# > should have the format: N[.N[.N]] (N is a number between 0 and 999. > Only +# the first N is mandatory.) If the version argument is > given (e.g. +# 1.3.17), AX_PKG_SWIG checks that the swig package > is this version number +# or higher. +# +# As usual, > action-if-found is executed if SWIG is found, otherwise +# > action-if-not-found is executed. +# +# In configure.in, use as: > +# +# AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required > to build..]) ]) +# AX_SWIG_ENABLE_CXX +# > AX_SWIG_MULTI_MODULE_SUPPORT +# AX_SWIG_PYTHON +# +# LICENSE > +# +# Copyright (c) 2008 Sebastian Huber > +# Copyright (c) 2008 Alan W. Irwin > +# Copyright (c) 2008 Rafael > Laboissiere +# Copyright (c) 2008 Andrew > Collier +# Copyright (c) 2011 Murray > Cumming +# +# This program is free > software; you can redistribute it and/or modify it +# under the > terms of the GNU General Public License as published by the +# > Free Software Foundation; either version 2 of the License, or (at > your +# option) any later version. +# +# This program is > distributed in the hope that it will be useful, but +# WITHOUT > ANY WARRANTY; without even the implied warranty of +# > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General +# Public License for more details. +# +# You should > have received a copy of the GNU General Public License along +# > with this program. If not, see . +# > +# As a special exception, the respective Autoconf Macro's > copyright owner +# gives unlimited permission to copy, distribute > and modify the configure +# scripts that are the output of > Autoconf when processing the Macro. You +# need not follow the > terms of the GNU General Public License when using +# or > distributing such scripts, even though portions of the text of the > +# Macro appear in them. The GNU General Public License (GPL) > does govern +# all other use of the material that constitutes the > Autoconf Macro. +# +# This special exception to the GPL applies > to versions of the Autoconf +# Macro released by the Autoconf > Archive. When you make and distribute a +# modified version of > the Autoconf Macro, you may extend this special +# exception to > the GPL to apply to your modified version as well. + +#serial 8 + > +AC_DEFUN([AX_PKG_SWIG],[ + # Ubuntu has swig 2.0 as > /usr/bin/swig2.0 + AC_PATH_PROGS([SWIG],[swig swig2.0]) + > if test -z "$SWIG" ; then + m4_ifval([$3],[$3],[:]) > + elif test -n "$1" ; then + > AC_MSG_CHECKING([SWIG version]) + > [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed > 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`] + > AC_MSG_RESULT([$swig_version]) + if test -n > "$swig_version" ; then + # Calculate the > required version number components + > [required=$1] + [required_major=`echo > $required | sed 's/[^0-9].*//'`] + if test > -z "$required_major" ; then + > [required_major=0] + fi + > [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] + > [required_minor=`echo $required | sed 's/[^0-9].*//'`] + > if test -z "$required_minor" ; then + > [required_minor=0] + fi + > [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] + > [required_patch=`echo $required | sed 's/[^0-9].*//'`] + > if test -z "$required_patch" ; then + > [required_patch=0] + fi + > # Calculate the available version number components + > [available=$swig_version] + > [available_major=`echo $available | sed 's/[^0-9].*//'`] + > if test -z "$available_major" ; then + > [available_major=0] + fi + > [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] + > [available_minor=`echo $available | sed 's/[^0-9].*//'`] + > if test -z "$available_minor" ; then + > [available_minor=0] + fi + > [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] + > [available_patch=`echo $available | sed 's/[^0-9].*//'`] + > if test -z "$available_patch" ; then + > [available_patch=0] + fi + > # Convert the version tuple into a single number for easier > comparison. + # Using base 100 should be > safe since SWIG internally uses BCD values + > # to encode its version number. + > required_swig_vernum=`expr $required_major \* 10000 \ + > \+ $required_minor \* 100 \+ $required_patch` + > available_swig_vernum=`expr $available_major \* 10000 \ + > \+ $available_minor \* 100 \+ $available_patch` + + > if test $available_swig_vernum -lt $required_swig_vernum; then + > AC_MSG_WARN([SWIG version >= $1 is required. You have > $swig_version.]) + SWIG='' + > m4_ifval([$3],[$3],[]) + else + > AC_MSG_CHECKING([for SWIG library]) + > SWIG_LIB=`$SWIG -swiglib` + > AC_MSG_RESULT([$SWIG_LIB]) + > m4_ifval([$2],[$2],[]) + fi + > else + AC_MSG_WARN([cannot determine SWIG > version]) + SWIG='' + > m4_ifval([$3],[$3],[]) + fi + fi + > AC_SUBST([SWIG_LIB]) +]) diff --git a/configure.ac b/configure.ac > index 17e6b67..5e8edb4 100644 --- a/configure.ac +++ > b/configure.ac @@ -154,6 +154,42 @@ AC_CHECK_LIB([c], > [open_memstream], ] ) > > +# For Python +# SWIG version needed or newer: +swig_version=2.0.0 > + +AC_ARG_ENABLE([python-bindings], + > [AC_HELP_STRING([--enable-python-bindings], + > [compile Python bindings])], + [enable_python=yes], > [enable_python=no]) + +AM_CONDITIONAL([USE_PYTHON], [test > "x${enable_python:-yes}" = xyes]) + +if test > "x${enable_python:-yes}" = xyes; then + AX_PKG_SWIG($swig_version, > [], [ AC_MSG_ERROR([SWIG $swig_version or newer is needed]) ]) + > AM_PATH_PYTHON + + AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for > python, bypassing python-config]) + AC_ARG_VAR([PYTHON_CONFIG], > [Path to python-config]) + AS_IF([test -z "$PYTHON_INCLUDE"], [ + > AS_IF([test -z "$PYTHON_CONFIG"], [ + > AC_PATH_PROGS([PYTHON_CONFIG], + > [python$PYTHON_VERSION-config python-config], + > [no], + [`dirname $PYTHON`]) + AS_IF([test > "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config > for $PYTHON.])]) + ]) + AC_MSG_CHECKING([python include > flags]) + PYTHON_INCLUDE=`$PYTHON_CONFIG --includes` + > AC_MSG_RESULT([$PYTHON_INCLUDE]) + ]) + +else + > AC_MSG_NOTICE([You may configure with --enable-python-bindings > ]dnl +[if you want Python bindings.]) + +fi + # Option to only > build the consumer daemon and its libraries > AC_ARG_WITH([consumerd-only], > AS_HELP_STRING([--with-consumerd-only],[Only build the consumer > daemon [default=no]]), @@ -198,6 +234,10 @@ AC_CONFIG_FILES([ > doc/Makefile doc/man/Makefile include/Makefile + extras/Makefile + > extras/bindings/Makefile + extras/bindings/swig/Makefile + > extras/bindings/swig/python/Makefile src/Makefile > src/common/Makefile src/common/kernel-ctl/Makefile @@ -260,6 > +300,14 @@ AS_IF([test "x$lttng_ust_support" = "xyes"],[ > AS_ECHO("Disabled") ]) > > +#Python binding enabled/disabled +AS_ECHO_N("Python binding: ") > +AS_IF([test "x${enable_python:-yes}" = xyes], [ + > AS_ECHO("Enabled") +],[ + AS_ECHO("Disabled") +]) + # Do we build > only the consumerd, or everything AS_IF([test "x$consumerd_only" = > "xyes"],[ AS_ECHO("Only the consumerd daemon will be built.") diff > --git a/doc/python-howto.txt b/doc/python-howto.txt new file mode > 100644 index 0000000..5f7fcfb --- /dev/null +++ > b/doc/python-howto.txt @@ -0,0 +1,70 @@ +PYTHON BINDINGS > +---------------- + +This is a brief howto for using the > lttng-tools Python module. + +By default, the Python bindings are > not installed. +If you wish the Python bindings, you can configure > with the +--enable-python-bindings option during the installation > procedure: + + $ ./configure --enable-python-bindings + +The > Python module is automatically generated using SWIG, therefore the > +swig2.0 package on Debian/Ubuntu is requied. + +Once installed, > the Python module can be used by importing it in Python. +In the > Python interpreter: + + >>> import lttng + +Example: > +---------------- + +Quick example using Python to trace with > LTTng. + +1) Run python + + $ python + +2) Import the lttng > module + + >>> import lttng + +3) Create a session + + >>> > lttng.create("session-name", "path/to/trace") + +4) Create a handle > for the tracing session and domain + + >>> domain = > lttng.Domain() + >>> domain.type = lttng.DOMAIN_KERNEL * + >>> > handle = lttng.Handle("session-name", domain) + +* This line is > somewhat useless since domain.type is set to 0 + by default, the > corresponding value of lttng.DOMAIN_KERNEL + +5) Enable all Kernel > events + + >>> event = lttng.Event() + >>> event.type = > lttng.EVENT_TRACEPOINT * + >>> event.loglevel_type = > lttng.EVENT_LOGLEVEL_ALL * + >>> lttng.enable_event(handle, event, > None) + +* These two lines are somewhat useless since event.type + > and event.loglevel_type are by default set to 0, the + > corresponding value of lttng.EVENT_TRACEPOINT and + > lttng.EVENT_LOGLEVEL_ALL + +5) Start tracing + + >>> > lttng.start("session-name") + +6) Stop tracing + + >>> > lttng.stop("session-name") + +7) Destroy the tracing session + + > >>> lttng.destroy("session-name") + +For an example script with > more details, see extras/bindings/swig/python/tests/example.py diff > --git a/extras/Makefile.am b/extras/Makefile.am new file mode > 100644 index 0000000..925dc2e --- /dev/null +++ > b/extras/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = bindings diff --git > a/extras/bindings/Makefile.am b/extras/bindings/Makefile.am new > file mode 100644 index 0000000..1585422 --- /dev/null +++ > b/extras/bindings/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = swig diff > --git a/extras/bindings/swig/Makefile.am > b/extras/bindings/swig/Makefile.am new file mode 100644 index > 0000000..dcd868d --- /dev/null +++ > b/extras/bindings/swig/Makefile.am @@ -0,0 +1,3 @@ +if USE_PYTHON > +SUBDIRS = python +endif diff --git > a/extras/bindings/swig/python/Makefile.am > b/extras/bindings/swig/python/Makefile.am new file mode 100644 > index 0000000..85237a4 --- /dev/null +++ > b/extras/bindings/swig/python/Makefile.am @@ -0,0 +1,25 @@ > +lttng.i: lttng.i.in + sed "s/LTTNG_VERSION_STR/LTTng > $(PACKAGE_VERSION)/g" lttng.i + +AM_CFLAGS = > -I$(PYTHON_INCLUDE) -I$(top_srcdir)/lib/lttng-ctl -I../common \ + > $(BUDDY_CFLAGS) + +EXTRA_DIST = lttng.i +python_PYTHON = lttng.py > +pyexec_LTLIBRARIES = _lttng.la + +MAINTAINERCLEANFILES = > lttng_wrap.c lttng.py + +_lttng_la_SOURCES = lttng_wrap.c + > +_lttng_la_LDFLAGS = -module + +_lttng_la_LIBADD = > $(top_srcdir)/src/lib/lttng-ctl/liblttng-ctl.la \ + > $(top_srcdir)/src/common/sessiond-comm/libsessiond-comm.la + +# > SWIG 'warning md variable unused' fixed after SWIG build: > +lttng_wrap.c: lttng.i + $(SWIG) -python -I. > -I$(top_srcdir)/src/common/sessiond-comm lttng.i + sed -i > "s/PyObject \*m, \*d, \*md;/PyObject \*m, \*d;\n#if > defined(SWIGPYTHON_BUILTIN)\nPyObject *md;\n#endif/g" lttng_wrap.c > + sed -i "s/md = d/d/g" lttng_wrap.c + sed -i > "s/(void)public_symbol;/(void)public_symbol;\n md = d;/g" > lttng_wrap.c diff --git a/extras/bindings/swig/python/lttng.i.in > b/extras/bindings/swig/python/lttng.i.in new file mode 100644 index > 0000000..0d6d1e9 --- /dev/null +++ > b/extras/bindings/swig/python/lttng.i.in @@ -0,0 +1,1029 @@ > +%define DOCSTRING +"LTTNG_VERSION_STR + +The LTTng project aims > at providing highly efficient tracing tools for Linux. +It's > tracers help tracking down performance issues and debugging > problems involving +multiple concurrent processes and threads. > Tracing across multiple systems is also possible." +%enddef + > +%module(docstring=DOCSTRING) lttng + +%include "typemaps.i" > +%include "pyabc.i" +%{ +#define SWIG_FILE_WITH_INIT +#include > +%} + +typedef unsigned int uint32_t; +typedef int > int32_t; +typedef unsigned long long uint64_t; +typedef long > pid_t; + + +// ============================================= +// > ENUMS +// These are directly taken from lttng.h. +// Any change to > these enums must also be +// made here. +// > ============================================= + > +%rename("DOMAIN_KERNEL") LTTNG_DOMAIN_KERNEL; > +%rename("DOMAIN_UST") LTTNG_DOMAIN_UST; +enum lttng_domain_type { > + LTTNG_DOMAIN_KERNEL = 1, + LTTNG_DOMAIN_UST > = 2, +}; + +%rename("EVENT_ALL") LTTNG_EVENT_ALL; > +%rename("EVENT_TRACEPOINT") LTTNG_EVENT_TRACEPOINT; > +%rename("EVENT_PROBE") LTTNG_EVENT_PROBE; > +%rename("EVENT_FUNCTION")LTTNG_EVENT_FUNCTION; > +%rename("EVENT_FUNCTION_ENTRY") LTTNG_EVENT_FUNCTION_ENTRY; > +%rename("EVENT_NOOP") LTTNG_EVENT_NOOP; +%rename("EVENT_SYSCALL") > LTTNG_EVENT_SYSCALL; +enum lttng_event_type { + LTTNG_EVENT_ALL > = -1, + LTTNG_EVENT_TRACEPOINT = 0, + > LTTNG_EVENT_PROBE = 1, + LTTNG_EVENT_FUNCTION > = 2, + LTTNG_EVENT_FUNCTION_ENTRY = 3, + > LTTNG_EVENT_NOOP = 4, + LTTNG_EVENT_SYSCALL > = 5, +}; + +%rename("EVENT_LOGLEVEL_ALL") > LTTNG_EVENT_LOGLEVEL_ALL; +%rename("EVENT_LOGLEVEL_RANGE") > LTTNG_EVENT_LOGLEVEL_RANGE; +%rename("EVENT_LOGLEVEL_SINGLE") > LTTNG_EVENT_LOGLEVEL_SINGLE; +enum lttng_loglevel_type { + > LTTNG_EVENT_LOGLEVEL_ALL = 0, + > LTTNG_EVENT_LOGLEVEL_RANGE = 1, + > LTTNG_EVENT_LOGLEVEL_SINGLE = 2, +}; + > +%rename("LOGLEVEL_EMERG") LTTNG_LOGLEVEL_EMERG; > +%rename("LOGLEVEL_ALERT") LTTNG_LOGLEVEL_ALERT; > +%rename("LOGLEVEL_CRIT") LTTNG_LOGLEVEL_CRIT; > +%rename("LOGLEVEL_ERR") LTTNG_LOGLEVEL_ERR; > +%rename("LOGLEVEL_WARNING") LTTNG_LOGLEVEL_WARNING; > +%rename("LOGLEVEL_NOTICE") LTTNG_LOGLEVEL_NOTICE; > +%rename("LOGLEVEL_INFO") LTTNG_LOGLEVEL_INFO; > +%rename("LOGLEVEL_DEBUG_SYSTEM") LTTNG_LOGLEVEL_DEBUG_SYSTEM; > +%rename("LOGLEVEL_DEBUG_PROGRAM") LTTNG_LOGLEVEL_DEBUG_PROGRAM; > +%rename("LOGLEVEL_DEBUG_PROCESS") LTTNG_LOGLEVEL_DEBUG_PROCESS; > +%rename("LOGLEVEL_DEBUG_MODULE") LTTNG_LOGLEVEL_DEBUG_MODULE; > +%rename("LOGLEVEL_DEBUG_UNIT") LTTNG_LOGLEVEL_DEBUG_UNIT; > +%rename("LOGLEVEL_DEBUG_FUNCTION") LTTNG_LOGLEVEL_DEBUG_FUNCTION; > +%rename("LOGLEVEL_DEBUG_LINE") LTTNG_LOGLEVEL_DEBUG_LINE; > +%rename("LOGLEVEL_DEBUG") LTTNG_LOGLEVEL_DEBUG; +enum > lttng_loglevel { + LTTNG_LOGLEVEL_EMERG = > 0, + LTTNG_LOGLEVEL_ALERT = 1, + > LTTNG_LOGLEVEL_CRIT = 2, + > LTTNG_LOGLEVEL_ERR = 3, + > LTTNG_LOGLEVEL_WARNING = 4, + > LTTNG_LOGLEVEL_NOTICE = 5, + > LTTNG_LOGLEVEL_INFO = 6, + > LTTNG_LOGLEVEL_DEBUG_SYSTEM = 7, + > LTTNG_LOGLEVEL_DEBUG_PROGRAM = 8, + > LTTNG_LOGLEVEL_DEBUG_PROCESS = 9, + > LTTNG_LOGLEVEL_DEBUG_MODULE = 10, + > LTTNG_LOGLEVEL_DEBUG_UNIT = 11, + > LTTNG_LOGLEVEL_DEBUG_FUNCTION = 12, + > LTTNG_LOGLEVEL_DEBUG_LINE = 13, + > LTTNG_LOGLEVEL_DEBUG = 14, +}; + > +%rename("EVENT_SPLICE") LTTNG_EVENT_SPLICE; +%rename("EVENT_MMAP") > LTTNG_EVENT_MMAP; +enum lttng_event_output { + LTTNG_EVENT_SPLICE > = 0, + LTTNG_EVENT_MMAP = 1, +}; + > +%rename("EVENT_CONTEXT_PID") LTTNG_EVENT_CONTEXT_PID; > +%rename("EVENT_CONTEXT_PERF_COUNTER") > LTTNG_EVENT_CONTEXT_PERF_COUNTER; > +%rename("EVENT_CONTEXT_PROCNAME") LTTNG_EVENT_CONTEXT_PROCNAME; > +%rename("EVENT_CONTEXT_PRIO") LTTNG_EVENT_CONTEXT_PRIO; > +%rename("EVENT_CONTEXT_NICE") LTTNG_EVENT_CONTEXT_NICE; > +%rename("EVENT_CONTEXT_VPID") LTTNG_EVENT_CONTEXT_VPID; > +%rename("EVENT_CONTEXT_TID") LTTNG_EVENT_CONTEXT_TID; > +%rename("EVENT_CONTEXT_VTID") LTTNG_EVENT_CONTEXT_VTID; > +%rename("EVENT_CONTEXT_PPID") LTTNG_EVENT_CONTEXT_PPID; > +%rename("EVENT_CONTEXT_VPPID") LTTNG_EVENT_CONTEXT_VPPID; > +%rename("EVENT_CONTEXT_PTHREAD_ID") > LTTNG_EVENT_CONTEXT_PTHREAD_ID; +enum lttng_event_context_type { + > LTTNG_EVENT_CONTEXT_PID = 0, + > LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, + > LTTNG_EVENT_CONTEXT_PROCNAME = 2, + > LTTNG_EVENT_CONTEXT_PRIO = 3, + > LTTNG_EVENT_CONTEXT_NICE = 4, + > LTTNG_EVENT_CONTEXT_VPID = 5, + > LTTNG_EVENT_CONTEXT_TID = 6, + > LTTNG_EVENT_CONTEXT_VTID = 7, + > LTTNG_EVENT_CONTEXT_PPID = 8, + > LTTNG_EVENT_CONTEXT_VPPID = 9, + > LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10, +}; + > +%rename("CALIBRATE_FUNCTION") LTTNG_CALIBRATE_FUNCTION; +enum > lttng_calibrate_type { + LTTNG_CALIBRATE_FUNCTION = > 0, +}; + + + +// ============================================= +// > TYPEMAPS +// ============================================= + > +//list_sessions +%typemap(argout) struct lttng_session > **sessions{ + + int l = PyInt_AsSsize_t($result); + if (l >= 0) + > { + PyObject *sessions = PyList_New(0); + int i; + for(i=0; i i++) + { + PyObject *tmp = PyTuple_New(4); + PyObject *name = > PyString_FromString((*$1)[i].name); + PyObject *path = > PyString_FromString((*$1)[i].path); + PyObject *enabled = > PyInt_FromSize_t((*$1)[i].enabled); + PyObject *padding = > PyString_FromString((*$1)[i].padding); + + PyTuple_SetItem(tmp, > 0, name); + PyTuple_SetItem(tmp, 1, path); + > PyTuple_SetItem(tmp, 2, enabled); + PyTuple_SetItem(tmp, 3, > padding); + PyList_Append(sessions, tmp); + } + $result = > sessions; + } +} +%typemap(in,numinputs=0) struct lttng_session > **sessions (struct lttng_session *temp){ + $1=&temp; +} + > +//list_domains +%typemap(argout) struct lttng_domain **domains{ + > + int l = PyInt_AsSsize_t($result); + if (l >= 0) + { + PyObject > *dom = PyList_New(0); + int i; + for(i=0; i PyObject *tmp = PyTuple_New(5); + PyObject *type = > PyInt_FromSize_t((*$1)[i].type); + PyObject *execname = > PyString_FromString((*$1)[i].attr.exec_name); + PyObject *pid = > PyInt_FromSize_t((*$1)[i].attr.pid); + PyObject *padding = > PyString_FromString((*$1)[i].padding); + PyObject *attrpadding = > PyString_FromString((*$1)[i].attr.padding); + + > PyTuple_SetItem(tmp, 0, type); + PyTuple_SetItem(tmp, 1, > padding); + PyTuple_SetItem(tmp, 2, pid); + > PyTuple_SetItem(tmp, 3, execname); + PyTuple_SetItem(tmp, 4, > attrpadding); + PyList_Append(dom, tmp); + } + $result = dom; + > } +} +%typemap(in,numinputs=0) struct lttng_domain **domains > (struct lttng_domain *temp){ + $1=&temp; +} + +//list_channels > +%typemap(argout) struct lttng_channel **channels{ + + int l = > PyInt_AsSsize_t($result); + if (l >= 0) + { + PyObject *chan = > PyList_New(0); + int i; + for(i=0; i *tmp = PyTuple_New(4); + PyObject *name = > PyString_FromString((*$1)[i].name); + PyObject *enabled = > PyInt_FromSize_t((*$1)[i].enabled); + PyObject *padding = > PyString_FromString((*$1)[i].padding); + + PyObject *attrtmp = > PyTuple_New(7); + PyObject *overwrite = > PyInt_FromLong((*$1)[i].attr.overwrite); + PyObject *subbuf = > PyInt_FromSize_t((*$1)[i].attr.subbuf_size); + PyObject *num = > PyInt_FromSize_t((*$1)[i].attr.num_subbuf); + PyObject > *switchtimer = > PyInt_FromSize_t((*$1)[i].attr.switch_timer_interval); + PyObject > *readtimer = PyInt_FromSize_t((*$1)[i].attr.read_timer_interval); + > PyObject *output = PyInt_FromSize_t((*$1)[i].attr.output); + > PyObject *attrpad = PyString_FromString((*$1)[i].attr.padding); + + > PyTuple_SetItem(attrtmp, 0, overwrite); + > PyTuple_SetItem(attrtmp, 1, subbuf); + PyTuple_SetItem(attrtmp, > 2, num); + PyTuple_SetItem(attrtmp, 3, switchtimer); + > PyTuple_SetItem(attrtmp, 4, readtimer); + > PyTuple_SetItem(attrtmp, 5, output); + PyTuple_SetItem(attrtmp, > 6, attrpad); + + PyTuple_SetItem(tmp, 0, name); + > PyTuple_SetItem(tmp, 1, enabled); + PyTuple_SetItem(tmp, 2, > padding); + PyTuple_SetItem(tmp, 3, attrtmp); + > PyList_Append(chan, tmp); + } + $result = chan; + } +} > +%typemap(in,numinputs=0) struct lttng_channel **channels (struct > lttng_channel *temp){ + $1=&temp; +} + +//list_events & > list_tracepoints +%typemap(argout) struct lttng_event **events{ + + > int l = PyInt_AsSsize_t($result); + if (l >= 0) + { + PyObject > *events = PyList_New(0); + int i; + for(i=0; i PyObject *tmp = PyTuple_New(10); + PyObject *name = > PyString_FromString((*$1)[i].name); + PyObject *type = > PyInt_FromSize_t((*$1)[i].type); + PyObject *logleveltype = > PyInt_FromSize_t((*$1)[i].loglevel_type); + PyObject *loglevel = > PyInt_FromLong((*$1)[i].loglevel); + PyObject *enabled = > PyInt_FromLong((*$1)[i].enabled); + PyObject *pid = > PyInt_FromSize_t((*$1)[i].pid); + PyObject *padding = > PyString_FromString((*$1)[i].padding); + PyObject *attrpadding = > PyString_FromString((*$1)[i].attr.padding); + + PyObject *probe = > PyTuple_New(4); + PyObject *addr = > PyInt_FromSize_t((*$1)[i].attr.probe.addr); + PyObject *offset = > PyInt_FromSize_t((*$1)[i].attr.probe.offset); + PyObject > *symbolname = > PyString_FromString((*$1)[i].attr.probe.symbol_name); + PyObject > *probepad = PyString_FromString((*$1)[i].attr.probe.padding); + + > PyObject *function = PyTuple_New(2); + PyObject *f_symbolname = > PyString_FromString((*$1)[i].attr.ftrace.symbol_name); + PyObject > *f_pad = PyString_FromString((*$1)[i].attr.ftrace.padding); + + > PyTuple_SetItem(function, 0, f_symbolname); + > PyTuple_SetItem(function, 1, f_pad); + + PyTuple_SetItem(probe, > 0, addr); + PyTuple_SetItem(probe, 1, offset); + > PyTuple_SetItem(probe, 2, symbolname); + PyTuple_SetItem(probe, > 3, probepad); + + PyTuple_SetItem(tmp, 0, name); + > PyTuple_SetItem(tmp, 1, type); + PyTuple_SetItem(tmp, 2, > logleveltype); + PyTuple_SetItem(tmp, 3, loglevel); + > PyTuple_SetItem(tmp, 4, enabled); + PyTuple_SetItem(tmp, 5, > pid); + PyTuple_SetItem(tmp, 6, padding); + > PyTuple_SetItem(tmp, 7, probe); + PyTuple_SetItem(tmp, 8, > function); + PyTuple_SetItem(tmp, 9, attrpadding); + > PyList_Append(events, tmp); + } + $result = events; + } +} > +%typemap(in,numinputs=0) struct lttng_event **events (struct > lttng_event *temp){ + $1=&temp; +} + + + +// > ============================================= +// FUNCTIONS +// > ============================================= + +%rename("create") > lttng_create_session(const char *name, const char *path); > +%rename("destroy") lttng_destroy_session(const char *name); > +%rename("_lttng_create_handle") lttng_create_handle(const char > *session_name, struct lttng_domain *domain); > +%rename("_lttng_destroy_handle") lttng_destroy_handle(struct > lttng_handle *handle); +%rename("_lttng_list_sessions") > lttng_list_sessions(struct lttng_session **sessions); > +%rename("_lttng_list_domains") lttng_list_domains(const char > *session_name, struct lttng_domain **domains); > +%rename("_lttng_list_channels") lttng_list_channels(struct > lttng_handle *handle,struct lttng_channel **channels); > +%rename("_lttng_list_events") lttng_list_events(struct > lttng_handle *handle, const char *channel_name, struct lttng_event > **events); +%rename("_lttng_list_tracepoints") > lttng_list_tracepoints(struct lttng_handle *handle, struct > lttng_event **events); +%rename("session_daemon_alive") > lttng_session_daemon_alive(void); +%rename("set_tracing_group") > lttng_set_tracing_group(const char *name); +%rename("strerror") > lttng_strerror(int code); +%rename("_lttng_register_consumer") > lttng_register_consumer(struct lttng_handle *handle, const char > *socket_path); +%rename("start") lttng_start_tracing(const char > *session_name); +%rename("stop") lttng_stop_tracing(const char > *session_name); +%rename("_lttng_add_context") > lttng_add_context(struct lttng_handle *handle, struct > lttng_event_context *ctx, const char *event_name, const char > *channel_name); +%rename("_lttng_enable_event") > lttng_enable_event(struct lttng_handle *handle, struct lttng_event > *ev, const char *channel_name); +%rename("_lttng_enable_channel") > lttng_enable_channel(struct lttng_handle *handle, struct > lttng_channel *chan); +%rename("_lttng_disable_event") > lttng_disable_event(struct lttng_handle *handle, const char *name, > const char *channel_name); +%rename("_lttng_disable_channel") > lttng_disable_channel(struct lttng_handle *handle, const char > *name); +%rename("_lttng_calibrate") lttng_calibrate(struct > lttng_handle *handle, struct lttng_calibrate *calibrate); > +%rename("channel_set_default_attr") > lttng_channel_set_default_attr(struct lttng_domain *domain, struct > lttng_channel_attr *attr); + +//Redefined functions +struct > lttng_handle *lttng_create_handle(const char *session_name, + > struct lttng_domain *domain); +void lttng_destroy_handle(struct > lttng_handle *handle); +int lttng_list_channels(struct lttng_handle > *handle,struct lttng_channel **channels); +int > lttng_list_events(struct lttng_handle *handle, + const char > *channel_name, struct lttng_event **events); +int > lttng_list_tracepoints(struct lttng_handle *handle, struct > lttng_event **events); +int lttng_add_context(struct lttng_handle > *handle, struct lttng_event_context *ctx, + const char > *event_name, const char *channel_name); +int > lttng_enable_event(struct lttng_handle *handle, + struct > lttng_event *ev, const char *channel_name); +int > lttng_enable_channel(struct lttng_handle *handle, struct > lttng_channel *chan); +int lttng_disable_event(struct lttng_handle > *handle, + const char *name, const char *channel_name); +int > lttng_disable_channel(struct lttng_handle *handle, const char > *name); +int lttng_calibrate(struct lttng_handle *handle, struct > lttng_calibrate *calibrate); +int lttng_register_consumer(struct > lttng_handle *handle, const char *socket_path); +int > lttng_list_sessions(struct lttng_session **sessions); +int > lttng_list_domains(const char *session_name, struct lttng_domain > **domains); + +//Functions not needing redefinition > +%feature("docstring")"create(str name, str path) -> int + +Create > a new tracing session using name and path. +Returns size of > returned session payload data or a negative error code." +int > lttng_create_session(const char *name, const char *path); + + > +%feature("docstring")"destroy(str name) -> int + +Tear down > tracing session using name. +Returns size of returned session > payload data or a negative error code." +int > lttng_destroy_session(const char *name); + + > +%feature("docstring")"session_daemon_alive() -> int + +Check if > session daemon is alive. +Return 1 if alive or 0 if not. +On error > returns a negative value." +int lttng_session_daemon_alive(void); > + + +%feature("docstring")"set_tracing_group(str name) -> int + > +Sets the tracing_group variable with name. +This function > allocates memory pointed to by tracing_group. +On success, returns > 0, on error, returns -1 (null name) or -ENOMEM." +int > lttng_set_tracing_group(const char *name); + + > +%feature("docstring")"strerror(int code) -> char + +Returns a > human readable string describing +the error code (a negative > value)." +const char *lttng_strerror(int code); + + > +%feature("docstring")"start(str session_name) -> int + +Start > tracing for all traces of the session. +Returns size of returned > session payload data or a negative error code." +int > lttng_start_tracing(const char *session_name); + + > +%feature("docstring")"stop(str session_name) -> int + +Stop > tracing for all traces of the session. +Returns size of returned > session payload data or a negative error code." +int > lttng_stop_tracing(const char *session_name); + + > +%feature("docstring")"channel_set_default_attr(Domain domain, > ChannelAttr attr) + +Set default channel attributes. +If either or > both of the arguments are null, attr content is zeroe'd." +void > lttng_channel_set_default_attr(struct lttng_domain *domain, struct > lttng_channel_attr *attr); + + +// > ============================================= +// Python > redefinition of some functions +// (List and Handle-related) +// > ============================================= + > +%feature("docstring")"" +%pythoncode %{ + +def list_sessions(): + > """ + list_sessions() -> dict + + Ask the session daemon for all > available sessions. + Returns a dict of Session instances, the key > is the name; + on error, returns a negative value. + """ + + > ses_list = _lttng_list_sessions() + if type(ses_list) is int: + > return ses_list + + sessions = {} + + for ses_elements in > ses_list: + ses = Session() + ses.name = ses_elements[0] + > ses.path = ses_elements[1] + ses.enabled = ses_elements[2] + > ses.padding = ses_elements[3] + + sessions[ses.name] = ses + + > return sessions + + +def list_domains(session_name): + """ + > list_domains(str session_name) -> list + + Ask the session daemon > for all available domains of a session. + Returns a list of Domain > instances; + on error, returns a negative value. + """ + + dom_list > = _lttng_list_domains(session_name) + if type(dom_list) is int: + > return dom_list + + domains = [] + + for dom_elements in dom_list: > + dom = Domain() + dom.type = dom_elements[0] + dom.paddinf = > dom_elements[1] + dom.attr.pid = dom_elements[2] + > dom.attr.exec_name = dom_elements[3] + dom.attr.padding = > dom_elements[4] + + domains.append(dom) + + return domains + + > +def list_channels(handle): + """ + list_channels(Handle handle) -> > dict + + Ask the session daemon for all available channels of a > session. + Returns a dict of Channel instances, the key is the > name; + on error, returns a negative value. + """ + + try: + > chan_list = _lttng_list_channels(handle._h) + except > AttributeError: + raise TypeError("in method 'list_channels', > argument 1 must be a Handle instance") + + if type(chan_list) is > int: + return chan_list + + channels = {} + + for channel_elements > in chan_list: + chan = Channel() + chan.name = > channel_elements[0] + chan.enabled = channel_elements[1] + > chan.padding = channel_elements[2] + chan.attr.overwrite = > channel_elements[3][0] + chan.attr.subbuf_size = > channel_elements[3][1] + chan.attr.num_subbuf = > channel_elements[3][2] + chan.attr.switch_timer_interval = > channel_elements[3][3] + chan.attr.read_timer_interval = > channel_elements[3][4] + chan.attr.output = > channel_elements[3][5] + chan.attr.padding = > channel_elements[3][6] + + channels[chan.name] = chan + + return > channels + + +def list_events(handle, channel_name): + """ + > list_events(Handle handle, str channel_name) -> dict + + Ask the > session daemon for all available events of a session channel. + > Returns a dict of Event instances, the key is the name; + on error, > returns a negative value. + """ + + try: + ev_list = > _lttng_list_events(handle._h, channel_name) + except > AttributeError: + raise TypeError("in method 'list_events', > argument 1 must be a Handle instance") + + if type(ev_list) is > int: + return ev_list + + events = {} + + for ev_elements in > ev_list: + ev = Event() + ev.name = ev_elements[0] + ev.type = > ev_elements[1] + ev.loglevel_type = ev_elements[2] + ev.loglevel > = ev_elements[3] + ev.enabled = ev_elements[4] + ev.pid = > ev_elements[5] + ev.attr.padding = ev_elements[6] + > ev.attr.probe.addr = ev_elements[7][0] + ev.attr.probe.offset = > ev_elements[7][1] + ev.attr.probe.symbol_name = ev_elements[7][2] > + ev.attr.probe.padding = ev_elements[7][3] + > ev.attr.ftrace.symbol_name = ev_elements[8][0] + > ev.attr.ftrace.padding = ev_elements[8][1] + ev.attr.padding = > ev_elements[9] + + events[ev.name] = ev + + return events + + +def > list_tracepoints(handle): + """ + list_tracepoints(Handle handle) > -> dict + + Returns a dict of Event instances, the key is the > name; + on error, returns a negative value. + """ + + try: + > ev_list = _lttng_list_tracepoints(handle._h) + except > AttributeError: + raise TypeError("in method 'list_tracepoints', > argument 1 must be a Handle instance") + + if type(ev_list) is > int: + return ev_list + + events = {} + + for ev_elements in > ev_list: + ev = Event() + ev.name = ev_elements[0] + ev.type = > ev_elements[1] + ev.loglevel_type = ev_elements[2] + ev.loglevel > = ev_elements[3] + ev.enabled = ev_elements[4] + ev.pid = > ev_elements[5] + ev.attr.padding = ev_elements[6] + > ev.attr.probe.addr = ev_elements[7][0] + ev.attr.probe.offset = > ev_elements[7][1] + ev.attr.probe.symbol_name = ev_elements[7][2] > + ev.attr.probe.padding = ev_elements[7][3] + > ev.attr.ftrace.symbol_name = ev_elements[8][0] + > ev.attr.ftrace.padding = ev_elements[8][1] + ev.attr.padding = > ev_elements[9] + + events[ev.name] = ev + + return events + + +def > register_consumer(handle, socket_path): + """ + > register_consumer(Handle handle, str socket_path) -> int + + > Register an outside consumer. + Returns size of returned session > payload data or a negative error code. + """ + + try: + return > _lttng_register_consumer(handle._h, socket_path) + except > AttributeError: + raise TypeError("in method 'register_consumer', > argument 1 must be a Handle instance") + + +def add_context(handle, > event_context, event_name, channel_name): + """ + > add_context(Handle handle, EventContext ctx, + str event_name, > str channel_name) -> int + + Add context to event and/or channel. + > If event_name is None, the context is applied to all events of the > channel. + If channel_name is None, a lookup of the event's channel > is done. + If both are None, the context is applied to all events > of all channels. + Returns the size of the returned payload data or > a negative error code. + """ + + try: + return > _lttng_add_context(handle._h, event_context, event_name, > channel_name) + except AttributeError: + raise TypeError("in > method 'add_context', argument 1 must be a Handle instance") + + > +def enable_event(handle, event, channel_name): + """ + > enable_event(Handle handle, Event event, + str channel_name) > -> int + + Enable event(s) for a channel. + If no event name is > specified, all events are enabled. + If no channel name is > specified, the default 'channel0' is used. + Returns size of > returned session payload data or a negative error code. + """ + + > try: + return _lttng_enable_event(handle._h, event, channel_name) > + except AttributeError: + raise TypeError("in method > 'enable_event', argument 1 must be a Handle instance") + + +def > enable_channel(handle, channel): + """ + enable_channel(Handle > handle, Channel channel -> int + + Enable channel per domain + > Returns size of returned session payload data or a negative error > code. + """ + + try: + return _lttng_enable_channel(handle._h, > channel) + except AttributeError: + raise TypeError("in method > 'enable_channel', argument 1 must be a Handle instance") + + +def > disable_event(handle, name, channel_name): + """ + > disable_event(Handle handle, str name, str channel_name) -> int + + > Disable event(s) of a channel and domain. + If no event name is > specified, all events are disabled. + If no channel name is > specified, the default 'channel0' is used. + Returns size of > returned session payload data or a negative error code + """ + + > try: + return _lttng_disable_event(handle._h, name, channel_name) > + except AttributeError: + raise TypeError("in method > 'disable_event', argument 1 must be a Handle instance") + + +def > disable_channel(handle, name): + """ + disable_channel(Handle > handle, str name) -> int + + All tracing will be stopped for > registered events of the channel. + Returns size of returned > session payload data or a negative error code. + """ + + try: + > return _lttng_disable_channel(handle._h, name) + except > AttributeError: + raise TypeError("in method 'disable_channel', > argument 1 must be a Handle instance") + + +def calibrate(handle, > calibrate): + """ + calibrate(Handle handle, Calibrate calibrate) > -> int + + Quantify LTTng overhead. + Returns size of returned > session payload data or a negative error code. + """ + + try: + > return _lttng_calibrate(handle._h, calibrate) + except > AttributeError: + raise TypeError("in method 'calibrate', argument > 1 must be a Handle instance") +%} + + +// > ============================================= +// Handle class +// > Used to prevent freeing unallocated memory +// > ============================================= + > +%feature("docstring")"" +%feature("autodoc", "1"); + +%pythoncode > %{ +class Handle: + """ + Manages a handle. + Takes two > arguments: (str session_name, Domain domain) + """ + + __frozen = > False + + def __init__(self, session_name, domain): + if > type(session_name) is not str: + raise TypeError("in method > '__init__', argument 2 of type 'str'") + if type(domain) is not > Domain and domain is not None: + raise TypeError("in method > '__init__', argument 3 of type 'lttng.Domain'") + + self._sname = > session_name + if domain is None: + self._domtype = None + > else: + self._domtype = domain.type + self._h = > _lttng_create_handle(session_name, domain) + self.__frozen = True > + + def __del__(self): + _lttng_destroy_handle(self._h) + + def > __repr__(self): + if self._domtype == 1: + domstr = > "DOMAIN_KERNEL" + elif self._domtype == 2: + domstr = > "DOMAIN_UST" + else: + domstr = self._domtype + + return > "lttng.Handle; session('{}'), domain.type({})".format( + > self._sname, domstr) + + def __setattr__(self, attr, val): + if > self.__frozen: + raise NotImplementedError("cannot modify > attributes") + else: + self.__dict__[attr] = val +%} + + +// > ============================================= +// STRUCTURES +// > These are directly taken from lttng.h. +// Any change to these > structures must also be +// made here. +// > ============================================= + +%rename("Domain") > lttng_domain; +%rename("EventContext") lttng_event_context; > +%rename("Event") lttng_event; +%rename("Calibrate") > lttng_calibrate; +%rename("ChannelAttr") lttng_channel_attr; > +%rename("Channel") lttng_channel; +%rename("Session") > lttng_session; + +struct lttng_domain{ + enum lttng_domain_type > type; + char padding[LTTNG_DOMAIN_PADDING1]; + + union { + pid_t > pid; + char exec_name[NAME_MAX]; + char > padding[LTTNG_DOMAIN_PADDING2]; + } attr; + + %extend { + char > *__repr__() { + static char temp[256]; + switch ( $self->type ) > { + case 1: + sprintf(temp, "lttng.Domain; > type(DOMAIN_KERNEL)"); + break; + case 2: + sprintf(temp, > "lttng.Domain; type(DOMAIN_UST)"); + break; + default: + > sprintf(temp, "lttng.Domain; type(%i)", $self->type); + break; + > } + return &temp[0]; + } + } +}; + +struct lttng_event_context > { + enum lttng_event_context_type ctx; + char > padding[LTTNG_EVENT_CONTEXT_PADDING1]; + + union { + struct > lttng_event_perf_counter_ctx perf_counter; + char > padding[LTTNG_EVENT_CONTEXT_PADDING2]; + } u; + + %extend { + char > *__repr__() { + static char temp[256]; + switch ( $self->ctx ) > { + case 0: + sprintf(temp, "lttng.EventContext; > ctx(EVENT_CONTEXT_PID)"); + break; + case 1: + > sprintf(temp, "lttng.EventContext; > ctx(EVENT_CONTEXT_PERF_COUNTER)"); + break; + case 2: + > sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PROCNAME)"); + > break; + case 3: + sprintf(temp, "lttng.EventContext; > ctx(EVENT_CONTEXT_PRIO)"); + break; + case 4: + > sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_NICE)"); + > break; + case 5: + sprintf(temp, "lttng.EventContext; > ctx(EVENT_CONTEXT_VPID)"); + break; + case 6: + > sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_TID)"); + > break; + case 7: + sprintf(temp, "lttng.EventContext; > ctx(EVENT_CONTEXT_VTID)"); + break; + case 8: + > sprintf(temp, "lttng.EventContext; ctx(EVENT_CONTEXT_PPID)"); + > break; + case 9: + sprintf(temp, "lttng.EventContext; > ctx(EVENT_CONTEXT_VPPID)"); + break; + case 10: + > sprintf(temp, "lttng.EventContext; > ctx(EVENT_CONTEXT_PTHREAD_ID)"); + break; + default: + > sprintf(temp, "lttng.EventContext; type(%i)", $self->ctx); + > break; + } + return &temp[0]; + } + } +}; + +struct > lttng_event_probe_attr { + uint64_t addr; + uint64_t offset; + char > symbol_name[LTTNG_SYMBOL_NAME_LEN]; + char > padding[LTTNG_EVENT_PROBE_PADDING1]; +}; + +struct > lttng_event_function_attr { + char > symbol_name[LTTNG_SYMBOL_NAME_LEN]; + char > padding[LTTNG_EVENT_FUNCTION_PADDING1]; +}; + +struct lttng_event > { + enum lttng_event_type type; + char > name[LTTNG_SYMBOL_NAME_LEN]; + + enum lttng_loglevel_type > loglevel_type; + int loglevel; + + int32_t enabled; + pid_t pid; + > + char padding[LTTNG_EVENT_PADDING1]; + + union { + struct > lttng_event_probe_attr probe; + struct lttng_event_function_attr > ftrace; + + char padding[LTTNG_EVENT_PADDING2]; + } attr; + + > %extend { + char *__repr__() { + static char temp[512]; + char > evtype[50]; + char logtype[50]; + + switch ( $self->type ) { + > case -1: + sprintf(evtype, "EVENT_ALL"); + break; + case > 0: + sprintf(evtype, "EVENT_TRACEPOINT"); + break; + case > 1: + sprintf(evtype, "EVENT_PROBE"); + break; + case 2: + > sprintf(evtype, "EVENT_FUNCTION"); + break; + case 3: + > sprintf(evtype, "EVENT_FUNCTION_ENTRY"); + break; + case 4: + > sprintf(evtype, "EVENT_NOOP"); + break; + case 5: + > sprintf(evtype, "EVENT_SYSCALL"); + break; + default: + > sprintf(evtype, "%i", $self->type); + break; + } + + switch > ( $self->loglevel_type ) { + case 0: + sprintf(logtype, > "EVENT_LOGLEVEL_ALL"); + break; + case 1: + > sprintf(logtype, "EVENT_LOGLEVEL_RANGE"); + break; + case 2: + > sprintf(logtype, "EVENT_LOGLEVEL_SINGLE"); + break; + > default: + sprintf(logtype, "%i", $self->loglevel_type); + > break; + } + + sprintf(temp, "lttng.Event; name('%s'), > type(%s), " + "loglevel_type(%s), loglevel(%i), " + > "enabled(%s), pid(%i)", + $self->name, evtype, logtype, > $self->loglevel, + $self->enabled ? "True" : "False", > $self->pid); + return &temp[0]; + } + } +}; + +struct > lttng_calibrate { + enum lttng_calibrate_type type; + char > padding[LTTNG_CALIBRATE_PADDING1]; + + %extend { + char > *__repr__() { + static char temp[256]; + switch ( $self->type ) > { + case 0: + sprintf(temp, "lttng.Calibrate; > type(CALIBRATE_FUNCTION)"); + break; + default: + > sprintf(temp, "lttng.Calibrate; type(%i)", $self->type); + > break; + } + return &temp[0]; + } + } +}; + +struct > lttng_channel_attr { + int overwrite; + uint64_t subbuf_size; + > uint64_t num_subbuf; + unsigned int switch_timer_interval; + > unsigned int read_timer_interval; + enum lttng_event_output > output; + + char padding[LTTNG_CHANNEL_ATTR_PADDING1]; + + %extend > { + char *__repr__() { + static char temp[256]; + char > evout[25]; + + switch ( $self->output ) { + case 0: + > sprintf(evout, "EVENT_SPLICE"); + break; + case 1: + > sprintf(evout, "EVENT_MMAP"); + break; + default: + > sprintf(evout, "%i", $self->output); + break; + } + > sprintf(temp, "lttng.ChannelAttr; overwrite(%i), subbuf_size(%lu), > " + "num_subbuf(%lu), switch_timer_interval(%u), " + > "read_timer_interval(%u), output(%s)", + $self->overwrite, > $self->subbuf_size, $self->num_subbuf, + > $self->switch_timer_interval, $self->read_timer_interval, + > evout); + return &temp[0]; + } + } +}; + +struct lttng_channel > { + char name[LTTNG_SYMBOL_NAME_LEN]; + uint32_t enabled; + struct > lttng_channel_attr attr; + char padding[LTTNG_CHANNEL_PADDING1]; + > + %extend { + char *__repr__() { + static char temp[512]; + > sprintf(temp, "lttng.Channel; name('%s'), enabled(%s)", + > $self->name, $self->enabled ? "True" : "False"); + return > &temp[0]; + } + } +}; + +struct lttng_session { + char > name[NAME_MAX]; + char path[PATH_MAX]; + uint32_t enabled; + char > padding[LTTNG_SESSION_PADDING1]; + + %extend { + char *__repr__() > { + static char temp[512]; + sprintf(temp, "lttng.Session; > name('%s'), path('%s'), enabled(%s)", + $self->name, > $self->path, + $self->enabled ? "True" : "False"); + return > &temp[0]; + } + } +}; diff --git > a/extras/bindings/swig/python/tests/example.py > b/extras/bindings/swig/python/tests/example.py new file mode > 100644 index 0000000..9703170 --- /dev/null +++ > b/extras/bindings/swig/python/tests/example.py @@ -0,0 +1,109 @@ > +#This example shows basically how to use the lttng-tools python > module + +from lttng import * + +# This error will be raised is > something goes wrong +class LTTngError(Exception): + def > __init__(self, value): + self.value = value + def __str__(self): + > return repr(self.value) + +#Setting up the domain to use +dom = > Domain() +dom.type = DOMAIN_KERNEL + +#Setting up a channel to use > +channel = Channel() +channel.name = "mychan" > +channel.attr.overwrite = 0 +channel.attr.subbuf_size = 4096 > +channel.attr.num_subbuf = 8 +channel.attr.switch_timer_interval = > 0 +channel.attr.read_timer_interval = 200 +channel.attr.output = > EVENT_SPLICE + +#Setting up some events that will be used +event = > Event() +event.type = EVENT_TRACEPOINT +event.loglevel_type = > EVENT_LOGLEVEL_ALL + +sched_switch = Event() +sched_switch.name = > "sched_switch" +sched_switch.type = EVENT_TRACEPOINT > +sched_switch.loglevel_type = EVENT_LOGLEVEL_ALL + > +sched_process_exit = Event() +sched_process_exit.name = > "sched_process_exit" +sched_process_exit.type = EVENT_TRACEPOINT > +sched_process_exit.loglevel_type = EVENT_LOGLEVEL_ALL + > +sched_process_free = Event() +sched_process_free.name = > "sched_process_free" +sched_process_free.type = EVENT_TRACEPOINT > +sched_process_free.loglevel_type = EVENT_LOGLEVEL_ALL + + > +#Creating a new session +res = > create("test","/lttng-traces/test") +if res<0: + raise > LTTngError(strerror(res)) + +#Creating handle +han = None +han = > Handle("test", dom) +if han is None: + raise LTTngError("Handle not > created") + +#Enabling the kernel channel +res = > enable_channel(han, channel) +if res<0: + raise > LTTngError(strerror(res)) + +#Enabling some events in given > channel +#To enable all events in default channel, use > +#enable_event(han, event, None) +res = enable_event(han, > sched_switch, channel.name) +if res<0: + raise > LTTngError(strerror(res)) + +res = enable_event(han, > sched_process_exit, channel.name) +if res<0: + raise > LTTngError(strerror(res)) + +res = enable_event(han, > sched_process_free, channel.name) +if res<0: + raise > LTTngError(strerror(res)) + +#Disabling an event +res = > disable_event(han, sched_switch.name, channel.name) +if res<0: + > raise LTTngError(strerror(res)) + +#Getting a list of the channels > +l = list_channels(han) +if type(l) is int: + raise > LTTngError(strerror(l)) + +#Starting the trace +res = > start("test") +if res<0: + raise LTTngError(strerror(res)) + > +#Stopping the trace +res = stop("test") +if res<0: + raise > LTTngError(strerror(res)) + +#Disabling a channel +res = > disable_channel(han, channel.name) +if res<0: + raise > LTTngError(strerror(res)) + +#Destroying the handle +del han + > +#Destroying the session +res = destroy("test") +if res<0: + raise > LTTngError(strerror(res)) diff --git > a/extras/bindings/swig/python/tests/run.sh > b/extras/bindings/swig/python/tests/run.sh new file mode 100644 > index 0000000..7de819b --- /dev/null +++ > b/extras/bindings/swig/python/tests/run.sh @@ -0,0 +1 @@ +python > tests.py diff --git a/extras/bindings/swig/python/tests/tests.py > b/extras/bindings/swig/python/tests/tests.py new file mode 100644 > index 0000000..a4be981 --- /dev/null +++ > b/extras/bindings/swig/python/tests/tests.py @@ -0,0 +1,310 @@ > +import unittest +import os +import time +from lttng import * + > +class TestLttngPythonModule (unittest.TestCase): + + def > test_kernel_all_events(self): + dom = Domain() + dom.type = > DOMAIN_KERNEL + + event = Event() + event.type = > EVENT_TRACEPOINT + event.loglevel_type = EVENT_LOGLEVEL_ALL + + > han = Handle("test_kernel_all_ev", dom) + + r = > create("test_kernel_all_ev","/lttng-traces/test") + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > enable_event(han, event, None) + self.assertGreaterEqual(r, 0, > strerror(r)) + + r = start("test_kernel_all_ev") + > self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r > = stop("test_kernel_all_ev") + self.assertGreaterEqual(r, 0, > strerror(r)) + + r = destroy("test_kernel_all_ev") + > self.assertGreaterEqual(r, 0, strerror(r)) + + + def > test_kernel_event(self): + + dom = Domain() + dom.type = > DOMAIN_KERNEL + + channel = Channel() + channel.name="mychan" + > channel.attr.overwrite = 0 + channel.attr.subbuf_size = 4096 + > channel.attr.num_subbuf = 8 + channel.attr.switch_timer_interval = > 0 + channel.attr.read_timer_interval = 200 + channel.attr.output > = EVENT_SPLICE + + sched_switch = Event() + sched_switch.name = > "sched_switch" + sched_switch.type = EVENT_TRACEPOINT + > sched_switch.loglevel_type = EVENT_LOGLEVEL_ALL + + > sched_process_exit = Event() + sched_process_exit.name = > "sched_process_exit" + sched_process_exit.type = EVENT_TRACEPOINT > + sched_process_exit.loglevel_type = EVENT_LOGLEVEL_ALL + + > sched_process_free = Event() + sched_process_free.name = > "sched_process_free" + sched_process_free.type = EVENT_TRACEPOINT > + sched_process_free.loglevel_type = EVENT_LOGLEVEL_ALL + + han = > Handle("test_kernel_event", dom) + + #Create session test + r = > create("test_kernel_event","/lttng-traces/test") + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling channel > tests + r = enable_channel(han, channel) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling events > tests + r = enable_event(han, sched_switch, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > enable_event(han, sched_process_exit, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > enable_event(han, sched_process_free, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Disabling events > tests + r = disable_event(han, sched_switch.name, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > disable_event(han, sched_process_free.name, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Renabling events > tests + r = enable_event(han, sched_switch, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > enable_event(han, sched_process_free, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Start, stop, > destroy + r = start("test_kernel_event") + > self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r > = stop("test_kernel_event") + self.assertGreaterEqual(r, 0, > strerror(r)) + + r=disable_channel(han, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + > r=destroy("test_kernel_event") + self.assertGreaterEqual(r, 0, > strerror(r)) + + + + def test_ust_all_events(self): + dom = > Domain() + dom.type = DOMAIN_UST + + event = Event() + > event.type = EVENT_TRACEPOINT + event.loglevel_type = > EVENT_LOGLEVEL_ALL + + han = Handle("test_ust_all_ev", dom) + + r > = create("test_ust_all_ev","/lttng-traces/test") + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > enable_event(han, event, None) + self.assertGreaterEqual(r, 0, > strerror(r)) + + r = start("test_ust_all_ev") + > self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r > = stop("test_ust_all_ev") + self.assertGreaterEqual(r, 0, > strerror(r)) + + r = destroy("test_ust_all_ev") + > self.assertGreaterEqual(r, 0, strerror(r)) + + + def > test_ust_event(self): + + dom = Domain() + dom.type = DOMAIN_UST > + + channel = Channel() + channel.name="mychan" + > channel.attr.overwrite = 0 + channel.attr.subbuf_size = 4096 + > channel.attr.num_subbuf = 8 + channel.attr.switch_timer_interval = > 0 + channel.attr.read_timer_interval = 200 + channel.attr.output > = EVENT_MMAP + + ev1 = Event() + ev1.name = "tp1" + ev1.type = > EVENT_TRACEPOINT + ev1.loglevel_type = EVENT_LOGLEVEL_ALL + + ev2 > = Event() + ev2.name = "ev2" + ev2.type = EVENT_TRACEPOINT + > ev2.loglevel_type = EVENT_LOGLEVEL_ALL + + ev3 = Event() + > ev3.name = "ev3" + ev3.type = EVENT_TRACEPOINT + > ev3.loglevel_type = EVENT_LOGLEVEL_ALL + + han = > Handle("test_ust_event", dom) + + #Create session test + r = > create("test_ust_event","/lttng-traces/test") + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling channel > tests + r = enable_channel(han, channel) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Enabling events > tests + r = enable_event(han, ev1, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > enable_event(han, ev2, channel.name) + self.assertGreaterEqual(r, > 0, strerror(r)) + + r = enable_event(han, ev3, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Disabling events > tests + r = disable_event(han, ev1.name, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > disable_event(han, ev3.name, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Renabling events > tests + r = enable_event(han, ev1, channel.name) + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > enable_event(han, ev3, channel.name) + self.assertGreaterEqual(r, > 0, strerror(r)) + + #Start, stop + r = start("test_ust_event") + > self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r > = stop("test_ust_event") + self.assertGreaterEqual(r, 0, > strerror(r)) + + #Restart/restop + r = start("test_ust_event") + > self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r > = stop("test_ust_event") + self.assertGreaterEqual(r, 0, > strerror(r)) + + #Disabling channel and destroy + > r=disable_channel(han, channel.name) + self.assertGreaterEqual(r, > 0, strerror(r)) + + r=destroy("test_ust_event") + > self.assertGreaterEqual(r, 0, strerror(r)) + + + def > test_other_functions(self): + dom = Domain() + > dom.type=DOMAIN_KERNEL + + event=Event() + > event.type=EVENT_TRACEPOINT + > event.loglevel_type=EVENT_LOGLEVEL_ALL + + calib = Calibrate() + > calib.type = CALIBRATE_FUNCTION + + ctx = EventContext() + > ctx.type=EVENT_CONTEXT_PID + + chattr = ChannelAttr() + > chattr.overwrite = 0 + chattr.subbuf_size = 4096 + > chattr.num_subbuf = 8 + chattr.switch_timer_interval = 0 + > chattr.read_timer_interval = 200 + chattr.output = EVENT_SPLICE + > + han = Handle("test_otherf" , dom) + + r = > create("test_otherf","/lttng-traces/test") + > self.assertGreaterEqual(r, 0, strerror(r)) + + r = > enable_event(han, event, None) + self.assertGreaterEqual(r, 0, > strerror(r)) + + #Calibrate test + r = calibrate(han , calib) + > self.assertGreaterEqual(r, 0, strerror(r)) + + #Context test + r > = add_context(han, ctx, "sched_switch", "channel0") + > self.assertGreaterEqual(r, 0, strerror(r)) + #Any channel + r = > add_context(han, ctx, "sched_wakeup", None) + > self.assertGreaterEqual(r, 0, strerror(r)) + #All events + r = > add_context(han, ctx, None, None) + self.assertGreaterEqual(r, 0, > strerror(r)) + + #Def. channel attr + > channel_set_default_attr(dom, chattr) + > channel_set_default_attr(None, None) + + #Ses Daemon alive + r = > session_daemon_alive() + self.assertTrue(r == 1 or r == 0, > strerror(r)) + + #Setting trace group + r = > set_tracing_group("testing") + self.assertGreaterEqual(r, 0, > strerror(r)) + + + r = start("test_otherf") + > self.assertGreaterEqual(r, 0, strerror(r)) + time.sleep(2) + + r > = stop("test_otherf") + self.assertGreaterEqual(r, 0, > strerror(r)) + + del han + + r = destroy("test_otherf") + > self.assertGreaterEqual(r, 0, strerror(r)) + + +if __name__ == > "__main__": + # CHECK IF ROOT + if os.geteuid() == 0: + #Make sure > session names don't already exist: + destroy("test_kernel_event") > + destroy("test_kernel_all_events") + > destroy("test_ust_all_events") + destroy("test_ust_event") + > destroy("test_otherf") + + unittest.main() + else: + > print('Script must be run as root') -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQRh+UAAoJEELoaioR9I02ZxQIAJm67RhMR7WaQvAULxy93EM3 K74cfEHgR/J09zN+zSkQYFPLip3VMJj9wuGK3XGoPTbTGZiUKgEnYe89joP2w3b/ m6bNq2mbAY2iBEkGDZ2FJ/E7G+UHLMvoVDlbTMWWi8NC9q5WiA8pUDFnF+/3R74k qh7UMDKTJ/alAVcEaFajz2NlfRYpZB5rWv7PtAK4tTN2ig7egCxSe8rrslP7wBtf jrkdJK4y6OvkVv5nlqhq6mgTaOplGSbXlf3Gs30yxkhcHAVg5u09N/3m9yS15zki DeN5WiE/TBYfhMxD4UKRpVJv4BBcPMTjl5ltj5LhduySDts9S67uifPcI5KrKro= =e8cK -----END PGP SIGNATURE----- From dgoulet at efficios.com Tue Sep 4 11:42:01 2012 From: dgoulet at efficios.com (David Goulet) Date: Tue, 04 Sep 2012 11:42:01 -0400 Subject: [lttng-dev] [PATCH lttng-tools 0/3] Filter allocation and large bytecode fixes In-Reply-To: <1346093301-25274-1-git-send-email-christian.babeux@efficios.com> References: <1346093301-25274-1-git-send-email-christian.babeux@efficios.com> Message-ID: <50462149.4010803@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 All merged except 2/3. David Christian Babeux: > Hi all, > > While testing the new filtering feature, some issues were > discovered when generating large bytecode (more than 32768 bytes). > > The first patch fix an issue with the buffer size not being a power > of 2, thus leading to odd-looking alloc buffer size. > > The second patch is a typo fix. > > The third patch fix an issue when generating a bytecode longer than > 32768 bytes. The alloc_len of the underlying bytecode buffer was > artificially limiting the bytecode size to 32768 because its length > was overflowing the range of 16-bits values. > > Thanks, > > Christian Babeux (3): Fix: Filter bytecode alloc buffer size must > be a power of 2 Fix: Typo in LTTNG_FILTER_MAX_LEN Fix: Generation > of bytecode longer than 32768 bytes fails > > src/bin/lttng-sessiond/main.c | 2 +- > src/common/sessiond-comm/sessiond-comm.h | 2 +- > src/lib/lttng-ctl/filter/filter-bytecode.h | 2 +- > .../filter/filter-visitor-generate-bytecode.c | 46 > ++++++++++++++++++++-- 4 files changed, 46 insertions(+), 6 > deletions(-) > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQRiFJAAoJEELoaioR9I02CJkIAK17zl/81EYeECRffELtmNDa KwSLfhPl2Xf0wVPm2TshxLK5Lc3yE/14KYrMbeTP4sYB87Vn66k4HqZIqWHtYtaS TKI1qjruhuC4LqySHTUcuw4TWC0j96ZoM5iSc97lj9dqCmrRA8A9msnbfssPi/FQ g6tIsScpozrzHbBNYL9aCBqcrdX60tMm2fZ7XqJZi5f3yy7QNlWKVNWrFWHHxMks PATSwgQhhyVi8GsZj33n+bMBuiXbMxii1S5h7zVedxCXWdL5w1wtr9l6WmD/l8jw HUtCS+BWh0Fldh1/M2ua2GyfvAGJuyxJyJPC/jPdYF9dJWf+/3AoWMn6poIbxPA= =pRxc -----END PGP SIGNATURE----- From paulmck at linux.vnet.ibm.com Tue Sep 4 18:13:23 2012 From: paulmck at linux.vnet.ibm.com (Paul E. McKenney) Date: Tue, 4 Sep 2012 15:13:23 -0700 Subject: [lttng-dev] [PATCH] Ensure that read-side functions meet 10-line LGPL criterion In-Reply-To: <20120903180300.GA14133@Krystal> References: <20120902005911.GA26326@linux.vnet.ibm.com> <20120903180300.GA14133@Krystal> Message-ID: <20120904221323.GO2593@linux.vnet.ibm.com> On Mon, Sep 03, 2012 at 02:03:00PM -0400, Mathieu Desnoyers wrote: > * Paul E. McKenney (paulmck at linux.vnet.ibm.com) wrote: > > This commit ensures that all read-side functions meet the 10-line LGPL > > criterion that permits them to be expanded directly into non-LGPL code, > > without function-call instructions. It also documents this as the intent. > > > > Signed-off-by: Paul E. McKenney > > > > diff --git a/urcu/static/urcu-bp.h b/urcu/static/urcu-bp.h > > index e7b2eda..881b4a4 100644 > > --- a/urcu/static/urcu-bp.h > > +++ b/urcu/static/urcu-bp.h > > @@ -6,8 +6,8 @@ > > * > > * Userspace RCU header. > > * > > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking > > - * dynamically with the userspace rcu library. > > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > > * > > * Copyright (c) 2009 Mathieu Desnoyers > > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > > @@ -162,32 +162,48 @@ static inline int rcu_old_gp_ongoing(long *value) > > ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); > > } > > > > +/* > > + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as > > + * the per-thread rcu_reader.ctr) has the upper bits containing a count of > > + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero > > + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in > > + * _rcu_read_lock() happen before the subsequent read-side critical section. > > + */ > > +static inline void _rcu_read_lock_help(unsigned long tmp) > > could we rename the "_rcu_read_lock_help" to "_rcu_read_lock_update" ? > > I think it would fit better the role of this function in the algorithm. > > As Josh pointed out, "directloy" -> "directly" below, > > The rest looks good. I'll wait for an updated version. Here you go! Thanx, Paul ------------------------------------------------------------------------ Ensure that read-side functions meet 10-line LGPL criterion This commit ensures that all read-side functions meet the 10-line LGPL criterion that permits them to be expanded directly into non-LGPL code, without function-call instructions. It also documents this as the intent. [ paulmck: Spelling fixes called out by Josh Triplett and name change called out by Mathieu Desnoyers (_rcu_read_lock_help() -> _rcu_read_lock_update(). ] Signed-off-by: Paul E. McKenney diff --git a/urcu/static/urcu-bp.h b/urcu/static/urcu-bp.h index e7b2eda..a2f7368 100644 --- a/urcu/static/urcu-bp.h +++ b/urcu/static/urcu-bp.h @@ -6,8 +6,8 @@ * * Userspace RCU header. * - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking - * dynamically with the userspace rcu library. + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. * * Copyright (c) 2009 Mathieu Desnoyers * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. @@ -162,32 +162,48 @@ static inline int rcu_old_gp_ongoing(long *value) ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); } +/* + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as + * the per-thread rcu_reader.ctr) has the upper bits containing a count of + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in + * _rcu_read_lock() happen before the subsequent read-side critical section. + */ +static inline void _rcu_read_lock_update(unsigned long tmp) +{ + if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); + cmm_smp_mb(); + } else + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); +} + +/* + * Enter an RCU read-side critical section. + * + * The first cmm_barrier() call ensures that the compiler does not reorder + * the body of _rcu_read_lock() with a mutex. + * + * This function and its helper are both less than 10 lines long. The + * intent is that this function meets the 10-line criterion in LGPL, + * allowing this function to be invoked directly from non-LGPL code. + */ static inline void _rcu_read_lock(void) { long tmp; - /* Check if registered */ if (caa_unlikely(!URCU_TLS(rcu_reader))) - rcu_bp_register(); - + rcu_bp_register(); /* If not yet registered. */ cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ tmp = URCU_TLS(rcu_reader)->ctr; - /* - * rcu_gp_ctr is - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) - */ - if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); - /* - * Set active readers count for outermost nesting level before - * accessing the pointer. - */ - cmm_smp_mb(); - } else { - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); - } + _rcu_read_lock_update(tmp); } +/* + * Exit an RCU read-side critical section. This function is less than + * 10 lines of code, and is intended to be usable by non-LGPL code, as + * called out in LGPL. + */ static inline void _rcu_read_unlock(void) { /* diff --git a/urcu/static/urcu-pointer.h b/urcu/static/urcu-pointer.h index 48dc5bf..4361156 100644 --- a/urcu/static/urcu-pointer.h +++ b/urcu/static/urcu-pointer.h @@ -6,8 +6,8 @@ * * Userspace RCU header. Operations on pointers. * - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-pointer.h for - * linking dynamically with the userspace rcu library. + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. * * Copyright (c) 2009 Mathieu Desnoyers * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. @@ -59,8 +59,11 @@ extern "C" { * addition to forthcoming C++ standard. * * Should match rcu_assign_pointer() or rcu_xchg_pointer(). + * + * This macro is less than 10 lines long. The intent is that this macro + * meets the 10-line criterion in LGPL, allowing this function to be + * expanded directly in non-LGPL code. */ - #define _rcu_dereference(p) ({ \ __typeof__(p) _________p1 = CMM_LOAD_SHARED(p); \ cmm_smp_read_barrier_depends(); \ @@ -73,8 +76,11 @@ extern "C" { * data structure, which can be safely freed after waiting for a quiescent state * using synchronize_rcu(). If fails (unexpected value), returns old (which * should not be freed !). + * + * This macro is less than 10 lines long. The intent is that this macro + * meets the 10-line criterion in LGPL, allowing this function to be + * expanded directly in non-LGPL code. */ - #define _rcu_cmpxchg_pointer(p, old, _new) \ ({ \ __typeof__(*p) _________pold = (old); \ @@ -89,8 +95,11 @@ extern "C" { * _rcu_xchg_pointer - same as rcu_assign_pointer, but returns the previous * pointer to the data structure, which can be safely freed after waiting for a * quiescent state using synchronize_rcu(). + * + * This macro is less than 10 lines long. The intent is that this macro + * meets the 10-line criterion in LGPL, allowing this function to be + * expanded directly in non-LGPL code. */ - #define _rcu_xchg_pointer(p, v) \ ({ \ __typeof__(*p) _________pv = (v); \ @@ -121,8 +130,11 @@ extern "C" { * data structure before its publication. * * Should match rcu_dereference_pointer(). + * + * This macro is less than 10 lines long. The intent is that this macro + * meets the 10-line criterion in LGPL, allowing this function to be + * expanded directly in non-LGPL code. */ - #define _rcu_assign_pointer(p, v) _rcu_set_pointer(&(p), v) #ifdef __cplusplus diff --git a/urcu/static/urcu-qsbr.h b/urcu/static/urcu-qsbr.h index 22908a4..5580092 100644 --- a/urcu/static/urcu-qsbr.h +++ b/urcu/static/urcu-qsbr.h @@ -6,8 +6,8 @@ * * Userspace RCU QSBR header. * - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-qsbr.h for linking - * dynamically with the userspace rcu QSBR library. + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. * * Copyright (c) 2009 Mathieu Desnoyers * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. @@ -157,15 +157,36 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) return v && (v != rcu_gp_ctr); } +/* + * Enter an RCU read-side critical section. + * + * This function is less than 10 lines long. The intent is that this + * function meets the 10-line criterion for LGPL, allowing this function + * to be invoked directly from non-LGPL code. + */ static inline void _rcu_read_lock(void) { rcu_assert(URCU_TLS(rcu_reader).ctr); } +/* + * Exit an RCU read-side critical section. + * + * This function is less than 10 lines long. The intent is that this + * function meets the 10-line criterion for LGPL, allowing this function + * to be invoked directly from non-LGPL code. + */ static inline void _rcu_read_unlock(void) { } +/* + * Inform RCU of a quiescent state. + * + * This function is less than 10 lines long. The intent is that this + * function meets the 10-line criterion for LGPL, allowing this function + * to be invoked directly from non-LGPL code. + */ static inline void _rcu_quiescent_state(void) { cmm_smp_mb(); @@ -175,6 +196,14 @@ static inline void _rcu_quiescent_state(void) cmm_smp_mb(); } +/* + * Take a thread offline, prohibiting it from entering further RCU + * read-side critical sections. + * + * This function is less than 10 lines long. The intent is that this + * function meets the 10-line criterion for LGPL, allowing this function + * to be invoked directly from non-LGPL code. + */ static inline void _rcu_thread_offline(void) { cmm_smp_mb(); @@ -184,6 +213,14 @@ static inline void _rcu_thread_offline(void) cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ } +/* + * Bring a thread online, allowing it to once again enter RCU + * read-side critical sections. + * + * This function is less than 10 lines long. The intent is that this + * function meets the 10-line criterion for LGPL, allowing this function + * to be invoked directly from non-LGPL code. + */ static inline void _rcu_thread_online(void) { cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ diff --git a/urcu/static/urcu.h b/urcu/static/urcu.h index f27f8b6..f211dab 100644 --- a/urcu/static/urcu.h +++ b/urcu/static/urcu.h @@ -6,8 +6,8 @@ * * Userspace RCU header. * - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking - * dynamically with the userspace rcu library. + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. * * Copyright (c) 2009 Mathieu Desnoyers * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. @@ -252,46 +252,71 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); } -static inline void _rcu_read_lock(void) +/* + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as + * the per-thread rcu_reader.ctr) has the upper bits containing a count of + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in + * _rcu_read_lock() happen before the subsequent read-side critical section. + */ +static inline void _rcu_read_lock_update(unsigned long tmp) { - unsigned long tmp; - - cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ - tmp = URCU_TLS(rcu_reader).ctr; - /* - * rcu_gp_ctr is - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) - */ if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); - /* - * Set active readers count for outermost nesting level before - * accessing the pointer. See smp_mb_master(). - */ smp_mb_slave(RCU_MB_GROUP); - } else { + } else _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, tmp + RCU_GP_COUNT); - } } -static inline void _rcu_read_unlock(void) +/* + * Enter an RCU read-side critical section. + * + * The first cmm_barrier() call ensures that the compiler does not reorder + * the body of _rcu_read_lock() with a mutex. + * + * This function and its helper are both less than 10 lines long. The + * intent is that this function meets the 10-line criterion in LGPL, + * allowing this function to be invoked directly from non-LGPL code. + */ +static inline void _rcu_read_lock(void) { unsigned long tmp; + cmm_barrier(); tmp = URCU_TLS(rcu_reader).ctr; - /* - * Finish using rcu before decrementing the pointer. - * See smp_mb_master(). - */ + _rcu_read_lock_update(tmp); +} + +/* + * This is a helper function for _rcu_read_unlock(). + * + * The first smp_mb_slave() call ensures that the critical section is + * seen to preced the store to rcu_reader.ctr. + * The second smp_mb_slave() call ensures that we write to rcu_reader.ctr + * before reading the update-side futex. + */ +static inline void _rcu_read_unlock_help(unsigned long tmp) +{ if (caa_likely((tmp & RCU_GP_CTR_NEST_MASK) == RCU_GP_COUNT)) { smp_mb_slave(RCU_MB_GROUP); _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); - /* write URCU_TLS(rcu_reader).ctr before read futex */ smp_mb_slave(RCU_MB_GROUP); wake_up_gp(); - } else { + } else _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); - } +} + +/* + * Exit an RCU read-side crtical section. Both this function and its + * helper are smaller than 10 lines of code, and are intended to be + * usable by non-LGPL code, as called out in LGPL. + */ +static inline void _rcu_read_unlock(void) +{ + unsigned long tmp; + + tmp = URCU_TLS(rcu_reader).ctr; + _rcu_read_unlock_help(tmp); cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ } From christian.babeux at efficios.com Tue Sep 4 18:57:29 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Tue, 4 Sep 2012 18:57:29 -0400 Subject: [lttng-dev] [PATCH v2 lttng-tools] Filter allocation and large bytecode fixes In-Reply-To: <1346093301-25274-1-git-send-email-christian.babeux@efficios.com> References: <1346093301-25274-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1346799450-22888-1-git-send-email-christian.babeux@efficios.com> Hi all, After some discussion with Mathieu, it was decided that we should accept filter bytecode with a length of 65536 bytes. In order to fully support this length, the len field of lttng_ust_filter_bytecode must be able to hold that value, so we must change the len type from a uint16_t to a uint32_t. Also, the relocation table offset field must be able to hold a value larger than 65535 since the table is located at the end of the generated bytecode. The field type must be changed from a uint16_t to a uint32_t. Theses changes _will_ break the filter ABI. Since we are in RC and the lttng_ust_filter_bytecode struct has only been introduced with the new filtering feature this seems to be a reasonable approach. This change must also be reflected on the lttng-ust side. A subsequent patch for lttng-ust will address this particular concern. Changelog v2: 1/3 - Already merged. 2/3 - Respin. Support 65536 bytes bytecode len + filter ABI changes. 3/3 - Already merged. Thanks, Christian Babeux (1): Fix: Accept bytecode of length 65536 bytes src/bin/lttng-sessiond/lttng-ust-abi.h | 6 +++--- src/common/sessiond-comm/sessiond-comm.h | 6 +++--- src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) -- 1.7.11.4 From christian.babeux at efficios.com Tue Sep 4 18:57:30 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Tue, 4 Sep 2012 18:57:30 -0400 Subject: [lttng-dev] [PATCH v2 lttng-tools] Fix: Accept bytecode of length 65536 bytes In-Reply-To: <1346799450-22888-1-git-send-email-christian.babeux@efficios.com> References: <1346093301-25274-1-git-send-email-christian.babeux@efficios.com> <1346799450-22888-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1346799450-22888-2-git-send-email-christian.babeux@efficios.com> In order to support the filter bytecode maximum length (65536 bytes), the lttng_ust_filter_bytecode len field type must be able to hold more than a uint16_t. Change the field type to a uint32_t. Also, since the relocation table is located at the end of the actual bytecode, the reloc_table_offset (reloc_offset in ust-abi) field must support offset values larger than 65535. Change the field type to a uint32_t. This change will allow support of relocation table appended to larger bytecode without breaking the ABI if the need arise in the future. Both changes currently breaks the filter ABI, but this should be a reasonable compromise since the filtering feature has not been released yet. Signed-off-by: Christian Babeux --- src/bin/lttng-sessiond/lttng-ust-abi.h | 6 +++--- src/common/sessiond-comm/sessiond-comm.h | 6 +++--- src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bin/lttng-sessiond/lttng-ust-abi.h b/src/bin/lttng-sessiond/lttng-ust-abi.h index d8b10c2..504c060 100644 --- a/src/bin/lttng-sessiond/lttng-ust-abi.h +++ b/src/bin/lttng-sessiond/lttng-ust-abi.h @@ -168,10 +168,10 @@ struct lttng_ust_calibrate { } u; }; -#define FILTER_BYTECODE_MAX_LEN 65535 +#define FILTER_BYTECODE_MAX_LEN 65536 struct lttng_ust_filter_bytecode { - uint16_t len; - uint16_t reloc_offset; + uint32_t len; + uint32_t reloc_offset; char data[0]; }; diff --git a/src/common/sessiond-comm/sessiond-comm.h b/src/common/sessiond-comm/sessiond-comm.h index ff22875..62205f4 100644 --- a/src/common/sessiond-comm/sessiond-comm.h +++ b/src/common/sessiond-comm/sessiond-comm.h @@ -208,7 +208,7 @@ struct lttcomm_session_msg { } u; }; -#define LTTNG_FILTER_MAX_LEN 65535 +#define LTTNG_FILTER_MAX_LEN 65536 /* * Filter bytecode data. The reloc table is located at the end of the @@ -216,8 +216,8 @@ struct lttcomm_session_msg { * starts at reloc_table_offset. */ struct lttng_filter_bytecode { - uint16_t len; /* len of data */ - uint16_t reloc_table_offset; + uint32_t len; /* len of data */ + uint32_t reloc_table_offset; char data[0]; }; diff --git a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c index 98f8375..332a387 100644 --- a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c @@ -239,7 +239,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node) uint32_t insn_len = sizeof(struct load_op) + sizeof(struct field_ref); struct field_ref ref_offset; - uint16_t reloc_offset; + uint32_t reloc_offset; insn = calloc(insn_len, 1); if (!insn) -- 1.7.11.4 From christian.babeux at efficios.com Tue Sep 4 19:02:24 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Tue, 4 Sep 2012 19:02:24 -0400 Subject: [lttng-dev] [PATCH lttng-ust] Fix: Filter ABI changes to support FILTER_BYTECODE_MAX_LEN (65536) Message-ID: <1346799744-23032-1-git-send-email-christian.babeux@efficios.com> In order to support the filter bytecode maximum length (65536 bytes), the lttng_ust_filter_bytecode len field type must be able to hold more than a uint16_t. Change the field type to a uint32_t. Also, since the relocation table is located at the end of the actual bytecode, the reloc_offset field must support offset values larger than 65535. Change the field type to a uint32_t. This change will allow support of relocation table appended to larger bytecode without breaking the ABI if the need arise in the future. Both changes currently breaks the filter ABI, but this should be a reasonable compromise since the filtering feature has not been released yet. Signed-off-by: Christian Babeux --- include/lttng/ust-abi.h | 4 ++-- include/ust-comm.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index 0489e89..91639a7 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -174,8 +174,8 @@ struct lttng_ust_calibrate { #define FILTER_BYTECODE_MAX_LEN 65536 struct lttng_ust_filter_bytecode { - uint16_t len; - uint16_t reloc_offset; + uint32_t len; + uint32_t reloc_offset; char data[0]; }; diff --git a/include/ust-comm.h b/include/ust-comm.h index b09fcca..4a3e4ce 100644 --- a/include/ust-comm.h +++ b/include/ust-comm.h @@ -132,8 +132,8 @@ struct ustcomm_ust_msg { struct lttng_ust_tracer_version version; struct lttng_ust_tracepoint_iter tracepoint; struct { - uint16_t data_size; /* following filter data */ - uint16_t reloc_offset; + uint32_t data_size; /* following filter data */ + uint32_t reloc_offset; } filter; } u; }; -- 1.7.11.4 From mathieu.desnoyers at efficios.com Wed Sep 5 10:44:43 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Wed, 5 Sep 2012 10:44:43 -0400 Subject: [lttng-dev] [PATCH lttng-ust] Fix: Filter ABI changes to support FILTER_BYTECODE_MAX_LEN (65536) In-Reply-To: <1346799744-23032-1-git-send-email-christian.babeux@efficios.com> References: <1346799744-23032-1-git-send-email-christian.babeux@efficios.com> Message-ID: <20120905144443.GA18761@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > In order to support the filter bytecode maximum length (65536 bytes), > the lttng_ust_filter_bytecode len field type must be able to > hold more than a uint16_t. Change the field type to a uint32_t. > > Also, since the relocation table is located at the end of the actual > bytecode, the reloc_offset field must support offset values larger > than 65535. Change the field type to a uint32_t. This change will > allow support of relocation table appended to larger bytecode without > breaking the ABI if the need arise in the future. > > Both changes currently breaks the filter ABI, but this should be a > reasonable compromise since the filtering feature has not been > released yet. > > Signed-off-by: Christian Babeux > --- > include/lttng/ust-abi.h | 4 ++-- > include/ust-comm.h | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h > index 0489e89..91639a7 100644 > --- a/include/lttng/ust-abi.h > +++ b/include/lttng/ust-abi.h > @@ -174,8 +174,8 @@ struct lttng_ust_calibrate { > > #define FILTER_BYTECODE_MAX_LEN 65536 > struct lttng_ust_filter_bytecode { > - uint16_t len; > - uint16_t reloc_offset; > + uint32_t len; > + uint32_t reloc_offset; You'll need to add a check in liblttng-ust/lttng-ust-comm.c, when the data is received: we need to check that the reloc_offset is within the data. Mathieu > char data[0]; > }; > > diff --git a/include/ust-comm.h b/include/ust-comm.h > index b09fcca..4a3e4ce 100644 > --- a/include/ust-comm.h > +++ b/include/ust-comm.h > @@ -132,8 +132,8 @@ struct ustcomm_ust_msg { > struct lttng_ust_tracer_version version; > struct lttng_ust_tracepoint_iter tracepoint; > struct { > - uint16_t data_size; /* following filter data */ > - uint16_t reloc_offset; > + uint32_t data_size; /* following filter data */ > + uint32_t reloc_offset; > } filter; > } u; > }; > -- > 1.7.11.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Wed Sep 5 11:29:05 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Wed, 5 Sep 2012 11:29:05 -0400 Subject: [lttng-dev] [PATCH v2 lttng-tools] Fix: Accept bytecode of length 65536 bytes In-Reply-To: <1346799450-22888-2-git-send-email-christian.babeux@efficios.com> References: <1346093301-25274-1-git-send-email-christian.babeux@efficios.com> <1346799450-22888-1-git-send-email-christian.babeux@efficios.com> <1346799450-22888-2-git-send-email-christian.babeux@efficios.com> Message-ID: <20120905152905.GA19825@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > In order to support the filter bytecode maximum length (65536 bytes), > the lttng_ust_filter_bytecode len field type must be able to > hold more than a uint16_t. Change the field type to a uint32_t. > > Also, since the relocation table is located at the end of the actual > bytecode, the reloc_table_offset (reloc_offset in ust-abi) field must > support offset values larger than 65535. Change the field type to a > uint32_t. This change will allow support of relocation table appended > to larger bytecode without breaking the ABI if the need arise in the > future. > > Both changes currently breaks the filter ABI, but this should be a > reasonable compromise since the filtering feature has not been > released yet. > > Signed-off-by: Christian Babeux > --- > src/bin/lttng-sessiond/lttng-ust-abi.h | 6 +++--- > src/common/sessiond-comm/sessiond-comm.h | 6 +++--- > src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c | 2 +- > 3 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/src/bin/lttng-sessiond/lttng-ust-abi.h b/src/bin/lttng-sessiond/lttng-ust-abi.h > index d8b10c2..504c060 100644 > --- a/src/bin/lttng-sessiond/lttng-ust-abi.h > +++ b/src/bin/lttng-sessiond/lttng-ust-abi.h > @@ -168,10 +168,10 @@ struct lttng_ust_calibrate { > } u; > }; > > -#define FILTER_BYTECODE_MAX_LEN 65535 > +#define FILTER_BYTECODE_MAX_LEN 65536 > struct lttng_ust_filter_bytecode { > - uint16_t len; > - uint16_t reloc_offset; > + uint32_t len; > + uint32_t reloc_offset; > char data[0]; > }; > > diff --git a/src/common/sessiond-comm/sessiond-comm.h b/src/common/sessiond-comm/sessiond-comm.h > index ff22875..62205f4 100644 > --- a/src/common/sessiond-comm/sessiond-comm.h > +++ b/src/common/sessiond-comm/sessiond-comm.h > @@ -208,7 +208,7 @@ struct lttcomm_session_msg { > } u; > }; > > -#define LTTNG_FILTER_MAX_LEN 65535 > +#define LTTNG_FILTER_MAX_LEN 65536 > > /* > * Filter bytecode data. The reloc table is located at the end of the > @@ -216,8 +216,8 @@ struct lttcomm_session_msg { > * starts at reloc_table_offset. > */ > struct lttng_filter_bytecode { > - uint16_t len; /* len of data */ > - uint16_t reloc_table_offset; > + uint32_t len; /* len of data */ > + uint32_t reloc_table_offset; So you might want to add, at: src/bin/lttng-sessiond/main.c, around line 3965 (under case LTTNG_SET_FILTER): if (cmd_ctx->lsm->u.filter.reloc_table_offset > LTTNG_FILTER_MAX_LEN - 1) { ret = LTTNG_ERR_FILTER_INVAL; goto error; } and change: if (cmd_ctx->lsm->u.filter.bytecode_len > 65336) { for if (cmd_ctx->lsm->u.filter.bytecode_len > LTTNG_FILTER_MAX_LEN) { Thanks, Mathieu > char data[0]; > }; > > diff --git a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c > index 98f8375..332a387 100644 > --- a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c > +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c > @@ -239,7 +239,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node) > uint32_t insn_len = sizeof(struct load_op) > + sizeof(struct field_ref); > struct field_ref ref_offset; > - uint16_t reloc_offset; > + uint32_t reloc_offset; > > insn = calloc(insn_len, 1); > if (!insn) > -- > 1.7.11.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 6 09:38:19 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 6 Sep 2012 09:38:19 -0400 Subject: [lttng-dev] Timestamps in babeltrace In-Reply-To: <503E3297.8090703@keymile.com> References: <4EEB1A44.2020500@keymile.com> <503CC0DF.7030607@keymile.com> <503E3297.8090703@keymile.com> Message-ID: <20120906133819.GB3630@Krystal> Hello! We use the kernel clock gettime (see lttng-modules/wrapper/trace-clock.h). Currently we use ktime_get(), but I think I need to fix that for archs where it does not return nanoseconds, but I doubt this would be causing your issue. What we _do_ expect though is that ktime_get returns a monotonic time from a CPU point of view. If your time source ever goes backward, this would be seen as an overflow. You might want to triple-check that your time source never go backward. Mathieu * Gerlando Falauto (gerlando.falauto at keymile.com) wrote: > Hi again, > > I tested this on an ARM board, and results look OK on both babeltrace > and within TMF. So there must be something wrong with the way timestamps > are calculated (and/or stored) by LLTng 2.x on the target. > > I looked at the timestamps again (having babeltrace dump the > timestamp-cycles in HEX, sided by timestamp-seconds), and got the > following: > > [000000000e3816c58e6e] [1346144403.557251024] (+?.?????????) > [000000000e3816e58d02] [1346144403.559347812] (+0.002096788) > [000000000e3816e887cb] [1346144403.559543085] (+0.000195273) > [000000000e3816f08eb7] [1346144403.560069145] (+0.000526060) > [000000000e3816f91981] [1346144403.560628963] (+0.000559818) > [000000000e38170a3b65] [1346144403.561751751] (+0.001122788) > [000000000e3817108c1b] [1346144403.562165629] (+0.000413878) > [000000000e381712d427] [1346144403.562315145] (+0.000149516) > [000000000e38172a770d] [1346144403.563864175] (+0.001549030) > [000000000e381744a88b] [1346144403.565580781] (+0.001716606) > [000000000e38176dd2e6] [1346144403.568278600] (+0.002697819) > [000000000e38176f4e65] [1346144403.568375751] (+0.000097151) > [000000000e381779ed61] [1346144403.569071811] (+0.000696060) > [000000000e38177b3f36] [1346144403.569158296] (+0.000086485) > [000000000e38177bc849] [1346144403.569193387] (+0.000035091) > [000000000e38177ce3e7] [1346144403.569265993] (+0.000072606) > [000000000e38177e25a3] [1346144403.569348357] (+0.000082364) > [000000000e38177f214b] [1346144403.569412781] (+0.000064424) > [000000000e3817804754] [1346144403.569488054] (+0.000075273) > [000000000e381793d8cc] [1346144403.570770478] (+0.001282424) > [000000000e3817951f07] [1346144403.570853993] (+0.000083515) > [000000000e38179cc3b5] [1346144403.571354903] (+0.000500910) > [000000000e38179ef04a] [1346144403.571497388] (+0.000142485) > [000000000e3817a066d0] [1346144403.571593266] (+0.000095878) > [000000000e3817a84ab3] [1346144403.572110357] (+0.000517091) > [000000000e3817aaf798] [1346144403.572285690] (+0.000175333) > [000000000e3817acc2a4] [1346144403.572403206] (+0.000117516) > [000000000e3817bc26fb] [1346144403.573411933] (+0.001008727) > [000000000e3817c223e3] [1346144403.573804357] (+0.000392424) > [000000000e3817c3731d] [1346144403.573890175] (+0.000085818) > [000000000e3817c3fb7a] [1346144403.573925084] (+0.000034909) > [000000000e3817c50c71] [1346144403.573994963] (+0.000069879) > [000000000e3817c64a26] [1346144403.574076296] (+0.000081333) > [000000000e3817c74519] [1346144403.574140539] (+0.000064243) > [000000000e3817c8684a] [1346144403.574215084] (+0.000074545) > [000000000e3817d4a27f] [1346144403.575016417] (+0.000801333) > [000000000e3817dbc719] [1346144403.575484539] (+0.000468122) > [000000000e3817de86b2] [1346144403.575664660] (+0.000180121) > [000000000e3817e98332] [1346144403.576384660] (+0.000720000) > [000000000e3817eed6d5] [1346144403.576733751] (+0.000349091) > [000000000e3817f0f079] [1346144403.576871387] (+0.000137636) > [000000000e3817fa997c] [1346144403.577504478] (+0.000633091) > [000000000e3817ffc467] [1346144403.577843145] (+0.000338667) > [000000000e3818100692] [1346144403.578908660] (+0.001065515) > [000000000e381817dcf7] [1346144403.579422297] (+0.000513637) > [000000000e381821774c] [1346144403.580051630] (+0.000629333) > [000000000e3818293e89] [1346144403.580561387] (+0.000509757) > [000000000e38182d7c79] [1346144403.580839387] (+0.000278000) > [000000000e38183661ef] [1346144403.581422417] (+0.000583030) > [000000000e38183d1430] [1346144403.581861266] (+0.000438849) > [000000000e3818433d9a] [1346144403.582265084] (+0.000403818) > [000000000e38184a844a] [1346144403.582741932] (+0.000476848) > [000000000e3818511160] [1346144403.583171266] (+0.000429334) > [000000000e381857ed4b] [1346144403.583620781] (+0.000449515) > [000000000e381861db33] [1346144403.584271509] (+0.000650728) > [000000000e3818678ef3] [1346144403.584645205] (+0.000373696) > [000000000e38186e85dc] [1346144403.585101630] (+0.000456425) > [000000000e381875ec45] [1346144403.585586599] (+0.000484969) > [000000000e38187af334] [1346144403.585916054] (+0.000329455) > [000000000e3818a5f4ac] [1346144403.588734478] (+0.002818424) > [000000000e3818bd10dd] [1346144403.590249023] (+0.001514545) > [000000000e3818c35f73] [1346144403.590662357] (+0.000413334) > [000000000e3818c4c52a] [1346144403.590753932] (+0.000091575) > [000000000e3818cbb849] [1346144403.591209387] (+0.000455455) > [000000000e3818cfcccb] [1346144403.591476781] (+0.000267394) > [000000000e3818d54f12] [1346144403.591837812] (+0.000361031) > [000000000e3818d81053] [1346144403.592018357] (+0.000180545) > [000000000e3818d932cf] [1346144403.592092721] (+0.000074364) > [000000000e3818de4f48] [1346144403.592427690] (+0.000334969) > [000000000e3818df9af5] [1346144403.592512599] (+0.000084909) > [000000000e38191378e5] [1346144403.595911751] (+0.003399152) > [000000000e38191542c1] [1346144403.596028963] (+0.000117212) > [000000000e3819189d6b] [1346144403.596248781] (+0.000219818) > [000000000e38191a4715] [1346144403.596357751] (+0.000108970) > [000000000e3819282a3e] [1346144403.597267872] (+0.000910121) > [000000000e38194e6256] [1346144403.599772600] (+0.002504728) > [000000000e3819516697] [1346144403.599970297] (+0.000197697) > [000000000e381953f0eb] [1346144403.600136781] (+0.000166484) > [000000000e38195791e5] [1346144403.600374599] (+0.000237818) > [000000000e38196bff4c] [1346144403.601713326] (+0.001338727) > [000000000e38196d4459] [1346144403.601796539] (+0.000083213) > [000000000e38197290a5] [1346144403.602143751] (+0.000347212) > [000000000e381975ccc5] [1346144403.602355751] (+0.000212000) > [000000000e381976eac1] [1346144403.602428963] (+0.000073212) > [000000000e38197bf486] [1346144403.602759144] (+0.000330181) > [000000000e38197e224a] [1346144403.602901932] (+0.000142788) > [000000000e38197f2364] [1346144403.602967750] (+0.000065818) > [000000000e381986a674] [1346144403.603460054] (+0.000492304) > [000000000e38198b8fcb] [1346144403.603781933] (+0.000321879) > [000000000e38198cd550] [1346144403.603865266] (+0.000083333) > [000000000e381992f086] [1346144403.604265448] (+0.000400182) > [000000000e3819943d9f] [1346144403.604350721] (+0.000085273) > [000000000e3819b686d8] [1346144403.606597690] (+0.002246969) > [000000000e3819b8259e] [1346144403.606703872] (+0.000106182) > [000000000e3819bb4684] [1346144403.606908902] (+0.000205030) > [000000000e3819ec04bc] [1346144403.610103326] (+0.003194424) > [000000000e3819eda61d] [1346144403.610210175] (+0.000106849) > [000000000e3819f0c77c] [1346144403.610415326] (+0.000205151) > [000000000e381a2178af] [1346144403.613606417] (+0.003191091) > [000000000e381a2314da] [1346144403.613711932] (+0.000105515) > [000000000e381a2633dc] [1346144403.613916478] (+0.000204546) > [000000000e381a4f3892] [1346144403.616604660] (+0.002688182) > [000000000e381a50ca8f] [1346144403.616707569] (+0.000102909) > [000000000e381a53e5c7] [1346144403.616911145] (+0.000203576) > [000000000e381a557437] [1346144403.617013145] (+0.000102000) > [000000000e381a7d5dc8] [1346144403.619628842] (+0.002615697) > [000000000e381a7fa51d] [1346144403.619778175] (+0.000149333) > [000000000e381a864560] [1346144403.620212418] (+0.000434243) > [000000000e381a9651cd] [1346144403.621264175] (+0.001051757) > [000000000e381aa37b5b] [1346144403.622126781] (+0.000862606) > [000000000e381ab84868] [1346144403.623489994] (+0.001363213) > [000000000e381ac23926] [1346144403.624141448] (+0.000651454) > [000000000e381adcda62] [1346144403.625886660] (+0.001745212) > [000000000e381ae50f78] [1346144403.626424538] (+0.000537878) > [000000000e381aebcd52] [1346144403.626866356] (+0.000441818) > [000000000e381aeec673] [1346144403.627061205] (+0.000194849) > [000000000e381b1e47ac] [1346144403.630174478] (+0.003113273) > [000000000e381b33e1bd] [1346144403.631590175] (+0.001415697) > [000000000e381b3a9348] [1346144403.632028842] (+0.000438667) > [000000000e381b636d9d] [1346144403.634706175] (+0.002677333) > [000000000e381b6b6304] [1346144403.635227750] (+0.000521575) > [000000000e381b72078a] [1346144403.635663084] (+0.000435334) > [000000000e381b7426dd] [1346144403.635802175] (+0.000139091) > [000000000e381b7b720d] [1346144403.636280175] (+0.000478000) > [000000000e381b839470] [1346144403.636813266] (+0.000533091) > [000000000e381b85aca9] [1346144403.636950539] (+0.000137273) > [000000000e381b8b5abb] [1346144403.637322781] (+0.000372242) > [000000000e381b9a25e6] [1346144403.638292296] (+0.000969515) > [000000000e381ba522a2] [1346144403.639012356] (+0.000720060) > [000000000e381ba86e62] [1346144403.639228356] (+0.000216000) > [000000000e381bb3f1d5] [1346144403.639982903] (+0.000754547) > [000000000e381bb7c172] [1346144403.640232660] (+0.000249757) > [000000000e3903588b84] [1346144407.526307046] (+3.886074386) > [000000000e390359cae2] [1346144407.526388804] (+0.000081758) > [000000000e39035b5e4b] [1346144407.526492077] (+0.000103273) > [000000000e390d5bcfc7] [1346144407.694293289] (+0.167801212) > [000000000e390d5cfa12] [1346144407.694369652] (+0.000076363) > [000000000e390d5e5b4b] [1346144407.694460077] (+0.000090425) > [000000000e390eca0c68] [1346144407.718294986] (+0.023834909) > [000000000e390ecb3326] [1346144407.718370440] (+0.000075454) > [000000000e390ecc897b] [1346144407.718458077] (+0.000087637) > [000000000e390f9daeac] [1346144407.732164622] (+0.013706545) > [000000000e390f9ea469] [1346144407.732227531] (+0.000062909) > [000000000e390fa2983f] [1346144407.732486561] (+0.000259030) > [000000000e3a003ef59a] [1346144411.769265916] (+4.036779355) > [000000000e3a00402dde] [1346144411.769345856] (+0.000079940) > [000000000e3a00458822] [1346144411.769696644] (+0.000350788) > [000000000e3a03586436] [1346144411.821264280] (+0.051567636) > [000000000e3a03598dcc] [1346144411.821340462] (+0.000076182) > [000000000e3a035ac596] [1346144411.821420280] (+0.000079818) > [000000000e3b0358576b] [1346144416.116228301] (+4.294808021) > [000000000e3b03598dca] [1346144416.116307756] (+0.000079455) > [000000000e3b035b1870] [1346144416.116408786] (+0.000101030) > [000000000e3c003ee0c3] [1346144420.359195173] (+4.242786387) > [000000000e3c00401228] [1346144420.359273354] (+0.000078181) > [000000000e3c00480297] [1346144420.359793657] (+0.000520303) > [000000000e3c035863f7] [1346144420.411198809] (+0.051405152) > [000000000e3c03598e43] [1346144420.411275173] (+0.000076364) > [000000000e3c035ac6ff] [1346144420.411355233] (+0.000080060) > [000000000e3d03586b4c] [1346144424.706167982] (+4.294812749) > [000000000e3d0359a7d2] [1346144424.706249012] (+0.000081030) > [000000000e3d035b2f28] [1346144424.706349194] (+0.000100182) > [000000000e3e003ee0fb] [1346144428.949129821] (+4.242780627) > [000000000e3e00401317] [1346144428.949208185] (+0.000078364) > [000000000e3e00495a90] [1346144428.949816306] (+0.000608121) > [000000000e3e00f6261f] [1346144428.961140609] (+0.011324303) > [000000000e3e00f79420] [1346144428.961234306] (+0.000093697) > [000000000e3e00f8ba29] [1346144428.961309579] (+0.000075273) > [000000000e3e03586522] [1346144429.001133700] (+0.039824121) > [000000000e3e03598e7b] [1346144429.001209821] (+0.000076121) > [000000000e3e035acd23] [1346144429.001291397] (+0.000081576) > [000000000e3e0d5bc868] [1346144429.169127882] (+0.167836485) > [000000000e3e0d5cf67d] [1346144429.169205215] (+0.000077333) > [000000000e3e0d60bcdf] [1346144429.169452609] (+0.000247394) > [000000000e3e0d645b02] [1346144429.169689700] (+0.000237091) > [000000000e3e0d711730] [1346144429.170524306] (+0.000834606) > [000000000e3e10139fd2] [1346144429.214730548] (+0.044206242) > [000000000e3e10150f7b] [1346144429.214824669] (+0.000094121) > [000000000e3e10190223] [1346144429.215083397] (+0.000258728) > [000000000e3e111413cf] [1346144429.231537457] (+0.016454060) > [000000000e3e11157581] [1346144429.231628003] (+0.000090546) > [000000000e3e11193dc7] [1346144429.231875881] (+0.000247878) > [000000000e3f03586de3] [1346144433.296103237] (+4.064227356) > [000000000e3f03599e93] [1346144433.296181237] (+0.000078000) > [000000000e3f035b2754] [1346144433.296281782] (+0.000100545) > [000000000e40003ee171] [1346144437.539064531] (+4.242782749) > [000000000e400040138c] [1346144437.539142894] (+0.000078363) > [000000000e4000462587] [1346144437.539540713] (+0.000397819) > [000000000e4003586469] [1346144437.591068107] (+0.051527394) > [000000000e4003598f6a] [1346144437.591144652] (+0.000076545) > [000000000e40035ac605] [1346144437.591224167] (+0.000079515) > [000000000e4103585761] [1346144441.886032067] (+4.294807900) > [000000000e4103598b62] [1346144441.886110916] (+0.000078849) > [000000000e41035b16fa] [1346144441.886212188] (+0.000101272) > [000000000e42003ee446] [1346144446.128999848] (+4.242787660) > [000000000e4200401532] [1346144446.129077908] (+0.000078060) > [000000000e420047efd9] [1346144446.129592635] (+0.000514727) > [000000000e420358699b] [1346144446.181004029] (+0.051411394) > [000000000e42035995cc] [1346144446.181080878] (+0.000076849) > [000000000e42035ad0aa] [1346144446.181161484] (+0.000080606) > [000000000e421c23e01f] [1346144446.596991361] (+0.415829877) > [000000000e421c2558c7] [1346144446.597087785] (+0.000096424) > [000000000e421c34e871] [1346144446.598107603] (+0.001019818) > [000000000e421c35d936] [1346144446.598169240] (+0.000061637) > [000000000e421c65189e] [1346144446.601265664] (+0.003096424) > [000000000e421c661b24] [1346144446.601331846] (+0.000066182) > [000000000e421c7fab69] [1346144446.603007179] (+0.001675333) > [000000000e421c86a8f2] [1346144446.603465300] (+0.000458121) > [000000000e421c880aa4] [1346144446.603555846] (+0.000090546) > [000000000e421c8f701b] [1346144446.604040573] (+0.000484727) > [000000000e421c95da63] [1346144446.604460997] (+0.000420424) > [000000000e421c97371c] [1346144446.604550270] (+0.000089273) > [000000000e421ca9fb16] [1346144446.605780088] (+0.001229818) > [000000000e421cb03e8b] [1346144446.606190573] (+0.000410485) > [000000000e421cb1a000] [1346144446.606281058] (+0.000090485) > [000000000e421cb89ab2] [1346144446.606738452] (+0.000457394) > [000000000e421cbefa16] [1346144446.607156088] (+0.000417636) > [000000000e421cc057fe] [1346144446.607245664] (+0.000089576) > [000000000e421cfc3af5] [1346144446.611170391] (+0.003924727) > [000000000e421d02756b] [1346144446.611578573] (+0.000408182) > [000000000e421d03d888] [1346144446.611669482] (+0.000090909) > [000000000e421d0ad063] [1346144446.612126149] (+0.000456667) > [000000000e421d114a0e] [1346144446.612550512] (+0.000424363) > [000000000e421d12a68a] [1346144446.612639724] (+0.000089212) > [000000000e421d2c1cc5] [1346144446.614308391] (+0.001668667) > [000000000e421d3260f0] [1346144446.614719058] (+0.000410667) > [000000000e421d33c44a] [1346144446.614810028] (+0.000090970) > [000000000e421d3abcda] [1346144446.615266876] (+0.000456848) > [000000000e421d410326] [1346144446.615678088] (+0.000411212) > [000000000e421d425f29] [1346144446.615767179] (+0.000089091) > [000000000e421d59acd5] [1346144446.617294391] (+0.001527212) > [000000000e421d5ff7de] [1346144446.617706816] (+0.000412425) > [000000000e421d615f7a] [1346144446.617798876] (+0.000092060) > [000000000e421d6855ad] [1346144446.618255119] (+0.000456243) > [000000000e421d6eb1fd] [1346144446.618671967] (+0.000416848) > [000000000e421d700fe5] [1346144446.618761543] (+0.000089576) > [000000000e421d86f308] [1346144446.620261482] (+0.001499939) > [000000000e421d8d4124] [1346144446.620674694] (+0.000413212) > [000000000e421d8ea405] [1346144446.620765543] (+0.000090849) > [000000000e421da58d13] [1346144446.622266997] (+0.001501454) > [000000000e421dabb0cf] [1346144446.622669361] (+0.000402364) > [000000000e421dad1594] [1346144446.622760694] (+0.000091333) > [000000000e421dc2edac] [1346144446.624192270] (+0.001431576) > [000000000e421dc93edc] [1346144446.624606270] (+0.000414000) > [000000000e421dcaa50d] [1346144446.624697967] (+0.000091697) > [000000000e421e4f0056] [1346144446.633372088] (+0.008674121) > [000000000e421e557e08] [1346144446.633797482] (+0.000425394) > [000000000e421e56e162] [1346144446.633888452] (+0.000090970) > [000000000e421e636796] [1346144446.634709240] (+0.000820788) > [000000000e421e64a7e6] [1346144446.634791240] (+0.000082000) > [000000000e421e6ae404] [1346144446.635199846] (+0.000408606) > [000000000e421e6dafb0] [1346144446.635383058] (+0.000183212) > [000000000e421e6ec24f] [1346144446.635453361] (+0.000070303) > [000000000e421e73ea9f] [1346144446.635791361] (+0.000338000) > [000000000e421e88f797] [1346144446.637170937] (+0.001379576) > [000000000e421e8c65ab] [1346144446.637395725] (+0.000224788) > [000000000e421e8dbcf2] [1346144446.637483604] (+0.000087879) > [000000000e421ea85c85] [1346144446.639228391] (+0.001744787) > [000000000e421ea9c3e5] [1346144446.639320391] (+0.000092000) > [000000000e421eafbeac] [1346144446.639712270] (+0.000391879) > [000000000e421eb7f386] [1346144446.640250088] (+0.000537818) > [000000000e421eb93399] [1346144446.640332027] (+0.000081939) > > Since the most significant 32 bits of the timestamp span from 0xe38 to > 0xe42, whose difference is exactly 0xa (10 in decimal), I would assume > they are somehow representing the uptime in seconds, whereas the least > significant 32 bits are (maybe?) really (clock?) cycles. > It looks like the maximum value reached by the least significant 32 bits > is somewehere near 0x1fff'ffff (so 29 bits as opposed to 32). > It's also easy to spot that the huge (4.3 seconds) gaps occur whenever > there's an increase in the uppermost 32-bit fraction (0xe38->0xe39, > etc...). > > Anyway, there's definitely something wrong with the way LLTng actually > picks up those timestamps. > Could someone please spend a few words on how these timestamps are > computed on PowerPC? > > Thanks a lot! > Gerlando > > On 08/28/2012 03:00 PM, Gerlando Falauto wrote: >> Hi, >> >> picking up again from my own message... >> >> I'm try this again after these few months, and I still get some similar >> behavior. >> Again, it's a 32-bit PowerPC with 4ms system tick (CONFIG_HZ=250). The >> machine has neither NTP nor internal clock, therefore I set a given >> timestamp before starting the test. >> Traces were generated using the latest master branch of the three >> repositories (lttng-modules, lttng-tools, userspace-rcu). >> >> Running the following script on the target: >> >> date -s "2012-08-28 09:00:00" >> lttng create trace >> lttng enable-channel -k mychannel >> lttng enable-event sched_switch,sched_wakeup -k -c mychannel >> lttng start >> echo waiting 10 seconds >> sleep 10 >> lttng stop >> lttng destroy trace >> date >> >> (for which I get the following output): >> >> Tue Aug 28 09:00:00 UTC 2012 >> Session trace created. >> Traces will be written in /root/lttng-traces/trace-20120828-090000 >> Kernel channel mychannel enabled for session trace >> kernel event sched_switch created in channel mychannel >> kernel event sched_wakeup created in channel mychannel >> Tracing started for session trace >> waiting 10 seconds >> Tracing stopped for session trace >> Session trace destroyed >> Tue Aug 28 09:00:10 UTC 2012 >> >> I get the following trace: >> >> babeltrace --clock-date --clock-gmt >> /path/to/root/lttng-traces/trace-20120828-090000/ >> [2012-08-28 09:00:00.348477307] (+?.?????????) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >> 20, prev_state = 0, next_comm = "cons_recv_fds", next_tid = 461, >> next_prio = 20 } >> [2012-08-28 09:00:00.350913974] (+0.002436667) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >> 20, prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio >> = 20 } >> [2012-08-28 09:00:00.352444701] (+0.001530727) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 492, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.352584944] (+0.000140243) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "klogd", tid = 385, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.352691186] (+0.000106242) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.352853368] (+0.000162182) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >> 20, prev_state = 0, next_comm = "klogd", next_tid = 385, next_prio = 20 } >> [2012-08-28 09:00:00.353377247] (+0.000523879) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.354078519] (+0.000701272) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "klogd", prev_tid = 385, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:00.354210095] (+0.000131576) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >> [2012-08-28 09:00:00.355109428] (+0.000899333) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >> prev_state = 130, next_comm = "klogd", next_tid = 385, next_prio = 20 } >> [2012-08-28 09:00:00.355501731] (+0.000392303) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.355620519] (+0.000118788) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "klogd", prev_tid = 385, prev_prio = 20, >> prev_state = 0, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >> [2012-08-28 09:00:00.356259610] (+0.000639091) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >> prev_state = 130, next_comm = "klogd", next_tid = 385, next_prio = 20 } >> [2012-08-28 09:00:00.356807429] (+0.000547819) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.357136883] (+0.000329454) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "klogd", prev_tid = 385, prev_prio = 20, >> prev_state = 1, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >> [2012-08-28 09:00:00.357816762] (+0.000679879) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >> prev_state = 130, next_comm = "lttng", next_tid = 492, next_prio = 20 } >> [2012-08-28 09:00:00.358233853] (+0.000417091) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.358371125] (+0.000137272) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >> prev_state = 0, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >> [2012-08-28 09:00:00.360446034] (+0.002074909) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >> prev_state = 1, next_comm = "lttng", next_tid = 492, next_prio = 20 } >> [2012-08-28 09:00:00.361265065] (+0.000819031) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.361352459] (+0.000087394) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >> [2012-08-28 09:00:00.361385974] (+0.000033515) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 492, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.361461186] (+0.000075212) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >> prev_state = 1, next_comm = "lttng", next_tid = 492, next_prio = 20 } >> [2012-08-28 09:00:00.361540459] (+0.000079273) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.361600641] (+0.000060182) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >> [2012-08-28 09:00:00.361685247] (+0.000084606) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >> prev_state = 1, next_comm = "lttng", next_tid = 492, next_prio = 20 } >> [2012-08-28 09:00:00.362983004] (+0.001297757) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sh", tid = 388, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.363067247] (+0.000084243) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >> prev_state = 64, next_comm = "sh", next_tid = 388, next_prio = 20 } >> [2012-08-28 09:00:00.363663428] (+0.000596181) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.363753004] (+0.000089576) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >> [2012-08-28 09:00:00.363788155] (+0.000035151) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sh", tid = 388, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.363856580] (+0.000068425) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >> prev_state = 1, next_comm = "sh", next_tid = 388, next_prio = 20 } >> [2012-08-28 09:00:00.363922519] (+0.000065939) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.364054580] (+0.000132061) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >> [2012-08-28 09:00:00.364119004] (+0.000064424) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >> prev_state = 1, next_comm = "sh", next_tid = 388, next_prio = 20 } >> [2012-08-28 09:00:00.366897247] (+0.002778243) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 461, next_prio = >> 20 } >> [2012-08-28 09:00:00.367404640] (+0.000507393) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >> 20, prev_state = 1, next_comm = "sh", next_tid = 388, next_prio = 20 } >> [2012-08-28 09:00:00.367605549] (+0.000200909) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >> prev_state = 1, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >> [2012-08-28 09:00:00.367966701] (+0.000361152) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >> 20, prev_state = 1, next_comm = "sh", next_tid = 495, next_prio = 20 } >> [2012-08-28 09:00:00.369751065] (+0.001784364) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 495, prev_prio = 20, >> prev_state = 130, next_comm = "cons_recv_fds", next_tid = 494, next_prio >> = 20 } >> [2012-08-28 09:00:00.370164277] (+0.000413212) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sh", tid = 495, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.371547186] (+0.001382909) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >> 20, prev_state = 130, next_comm = "sh", next_tid = 495, next_prio = 20 } >> [2012-08-28 09:00:00.371978216] (+0.000431030) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.372420277] (+0.000442061) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 495, prev_prio = 20, >> prev_state = 130, next_comm = "cons_recv_fds", next_tid = 494, next_prio >> = 20 } >> [2012-08-28 09:00:00.372877853] (+0.000457576) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sh", tid = 495, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.373435004] (+0.000557151) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >> 20, prev_state = 130, next_comm = "sh", next_tid = 495, next_prio = 20 } >> [2012-08-28 09:00:00.373916641] (+0.000481637) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.374868943] (+0.000952302) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 495, prev_prio = 20, >> prev_state = 130, next_comm = "cons_recv_fds", next_tid = 494, next_prio >> = 20 } >> [2012-08-28 09:00:00.375289610] (+0.000420667) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sh", tid = 495, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.375731186] (+0.000441576) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >> 20, prev_state = 130, next_comm = "sh", next_tid = 495, next_prio = 20 } >> [2012-08-28 09:00:00.376117428] (+0.000386242) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.378842034] (+0.002724606) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 494, next_prio = >> 20 } >> [2012-08-28 09:00:00.379333671] (+0.000491637) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >> 20, prev_state = 130, next_comm = "sleep", next_tid = 495, next_prio = 20 } >> [2012-08-28 09:00:00.380850217] (+0.001516546) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:00.381269065] (+0.000418848) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sleep", tid = 495, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:00.381361004] (+0.000091939) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "sleep", next_tid = 495, next_prio = 20 } >> [2012-08-28 09:00:00.386596822] (+0.005235818) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >> prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:00.394262762] (+0.007665940) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.394357368] (+0.000094606) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 494, next_prio = >> 20 } >> [2012-08-28 09:00:00.394719974] (+0.000362606) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 461, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.395709549] (+0.000989575) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >> 20, prev_state = 64, next_comm = "cons_recv_fds", next_tid = 461, >> next_prio = 20 } >> [2012-08-28 09:00:00.396408701] (+0.000699152) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_poll_fds", tid = 462, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.398866640] (+0.002457939) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >> 20, prev_state = 0, next_comm = "cons_poll_fds", next_tid = 462, >> next_prio = 20 } >> [2012-08-28 09:00:00.398973428] (+0.000106788) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_poll_fds", prev_tid = 462, prev_prio = >> 20, prev_state = 2, next_comm = "cons_recv_fds", next_tid = 461, >> next_prio = 20 } >> [2012-08-28 09:00:00.399076034] (+0.000102606) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_poll_fds", tid = 462, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.399131186] (+0.000055152) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >> 20, prev_state = 0, next_comm = "cons_poll_fds", next_tid = 462, >> next_prio = 20 } >> [2012-08-28 09:00:00.401086701] (+0.001955515) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_poll_fds", prev_tid = 462, prev_prio = >> 20, prev_state = 1, next_comm = "cons_recv_fds", next_tid = 461, >> next_prio = 20 } >> [2012-08-28 09:00:00.401670216] (+0.000583515) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >> 20, prev_state = 1, next_comm = "cons_recv_fds", next_tid = 496, >> next_prio = 20 } >> [2012-08-28 09:00:00.402858156] (+0.001187940) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >> 20, prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:00.403272398] (+0.000414242) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 496, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.403363852] (+0.000091454) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 496, next_prio = >> 20 } >> [2012-08-28 09:00:00.403830277] (+0.000466425) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >> 20, prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:00.404193731] (+0.000363454) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 496, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.404283852] (+0.000090121) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 496, next_prio = >> 20 } >> [2012-08-28 09:00:00.404909247] (+0.000625395) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >> 20, prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:00.405407065] (+0.000497818) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 496, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.405496823] (+0.000089758) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 496, next_prio = >> 20 } >> [2012-08-28 09:00:00.405854156] (+0.000357333) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 461, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.405938822] (+0.000084666) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >> 20, prev_state = 0, next_comm = "cons_recv_fds", next_tid = 461, >> next_prio = 20 } >> [2012-08-28 09:00:00.406084095] (+0.000145273) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >> 20, prev_state = 1, next_comm = "cons_recv_fds", next_tid = 496, >> next_prio = 20 } >> [2012-08-28 09:00:00.407004519] (+0.000920424) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 461, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.407075186] (+0.000070667) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >> 20, prev_state = 64, next_comm = "cons_recv_fds", next_tid = 461, >> next_prio = 20 } >> [2012-08-28 09:00:00.407706034] (+0.000630848) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "cons_poll_fds", tid = 462, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:00.407897368] (+0.000191334) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >> 20, prev_state = 1, next_comm = "cons_poll_fds", next_tid = 462, >> next_prio = 20 } >> [2012-08-28 09:00:00.408304580] (+0.000407212) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "cons_poll_fds", prev_tid = 462, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:04.547552602] (+4.139248022) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:04.547632966] (+0.000080364) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:04.547736542] (+0.000103576) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:04.691537693] (+0.143801151) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "flush-0:14", tid = 389, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:04.691615027] (+0.000077334) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "flush-0:14", next_tid = 389, next_prio = 20 } >> [2012-08-28 09:00:04.691705269] (+0.000090242) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "flush-0:14", prev_tid = 389, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:05.311535024] (+0.619829755) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:05.311613084] (+0.000078060) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:05.311882903] (+0.000269819) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:08.842504805] (+3.530621902) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:08.842583350] (+0.000078545) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:08.842664562] (+0.000081212) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:08.994502865] (+0.151838303) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:08.994581229] (+0.000078364) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:08.994670441] (+0.000089212) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:13.137477252] (+4.142806811) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:13.137557191] (+0.000079939) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:13.137656101] (+0.000098910) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:13.901469492] (+0.763813391) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:13.901548037] (+0.000078545) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:13.902056037] (+0.000508000) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:13.905507067] (+0.003451030) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sync_supers", tid = 76, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:13.905589916] (+0.000082849) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "sync_supers", next_tid = 76, next_prio = 20 } >> [2012-08-28 09:00:13.905661613] (+0.000071697) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sync_supers", prev_tid = 76, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:17.432437394] (+3.526775781) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:17.432515636] (+0.000078242) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:17.432599636] (+0.000084000) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:21.727404869] (+4.294805233) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:21.727485232] (+0.000080363) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:21.727587050] (+0.000101818) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:22.491405717] (+0.763818667) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:22.491484384] (+0.000078667) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:22.491873414] (+0.000389030) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:26.022372104] (+3.530498690) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:26.022450467] (+0.000078363) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:26.022531134] (+0.000080667) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:26.166376770] (+0.143845636) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "flush-0:14", tid = 389, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:26.166453558] (+0.000076788) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "flush-0:14", next_tid = 389, next_prio = 20 } >> [2012-08-28 09:00:26.166543558] (+0.000090000) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "flush-0:14", prev_tid = 389, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:30.317347278] (+4.150803720) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:30.317427399] (+0.000080121) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:30.317528550] (+0.000101151) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:31.081338729] (+0.763810179) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:31.081417759] (+0.000079030) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:31.081881335] (+0.000463576) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:34.612306086] (+3.530424751) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:34.612384571] (+0.000078485) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:34.612465116] (+0.000080545) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:38.907282170] (+4.294817054) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:38.907362109] (+0.000079939) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:38.907461442] (+0.000099333) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:39.622817924] (+0.715356482) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:39.622887803] (+0.000069879) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >> [2012-08-28 09:00:39.623148106] (+0.000260303) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >> prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:39.671276530] (+0.048128424) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:39.671355864] (+0.000079334) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:39.671687682] (+0.000331818) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:39.675311742] (+0.003624060) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sync_supers", tid = 76, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:39.675394409] (+0.000082667) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "sync_supers", next_tid = 76, next_prio = 20 } >> [2012-08-28 09:00:39.675466288] (+0.000071879) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sync_supers", prev_tid = 76, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.202240735] (+3.526774447) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.202318857] (+0.000078122) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >> [2012-08-28 09:00:43.202402250] (+0.000083393) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.346233038] (+0.143830788) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sleep", tid = 495, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.346330614] (+0.000097576) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "sleep", next_tid = 495, next_prio = 20 } >> [2012-08-28 09:00:43.347314432] (+0.000983818) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sh", tid = 388, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.347383644] (+0.000069212) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >> prev_state = 64, next_comm = "sh", next_tid = 388, next_prio = 20 } >> [2012-08-28 09:00:43.349999825] (+0.002616181) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >> prev_state = 1, next_comm = "sh", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.351726735] (+0.001726910) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.352191159] (+0.000464424) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sh", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.352283038] (+0.000091879) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "sh", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.353304492] (+0.001021454) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.353711038] (+0.000406546) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "sh", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.353802856] (+0.000091818) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "sh", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.357738795] (+0.003935939) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.358151644] (+0.000412849) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.358400311] (+0.000248667) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.358873644] (+0.000473333) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.359283644] (+0.000410000) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.359375523] (+0.000091879) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.360845098] (+0.001469575) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.361246492] (+0.000401394) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.361338977] (+0.000092485) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.361800674] (+0.000461697) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.362320250] (+0.000519576) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.362479463] (+0.000159213) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.363838068] (+0.001358605) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.364240553] (+0.000402485) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.364332553] (+0.000092000) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.364792189] (+0.000459636) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.365205038] (+0.000412849) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.365296916] (+0.000091878) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.366988129] (+0.001691213) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.367399705] (+0.000411576) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.367492371] (+0.000092666) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.368825704] (+0.001333333) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.369229038] (+0.000403334) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.369321280] (+0.000092242) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.370950675] (+0.001629395) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.371353220] (+0.000402545) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.371445462] (+0.000092242) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.380016917] (+0.008571455) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.380428129] (+0.000411212) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.380521159] (+0.000093030) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.381335462] (+0.000814303) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:43.381420795] (+0.000085333) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >> [2012-08-28 09:00:43.381826250] (+0.000405455) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >> 20, prev_state = 1, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.382007038] (+0.000180788) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:43.382081522] (+0.000074484) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >> [2012-08-28 09:00:43.382528190] (+0.000446668) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >> 20, prev_state = 1, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.383627341] (+0.001099151) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >> [2012-08-28 09:00:43.384035280] (+0.000407939) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >> target_cpu = 0 } >> [2012-08-28 09:00:43.384128189] (+0.000092909) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.385790613] (+0.001662424) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:43.385877704] (+0.000087091) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >> [2012-08-28 09:00:43.386442190] (+0.000564486) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >> 20, prev_state = 1, next_comm = "lttng", next_tid = 497, next_prio = 20 } >> [2012-08-28 09:00:43.386978008] (+0.000535818) mgcoge3ne sched_wakeup: { >> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >> 1, target_cpu = 0 } >> [2012-08-28 09:00:43.387074129] (+0.000096121) mgcoge3ne sched_switch: { >> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >> >> So again, I get these huge 3.3 (or so) seconds gaps, and a final >> timestamp which is 43 seconds instead of the 10 seconds which actually >> went by. >> >> BTW, I also tried with TMF under Eclipse, and here I get even weirder >> results. Here's a table of correspondence (as there must be some occult >> side to it!) for the timestamps as reported by babeltrace vs. Eclipse: >> >> [2012-08-28 09:00:00.348477307] -> 2033-05-07 16:49:22.035276997 >> ... >> [2012-08-28 09:00:00.408304580] -> 2033-05-07 16:49:22.112912324 >> .... >> [2012-08-28 09:00:04.691537693] -> 2039-11-23 09:06:50.748861638 >> >> Under Eclipse, the latest event of this 10-second trace lies sometime >> within year 2124. >> >> No clue, anyone? >> >> Thank you, >> Gerlando >> >> On 12/16/2011 11:15 AM, Gerlando Falauto wrote: >>> Hi, >>> >>> I am trying to use LLTng 2.0 (since I have no alternative for a 3.0 >>> kernel!) and I of course use babeltrace to read them. >>> Problem is, I can't make any sense out of the timestamps, as I get >>> something like (two CPU-hog bash processes): >>> >>> [1658841591493] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>> next_prio = 20 } >>> [1658845590645] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>> next_prio = 20 } >>> [1658849590039] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>> next_prio = 20 } >>> [1658853591069] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>> next_prio = 20 } >>> [1662152559395] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>> next_prio = 20 } >>> [1662156587941] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>> next_prio = 20 } >>> [1662160557698] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>> next_prio = 20 } >>> [1662164557517] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>> next_prio = 20 } >>> [....................................cut...........................] >>> [1663140553029] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>> next_prio = 20 } >>> [1663144555029] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>> next_prio = 20 } >>> [1663148552423] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>> next_prio = 20 } >>> [1666447519719] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>> next_prio = 20 } >>> [1666451561355] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>> 646, prev_prio = 20, prev_state = 0, next_comm = "kworker/0:1", next_tid >>> = 94, next_prio = 20 } >>> [1666451863719] sched_switch: { 0 }, { prev_comm = "kworker/0:1", >>> prev_tid = 94, prev_prio = 20, prev_state = 1, next_comm = "bash", >>> next_tid = 647, next_prio = 20 } >>> >>> Which made me think timestamps were expressed in nanoseconds, as I am >>> running this on 4ms-tick PowerPC (CONFIG_HZ=250), and the difference >>> between timestamps is approximately 4,000,000. >>> However, I get these huge 3.3 second gaps between for instance between >>> 1658853591069 and 1662152559395. >>> Curiously enough, these leap 3.3 seconds occur exactly (well, within 4ms >>> precision...) every second. Kind of like the "seconds" part of the >>> timestamp is calculated on a wrong-base arithmetics or so.... >>> This also makes sense as the seconds' portion of the timestamp is >>> essentially 4.3 times bigger than the uptime (and any time stretch is >>> 4.3 times bigger than reality, for that matter). >>> >>> Any suggestions? >>> >>> Thanks! >>> Gerlando >>> >>> P.S. This also happens without my hack for flight recording mode... > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From gerlando.falauto at keymile.com Thu Sep 6 09:42:43 2012 From: gerlando.falauto at keymile.com (Gerlando Falauto) Date: Thu, 06 Sep 2012 15:42:43 +0200 Subject: [lttng-dev] Timestamps in babeltrace In-Reply-To: <20120906133819.GB3630@Krystal> References: <4EEB1A44.2020500@keymile.com> <503CC0DF.7030607@keymile.com> <503E3297.8090703@keymile.com> <20120906133819.GB3630@Krystal> Message-ID: <5048A853.2070701@keymile.com> Hi Mathieu, thanks for your answer. Actually I already found a solution and posted a patch to the list... didn't you see that? As for whatever junk I see on TMF, well... that's a problem within TMS! So I am crying for help on their list about that. :-) Thanks, Gerlando On 09/06/2012 03:38 PM, Mathieu Desnoyers wrote: > Hello! > > We use the kernel clock gettime (see > lttng-modules/wrapper/trace-clock.h). Currently we use ktime_get(), but > I think I need to fix that for archs where it does not return > nanoseconds, but I doubt this would be causing your issue. What we _do_ > expect though is that ktime_get returns a monotonic time from a CPU > point of view. If your time source ever goes backward, this would be > seen as an overflow. > > You might want to triple-check that your time source never go backward. > > Mathieu > > * Gerlando Falauto (gerlando.falauto at keymile.com) wrote: >> Hi again, >> >> I tested this on an ARM board, and results look OK on both babeltrace >> and within TMF. So there must be something wrong with the way timestamps >> are calculated (and/or stored) by LLTng 2.x on the target. >> >> I looked at the timestamps again (having babeltrace dump the >> timestamp-cycles in HEX, sided by timestamp-seconds), and got the >> following: >> >> [000000000e3816c58e6e] [1346144403.557251024] (+?.?????????) >> [000000000e3816e58d02] [1346144403.559347812] (+0.002096788) >> [000000000e3816e887cb] [1346144403.559543085] (+0.000195273) >> [000000000e3816f08eb7] [1346144403.560069145] (+0.000526060) >> [000000000e3816f91981] [1346144403.560628963] (+0.000559818) >> [000000000e38170a3b65] [1346144403.561751751] (+0.001122788) >> [000000000e3817108c1b] [1346144403.562165629] (+0.000413878) >> [000000000e381712d427] [1346144403.562315145] (+0.000149516) >> [000000000e38172a770d] [1346144403.563864175] (+0.001549030) >> [000000000e381744a88b] [1346144403.565580781] (+0.001716606) >> [000000000e38176dd2e6] [1346144403.568278600] (+0.002697819) >> [000000000e38176f4e65] [1346144403.568375751] (+0.000097151) >> [000000000e381779ed61] [1346144403.569071811] (+0.000696060) >> [000000000e38177b3f36] [1346144403.569158296] (+0.000086485) >> [000000000e38177bc849] [1346144403.569193387] (+0.000035091) >> [000000000e38177ce3e7] [1346144403.569265993] (+0.000072606) >> [000000000e38177e25a3] [1346144403.569348357] (+0.000082364) >> [000000000e38177f214b] [1346144403.569412781] (+0.000064424) >> [000000000e3817804754] [1346144403.569488054] (+0.000075273) >> [000000000e381793d8cc] [1346144403.570770478] (+0.001282424) >> [000000000e3817951f07] [1346144403.570853993] (+0.000083515) >> [000000000e38179cc3b5] [1346144403.571354903] (+0.000500910) >> [000000000e38179ef04a] [1346144403.571497388] (+0.000142485) >> [000000000e3817a066d0] [1346144403.571593266] (+0.000095878) >> [000000000e3817a84ab3] [1346144403.572110357] (+0.000517091) >> [000000000e3817aaf798] [1346144403.572285690] (+0.000175333) >> [000000000e3817acc2a4] [1346144403.572403206] (+0.000117516) >> [000000000e3817bc26fb] [1346144403.573411933] (+0.001008727) >> [000000000e3817c223e3] [1346144403.573804357] (+0.000392424) >> [000000000e3817c3731d] [1346144403.573890175] (+0.000085818) >> [000000000e3817c3fb7a] [1346144403.573925084] (+0.000034909) >> [000000000e3817c50c71] [1346144403.573994963] (+0.000069879) >> [000000000e3817c64a26] [1346144403.574076296] (+0.000081333) >> [000000000e3817c74519] [1346144403.574140539] (+0.000064243) >> [000000000e3817c8684a] [1346144403.574215084] (+0.000074545) >> [000000000e3817d4a27f] [1346144403.575016417] (+0.000801333) >> [000000000e3817dbc719] [1346144403.575484539] (+0.000468122) >> [000000000e3817de86b2] [1346144403.575664660] (+0.000180121) >> [000000000e3817e98332] [1346144403.576384660] (+0.000720000) >> [000000000e3817eed6d5] [1346144403.576733751] (+0.000349091) >> [000000000e3817f0f079] [1346144403.576871387] (+0.000137636) >> [000000000e3817fa997c] [1346144403.577504478] (+0.000633091) >> [000000000e3817ffc467] [1346144403.577843145] (+0.000338667) >> [000000000e3818100692] [1346144403.578908660] (+0.001065515) >> [000000000e381817dcf7] [1346144403.579422297] (+0.000513637) >> [000000000e381821774c] [1346144403.580051630] (+0.000629333) >> [000000000e3818293e89] [1346144403.580561387] (+0.000509757) >> [000000000e38182d7c79] [1346144403.580839387] (+0.000278000) >> [000000000e38183661ef] [1346144403.581422417] (+0.000583030) >> [000000000e38183d1430] [1346144403.581861266] (+0.000438849) >> [000000000e3818433d9a] [1346144403.582265084] (+0.000403818) >> [000000000e38184a844a] [1346144403.582741932] (+0.000476848) >> [000000000e3818511160] [1346144403.583171266] (+0.000429334) >> [000000000e381857ed4b] [1346144403.583620781] (+0.000449515) >> [000000000e381861db33] [1346144403.584271509] (+0.000650728) >> [000000000e3818678ef3] [1346144403.584645205] (+0.000373696) >> [000000000e38186e85dc] [1346144403.585101630] (+0.000456425) >> [000000000e381875ec45] [1346144403.585586599] (+0.000484969) >> [000000000e38187af334] [1346144403.585916054] (+0.000329455) >> [000000000e3818a5f4ac] [1346144403.588734478] (+0.002818424) >> [000000000e3818bd10dd] [1346144403.590249023] (+0.001514545) >> [000000000e3818c35f73] [1346144403.590662357] (+0.000413334) >> [000000000e3818c4c52a] [1346144403.590753932] (+0.000091575) >> [000000000e3818cbb849] [1346144403.591209387] (+0.000455455) >> [000000000e3818cfcccb] [1346144403.591476781] (+0.000267394) >> [000000000e3818d54f12] [1346144403.591837812] (+0.000361031) >> [000000000e3818d81053] [1346144403.592018357] (+0.000180545) >> [000000000e3818d932cf] [1346144403.592092721] (+0.000074364) >> [000000000e3818de4f48] [1346144403.592427690] (+0.000334969) >> [000000000e3818df9af5] [1346144403.592512599] (+0.000084909) >> [000000000e38191378e5] [1346144403.595911751] (+0.003399152) >> [000000000e38191542c1] [1346144403.596028963] (+0.000117212) >> [000000000e3819189d6b] [1346144403.596248781] (+0.000219818) >> [000000000e38191a4715] [1346144403.596357751] (+0.000108970) >> [000000000e3819282a3e] [1346144403.597267872] (+0.000910121) >> [000000000e38194e6256] [1346144403.599772600] (+0.002504728) >> [000000000e3819516697] [1346144403.599970297] (+0.000197697) >> [000000000e381953f0eb] [1346144403.600136781] (+0.000166484) >> [000000000e38195791e5] [1346144403.600374599] (+0.000237818) >> [000000000e38196bff4c] [1346144403.601713326] (+0.001338727) >> [000000000e38196d4459] [1346144403.601796539] (+0.000083213) >> [000000000e38197290a5] [1346144403.602143751] (+0.000347212) >> [000000000e381975ccc5] [1346144403.602355751] (+0.000212000) >> [000000000e381976eac1] [1346144403.602428963] (+0.000073212) >> [000000000e38197bf486] [1346144403.602759144] (+0.000330181) >> [000000000e38197e224a] [1346144403.602901932] (+0.000142788) >> [000000000e38197f2364] [1346144403.602967750] (+0.000065818) >> [000000000e381986a674] [1346144403.603460054] (+0.000492304) >> [000000000e38198b8fcb] [1346144403.603781933] (+0.000321879) >> [000000000e38198cd550] [1346144403.603865266] (+0.000083333) >> [000000000e381992f086] [1346144403.604265448] (+0.000400182) >> [000000000e3819943d9f] [1346144403.604350721] (+0.000085273) >> [000000000e3819b686d8] [1346144403.606597690] (+0.002246969) >> [000000000e3819b8259e] [1346144403.606703872] (+0.000106182) >> [000000000e3819bb4684] [1346144403.606908902] (+0.000205030) >> [000000000e3819ec04bc] [1346144403.610103326] (+0.003194424) >> [000000000e3819eda61d] [1346144403.610210175] (+0.000106849) >> [000000000e3819f0c77c] [1346144403.610415326] (+0.000205151) >> [000000000e381a2178af] [1346144403.613606417] (+0.003191091) >> [000000000e381a2314da] [1346144403.613711932] (+0.000105515) >> [000000000e381a2633dc] [1346144403.613916478] (+0.000204546) >> [000000000e381a4f3892] [1346144403.616604660] (+0.002688182) >> [000000000e381a50ca8f] [1346144403.616707569] (+0.000102909) >> [000000000e381a53e5c7] [1346144403.616911145] (+0.000203576) >> [000000000e381a557437] [1346144403.617013145] (+0.000102000) >> [000000000e381a7d5dc8] [1346144403.619628842] (+0.002615697) >> [000000000e381a7fa51d] [1346144403.619778175] (+0.000149333) >> [000000000e381a864560] [1346144403.620212418] (+0.000434243) >> [000000000e381a9651cd] [1346144403.621264175] (+0.001051757) >> [000000000e381aa37b5b] [1346144403.622126781] (+0.000862606) >> [000000000e381ab84868] [1346144403.623489994] (+0.001363213) >> [000000000e381ac23926] [1346144403.624141448] (+0.000651454) >> [000000000e381adcda62] [1346144403.625886660] (+0.001745212) >> [000000000e381ae50f78] [1346144403.626424538] (+0.000537878) >> [000000000e381aebcd52] [1346144403.626866356] (+0.000441818) >> [000000000e381aeec673] [1346144403.627061205] (+0.000194849) >> [000000000e381b1e47ac] [1346144403.630174478] (+0.003113273) >> [000000000e381b33e1bd] [1346144403.631590175] (+0.001415697) >> [000000000e381b3a9348] [1346144403.632028842] (+0.000438667) >> [000000000e381b636d9d] [1346144403.634706175] (+0.002677333) >> [000000000e381b6b6304] [1346144403.635227750] (+0.000521575) >> [000000000e381b72078a] [1346144403.635663084] (+0.000435334) >> [000000000e381b7426dd] [1346144403.635802175] (+0.000139091) >> [000000000e381b7b720d] [1346144403.636280175] (+0.000478000) >> [000000000e381b839470] [1346144403.636813266] (+0.000533091) >> [000000000e381b85aca9] [1346144403.636950539] (+0.000137273) >> [000000000e381b8b5abb] [1346144403.637322781] (+0.000372242) >> [000000000e381b9a25e6] [1346144403.638292296] (+0.000969515) >> [000000000e381ba522a2] [1346144403.639012356] (+0.000720060) >> [000000000e381ba86e62] [1346144403.639228356] (+0.000216000) >> [000000000e381bb3f1d5] [1346144403.639982903] (+0.000754547) >> [000000000e381bb7c172] [1346144403.640232660] (+0.000249757) >> [000000000e3903588b84] [1346144407.526307046] (+3.886074386) >> [000000000e390359cae2] [1346144407.526388804] (+0.000081758) >> [000000000e39035b5e4b] [1346144407.526492077] (+0.000103273) >> [000000000e390d5bcfc7] [1346144407.694293289] (+0.167801212) >> [000000000e390d5cfa12] [1346144407.694369652] (+0.000076363) >> [000000000e390d5e5b4b] [1346144407.694460077] (+0.000090425) >> [000000000e390eca0c68] [1346144407.718294986] (+0.023834909) >> [000000000e390ecb3326] [1346144407.718370440] (+0.000075454) >> [000000000e390ecc897b] [1346144407.718458077] (+0.000087637) >> [000000000e390f9daeac] [1346144407.732164622] (+0.013706545) >> [000000000e390f9ea469] [1346144407.732227531] (+0.000062909) >> [000000000e390fa2983f] [1346144407.732486561] (+0.000259030) >> [000000000e3a003ef59a] [1346144411.769265916] (+4.036779355) >> [000000000e3a00402dde] [1346144411.769345856] (+0.000079940) >> [000000000e3a00458822] [1346144411.769696644] (+0.000350788) >> [000000000e3a03586436] [1346144411.821264280] (+0.051567636) >> [000000000e3a03598dcc] [1346144411.821340462] (+0.000076182) >> [000000000e3a035ac596] [1346144411.821420280] (+0.000079818) >> [000000000e3b0358576b] [1346144416.116228301] (+4.294808021) >> [000000000e3b03598dca] [1346144416.116307756] (+0.000079455) >> [000000000e3b035b1870] [1346144416.116408786] (+0.000101030) >> [000000000e3c003ee0c3] [1346144420.359195173] (+4.242786387) >> [000000000e3c00401228] [1346144420.359273354] (+0.000078181) >> [000000000e3c00480297] [1346144420.359793657] (+0.000520303) >> [000000000e3c035863f7] [1346144420.411198809] (+0.051405152) >> [000000000e3c03598e43] [1346144420.411275173] (+0.000076364) >> [000000000e3c035ac6ff] [1346144420.411355233] (+0.000080060) >> [000000000e3d03586b4c] [1346144424.706167982] (+4.294812749) >> [000000000e3d0359a7d2] [1346144424.706249012] (+0.000081030) >> [000000000e3d035b2f28] [1346144424.706349194] (+0.000100182) >> [000000000e3e003ee0fb] [1346144428.949129821] (+4.242780627) >> [000000000e3e00401317] [1346144428.949208185] (+0.000078364) >> [000000000e3e00495a90] [1346144428.949816306] (+0.000608121) >> [000000000e3e00f6261f] [1346144428.961140609] (+0.011324303) >> [000000000e3e00f79420] [1346144428.961234306] (+0.000093697) >> [000000000e3e00f8ba29] [1346144428.961309579] (+0.000075273) >> [000000000e3e03586522] [1346144429.001133700] (+0.039824121) >> [000000000e3e03598e7b] [1346144429.001209821] (+0.000076121) >> [000000000e3e035acd23] [1346144429.001291397] (+0.000081576) >> [000000000e3e0d5bc868] [1346144429.169127882] (+0.167836485) >> [000000000e3e0d5cf67d] [1346144429.169205215] (+0.000077333) >> [000000000e3e0d60bcdf] [1346144429.169452609] (+0.000247394) >> [000000000e3e0d645b02] [1346144429.169689700] (+0.000237091) >> [000000000e3e0d711730] [1346144429.170524306] (+0.000834606) >> [000000000e3e10139fd2] [1346144429.214730548] (+0.044206242) >> [000000000e3e10150f7b] [1346144429.214824669] (+0.000094121) >> [000000000e3e10190223] [1346144429.215083397] (+0.000258728) >> [000000000e3e111413cf] [1346144429.231537457] (+0.016454060) >> [000000000e3e11157581] [1346144429.231628003] (+0.000090546) >> [000000000e3e11193dc7] [1346144429.231875881] (+0.000247878) >> [000000000e3f03586de3] [1346144433.296103237] (+4.064227356) >> [000000000e3f03599e93] [1346144433.296181237] (+0.000078000) >> [000000000e3f035b2754] [1346144433.296281782] (+0.000100545) >> [000000000e40003ee171] [1346144437.539064531] (+4.242782749) >> [000000000e400040138c] [1346144437.539142894] (+0.000078363) >> [000000000e4000462587] [1346144437.539540713] (+0.000397819) >> [000000000e4003586469] [1346144437.591068107] (+0.051527394) >> [000000000e4003598f6a] [1346144437.591144652] (+0.000076545) >> [000000000e40035ac605] [1346144437.591224167] (+0.000079515) >> [000000000e4103585761] [1346144441.886032067] (+4.294807900) >> [000000000e4103598b62] [1346144441.886110916] (+0.000078849) >> [000000000e41035b16fa] [1346144441.886212188] (+0.000101272) >> [000000000e42003ee446] [1346144446.128999848] (+4.242787660) >> [000000000e4200401532] [1346144446.129077908] (+0.000078060) >> [000000000e420047efd9] [1346144446.129592635] (+0.000514727) >> [000000000e420358699b] [1346144446.181004029] (+0.051411394) >> [000000000e42035995cc] [1346144446.181080878] (+0.000076849) >> [000000000e42035ad0aa] [1346144446.181161484] (+0.000080606) >> [000000000e421c23e01f] [1346144446.596991361] (+0.415829877) >> [000000000e421c2558c7] [1346144446.597087785] (+0.000096424) >> [000000000e421c34e871] [1346144446.598107603] (+0.001019818) >> [000000000e421c35d936] [1346144446.598169240] (+0.000061637) >> [000000000e421c65189e] [1346144446.601265664] (+0.003096424) >> [000000000e421c661b24] [1346144446.601331846] (+0.000066182) >> [000000000e421c7fab69] [1346144446.603007179] (+0.001675333) >> [000000000e421c86a8f2] [1346144446.603465300] (+0.000458121) >> [000000000e421c880aa4] [1346144446.603555846] (+0.000090546) >> [000000000e421c8f701b] [1346144446.604040573] (+0.000484727) >> [000000000e421c95da63] [1346144446.604460997] (+0.000420424) >> [000000000e421c97371c] [1346144446.604550270] (+0.000089273) >> [000000000e421ca9fb16] [1346144446.605780088] (+0.001229818) >> [000000000e421cb03e8b] [1346144446.606190573] (+0.000410485) >> [000000000e421cb1a000] [1346144446.606281058] (+0.000090485) >> [000000000e421cb89ab2] [1346144446.606738452] (+0.000457394) >> [000000000e421cbefa16] [1346144446.607156088] (+0.000417636) >> [000000000e421cc057fe] [1346144446.607245664] (+0.000089576) >> [000000000e421cfc3af5] [1346144446.611170391] (+0.003924727) >> [000000000e421d02756b] [1346144446.611578573] (+0.000408182) >> [000000000e421d03d888] [1346144446.611669482] (+0.000090909) >> [000000000e421d0ad063] [1346144446.612126149] (+0.000456667) >> [000000000e421d114a0e] [1346144446.612550512] (+0.000424363) >> [000000000e421d12a68a] [1346144446.612639724] (+0.000089212) >> [000000000e421d2c1cc5] [1346144446.614308391] (+0.001668667) >> [000000000e421d3260f0] [1346144446.614719058] (+0.000410667) >> [000000000e421d33c44a] [1346144446.614810028] (+0.000090970) >> [000000000e421d3abcda] [1346144446.615266876] (+0.000456848) >> [000000000e421d410326] [1346144446.615678088] (+0.000411212) >> [000000000e421d425f29] [1346144446.615767179] (+0.000089091) >> [000000000e421d59acd5] [1346144446.617294391] (+0.001527212) >> [000000000e421d5ff7de] [1346144446.617706816] (+0.000412425) >> [000000000e421d615f7a] [1346144446.617798876] (+0.000092060) >> [000000000e421d6855ad] [1346144446.618255119] (+0.000456243) >> [000000000e421d6eb1fd] [1346144446.618671967] (+0.000416848) >> [000000000e421d700fe5] [1346144446.618761543] (+0.000089576) >> [000000000e421d86f308] [1346144446.620261482] (+0.001499939) >> [000000000e421d8d4124] [1346144446.620674694] (+0.000413212) >> [000000000e421d8ea405] [1346144446.620765543] (+0.000090849) >> [000000000e421da58d13] [1346144446.622266997] (+0.001501454) >> [000000000e421dabb0cf] [1346144446.622669361] (+0.000402364) >> [000000000e421dad1594] [1346144446.622760694] (+0.000091333) >> [000000000e421dc2edac] [1346144446.624192270] (+0.001431576) >> [000000000e421dc93edc] [1346144446.624606270] (+0.000414000) >> [000000000e421dcaa50d] [1346144446.624697967] (+0.000091697) >> [000000000e421e4f0056] [1346144446.633372088] (+0.008674121) >> [000000000e421e557e08] [1346144446.633797482] (+0.000425394) >> [000000000e421e56e162] [1346144446.633888452] (+0.000090970) >> [000000000e421e636796] [1346144446.634709240] (+0.000820788) >> [000000000e421e64a7e6] [1346144446.634791240] (+0.000082000) >> [000000000e421e6ae404] [1346144446.635199846] (+0.000408606) >> [000000000e421e6dafb0] [1346144446.635383058] (+0.000183212) >> [000000000e421e6ec24f] [1346144446.635453361] (+0.000070303) >> [000000000e421e73ea9f] [1346144446.635791361] (+0.000338000) >> [000000000e421e88f797] [1346144446.637170937] (+0.001379576) >> [000000000e421e8c65ab] [1346144446.637395725] (+0.000224788) >> [000000000e421e8dbcf2] [1346144446.637483604] (+0.000087879) >> [000000000e421ea85c85] [1346144446.639228391] (+0.001744787) >> [000000000e421ea9c3e5] [1346144446.639320391] (+0.000092000) >> [000000000e421eafbeac] [1346144446.639712270] (+0.000391879) >> [000000000e421eb7f386] [1346144446.640250088] (+0.000537818) >> [000000000e421eb93399] [1346144446.640332027] (+0.000081939) >> >> Since the most significant 32 bits of the timestamp span from 0xe38 to >> 0xe42, whose difference is exactly 0xa (10 in decimal), I would assume >> they are somehow representing the uptime in seconds, whereas the least >> significant 32 bits are (maybe?) really (clock?) cycles. >> It looks like the maximum value reached by the least significant 32 bits >> is somewehere near 0x1fff'ffff (so 29 bits as opposed to 32). >> It's also easy to spot that the huge (4.3 seconds) gaps occur whenever >> there's an increase in the uppermost 32-bit fraction (0xe38->0xe39, >> etc...). >> >> Anyway, there's definitely something wrong with the way LLTng actually >> picks up those timestamps. >> Could someone please spend a few words on how these timestamps are >> computed on PowerPC? >> >> Thanks a lot! >> Gerlando >> >> On 08/28/2012 03:00 PM, Gerlando Falauto wrote: >>> Hi, >>> >>> picking up again from my own message... >>> >>> I'm try this again after these few months, and I still get some similar >>> behavior. >>> Again, it's a 32-bit PowerPC with 4ms system tick (CONFIG_HZ=250). The >>> machine has neither NTP nor internal clock, therefore I set a given >>> timestamp before starting the test. >>> Traces were generated using the latest master branch of the three >>> repositories (lttng-modules, lttng-tools, userspace-rcu). >>> >>> Running the following script on the target: >>> >>> date -s "2012-08-28 09:00:00" >>> lttng create trace >>> lttng enable-channel -k mychannel >>> lttng enable-event sched_switch,sched_wakeup -k -c mychannel >>> lttng start >>> echo waiting 10 seconds >>> sleep 10 >>> lttng stop >>> lttng destroy trace >>> date >>> >>> (for which I get the following output): >>> >>> Tue Aug 28 09:00:00 UTC 2012 >>> Session trace created. >>> Traces will be written in /root/lttng-traces/trace-20120828-090000 >>> Kernel channel mychannel enabled for session trace >>> kernel event sched_switch created in channel mychannel >>> kernel event sched_wakeup created in channel mychannel >>> Tracing started for session trace >>> waiting 10 seconds >>> Tracing stopped for session trace >>> Session trace destroyed >>> Tue Aug 28 09:00:10 UTC 2012 >>> >>> I get the following trace: >>> >>> babeltrace --clock-date --clock-gmt >>> /path/to/root/lttng-traces/trace-20120828-090000/ >>> [2012-08-28 09:00:00.348477307] (+?.?????????) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>> 20, prev_state = 0, next_comm = "cons_recv_fds", next_tid = 461, >>> next_prio = 20 } >>> [2012-08-28 09:00:00.350913974] (+0.002436667) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>> 20, prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio >>> = 20 } >>> [2012-08-28 09:00:00.352444701] (+0.001530727) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 492, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.352584944] (+0.000140243) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "klogd", tid = 385, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.352691186] (+0.000106242) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.352853368] (+0.000162182) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>> 20, prev_state = 0, next_comm = "klogd", next_tid = 385, next_prio = 20 } >>> [2012-08-28 09:00:00.353377247] (+0.000523879) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.354078519] (+0.000701272) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "klogd", prev_tid = 385, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:00.354210095] (+0.000131576) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >>> [2012-08-28 09:00:00.355109428] (+0.000899333) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >>> prev_state = 130, next_comm = "klogd", next_tid = 385, next_prio = 20 } >>> [2012-08-28 09:00:00.355501731] (+0.000392303) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.355620519] (+0.000118788) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "klogd", prev_tid = 385, prev_prio = 20, >>> prev_state = 0, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >>> [2012-08-28 09:00:00.356259610] (+0.000639091) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >>> prev_state = 130, next_comm = "klogd", next_tid = 385, next_prio = 20 } >>> [2012-08-28 09:00:00.356807429] (+0.000547819) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.357136883] (+0.000329454) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "klogd", prev_tid = 385, prev_prio = 20, >>> prev_state = 1, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >>> [2012-08-28 09:00:00.357816762] (+0.000679879) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >>> prev_state = 130, next_comm = "lttng", next_tid = 492, next_prio = 20 } >>> [2012-08-28 09:00:00.358233853] (+0.000417091) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.358371125] (+0.000137272) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >>> prev_state = 0, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >>> [2012-08-28 09:00:00.360446034] (+0.002074909) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >>> prev_state = 1, next_comm = "lttng", next_tid = 492, next_prio = 20 } >>> [2012-08-28 09:00:00.361265065] (+0.000819031) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.361352459] (+0.000087394) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >>> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >>> [2012-08-28 09:00:00.361385974] (+0.000033515) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 492, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.361461186] (+0.000075212) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >>> prev_state = 1, next_comm = "lttng", next_tid = 492, next_prio = 20 } >>> [2012-08-28 09:00:00.361540459] (+0.000079273) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.361600641] (+0.000060182) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >>> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >>> [2012-08-28 09:00:00.361685247] (+0.000084606) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >>> prev_state = 1, next_comm = "lttng", next_tid = 492, next_prio = 20 } >>> [2012-08-28 09:00:00.362983004] (+0.001297757) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sh", tid = 388, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.363067247] (+0.000084243) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >>> prev_state = 64, next_comm = "sh", next_tid = 388, next_prio = 20 } >>> [2012-08-28 09:00:00.363663428] (+0.000596181) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.363753004] (+0.000089576) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >>> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >>> [2012-08-28 09:00:00.363788155] (+0.000035151) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sh", tid = 388, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.363856580] (+0.000068425) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >>> prev_state = 1, next_comm = "sh", next_tid = 388, next_prio = 20 } >>> [2012-08-28 09:00:00.363922519] (+0.000065939) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.364054580] (+0.000132061) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >>> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >>> [2012-08-28 09:00:00.364119004] (+0.000064424) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >>> prev_state = 1, next_comm = "sh", next_tid = 388, next_prio = 20 } >>> [2012-08-28 09:00:00.366897247] (+0.002778243) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 461, next_prio = >>> 20 } >>> [2012-08-28 09:00:00.367404640] (+0.000507393) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>> 20, prev_state = 1, next_comm = "sh", next_tid = 388, next_prio = 20 } >>> [2012-08-28 09:00:00.367605549] (+0.000200909) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >>> prev_state = 1, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >>> [2012-08-28 09:00:00.367966701] (+0.000361152) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>> 20, prev_state = 1, next_comm = "sh", next_tid = 495, next_prio = 20 } >>> [2012-08-28 09:00:00.369751065] (+0.001784364) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 495, prev_prio = 20, >>> prev_state = 130, next_comm = "cons_recv_fds", next_tid = 494, next_prio >>> = 20 } >>> [2012-08-28 09:00:00.370164277] (+0.000413212) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sh", tid = 495, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.371547186] (+0.001382909) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >>> 20, prev_state = 130, next_comm = "sh", next_tid = 495, next_prio = 20 } >>> [2012-08-28 09:00:00.371978216] (+0.000431030) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.372420277] (+0.000442061) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 495, prev_prio = 20, >>> prev_state = 130, next_comm = "cons_recv_fds", next_tid = 494, next_prio >>> = 20 } >>> [2012-08-28 09:00:00.372877853] (+0.000457576) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sh", tid = 495, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.373435004] (+0.000557151) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >>> 20, prev_state = 130, next_comm = "sh", next_tid = 495, next_prio = 20 } >>> [2012-08-28 09:00:00.373916641] (+0.000481637) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.374868943] (+0.000952302) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 495, prev_prio = 20, >>> prev_state = 130, next_comm = "cons_recv_fds", next_tid = 494, next_prio >>> = 20 } >>> [2012-08-28 09:00:00.375289610] (+0.000420667) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sh", tid = 495, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.375731186] (+0.000441576) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >>> 20, prev_state = 130, next_comm = "sh", next_tid = 495, next_prio = 20 } >>> [2012-08-28 09:00:00.376117428] (+0.000386242) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.378842034] (+0.002724606) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 494, next_prio = >>> 20 } >>> [2012-08-28 09:00:00.379333671] (+0.000491637) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >>> 20, prev_state = 130, next_comm = "sleep", next_tid = 495, next_prio = 20 } >>> [2012-08-28 09:00:00.380850217] (+0.001516546) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:00.381269065] (+0.000418848) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sleep", tid = 495, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:00.381361004] (+0.000091939) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "sleep", next_tid = 495, next_prio = 20 } >>> [2012-08-28 09:00:00.386596822] (+0.005235818) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >>> prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:00.394262762] (+0.007665940) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.394357368] (+0.000094606) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 494, next_prio = >>> 20 } >>> [2012-08-28 09:00:00.394719974] (+0.000362606) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 461, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.395709549] (+0.000989575) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >>> 20, prev_state = 64, next_comm = "cons_recv_fds", next_tid = 461, >>> next_prio = 20 } >>> [2012-08-28 09:00:00.396408701] (+0.000699152) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_poll_fds", tid = 462, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.398866640] (+0.002457939) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>> 20, prev_state = 0, next_comm = "cons_poll_fds", next_tid = 462, >>> next_prio = 20 } >>> [2012-08-28 09:00:00.398973428] (+0.000106788) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_poll_fds", prev_tid = 462, prev_prio = >>> 20, prev_state = 2, next_comm = "cons_recv_fds", next_tid = 461, >>> next_prio = 20 } >>> [2012-08-28 09:00:00.399076034] (+0.000102606) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_poll_fds", tid = 462, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.399131186] (+0.000055152) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>> 20, prev_state = 0, next_comm = "cons_poll_fds", next_tid = 462, >>> next_prio = 20 } >>> [2012-08-28 09:00:00.401086701] (+0.001955515) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_poll_fds", prev_tid = 462, prev_prio = >>> 20, prev_state = 1, next_comm = "cons_recv_fds", next_tid = 461, >>> next_prio = 20 } >>> [2012-08-28 09:00:00.401670216] (+0.000583515) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>> 20, prev_state = 1, next_comm = "cons_recv_fds", next_tid = 496, >>> next_prio = 20 } >>> [2012-08-28 09:00:00.402858156] (+0.001187940) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >>> 20, prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:00.403272398] (+0.000414242) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 496, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.403363852] (+0.000091454) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 496, next_prio = >>> 20 } >>> [2012-08-28 09:00:00.403830277] (+0.000466425) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >>> 20, prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:00.404193731] (+0.000363454) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 496, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.404283852] (+0.000090121) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 496, next_prio = >>> 20 } >>> [2012-08-28 09:00:00.404909247] (+0.000625395) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >>> 20, prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:00.405407065] (+0.000497818) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 496, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.405496823] (+0.000089758) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 496, next_prio = >>> 20 } >>> [2012-08-28 09:00:00.405854156] (+0.000357333) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 461, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.405938822] (+0.000084666) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >>> 20, prev_state = 0, next_comm = "cons_recv_fds", next_tid = 461, >>> next_prio = 20 } >>> [2012-08-28 09:00:00.406084095] (+0.000145273) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>> 20, prev_state = 1, next_comm = "cons_recv_fds", next_tid = 496, >>> next_prio = 20 } >>> [2012-08-28 09:00:00.407004519] (+0.000920424) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 461, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.407075186] (+0.000070667) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >>> 20, prev_state = 64, next_comm = "cons_recv_fds", next_tid = 461, >>> next_prio = 20 } >>> [2012-08-28 09:00:00.407706034] (+0.000630848) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "cons_poll_fds", tid = 462, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:00.407897368] (+0.000191334) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>> 20, prev_state = 1, next_comm = "cons_poll_fds", next_tid = 462, >>> next_prio = 20 } >>> [2012-08-28 09:00:00.408304580] (+0.000407212) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "cons_poll_fds", prev_tid = 462, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:04.547552602] (+4.139248022) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:04.547632966] (+0.000080364) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:04.547736542] (+0.000103576) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:04.691537693] (+0.143801151) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "flush-0:14", tid = 389, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:04.691615027] (+0.000077334) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "flush-0:14", next_tid = 389, next_prio = 20 } >>> [2012-08-28 09:00:04.691705269] (+0.000090242) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "flush-0:14", prev_tid = 389, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:05.311535024] (+0.619829755) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:05.311613084] (+0.000078060) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:05.311882903] (+0.000269819) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:08.842504805] (+3.530621902) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:08.842583350] (+0.000078545) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:08.842664562] (+0.000081212) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:08.994502865] (+0.151838303) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:08.994581229] (+0.000078364) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:08.994670441] (+0.000089212) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:13.137477252] (+4.142806811) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:13.137557191] (+0.000079939) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:13.137656101] (+0.000098910) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:13.901469492] (+0.763813391) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:13.901548037] (+0.000078545) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:13.902056037] (+0.000508000) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:13.905507067] (+0.003451030) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sync_supers", tid = 76, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:13.905589916] (+0.000082849) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "sync_supers", next_tid = 76, next_prio = 20 } >>> [2012-08-28 09:00:13.905661613] (+0.000071697) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sync_supers", prev_tid = 76, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:17.432437394] (+3.526775781) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:17.432515636] (+0.000078242) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:17.432599636] (+0.000084000) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:21.727404869] (+4.294805233) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:21.727485232] (+0.000080363) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:21.727587050] (+0.000101818) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:22.491405717] (+0.763818667) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:22.491484384] (+0.000078667) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:22.491873414] (+0.000389030) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:26.022372104] (+3.530498690) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:26.022450467] (+0.000078363) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:26.022531134] (+0.000080667) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:26.166376770] (+0.143845636) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "flush-0:14", tid = 389, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:26.166453558] (+0.000076788) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "flush-0:14", next_tid = 389, next_prio = 20 } >>> [2012-08-28 09:00:26.166543558] (+0.000090000) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "flush-0:14", prev_tid = 389, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:30.317347278] (+4.150803720) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:30.317427399] (+0.000080121) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:30.317528550] (+0.000101151) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:31.081338729] (+0.763810179) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:31.081417759] (+0.000079030) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:31.081881335] (+0.000463576) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:34.612306086] (+3.530424751) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:34.612384571] (+0.000078485) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:34.612465116] (+0.000080545) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:38.907282170] (+4.294817054) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:38.907362109] (+0.000079939) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:38.907461442] (+0.000099333) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:39.622817924] (+0.715356482) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:39.622887803] (+0.000069879) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >>> [2012-08-28 09:00:39.623148106] (+0.000260303) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >>> prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:39.671276530] (+0.048128424) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:39.671355864] (+0.000079334) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:39.671687682] (+0.000331818) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:39.675311742] (+0.003624060) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sync_supers", tid = 76, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:39.675394409] (+0.000082667) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "sync_supers", next_tid = 76, next_prio = 20 } >>> [2012-08-28 09:00:39.675466288] (+0.000071879) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sync_supers", prev_tid = 76, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.202240735] (+3.526774447) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.202318857] (+0.000078122) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>> [2012-08-28 09:00:43.202402250] (+0.000083393) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.346233038] (+0.143830788) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sleep", tid = 495, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.346330614] (+0.000097576) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "sleep", next_tid = 495, next_prio = 20 } >>> [2012-08-28 09:00:43.347314432] (+0.000983818) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sh", tid = 388, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.347383644] (+0.000069212) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >>> prev_state = 64, next_comm = "sh", next_tid = 388, next_prio = 20 } >>> [2012-08-28 09:00:43.349999825] (+0.002616181) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >>> prev_state = 1, next_comm = "sh", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.351726735] (+0.001726910) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.352191159] (+0.000464424) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sh", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.352283038] (+0.000091879) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "sh", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.353304492] (+0.001021454) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.353711038] (+0.000406546) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "sh", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.353802856] (+0.000091818) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "sh", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.357738795] (+0.003935939) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.358151644] (+0.000412849) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.358400311] (+0.000248667) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.358873644] (+0.000473333) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.359283644] (+0.000410000) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.359375523] (+0.000091879) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.360845098] (+0.001469575) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.361246492] (+0.000401394) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.361338977] (+0.000092485) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.361800674] (+0.000461697) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.362320250] (+0.000519576) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.362479463] (+0.000159213) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.363838068] (+0.001358605) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.364240553] (+0.000402485) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.364332553] (+0.000092000) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.364792189] (+0.000459636) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.365205038] (+0.000412849) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.365296916] (+0.000091878) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.366988129] (+0.001691213) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.367399705] (+0.000411576) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.367492371] (+0.000092666) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.368825704] (+0.001333333) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.369229038] (+0.000403334) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.369321280] (+0.000092242) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.370950675] (+0.001629395) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.371353220] (+0.000402545) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.371445462] (+0.000092242) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.380016917] (+0.008571455) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.380428129] (+0.000411212) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.380521159] (+0.000093030) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.381335462] (+0.000814303) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:43.381420795] (+0.000085333) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >>> [2012-08-28 09:00:43.381826250] (+0.000405455) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>> 20, prev_state = 1, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.382007038] (+0.000180788) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:43.382081522] (+0.000074484) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >>> [2012-08-28 09:00:43.382528190] (+0.000446668) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>> 20, prev_state = 1, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.383627341] (+0.001099151) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>> [2012-08-28 09:00:43.384035280] (+0.000407939) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>> target_cpu = 0 } >>> [2012-08-28 09:00:43.384128189] (+0.000092909) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.385790613] (+0.001662424) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:43.385877704] (+0.000087091) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >>> [2012-08-28 09:00:43.386442190] (+0.000564486) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>> 20, prev_state = 1, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>> [2012-08-28 09:00:43.386978008] (+0.000535818) mgcoge3ne sched_wakeup: { >>> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >>> 1, target_cpu = 0 } >>> [2012-08-28 09:00:43.387074129] (+0.000096121) mgcoge3ne sched_switch: { >>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >>> >>> So again, I get these huge 3.3 (or so) seconds gaps, and a final >>> timestamp which is 43 seconds instead of the 10 seconds which actually >>> went by. >>> >>> BTW, I also tried with TMF under Eclipse, and here I get even weirder >>> results. Here's a table of correspondence (as there must be some occult >>> side to it!) for the timestamps as reported by babeltrace vs. Eclipse: >>> >>> [2012-08-28 09:00:00.348477307] -> 2033-05-07 16:49:22.035276997 >>> ... >>> [2012-08-28 09:00:00.408304580] -> 2033-05-07 16:49:22.112912324 >>> .... >>> [2012-08-28 09:00:04.691537693] -> 2039-11-23 09:06:50.748861638 >>> >>> Under Eclipse, the latest event of this 10-second trace lies sometime >>> within year 2124. >>> >>> No clue, anyone? >>> >>> Thank you, >>> Gerlando >>> >>> On 12/16/2011 11:15 AM, Gerlando Falauto wrote: >>>> Hi, >>>> >>>> I am trying to use LLTng 2.0 (since I have no alternative for a 3.0 >>>> kernel!) and I of course use babeltrace to read them. >>>> Problem is, I can't make any sense out of the timestamps, as I get >>>> something like (two CPU-hog bash processes): >>>> >>>> [1658841591493] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>> next_prio = 20 } >>>> [1658845590645] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>> next_prio = 20 } >>>> [1658849590039] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>> next_prio = 20 } >>>> [1658853591069] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>> next_prio = 20 } >>>> [1662152559395] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>> next_prio = 20 } >>>> [1662156587941] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>> next_prio = 20 } >>>> [1662160557698] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>> next_prio = 20 } >>>> [1662164557517] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>> next_prio = 20 } >>>> [....................................cut...........................] >>>> [1663140553029] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>> next_prio = 20 } >>>> [1663144555029] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>> next_prio = 20 } >>>> [1663148552423] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>> next_prio = 20 } >>>> [1666447519719] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>> next_prio = 20 } >>>> [1666451561355] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>> 646, prev_prio = 20, prev_state = 0, next_comm = "kworker/0:1", next_tid >>>> = 94, next_prio = 20 } >>>> [1666451863719] sched_switch: { 0 }, { prev_comm = "kworker/0:1", >>>> prev_tid = 94, prev_prio = 20, prev_state = 1, next_comm = "bash", >>>> next_tid = 647, next_prio = 20 } >>>> >>>> Which made me think timestamps were expressed in nanoseconds, as I am >>>> running this on 4ms-tick PowerPC (CONFIG_HZ=250), and the difference >>>> between timestamps is approximately 4,000,000. >>>> However, I get these huge 3.3 second gaps between for instance between >>>> 1658853591069 and 1662152559395. >>>> Curiously enough, these leap 3.3 seconds occur exactly (well, within 4ms >>>> precision...) every second. Kind of like the "seconds" part of the >>>> timestamp is calculated on a wrong-base arithmetics or so.... >>>> This also makes sense as the seconds' portion of the timestamp is >>>> essentially 4.3 times bigger than the uptime (and any time stretch is >>>> 4.3 times bigger than reality, for that matter). >>>> >>>> Any suggestions? >>>> >>>> Thanks! >>>> Gerlando >>>> >>>> P.S. This also happens without my hack for flight recording mode... >> >> >> _______________________________________________ >> lttng-dev mailing list >> lttng-dev at lists.lttng.org >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 6 09:43:46 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 6 Sep 2012 09:43:46 -0400 Subject: [lttng-dev] [RFC URCU PATCH] wfqueue: ABI v1, simplify implementation, 2.3x to 2.6x performance boost In-Reply-To: <50357FF8.9060704@cn.fujitsu.com> References: <20120815213107.GB17224@Krystal> <5032054D.7050508@cn.fujitsu.com> <20120820131642.GA551@Krystal> <50330371.6060401@cn.fujitsu.com> <50357FF8.9060704@cn.fujitsu.com> Message-ID: <20120906134346.GE3630@Krystal> * Lai Jiangshan (laijs at cn.fujitsu.com) wrote: > ping we discussed a "batch" design offline. Do you think you would have time to spin a patch implementing it ? Thanks, Mathieu > > On 08/21/2012 11:41 AM, Lai Jiangshan wrote: > > On 08/20/2012 09:16 PM, Mathieu Desnoyers wrote: > >> * Lai Jiangshan (laijs at cn.fujitsu.com) wrote: > >>> On 08/16/2012 05:31 AM, Mathieu Desnoyers wrote: > >>>> This work is derived from the patch from Lai Jiangshan submitted as > >>>> "urcu: new wfqueue implementation" > >>>> (http://lists.lttng.org/pipermail/lttng-dev/2012-August/018379.html) > >>>> > >>> > >> > >> Hi Lai, > >> > >>> Hi, Mathieu > >>> > >>> please add this part to your patch. > >>> > >>> Changes(item5 has alternative): > >>> > >>> 1) Reorder the head and the tail in struct cds_wfq_queue > >>> Reason: wfq is enqueue-preference > >> > >> Is this a technical improvement over the original order ? Both cache > >> lines are aligned, so it should not matter which one comes first. So I'm > >> not sure why we should favor one order vs the other. > >> > >>> 2) Reorder the code of ___cds_wfq_next_blocking() > >>> Reason: short code, better readability > >> > >> Yes, I agree with this change. Can you extract it into a separate patch ? > >> > >>> > >>> 3) Add cds_wfq_dequeue_[un]lock > >>> Reason: the fields of struct cds_wfq_queue are not exposed to users of lib, > >>> but some APIs needs to have this lock held. Add this locking function > >>> to allow the users use such APIs > >> > >> I agree with this change too. You can put it into the same patch as (2). > >> > >>> > >>> 4) Add cds_wfq_node_sync_next(), cds_wfq_dequeue_all_blocking() > >>> Reason: helper for for_each_* > >> > >> Points 4-5-6-7 will need more discussion. > >> > >> I don't like exposing "cds_wfq_node_sync_next()", which should remain an > >> internal implementation detail not exposed to queue users. The > >> "get_first"/"get_next" API, as well as the dequeue, are providing an > >> abstraction that hide the node synchronization, which makes it harder > >> for the user to make mistakes. Given that the fast-path of > >> cds_wfq_node_sync_next is just a pointer load and test, I don't think > >> that skipping this the second time we iterate on the same queue would > >> bring any significant performance improvement, but exposing sync_next > >> adds in API complexity, which I would like to avoid. > > > > If the name "cds_wfq_node_sync_next()" is bad and exposes the implementation, > > we can rename it to "__cds_wfq_next_blocking_nocheck()" to hide the implementation. > > > > "get_next_nocheck": get next node of a queue, the caller ensure that the next node is existed. > > "get_next": get next node of a queue, it also finds out that whether the next node is existed or not. > > > > Or just remove "cds_wfq_node_sync_next()", use "get_next" instead. > > > >> > >> About cds_wfq_dequeue_all_blocking(): the "cds_wfq_splice()" I > >> introduced performs the same action as "cds_wfq_dequeue_all_blocking()", > >> but ensures that we can splice lists multiple times (rather than only > >> once), which is a very neat side-effect. Let's imagine a use-case like > >> Tree RCU, where each CPU produce a queue of call_rcu callbacks, and we > >> need to merge pairs of queues together recursively until we reach the > >> tree root: by doing splice() at each level of the tree, we can combine > >> the queues into a single queue without ever needing to do an iteration > >> on each node: no node synchronization is needed until we actually need > >> to traverse the queue at the root node level. > >> > >> The cost of exposing dequeue_all is that we need to expose sync_next > >> (more complexity for the user). As you exposed in your earlier email, > >> the gain we get by exposing dequeue_all separately from splice is that > >> dequeue_all is 1 xchg() operation, while splice is 2 xchg() operations. > >> However, given that this operation is typically amortized over many > >> nodes makes performance optimization a less compelling argument than > >> simplicity of use. > > > > Reducing the temporary big struct is also my tempt. > > > > --- > > Related to "internal", see the bottom. > > > >> > >>> > >>> 5) Add more for_each_*, which default semantic is dequeuing > >>> Reason: __cds_wfq_for_each_blocking_undequeue is enough for undequeuing loops > >>> don't need to add more. > >>> looping and dequeuing are the most probable use-cases. > >>> dequeuing for_each_* make the queue like a pipe. make it act as a channel.(GO language) > >>> Alternative: rename these dequeuing __cds_wfq_for_each*() to __cds_wfq_dequeue_for_each* > >> > >> I notice, in the iterators you added, the presence of > >> "cds_wfq_for_each_blocking_nobreak", and > >> "cds_wfq_for_each_blocking_nobreak_internal", which document that this > >> special flavor is needed for loops that do not have a "break" statement. > >> That seems to be very much error-prone and counter-intuitive for users, > >> and I would like to avoid that. > > > > __cds_wfq_for_each_blocking_safe(remove-all) is also "no-break"(*), is it error-prone and ...? > > > > So this is not a good reason to reject cds_wfq_for_each_blocking_nobreak(), if the user > > don't know how to use it, he should use cds_wfq_for_each_blocking() (the version in my > > patch which is dequeue()-based and we can break from the loop body) > > > > __cds_wfq_for_each_blocking_safe() and cds_wfq_for_each_blocking_nobreak() are exactly the > > same semantic in "remove-all" and "no-break". but cds_wfq_for_each_blocking_nobreak() > > does NOT CORRUPT the queue. > > > > So cds_wfq_for_each_blocking_nobreak() is yet another __cds_wfq_for_each_blocking_safe() > > and it don't corrupt the queue, it is really safer than __cds_wfq_for_each_blocking_safe(). > > > > """"footnote: (*) > > __cds_wfq_for_each_blocking_safe() should be used for "remove-none" or "remove-all" > > We should use __cds_wfq_for_each_blocking_undequeue() instead of __cds_wfq_for_each_blocking_safe(remove-none) > > """ > > > >> > >> The "internal" flavor, along with "sync_next" are then used in the > >> call_rcu code, since they are needed to get the best performance > >> possible. I don't like to use special, internal APIs for call_rcu: the > >> original motivation for refactoring the wfqueue code was testability, > >> and I would really like to make sure that the APIs we use internally are > >> also exposed to the outside world, mainly for testability, and also > >> because if we need to directly access internal interfaces to have good > >> performance, it means we did a poor job at exporting APIs that allow to > >> do the same kind of highly-efficient use of the queue. Exposing an API > >> with the "internal" keyword in it clearly discourages users from using > >> it. > > > > Related to "internal" see the bottom. > > > >> > >> > >>> > >>> 6) Remove __cds_wfq_for_each_blocking_safe > >>> Reason: its semantic is not clear, hard to define a well-defined semantic to it. > >>> when we use it, we have to delete none or delete all nodes, even when we delete all nodes, > >>> struct cds_wfq_queue still becomes stale while looping or after loop. > >> > >> The typical use-case I envision is: > >> > >> - enqueue many nodes to queue A > >> > >> - then, a dequeuer thread splice the content of queue A into its temporary > >> queue T (which head is local on its stack). > >> > >> - now, the thread is free to iterate on queue T, as many times as it > >> likes, and it does not need to change the structure of the queue while > >> iterating on it (read-only operation, without side-effect). The last > >> time it iterates on queue T, it needs to use the _safe iteration and > >> free the nodes. > >> > >> - after the nodes have been deleted, the queue T can be simply discarded > >> (if on stack, function return will do so; if dynamically allocated, > >> can be simply reinitialized to an empty queue, or freed). > > > > My for_each_*() can do exactly the same thing in this use-case since we still > > have splice() and cds_wfq_for_each_blocking_nobreak()(safer **_safe()). Doesn't it? > > > > The memory represented a struct queue is big.(two cache line), something we need to > > avoid to use it in the stack.(shorten the stack size or avoid to cost 2 or 3 additional cache line). > > > > -----------a use case > > All these local field are hot in the stack(and for some reason, it is not in the registers) > > int count; > > struct cds_wfq_queue tmp; > > struct cds_wfq_node *node, *next; > > > > It will use 4 cache line. Should we always recommend the users use splice()+tmp? > > > >> > >> As you certainly noticed, we can iterate both on a queue being > >> concurrently enqueued to, and on a queue that has been spliced into. > >> Being able to use iterators and dequeue on any queue (initial enqueue, > >> or queue spliced to) is a feature: we can therefore postpone the > >> "sync_next" synchronization to the moment where loop iteration is really > >> needed (lazy synchronization), which keeps optimal locality of reference > >> of synchronization vs node data access. > >> > >>> > >>> 7) Rename old __cds_wfq_for_each_blocking() to __cds_wfq_for_each_blocking_undequeue() > >>> Reason: the default semantic of the other for_each_* is dequeuing. > >> > >> I'm not convinced that "__cds_wfq_for_each_blocking_nobreak", > >> "__cds_wfq_for_each_blocking_nobreak_internal", and sync_next APIs are > >> improvements over the API I propose. For call_rcu, this turns > >> > >> cds_wfq_enqueue() > >> cds_wfq_splice_blocking() > >> __cds_wfq_for_each_blocking_safe() for iteration > >> > >> into: > >> > >> cds_wfq_enqueue() > >> __cds_wfq_dequeue_all_blocking() > >> __cds_wfq_for_each_blocking_nobreak_internal() for iteration > >> > >> Maybe we could do some documentation improvement to > >> "__cds_wfq_for_each_blocking(_safe)", __cds_wfq_first_blocking(), > >> __cds_wfq_next_blocking() API members I proposed. Maybe I did not > >> document them well enough ? > >> > > > > It does be not enough for __cds_wfq_for_each_blocking_safe(). > > > > I *STRONGLY OPPOSE* __cds_wfq_for_each_blocking_safe()(although it is suggested by me). > > > > If you oppose the dequeue_all(), I agreed with this list: > > Remove old __cds_wfq_for_each_blocking_safe() > > Use manual splice()+get_first()+get_next() for call_rcu_thread(). > > Remove my proposed cds_wfq_for_each_blocking_nobreak() > > Remove my proposed sync_next(), dequeue_all(). > > Keep dequeue-based for_each() (alternative: introduce it in future) > > > > If you also agreed this list, could you please partially merge my patch to your patch > > and send it for review to reduce the review cycle. (don't forget the other minimal fixes in my patch) > > > > ========== > > About internals: > > > > I want to expose the for_each_*, I don't want to expose these helpers: > > cds_wfq_node_sync_next() > > cds_wfq_dequeue_all_blocking() > > __cds_wfq_dequeue_all_blocking() > > __cds_wfq_for_each_blocking_nobreak_internal() > > (and I want to disallow the users use these helpers directly). > > > > but the for_each_* use these helpers, so I have to declare it in the urcu/wfqueue.h, > > and they become a part of ABI. > > > > So these helpers become internal things, how to handle internal things > > in a exposed *.h? > > > > I found "__cds_list_del()" and "__tls_access_ ## name ()" are also > > internals, and they are exposed. Are they exposed correctly? > > > > In my view, exposed internals is OK, what we can do is disallowing > > the users use it directly and ensuring the compatibility. > > > > And we don't need to test exposed internals directly via testcases, because they are > > internals, just like we don't need to test so much un-exposed internals. > > When we test the exposed API, the internals will be also tested. > > > > The call_rcu_thread() use the internal directly and can't be tested as you mentioned. > > It is not totally true. call_rcu_thread() need to inject a "synchronize_rcu()" > > to __cds_wfq_for_each_blocking_nobreak(), so I have to use > > __cds_wfq_for_each_blocking_nobreak_internal(). > > Tests for __cds_wfq_for_each_blocking_nobreak() are enough for call_rcu_thread(). > > > > In one word, I don't agreed full of your disgust to the exposed internals, > > but I agree to remove the ones introduced in my patch. > > > > Thanks, > > Lai > > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 6 10:04:18 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 6 Sep 2012 10:04:18 -0400 Subject: [lttng-dev] [PATCH 2/2] urcu: add notice to URCU_TLS() for it is not async-signal-safe In-Reply-To: <20120810141615.GA27969@Krystal> References: <1344414673-14714-1-git-send-email-laijs@cn.fujitsu.com> <1344414673-14714-2-git-send-email-laijs@cn.fujitsu.com> <20120809141417.GC9064@Krystal> <20120809200211.GA14409@Krystal> <50247E96.9080909@cn.fujitsu.com> <20120810141615.GA27969@Krystal> Message-ID: <20120906140418.GG3630@Krystal> * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote: > (for the records: this discussion is about userspace RCU tls-compat.h, > which uses TLS on systems supporting it, and fall back to > pthread_key_create/getspecific/setspecific if not. The culprit of the > issue is that we want to allow reading the tls-compat variable from > signal handlers, and thus async-signal-safety of pthread_key_* and TLS. > > The code we refer to is: > http://git.lttng.org/?p=userspace-rcu.git;a=blob;f=urcu/tls-compat.h;h=192a53609fb5f6bc445f98fdd6bc26918126687e;hb=HEAD) > > * Lai Jiangshan (laijs at cn.fujitsu.com) wrote: > > On 08/10/2012 04:02 AM, Mathieu Desnoyers wrote: > > > Looking at the result of a quick google search: > > > > > > http://curl.haxx.se/mail/lib-2006-09/0224.html > > > http://www.slamb.org/projects/sigsafe/api/patternref.html > > > > > > "Additionally, it makes the same assumption as all other methods for > > > handling thread-directed signals (with the exception of kevent(2) > > > handling), that pthread_getspecific(2) is async signal-safe. This is not > > > guaranteed by SUSv3." > > > > > > and > > > > > > https://groups.google.com/forum/?fromgroups#!topic/comp.os.linux.development/nZfmndKbzJw[1-25] > > > > > > it looks like using pthread_getspecific from a signal handler is not > > > always safe, mainly due to possible use of sigaltstack. So disabling > > > signals works for the "pthread_key_create" part, but we still have an > > > issue with pthread_getspecific. > > > > > > Ideas are welcome on how to best deal with this issue. > > > > What's the problem with disabling signals + pthread_getspecific()? > > Waht's the problem with disabling signals + __tls_access_ ## name()? > > * pthread_key_* fallback > > Disabling signals would allow us to be reentrant with respect to > signals, which actually solves part of the problem (reentrancy) for the > pthread_key_create part (protected by lock). > > Disabling signals, AFAIU, (and if we disregard the SUSv3 standard for a > minute) should not be strictly required around the pthread_getspecific > call on most architectures (no lock taken). We should carefully review > the implementations for each architecture we support if we want to > assume this though. If the getspecific returns NULL. we should disable > signals and call pthread_getspecific again with signals disabled, and > then call pthread_setspecific if necessary, before re-enabling signals. > The benefit of not _always_ disabling signals around > pthread_getspecific() is significant gain in performance in the common > case: the entire hot path of rcu_read_lock/unlock all happens in > userspace, without any system call, and uses tls-compat variables. > > The other part of the problem with pthread_getspecific and signal > handlers is that it does not seem to be SUSv3-compliant to use > pthread_getspecific() from within a signal handler. One example that can > lead to problems is if the signal handler is setup with sigaltstack(2). > > We might want to simply document this limitation: > > "RCU read-side critical sections can be used in signals handlers, except > those setup with sigaltstack(2)." Pushed a documentation change to that effect: commit 88ecbe6daa6da4850ea975b635cd1af8e4ca9bfe Author: Mathieu Desnoyers Date: Thu Sep 6 09:58:36 2012 -0400 Document sigaltstack(2) limitation Signed-off-by: Mathieu Desnoyers > > > * TLS > > Userspace RCU always touch the TLS variables from thread context (from > within rcu_register_thread()) before they are allowed to be touched by > signal handlers nested over threads. This ensures that issues with lazy > binding and dynamic linker lock are not encountered > (ref. http://sourceware.org/ml/libc-alpha/2012-06/msg00372.html). I did > the same within my LTTng-UST use of TLS variables: they are touched by a > constructor once so we don't run into deadlocks between UST lock and the > libc lock protecting dynamic linking (recursive mutex also taken around > the constructor calls, within which we needed to take the UST lock, thus > causing deadlocks). > This one should therefore just work (unless someone thinks otherwise). Thanks, Mathieu > > Feedback is welcome, > > Thanks, > > Mathieu > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 6 10:11:01 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 6 Sep 2012 10:11:01 -0400 Subject: [lttng-dev] Timestamps in babeltrace In-Reply-To: <5048A853.2070701@keymile.com> References: <4EEB1A44.2020500@keymile.com> <503CC0DF.7030607@keymile.com> <503E3297.8090703@keymile.com> <20120906133819.GB3630@Krystal> <5048A853.2070701@keymile.com> Message-ID: <20120906141101.GI3630@Krystal> * Gerlando Falauto (gerlando.falauto at keymile.com) wrote: > Hi Mathieu, > > thanks for your answer. > Actually I already found a solution and posted a patch to the list... > didn't you see that? ah! that's the patch I was looking for ;) Sorry, my inbox grew significantly in the past 2 weeks, thanks to LinuxCon/Plumbers etc.. > > As for whatever junk I see on TMF, well... that's a problem within TMS! > So I am crying for help on their list about that. :-) OK, I'm poking them with a large stick. They are not forgetting you, just busy in the current week or so. Thanks, Mathieu > > Thanks, > Gerlando > > On 09/06/2012 03:38 PM, Mathieu Desnoyers wrote: >> Hello! >> >> We use the kernel clock gettime (see >> lttng-modules/wrapper/trace-clock.h). Currently we use ktime_get(), but >> I think I need to fix that for archs where it does not return >> nanoseconds, but I doubt this would be causing your issue. What we _do_ >> expect though is that ktime_get returns a monotonic time from a CPU >> point of view. If your time source ever goes backward, this would be >> seen as an overflow. >> >> You might want to triple-check that your time source never go backward. >> >> Mathieu >> >> * Gerlando Falauto (gerlando.falauto at keymile.com) wrote: >>> Hi again, >>> >>> I tested this on an ARM board, and results look OK on both babeltrace >>> and within TMF. So there must be something wrong with the way timestamps >>> are calculated (and/or stored) by LLTng 2.x on the target. >>> >>> I looked at the timestamps again (having babeltrace dump the >>> timestamp-cycles in HEX, sided by timestamp-seconds), and got the >>> following: >>> >>> [000000000e3816c58e6e] [1346144403.557251024] (+?.?????????) >>> [000000000e3816e58d02] [1346144403.559347812] (+0.002096788) >>> [000000000e3816e887cb] [1346144403.559543085] (+0.000195273) >>> [000000000e3816f08eb7] [1346144403.560069145] (+0.000526060) >>> [000000000e3816f91981] [1346144403.560628963] (+0.000559818) >>> [000000000e38170a3b65] [1346144403.561751751] (+0.001122788) >>> [000000000e3817108c1b] [1346144403.562165629] (+0.000413878) >>> [000000000e381712d427] [1346144403.562315145] (+0.000149516) >>> [000000000e38172a770d] [1346144403.563864175] (+0.001549030) >>> [000000000e381744a88b] [1346144403.565580781] (+0.001716606) >>> [000000000e38176dd2e6] [1346144403.568278600] (+0.002697819) >>> [000000000e38176f4e65] [1346144403.568375751] (+0.000097151) >>> [000000000e381779ed61] [1346144403.569071811] (+0.000696060) >>> [000000000e38177b3f36] [1346144403.569158296] (+0.000086485) >>> [000000000e38177bc849] [1346144403.569193387] (+0.000035091) >>> [000000000e38177ce3e7] [1346144403.569265993] (+0.000072606) >>> [000000000e38177e25a3] [1346144403.569348357] (+0.000082364) >>> [000000000e38177f214b] [1346144403.569412781] (+0.000064424) >>> [000000000e3817804754] [1346144403.569488054] (+0.000075273) >>> [000000000e381793d8cc] [1346144403.570770478] (+0.001282424) >>> [000000000e3817951f07] [1346144403.570853993] (+0.000083515) >>> [000000000e38179cc3b5] [1346144403.571354903] (+0.000500910) >>> [000000000e38179ef04a] [1346144403.571497388] (+0.000142485) >>> [000000000e3817a066d0] [1346144403.571593266] (+0.000095878) >>> [000000000e3817a84ab3] [1346144403.572110357] (+0.000517091) >>> [000000000e3817aaf798] [1346144403.572285690] (+0.000175333) >>> [000000000e3817acc2a4] [1346144403.572403206] (+0.000117516) >>> [000000000e3817bc26fb] [1346144403.573411933] (+0.001008727) >>> [000000000e3817c223e3] [1346144403.573804357] (+0.000392424) >>> [000000000e3817c3731d] [1346144403.573890175] (+0.000085818) >>> [000000000e3817c3fb7a] [1346144403.573925084] (+0.000034909) >>> [000000000e3817c50c71] [1346144403.573994963] (+0.000069879) >>> [000000000e3817c64a26] [1346144403.574076296] (+0.000081333) >>> [000000000e3817c74519] [1346144403.574140539] (+0.000064243) >>> [000000000e3817c8684a] [1346144403.574215084] (+0.000074545) >>> [000000000e3817d4a27f] [1346144403.575016417] (+0.000801333) >>> [000000000e3817dbc719] [1346144403.575484539] (+0.000468122) >>> [000000000e3817de86b2] [1346144403.575664660] (+0.000180121) >>> [000000000e3817e98332] [1346144403.576384660] (+0.000720000) >>> [000000000e3817eed6d5] [1346144403.576733751] (+0.000349091) >>> [000000000e3817f0f079] [1346144403.576871387] (+0.000137636) >>> [000000000e3817fa997c] [1346144403.577504478] (+0.000633091) >>> [000000000e3817ffc467] [1346144403.577843145] (+0.000338667) >>> [000000000e3818100692] [1346144403.578908660] (+0.001065515) >>> [000000000e381817dcf7] [1346144403.579422297] (+0.000513637) >>> [000000000e381821774c] [1346144403.580051630] (+0.000629333) >>> [000000000e3818293e89] [1346144403.580561387] (+0.000509757) >>> [000000000e38182d7c79] [1346144403.580839387] (+0.000278000) >>> [000000000e38183661ef] [1346144403.581422417] (+0.000583030) >>> [000000000e38183d1430] [1346144403.581861266] (+0.000438849) >>> [000000000e3818433d9a] [1346144403.582265084] (+0.000403818) >>> [000000000e38184a844a] [1346144403.582741932] (+0.000476848) >>> [000000000e3818511160] [1346144403.583171266] (+0.000429334) >>> [000000000e381857ed4b] [1346144403.583620781] (+0.000449515) >>> [000000000e381861db33] [1346144403.584271509] (+0.000650728) >>> [000000000e3818678ef3] [1346144403.584645205] (+0.000373696) >>> [000000000e38186e85dc] [1346144403.585101630] (+0.000456425) >>> [000000000e381875ec45] [1346144403.585586599] (+0.000484969) >>> [000000000e38187af334] [1346144403.585916054] (+0.000329455) >>> [000000000e3818a5f4ac] [1346144403.588734478] (+0.002818424) >>> [000000000e3818bd10dd] [1346144403.590249023] (+0.001514545) >>> [000000000e3818c35f73] [1346144403.590662357] (+0.000413334) >>> [000000000e3818c4c52a] [1346144403.590753932] (+0.000091575) >>> [000000000e3818cbb849] [1346144403.591209387] (+0.000455455) >>> [000000000e3818cfcccb] [1346144403.591476781] (+0.000267394) >>> [000000000e3818d54f12] [1346144403.591837812] (+0.000361031) >>> [000000000e3818d81053] [1346144403.592018357] (+0.000180545) >>> [000000000e3818d932cf] [1346144403.592092721] (+0.000074364) >>> [000000000e3818de4f48] [1346144403.592427690] (+0.000334969) >>> [000000000e3818df9af5] [1346144403.592512599] (+0.000084909) >>> [000000000e38191378e5] [1346144403.595911751] (+0.003399152) >>> [000000000e38191542c1] [1346144403.596028963] (+0.000117212) >>> [000000000e3819189d6b] [1346144403.596248781] (+0.000219818) >>> [000000000e38191a4715] [1346144403.596357751] (+0.000108970) >>> [000000000e3819282a3e] [1346144403.597267872] (+0.000910121) >>> [000000000e38194e6256] [1346144403.599772600] (+0.002504728) >>> [000000000e3819516697] [1346144403.599970297] (+0.000197697) >>> [000000000e381953f0eb] [1346144403.600136781] (+0.000166484) >>> [000000000e38195791e5] [1346144403.600374599] (+0.000237818) >>> [000000000e38196bff4c] [1346144403.601713326] (+0.001338727) >>> [000000000e38196d4459] [1346144403.601796539] (+0.000083213) >>> [000000000e38197290a5] [1346144403.602143751] (+0.000347212) >>> [000000000e381975ccc5] [1346144403.602355751] (+0.000212000) >>> [000000000e381976eac1] [1346144403.602428963] (+0.000073212) >>> [000000000e38197bf486] [1346144403.602759144] (+0.000330181) >>> [000000000e38197e224a] [1346144403.602901932] (+0.000142788) >>> [000000000e38197f2364] [1346144403.602967750] (+0.000065818) >>> [000000000e381986a674] [1346144403.603460054] (+0.000492304) >>> [000000000e38198b8fcb] [1346144403.603781933] (+0.000321879) >>> [000000000e38198cd550] [1346144403.603865266] (+0.000083333) >>> [000000000e381992f086] [1346144403.604265448] (+0.000400182) >>> [000000000e3819943d9f] [1346144403.604350721] (+0.000085273) >>> [000000000e3819b686d8] [1346144403.606597690] (+0.002246969) >>> [000000000e3819b8259e] [1346144403.606703872] (+0.000106182) >>> [000000000e3819bb4684] [1346144403.606908902] (+0.000205030) >>> [000000000e3819ec04bc] [1346144403.610103326] (+0.003194424) >>> [000000000e3819eda61d] [1346144403.610210175] (+0.000106849) >>> [000000000e3819f0c77c] [1346144403.610415326] (+0.000205151) >>> [000000000e381a2178af] [1346144403.613606417] (+0.003191091) >>> [000000000e381a2314da] [1346144403.613711932] (+0.000105515) >>> [000000000e381a2633dc] [1346144403.613916478] (+0.000204546) >>> [000000000e381a4f3892] [1346144403.616604660] (+0.002688182) >>> [000000000e381a50ca8f] [1346144403.616707569] (+0.000102909) >>> [000000000e381a53e5c7] [1346144403.616911145] (+0.000203576) >>> [000000000e381a557437] [1346144403.617013145] (+0.000102000) >>> [000000000e381a7d5dc8] [1346144403.619628842] (+0.002615697) >>> [000000000e381a7fa51d] [1346144403.619778175] (+0.000149333) >>> [000000000e381a864560] [1346144403.620212418] (+0.000434243) >>> [000000000e381a9651cd] [1346144403.621264175] (+0.001051757) >>> [000000000e381aa37b5b] [1346144403.622126781] (+0.000862606) >>> [000000000e381ab84868] [1346144403.623489994] (+0.001363213) >>> [000000000e381ac23926] [1346144403.624141448] (+0.000651454) >>> [000000000e381adcda62] [1346144403.625886660] (+0.001745212) >>> [000000000e381ae50f78] [1346144403.626424538] (+0.000537878) >>> [000000000e381aebcd52] [1346144403.626866356] (+0.000441818) >>> [000000000e381aeec673] [1346144403.627061205] (+0.000194849) >>> [000000000e381b1e47ac] [1346144403.630174478] (+0.003113273) >>> [000000000e381b33e1bd] [1346144403.631590175] (+0.001415697) >>> [000000000e381b3a9348] [1346144403.632028842] (+0.000438667) >>> [000000000e381b636d9d] [1346144403.634706175] (+0.002677333) >>> [000000000e381b6b6304] [1346144403.635227750] (+0.000521575) >>> [000000000e381b72078a] [1346144403.635663084] (+0.000435334) >>> [000000000e381b7426dd] [1346144403.635802175] (+0.000139091) >>> [000000000e381b7b720d] [1346144403.636280175] (+0.000478000) >>> [000000000e381b839470] [1346144403.636813266] (+0.000533091) >>> [000000000e381b85aca9] [1346144403.636950539] (+0.000137273) >>> [000000000e381b8b5abb] [1346144403.637322781] (+0.000372242) >>> [000000000e381b9a25e6] [1346144403.638292296] (+0.000969515) >>> [000000000e381ba522a2] [1346144403.639012356] (+0.000720060) >>> [000000000e381ba86e62] [1346144403.639228356] (+0.000216000) >>> [000000000e381bb3f1d5] [1346144403.639982903] (+0.000754547) >>> [000000000e381bb7c172] [1346144403.640232660] (+0.000249757) >>> [000000000e3903588b84] [1346144407.526307046] (+3.886074386) >>> [000000000e390359cae2] [1346144407.526388804] (+0.000081758) >>> [000000000e39035b5e4b] [1346144407.526492077] (+0.000103273) >>> [000000000e390d5bcfc7] [1346144407.694293289] (+0.167801212) >>> [000000000e390d5cfa12] [1346144407.694369652] (+0.000076363) >>> [000000000e390d5e5b4b] [1346144407.694460077] (+0.000090425) >>> [000000000e390eca0c68] [1346144407.718294986] (+0.023834909) >>> [000000000e390ecb3326] [1346144407.718370440] (+0.000075454) >>> [000000000e390ecc897b] [1346144407.718458077] (+0.000087637) >>> [000000000e390f9daeac] [1346144407.732164622] (+0.013706545) >>> [000000000e390f9ea469] [1346144407.732227531] (+0.000062909) >>> [000000000e390fa2983f] [1346144407.732486561] (+0.000259030) >>> [000000000e3a003ef59a] [1346144411.769265916] (+4.036779355) >>> [000000000e3a00402dde] [1346144411.769345856] (+0.000079940) >>> [000000000e3a00458822] [1346144411.769696644] (+0.000350788) >>> [000000000e3a03586436] [1346144411.821264280] (+0.051567636) >>> [000000000e3a03598dcc] [1346144411.821340462] (+0.000076182) >>> [000000000e3a035ac596] [1346144411.821420280] (+0.000079818) >>> [000000000e3b0358576b] [1346144416.116228301] (+4.294808021) >>> [000000000e3b03598dca] [1346144416.116307756] (+0.000079455) >>> [000000000e3b035b1870] [1346144416.116408786] (+0.000101030) >>> [000000000e3c003ee0c3] [1346144420.359195173] (+4.242786387) >>> [000000000e3c00401228] [1346144420.359273354] (+0.000078181) >>> [000000000e3c00480297] [1346144420.359793657] (+0.000520303) >>> [000000000e3c035863f7] [1346144420.411198809] (+0.051405152) >>> [000000000e3c03598e43] [1346144420.411275173] (+0.000076364) >>> [000000000e3c035ac6ff] [1346144420.411355233] (+0.000080060) >>> [000000000e3d03586b4c] [1346144424.706167982] (+4.294812749) >>> [000000000e3d0359a7d2] [1346144424.706249012] (+0.000081030) >>> [000000000e3d035b2f28] [1346144424.706349194] (+0.000100182) >>> [000000000e3e003ee0fb] [1346144428.949129821] (+4.242780627) >>> [000000000e3e00401317] [1346144428.949208185] (+0.000078364) >>> [000000000e3e00495a90] [1346144428.949816306] (+0.000608121) >>> [000000000e3e00f6261f] [1346144428.961140609] (+0.011324303) >>> [000000000e3e00f79420] [1346144428.961234306] (+0.000093697) >>> [000000000e3e00f8ba29] [1346144428.961309579] (+0.000075273) >>> [000000000e3e03586522] [1346144429.001133700] (+0.039824121) >>> [000000000e3e03598e7b] [1346144429.001209821] (+0.000076121) >>> [000000000e3e035acd23] [1346144429.001291397] (+0.000081576) >>> [000000000e3e0d5bc868] [1346144429.169127882] (+0.167836485) >>> [000000000e3e0d5cf67d] [1346144429.169205215] (+0.000077333) >>> [000000000e3e0d60bcdf] [1346144429.169452609] (+0.000247394) >>> [000000000e3e0d645b02] [1346144429.169689700] (+0.000237091) >>> [000000000e3e0d711730] [1346144429.170524306] (+0.000834606) >>> [000000000e3e10139fd2] [1346144429.214730548] (+0.044206242) >>> [000000000e3e10150f7b] [1346144429.214824669] (+0.000094121) >>> [000000000e3e10190223] [1346144429.215083397] (+0.000258728) >>> [000000000e3e111413cf] [1346144429.231537457] (+0.016454060) >>> [000000000e3e11157581] [1346144429.231628003] (+0.000090546) >>> [000000000e3e11193dc7] [1346144429.231875881] (+0.000247878) >>> [000000000e3f03586de3] [1346144433.296103237] (+4.064227356) >>> [000000000e3f03599e93] [1346144433.296181237] (+0.000078000) >>> [000000000e3f035b2754] [1346144433.296281782] (+0.000100545) >>> [000000000e40003ee171] [1346144437.539064531] (+4.242782749) >>> [000000000e400040138c] [1346144437.539142894] (+0.000078363) >>> [000000000e4000462587] [1346144437.539540713] (+0.000397819) >>> [000000000e4003586469] [1346144437.591068107] (+0.051527394) >>> [000000000e4003598f6a] [1346144437.591144652] (+0.000076545) >>> [000000000e40035ac605] [1346144437.591224167] (+0.000079515) >>> [000000000e4103585761] [1346144441.886032067] (+4.294807900) >>> [000000000e4103598b62] [1346144441.886110916] (+0.000078849) >>> [000000000e41035b16fa] [1346144441.886212188] (+0.000101272) >>> [000000000e42003ee446] [1346144446.128999848] (+4.242787660) >>> [000000000e4200401532] [1346144446.129077908] (+0.000078060) >>> [000000000e420047efd9] [1346144446.129592635] (+0.000514727) >>> [000000000e420358699b] [1346144446.181004029] (+0.051411394) >>> [000000000e42035995cc] [1346144446.181080878] (+0.000076849) >>> [000000000e42035ad0aa] [1346144446.181161484] (+0.000080606) >>> [000000000e421c23e01f] [1346144446.596991361] (+0.415829877) >>> [000000000e421c2558c7] [1346144446.597087785] (+0.000096424) >>> [000000000e421c34e871] [1346144446.598107603] (+0.001019818) >>> [000000000e421c35d936] [1346144446.598169240] (+0.000061637) >>> [000000000e421c65189e] [1346144446.601265664] (+0.003096424) >>> [000000000e421c661b24] [1346144446.601331846] (+0.000066182) >>> [000000000e421c7fab69] [1346144446.603007179] (+0.001675333) >>> [000000000e421c86a8f2] [1346144446.603465300] (+0.000458121) >>> [000000000e421c880aa4] [1346144446.603555846] (+0.000090546) >>> [000000000e421c8f701b] [1346144446.604040573] (+0.000484727) >>> [000000000e421c95da63] [1346144446.604460997] (+0.000420424) >>> [000000000e421c97371c] [1346144446.604550270] (+0.000089273) >>> [000000000e421ca9fb16] [1346144446.605780088] (+0.001229818) >>> [000000000e421cb03e8b] [1346144446.606190573] (+0.000410485) >>> [000000000e421cb1a000] [1346144446.606281058] (+0.000090485) >>> [000000000e421cb89ab2] [1346144446.606738452] (+0.000457394) >>> [000000000e421cbefa16] [1346144446.607156088] (+0.000417636) >>> [000000000e421cc057fe] [1346144446.607245664] (+0.000089576) >>> [000000000e421cfc3af5] [1346144446.611170391] (+0.003924727) >>> [000000000e421d02756b] [1346144446.611578573] (+0.000408182) >>> [000000000e421d03d888] [1346144446.611669482] (+0.000090909) >>> [000000000e421d0ad063] [1346144446.612126149] (+0.000456667) >>> [000000000e421d114a0e] [1346144446.612550512] (+0.000424363) >>> [000000000e421d12a68a] [1346144446.612639724] (+0.000089212) >>> [000000000e421d2c1cc5] [1346144446.614308391] (+0.001668667) >>> [000000000e421d3260f0] [1346144446.614719058] (+0.000410667) >>> [000000000e421d33c44a] [1346144446.614810028] (+0.000090970) >>> [000000000e421d3abcda] [1346144446.615266876] (+0.000456848) >>> [000000000e421d410326] [1346144446.615678088] (+0.000411212) >>> [000000000e421d425f29] [1346144446.615767179] (+0.000089091) >>> [000000000e421d59acd5] [1346144446.617294391] (+0.001527212) >>> [000000000e421d5ff7de] [1346144446.617706816] (+0.000412425) >>> [000000000e421d615f7a] [1346144446.617798876] (+0.000092060) >>> [000000000e421d6855ad] [1346144446.618255119] (+0.000456243) >>> [000000000e421d6eb1fd] [1346144446.618671967] (+0.000416848) >>> [000000000e421d700fe5] [1346144446.618761543] (+0.000089576) >>> [000000000e421d86f308] [1346144446.620261482] (+0.001499939) >>> [000000000e421d8d4124] [1346144446.620674694] (+0.000413212) >>> [000000000e421d8ea405] [1346144446.620765543] (+0.000090849) >>> [000000000e421da58d13] [1346144446.622266997] (+0.001501454) >>> [000000000e421dabb0cf] [1346144446.622669361] (+0.000402364) >>> [000000000e421dad1594] [1346144446.622760694] (+0.000091333) >>> [000000000e421dc2edac] [1346144446.624192270] (+0.001431576) >>> [000000000e421dc93edc] [1346144446.624606270] (+0.000414000) >>> [000000000e421dcaa50d] [1346144446.624697967] (+0.000091697) >>> [000000000e421e4f0056] [1346144446.633372088] (+0.008674121) >>> [000000000e421e557e08] [1346144446.633797482] (+0.000425394) >>> [000000000e421e56e162] [1346144446.633888452] (+0.000090970) >>> [000000000e421e636796] [1346144446.634709240] (+0.000820788) >>> [000000000e421e64a7e6] [1346144446.634791240] (+0.000082000) >>> [000000000e421e6ae404] [1346144446.635199846] (+0.000408606) >>> [000000000e421e6dafb0] [1346144446.635383058] (+0.000183212) >>> [000000000e421e6ec24f] [1346144446.635453361] (+0.000070303) >>> [000000000e421e73ea9f] [1346144446.635791361] (+0.000338000) >>> [000000000e421e88f797] [1346144446.637170937] (+0.001379576) >>> [000000000e421e8c65ab] [1346144446.637395725] (+0.000224788) >>> [000000000e421e8dbcf2] [1346144446.637483604] (+0.000087879) >>> [000000000e421ea85c85] [1346144446.639228391] (+0.001744787) >>> [000000000e421ea9c3e5] [1346144446.639320391] (+0.000092000) >>> [000000000e421eafbeac] [1346144446.639712270] (+0.000391879) >>> [000000000e421eb7f386] [1346144446.640250088] (+0.000537818) >>> [000000000e421eb93399] [1346144446.640332027] (+0.000081939) >>> >>> Since the most significant 32 bits of the timestamp span from 0xe38 to >>> 0xe42, whose difference is exactly 0xa (10 in decimal), I would assume >>> they are somehow representing the uptime in seconds, whereas the least >>> significant 32 bits are (maybe?) really (clock?) cycles. >>> It looks like the maximum value reached by the least significant 32 bits >>> is somewehere near 0x1fff'ffff (so 29 bits as opposed to 32). >>> It's also easy to spot that the huge (4.3 seconds) gaps occur whenever >>> there's an increase in the uppermost 32-bit fraction (0xe38->0xe39, >>> etc...). >>> >>> Anyway, there's definitely something wrong with the way LLTng actually >>> picks up those timestamps. >>> Could someone please spend a few words on how these timestamps are >>> computed on PowerPC? >>> >>> Thanks a lot! >>> Gerlando >>> >>> On 08/28/2012 03:00 PM, Gerlando Falauto wrote: >>>> Hi, >>>> >>>> picking up again from my own message... >>>> >>>> I'm try this again after these few months, and I still get some similar >>>> behavior. >>>> Again, it's a 32-bit PowerPC with 4ms system tick (CONFIG_HZ=250). The >>>> machine has neither NTP nor internal clock, therefore I set a given >>>> timestamp before starting the test. >>>> Traces were generated using the latest master branch of the three >>>> repositories (lttng-modules, lttng-tools, userspace-rcu). >>>> >>>> Running the following script on the target: >>>> >>>> date -s "2012-08-28 09:00:00" >>>> lttng create trace >>>> lttng enable-channel -k mychannel >>>> lttng enable-event sched_switch,sched_wakeup -k -c mychannel >>>> lttng start >>>> echo waiting 10 seconds >>>> sleep 10 >>>> lttng stop >>>> lttng destroy trace >>>> date >>>> >>>> (for which I get the following output): >>>> >>>> Tue Aug 28 09:00:00 UTC 2012 >>>> Session trace created. >>>> Traces will be written in /root/lttng-traces/trace-20120828-090000 >>>> Kernel channel mychannel enabled for session trace >>>> kernel event sched_switch created in channel mychannel >>>> kernel event sched_wakeup created in channel mychannel >>>> Tracing started for session trace >>>> waiting 10 seconds >>>> Tracing stopped for session trace >>>> Session trace destroyed >>>> Tue Aug 28 09:00:10 UTC 2012 >>>> >>>> I get the following trace: >>>> >>>> babeltrace --clock-date --clock-gmt >>>> /path/to/root/lttng-traces/trace-20120828-090000/ >>>> [2012-08-28 09:00:00.348477307] (+?.?????????) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>>> 20, prev_state = 0, next_comm = "cons_recv_fds", next_tid = 461, >>>> next_prio = 20 } >>>> [2012-08-28 09:00:00.350913974] (+0.002436667) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>>> 20, prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio >>>> = 20 } >>>> [2012-08-28 09:00:00.352444701] (+0.001530727) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 492, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.352584944] (+0.000140243) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "klogd", tid = 385, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.352691186] (+0.000106242) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.352853368] (+0.000162182) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>>> 20, prev_state = 0, next_comm = "klogd", next_tid = 385, next_prio = 20 } >>>> [2012-08-28 09:00:00.353377247] (+0.000523879) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.354078519] (+0.000701272) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "klogd", prev_tid = 385, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:00.354210095] (+0.000131576) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >>>> [2012-08-28 09:00:00.355109428] (+0.000899333) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >>>> prev_state = 130, next_comm = "klogd", next_tid = 385, next_prio = 20 } >>>> [2012-08-28 09:00:00.355501731] (+0.000392303) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.355620519] (+0.000118788) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "klogd", prev_tid = 385, prev_prio = 20, >>>> prev_state = 0, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >>>> [2012-08-28 09:00:00.356259610] (+0.000639091) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >>>> prev_state = 130, next_comm = "klogd", next_tid = 385, next_prio = 20 } >>>> [2012-08-28 09:00:00.356807429] (+0.000547819) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.357136883] (+0.000329454) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "klogd", prev_tid = 385, prev_prio = 20, >>>> prev_state = 1, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >>>> [2012-08-28 09:00:00.357816762] (+0.000679879) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >>>> prev_state = 130, next_comm = "lttng", next_tid = 492, next_prio = 20 } >>>> [2012-08-28 09:00:00.358233853] (+0.000417091) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.358371125] (+0.000137272) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >>>> prev_state = 0, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >>>> [2012-08-28 09:00:00.360446034] (+0.002074909) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >>>> prev_state = 1, next_comm = "lttng", next_tid = 492, next_prio = 20 } >>>> [2012-08-28 09:00:00.361265065] (+0.000819031) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.361352459] (+0.000087394) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >>>> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >>>> [2012-08-28 09:00:00.361385974] (+0.000033515) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 492, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.361461186] (+0.000075212) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >>>> prev_state = 1, next_comm = "lttng", next_tid = 492, next_prio = 20 } >>>> [2012-08-28 09:00:00.361540459] (+0.000079273) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.361600641] (+0.000060182) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >>>> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >>>> [2012-08-28 09:00:00.361685247] (+0.000084606) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >>>> prev_state = 1, next_comm = "lttng", next_tid = 492, next_prio = 20 } >>>> [2012-08-28 09:00:00.362983004] (+0.001297757) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sh", tid = 388, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.363067247] (+0.000084243) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 492, prev_prio = 20, >>>> prev_state = 64, next_comm = "sh", next_tid = 388, next_prio = 20 } >>>> [2012-08-28 09:00:00.363663428] (+0.000596181) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.363753004] (+0.000089576) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >>>> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >>>> [2012-08-28 09:00:00.363788155] (+0.000035151) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sh", tid = 388, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.363856580] (+0.000068425) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >>>> prev_state = 1, next_comm = "sh", next_tid = 388, next_prio = 20 } >>>> [2012-08-28 09:00:00.363922519] (+0.000065939) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "ksoftirqd/0", tid = 3, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.364054580] (+0.000132061) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >>>> prev_state = 0, next_comm = "ksoftirqd/0", next_tid = 3, next_prio = 20 } >>>> [2012-08-28 09:00:00.364119004] (+0.000064424) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "ksoftirqd/0", prev_tid = 3, prev_prio = 20, >>>> prev_state = 1, next_comm = "sh", next_tid = 388, next_prio = 20 } >>>> [2012-08-28 09:00:00.366897247] (+0.002778243) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >>>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 461, next_prio = >>>> 20 } >>>> [2012-08-28 09:00:00.367404640] (+0.000507393) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>>> 20, prev_state = 1, next_comm = "sh", next_tid = 388, next_prio = 20 } >>>> [2012-08-28 09:00:00.367605549] (+0.000200909) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >>>> prev_state = 1, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >>>> [2012-08-28 09:00:00.367966701] (+0.000361152) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>>> 20, prev_state = 1, next_comm = "sh", next_tid = 495, next_prio = 20 } >>>> [2012-08-28 09:00:00.369751065] (+0.001784364) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 495, prev_prio = 20, >>>> prev_state = 130, next_comm = "cons_recv_fds", next_tid = 494, next_prio >>>> = 20 } >>>> [2012-08-28 09:00:00.370164277] (+0.000413212) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sh", tid = 495, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.371547186] (+0.001382909) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >>>> 20, prev_state = 130, next_comm = "sh", next_tid = 495, next_prio = 20 } >>>> [2012-08-28 09:00:00.371978216] (+0.000431030) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.372420277] (+0.000442061) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 495, prev_prio = 20, >>>> prev_state = 130, next_comm = "cons_recv_fds", next_tid = 494, next_prio >>>> = 20 } >>>> [2012-08-28 09:00:00.372877853] (+0.000457576) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sh", tid = 495, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.373435004] (+0.000557151) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >>>> 20, prev_state = 130, next_comm = "sh", next_tid = 495, next_prio = 20 } >>>> [2012-08-28 09:00:00.373916641] (+0.000481637) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.374868943] (+0.000952302) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 495, prev_prio = 20, >>>> prev_state = 130, next_comm = "cons_recv_fds", next_tid = 494, next_prio >>>> = 20 } >>>> [2012-08-28 09:00:00.375289610] (+0.000420667) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sh", tid = 495, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.375731186] (+0.000441576) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >>>> 20, prev_state = 130, next_comm = "sh", next_tid = 495, next_prio = 20 } >>>> [2012-08-28 09:00:00.376117428] (+0.000386242) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.378842034] (+0.002724606) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >>>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 494, next_prio = >>>> 20 } >>>> [2012-08-28 09:00:00.379333671] (+0.000491637) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >>>> 20, prev_state = 130, next_comm = "sleep", next_tid = 495, next_prio = 20 } >>>> [2012-08-28 09:00:00.380850217] (+0.001516546) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:00.381269065] (+0.000418848) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sleep", tid = 495, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:00.381361004] (+0.000091939) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "sleep", next_tid = 495, next_prio = 20 } >>>> [2012-08-28 09:00:00.386596822] (+0.005235818) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >>>> prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:00.394262762] (+0.007665940) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 494, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.394357368] (+0.000094606) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 494, next_prio = >>>> 20 } >>>> [2012-08-28 09:00:00.394719974] (+0.000362606) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 461, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.395709549] (+0.000989575) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 494, prev_prio = >>>> 20, prev_state = 64, next_comm = "cons_recv_fds", next_tid = 461, >>>> next_prio = 20 } >>>> [2012-08-28 09:00:00.396408701] (+0.000699152) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_poll_fds", tid = 462, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.398866640] (+0.002457939) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>>> 20, prev_state = 0, next_comm = "cons_poll_fds", next_tid = 462, >>>> next_prio = 20 } >>>> [2012-08-28 09:00:00.398973428] (+0.000106788) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_poll_fds", prev_tid = 462, prev_prio = >>>> 20, prev_state = 2, next_comm = "cons_recv_fds", next_tid = 461, >>>> next_prio = 20 } >>>> [2012-08-28 09:00:00.399076034] (+0.000102606) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_poll_fds", tid = 462, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.399131186] (+0.000055152) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>>> 20, prev_state = 0, next_comm = "cons_poll_fds", next_tid = 462, >>>> next_prio = 20 } >>>> [2012-08-28 09:00:00.401086701] (+0.001955515) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_poll_fds", prev_tid = 462, prev_prio = >>>> 20, prev_state = 1, next_comm = "cons_recv_fds", next_tid = 461, >>>> next_prio = 20 } >>>> [2012-08-28 09:00:00.401670216] (+0.000583515) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>>> 20, prev_state = 1, next_comm = "cons_recv_fds", next_tid = 496, >>>> next_prio = 20 } >>>> [2012-08-28 09:00:00.402858156] (+0.001187940) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >>>> 20, prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:00.403272398] (+0.000414242) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 496, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.403363852] (+0.000091454) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 496, next_prio = >>>> 20 } >>>> [2012-08-28 09:00:00.403830277] (+0.000466425) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >>>> 20, prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:00.404193731] (+0.000363454) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 496, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.404283852] (+0.000090121) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 496, next_prio = >>>> 20 } >>>> [2012-08-28 09:00:00.404909247] (+0.000625395) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >>>> 20, prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:00.405407065] (+0.000497818) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 496, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.405496823] (+0.000089758) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "cons_recv_fds", next_tid = 496, next_prio = >>>> 20 } >>>> [2012-08-28 09:00:00.405854156] (+0.000357333) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 461, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.405938822] (+0.000084666) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >>>> 20, prev_state = 0, next_comm = "cons_recv_fds", next_tid = 461, >>>> next_prio = 20 } >>>> [2012-08-28 09:00:00.406084095] (+0.000145273) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>>> 20, prev_state = 1, next_comm = "cons_recv_fds", next_tid = 496, >>>> next_prio = 20 } >>>> [2012-08-28 09:00:00.407004519] (+0.000920424) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_recv_fds", tid = 461, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.407075186] (+0.000070667) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 496, prev_prio = >>>> 20, prev_state = 64, next_comm = "cons_recv_fds", next_tid = 461, >>>> next_prio = 20 } >>>> [2012-08-28 09:00:00.407706034] (+0.000630848) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "cons_poll_fds", tid = 462, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:00.407897368] (+0.000191334) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_recv_fds", prev_tid = 461, prev_prio = >>>> 20, prev_state = 1, next_comm = "cons_poll_fds", next_tid = 462, >>>> next_prio = 20 } >>>> [2012-08-28 09:00:00.408304580] (+0.000407212) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "cons_poll_fds", prev_tid = 462, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:04.547552602] (+4.139248022) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:04.547632966] (+0.000080364) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:04.547736542] (+0.000103576) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:04.691537693] (+0.143801151) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "flush-0:14", tid = 389, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:04.691615027] (+0.000077334) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "flush-0:14", next_tid = 389, next_prio = 20 } >>>> [2012-08-28 09:00:04.691705269] (+0.000090242) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "flush-0:14", prev_tid = 389, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:05.311535024] (+0.619829755) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:05.311613084] (+0.000078060) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:05.311882903] (+0.000269819) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:08.842504805] (+3.530621902) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:08.842583350] (+0.000078545) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:08.842664562] (+0.000081212) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:08.994502865] (+0.151838303) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:08.994581229] (+0.000078364) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:08.994670441] (+0.000089212) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:13.137477252] (+4.142806811) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:13.137557191] (+0.000079939) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:13.137656101] (+0.000098910) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:13.901469492] (+0.763813391) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:13.901548037] (+0.000078545) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:13.902056037] (+0.000508000) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:13.905507067] (+0.003451030) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sync_supers", tid = 76, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:13.905589916] (+0.000082849) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "sync_supers", next_tid = 76, next_prio = 20 } >>>> [2012-08-28 09:00:13.905661613] (+0.000071697) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sync_supers", prev_tid = 76, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:17.432437394] (+3.526775781) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:17.432515636] (+0.000078242) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:17.432599636] (+0.000084000) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:21.727404869] (+4.294805233) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:21.727485232] (+0.000080363) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:21.727587050] (+0.000101818) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:22.491405717] (+0.763818667) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:22.491484384] (+0.000078667) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:22.491873414] (+0.000389030) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:26.022372104] (+3.530498690) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:26.022450467] (+0.000078363) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:26.022531134] (+0.000080667) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:26.166376770] (+0.143845636) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "flush-0:14", tid = 389, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:26.166453558] (+0.000076788) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "flush-0:14", next_tid = 389, next_prio = 20 } >>>> [2012-08-28 09:00:26.166543558] (+0.000090000) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "flush-0:14", prev_tid = 389, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:30.317347278] (+4.150803720) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:30.317427399] (+0.000080121) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:30.317528550] (+0.000101151) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:31.081338729] (+0.763810179) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:31.081417759] (+0.000079030) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:31.081881335] (+0.000463576) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:34.612306086] (+3.530424751) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:34.612384571] (+0.000078485) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:34.612465116] (+0.000080545) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:38.907282170] (+4.294817054) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:38.907362109] (+0.000079939) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:38.907461442] (+0.000099333) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:39.622817924] (+0.715356482) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "syslogd", tid = 383, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:39.622887803] (+0.000069879) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "syslogd", next_tid = 383, next_prio = 20 } >>>> [2012-08-28 09:00:39.623148106] (+0.000260303) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "syslogd", prev_tid = 383, prev_prio = 20, >>>> prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:39.671276530] (+0.048128424) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:39.671355864] (+0.000079334) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:39.671687682] (+0.000331818) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:39.675311742] (+0.003624060) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sync_supers", tid = 76, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:39.675394409] (+0.000082667) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "sync_supers", next_tid = 76, next_prio = 20 } >>>> [2012-08-28 09:00:39.675466288] (+0.000071879) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sync_supers", prev_tid = 76, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.202240735] (+3.526774447) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "kworker/0:1", tid = 99, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.202318857] (+0.000078122) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "kworker/0:1", next_tid = 99, next_prio = 20 } >>>> [2012-08-28 09:00:43.202402250] (+0.000083393) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "kworker/0:1", prev_tid = 99, prev_prio = >>>> 20, prev_state = 1, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.346233038] (+0.143830788) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sleep", tid = 495, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.346330614] (+0.000097576) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "sleep", next_tid = 495, next_prio = 20 } >>>> [2012-08-28 09:00:43.347314432] (+0.000983818) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sh", tid = 388, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.347383644] (+0.000069212) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sleep", prev_tid = 495, prev_prio = 20, >>>> prev_state = 64, next_comm = "sh", next_tid = 388, next_prio = 20 } >>>> [2012-08-28 09:00:43.349999825] (+0.002616181) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 388, prev_prio = 20, >>>> prev_state = 1, next_comm = "sh", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.351726735] (+0.001726910) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.352191159] (+0.000464424) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sh", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.352283038] (+0.000091879) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "sh", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.353304492] (+0.001021454) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "sh", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.353711038] (+0.000406546) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "sh", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.353802856] (+0.000091818) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "sh", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.357738795] (+0.003935939) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.358151644] (+0.000412849) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.358400311] (+0.000248667) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.358873644] (+0.000473333) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.359283644] (+0.000410000) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.359375523] (+0.000091879) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.360845098] (+0.001469575) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.361246492] (+0.000401394) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.361338977] (+0.000092485) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.361800674] (+0.000461697) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.362320250] (+0.000519576) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.362479463] (+0.000159213) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.363838068] (+0.001358605) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.364240553] (+0.000402485) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.364332553] (+0.000092000) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.364792189] (+0.000459636) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.365205038] (+0.000412849) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.365296916] (+0.000091878) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.366988129] (+0.001691213) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.367399705] (+0.000411576) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.367492371] (+0.000092666) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.368825704] (+0.001333333) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.369229038] (+0.000403334) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.369321280] (+0.000092242) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.370950675] (+0.001629395) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.371353220] (+0.000402545) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.371445462] (+0.000092242) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.380016917] (+0.008571455) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.380428129] (+0.000411212) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.380521159] (+0.000093030) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.381335462] (+0.000814303) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:43.381420795] (+0.000085333) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >>>> [2012-08-28 09:00:43.381826250] (+0.000405455) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>>> 20, prev_state = 1, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.382007038] (+0.000180788) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:43.382081522] (+0.000074484) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >>>> [2012-08-28 09:00:43.382528190] (+0.000446668) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>>> 20, prev_state = 1, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.383627341] (+0.001099151) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 130, next_comm = "swapper", next_tid = 0, next_prio = 20 } >>>> [2012-08-28 09:00:43.384035280] (+0.000407939) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "lttng", tid = 497, prio = 120, success = 1, >>>> target_cpu = 0 } >>>> [2012-08-28 09:00:43.384128189] (+0.000092909) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "swapper", prev_tid = 0, prev_prio = 20, >>>> prev_state = 0, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.385790613] (+0.001662424) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:43.385877704] (+0.000087091) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >>>> [2012-08-28 09:00:43.386442190] (+0.000564486) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "mng_clients", prev_tid = 452, prev_prio = >>>> 20, prev_state = 1, next_comm = "lttng", next_tid = 497, next_prio = 20 } >>>> [2012-08-28 09:00:43.386978008] (+0.000535818) mgcoge3ne sched_wakeup: { >>>> cpu_id = 0 }, { comm = "mng_clients", tid = 452, prio = 120, success = >>>> 1, target_cpu = 0 } >>>> [2012-08-28 09:00:43.387074129] (+0.000096121) mgcoge3ne sched_switch: { >>>> cpu_id = 0 }, { prev_comm = "lttng", prev_tid = 497, prev_prio = 20, >>>> prev_state = 0, next_comm = "mng_clients", next_tid = 452, next_prio = 20 } >>>> >>>> So again, I get these huge 3.3 (or so) seconds gaps, and a final >>>> timestamp which is 43 seconds instead of the 10 seconds which actually >>>> went by. >>>> >>>> BTW, I also tried with TMF under Eclipse, and here I get even weirder >>>> results. Here's a table of correspondence (as there must be some occult >>>> side to it!) for the timestamps as reported by babeltrace vs. Eclipse: >>>> >>>> [2012-08-28 09:00:00.348477307] -> 2033-05-07 16:49:22.035276997 >>>> ... >>>> [2012-08-28 09:00:00.408304580] -> 2033-05-07 16:49:22.112912324 >>>> .... >>>> [2012-08-28 09:00:04.691537693] -> 2039-11-23 09:06:50.748861638 >>>> >>>> Under Eclipse, the latest event of this 10-second trace lies sometime >>>> within year 2124. >>>> >>>> No clue, anyone? >>>> >>>> Thank you, >>>> Gerlando >>>> >>>> On 12/16/2011 11:15 AM, Gerlando Falauto wrote: >>>>> Hi, >>>>> >>>>> I am trying to use LLTng 2.0 (since I have no alternative for a 3.0 >>>>> kernel!) and I of course use babeltrace to read them. >>>>> Problem is, I can't make any sense out of the timestamps, as I get >>>>> something like (two CPU-hog bash processes): >>>>> >>>>> [1658841591493] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>>> next_prio = 20 } >>>>> [1658845590645] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>>> next_prio = 20 } >>>>> [1658849590039] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>>> next_prio = 20 } >>>>> [1658853591069] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>>> next_prio = 20 } >>>>> [1662152559395] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>>> next_prio = 20 } >>>>> [1662156587941] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>>> next_prio = 20 } >>>>> [1662160557698] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>>> next_prio = 20 } >>>>> [1662164557517] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>>> next_prio = 20 } >>>>> [....................................cut...........................] >>>>> [1663140553029] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>>> next_prio = 20 } >>>>> [1663144555029] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>>> next_prio = 20 } >>>>> [1663148552423] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 646, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 647, >>>>> next_prio = 20 } >>>>> [1666447519719] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 647, prev_prio = 20, prev_state = 0, next_comm = "bash", next_tid = 646, >>>>> next_prio = 20 } >>>>> [1666451561355] sched_switch: { 0 }, { prev_comm = "bash", prev_tid = >>>>> 646, prev_prio = 20, prev_state = 0, next_comm = "kworker/0:1", next_tid >>>>> = 94, next_prio = 20 } >>>>> [1666451863719] sched_switch: { 0 }, { prev_comm = "kworker/0:1", >>>>> prev_tid = 94, prev_prio = 20, prev_state = 1, next_comm = "bash", >>>>> next_tid = 647, next_prio = 20 } >>>>> >>>>> Which made me think timestamps were expressed in nanoseconds, as I am >>>>> running this on 4ms-tick PowerPC (CONFIG_HZ=250), and the difference >>>>> between timestamps is approximately 4,000,000. >>>>> However, I get these huge 3.3 second gaps between for instance between >>>>> 1658853591069 and 1662152559395. >>>>> Curiously enough, these leap 3.3 seconds occur exactly (well, within 4ms >>>>> precision...) every second. Kind of like the "seconds" part of the >>>>> timestamp is calculated on a wrong-base arithmetics or so.... >>>>> This also makes sense as the seconds' portion of the timestamp is >>>>> essentially 4.3 times bigger than the uptime (and any time stretch is >>>>> 4.3 times bigger than reality, for that matter). >>>>> >>>>> Any suggestions? >>>>> >>>>> Thanks! >>>>> Gerlando >>>>> >>>>> P.S. This also happens without my hack for flight recording mode... >>> >>> >>> _______________________________________________ >>> lttng-dev mailing list >>> lttng-dev at lists.lttng.org >>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev >> >> -- >> Mathieu Desnoyers >> Operating System Efficiency R&D Consultant >> EfficiOS Inc. >> http://www.efficios.com > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 6 10:27:27 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 6 Sep 2012 10:27:27 -0400 Subject: [lttng-dev] [PATCH] fix timestamps on architectures without CONFIG_KTIME_SCALAR In-Reply-To: <1346340992-27307-1-git-send-email-gerlando.falauto@keymile.com> References: <1346340992-27307-1-git-send-email-gerlando.falauto@keymile.com> Message-ID: <20120906142726.GJ3630@Krystal> * Gerlando Falauto (gerlando.falauto at keymile.com) wrote: > trace_clock_monotonic_wrapper() should return a u64 representing the > number of nanoseconds since system startup. > ktime_get() provides that value directly within its .tv64 field only > on those architectures defining CONFIG_KTIME_SCALAR, whereas in all > other cases (e.g. PowerPC) a ktime_to_ns() conversion (which > translates back to .tv64 when CONFIG_KTIME_SCALAR is defined) > becomes necessary. merged! Will make its way into stable-2.0 too. Thanks! Mathieu > > Signed-off-by: Gerlando Falauto > --- > wrapper/trace-clock.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h > index 6ea9e81..bced61c 100644 > --- a/wrapper/trace-clock.h > +++ b/wrapper/trace-clock.h > @@ -46,7 +46,7 @@ static inline u64 trace_clock_monotonic_wrapper(void) > return (u64) -EIO; > > ktime = ktime_get(); > - return (u64) ktime.tv64; > + return ktime_to_ns(ktime); > } > > static inline u32 trace_clock_read32(void) > -- > 1.7.10.1 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From christian.babeux at efficios.com Thu Sep 6 13:40:18 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 6 Sep 2012 13:40:18 -0400 Subject: [lttng-dev] [PATCH v3 lttng-tools] Filter allocation and large bytecode fixes In-Reply-To: <1346093301-25274-1-git-send-email-christian.babeux@efficios.com> References: <1346093301-25274-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1346953219-9001-1-git-send-email-christian.babeux@efficios.com> Previous iteration of patch 2/3 was missing a typo fix in the LTTNG_FILTER_MAX_LEN define. Also, Mathieu suggested that we put a check on the reloc_table_offset in the sessiond to check its bounds when receiving the LTTNG_SET_FILTER command. This is not necessary because the reloc_table_offset does not exist in the filter struct of the lttcomm_session_msg union. Changelog v3: 1/3 - Already merged. 2/3 - Add missing typo fix in LTTNG_FILTER_MAX_LEN define. 3/3 - Already merged. Changelog v2: 1/3 - Already merged. 2/3 - Respin. Support 65536 bytes bytecode len + filter ABI changes. 3/3 - Already merged. Thanks, Christian Babeux (1): Fix: Accept bytecode of length 65536 bytes src/bin/lttng-sessiond/lttng-ust-abi.h | 6 +++--- src/bin/lttng-sessiond/main.c | 2 +- src/common/sessiond-comm/sessiond-comm.h | 6 +++--- src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) -- 1.7.11.4 From christian.babeux at efficios.com Thu Sep 6 13:40:19 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 6 Sep 2012 13:40:19 -0400 Subject: [lttng-dev] [PATCH v3 lttng-tools] Fix: Accept bytecode of length 65536 bytes In-Reply-To: <1346953219-9001-1-git-send-email-christian.babeux@efficios.com> References: <1346093301-25274-1-git-send-email-christian.babeux@efficios.com> <1346953219-9001-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1346953219-9001-2-git-send-email-christian.babeux@efficios.com> In order to support the filter bytecode maximum length (65536 bytes), the lttng_ust_filter_bytecode len field type must be able to hold more than a uint16_t. Change the field type to a uint32_t. Also, since the relocation table is located at the end of the actual bytecode, the reloc_table_offset (reloc_offset in ust-abi) field must support offset values larger than 65535. Change the field type to a uint32_t. This change will allow support of relocation table appended to larger bytecode without breaking the ABI if the need arise in the future. Both changes currently breaks the filter ABI, but this should be a reasonable compromise since the filtering feature has not been released yet. Signed-off-by: Christian Babeux --- src/bin/lttng-sessiond/lttng-ust-abi.h | 6 +++--- src/bin/lttng-sessiond/main.c | 2 +- src/common/sessiond-comm/sessiond-comm.h | 6 +++--- src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bin/lttng-sessiond/lttng-ust-abi.h b/src/bin/lttng-sessiond/lttng-ust-abi.h index d8b10c2..504c060 100644 --- a/src/bin/lttng-sessiond/lttng-ust-abi.h +++ b/src/bin/lttng-sessiond/lttng-ust-abi.h @@ -168,10 +168,10 @@ struct lttng_ust_calibrate { } u; }; -#define FILTER_BYTECODE_MAX_LEN 65535 +#define FILTER_BYTECODE_MAX_LEN 65536 struct lttng_ust_filter_bytecode { - uint16_t len; - uint16_t reloc_offset; + uint32_t len; + uint32_t reloc_offset; char data[0]; }; diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 318da74..730ac65 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -2659,7 +2659,7 @@ skip_domain: { struct lttng_filter_bytecode *bytecode; - if (cmd_ctx->lsm->u.filter.bytecode_len > 65336) { + if (cmd_ctx->lsm->u.filter.bytecode_len > LTTNG_FILTER_MAX_LEN) { ret = LTTNG_ERR_FILTER_INVAL; goto error; } diff --git a/src/common/sessiond-comm/sessiond-comm.h b/src/common/sessiond-comm/sessiond-comm.h index 32ce384..62205f4 100644 --- a/src/common/sessiond-comm/sessiond-comm.h +++ b/src/common/sessiond-comm/sessiond-comm.h @@ -208,7 +208,7 @@ struct lttcomm_session_msg { } u; }; -#define LTTNG_FILTER_MAX_LEN 65336 +#define LTTNG_FILTER_MAX_LEN 65536 /* * Filter bytecode data. The reloc table is located at the end of the @@ -216,8 +216,8 @@ struct lttcomm_session_msg { * starts at reloc_table_offset. */ struct lttng_filter_bytecode { - uint16_t len; /* len of data */ - uint16_t reloc_table_offset; + uint32_t len; /* len of data */ + uint32_t reloc_table_offset; char data[0]; }; diff --git a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c index 98f8375..332a387 100644 --- a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c @@ -239,7 +239,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node) uint32_t insn_len = sizeof(struct load_op) + sizeof(struct field_ref); struct field_ref ref_offset; - uint16_t reloc_offset; + uint32_t reloc_offset; insn = calloc(insn_len, 1); if (!insn) -- 1.7.11.4 From mathieu.desnoyers at efficios.com Thu Sep 6 13:44:52 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 6 Sep 2012 13:44:52 -0400 Subject: [lttng-dev] [PATCH v3 lttng-tools] Fix: Accept bytecode of length 65536 bytes In-Reply-To: <1346953219-9001-2-git-send-email-christian.babeux@efficios.com> References: <1346093301-25274-1-git-send-email-christian.babeux@efficios.com> <1346953219-9001-1-git-send-email-christian.babeux@efficios.com> <1346953219-9001-2-git-send-email-christian.babeux@efficios.com> Message-ID: <20120906174452.GA8823@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > In order to support the filter bytecode maximum length (65536 bytes), > the lttng_ust_filter_bytecode len field type must be able to > hold more than a uint16_t. Change the field type to a uint32_t. > > Also, since the relocation table is located at the end of the actual > bytecode, the reloc_table_offset (reloc_offset in ust-abi) field must > support offset values larger than 65535. Change the field type to a > uint32_t. This change will allow support of relocation table appended > to larger bytecode without breaking the ABI if the need arise in the > future. > > Both changes currently breaks the filter ABI, but this should be a > reasonable compromise since the filtering feature has not been > released yet. > > Signed-off-by: Christian Babeux Acked-by: Mathieu Desnoyers > --- > src/bin/lttng-sessiond/lttng-ust-abi.h | 6 +++--- > src/bin/lttng-sessiond/main.c | 2 +- > src/common/sessiond-comm/sessiond-comm.h | 6 +++--- > src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c | 2 +- > 4 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/src/bin/lttng-sessiond/lttng-ust-abi.h b/src/bin/lttng-sessiond/lttng-ust-abi.h > index d8b10c2..504c060 100644 > --- a/src/bin/lttng-sessiond/lttng-ust-abi.h > +++ b/src/bin/lttng-sessiond/lttng-ust-abi.h > @@ -168,10 +168,10 @@ struct lttng_ust_calibrate { > } u; > }; > > -#define FILTER_BYTECODE_MAX_LEN 65535 > +#define FILTER_BYTECODE_MAX_LEN 65536 > struct lttng_ust_filter_bytecode { > - uint16_t len; > - uint16_t reloc_offset; > + uint32_t len; > + uint32_t reloc_offset; > char data[0]; > }; > > diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c > index 318da74..730ac65 100644 > --- a/src/bin/lttng-sessiond/main.c > +++ b/src/bin/lttng-sessiond/main.c > @@ -2659,7 +2659,7 @@ skip_domain: > { > struct lttng_filter_bytecode *bytecode; > > - if (cmd_ctx->lsm->u.filter.bytecode_len > 65336) { > + if (cmd_ctx->lsm->u.filter.bytecode_len > LTTNG_FILTER_MAX_LEN) { > ret = LTTNG_ERR_FILTER_INVAL; > goto error; > } > diff --git a/src/common/sessiond-comm/sessiond-comm.h b/src/common/sessiond-comm/sessiond-comm.h > index 32ce384..62205f4 100644 > --- a/src/common/sessiond-comm/sessiond-comm.h > +++ b/src/common/sessiond-comm/sessiond-comm.h > @@ -208,7 +208,7 @@ struct lttcomm_session_msg { > } u; > }; > > -#define LTTNG_FILTER_MAX_LEN 65336 > +#define LTTNG_FILTER_MAX_LEN 65536 > > /* > * Filter bytecode data. The reloc table is located at the end of the > @@ -216,8 +216,8 @@ struct lttcomm_session_msg { > * starts at reloc_table_offset. > */ > struct lttng_filter_bytecode { > - uint16_t len; /* len of data */ > - uint16_t reloc_table_offset; > + uint32_t len; /* len of data */ > + uint32_t reloc_table_offset; > char data[0]; > }; > > diff --git a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c > index 98f8375..332a387 100644 > --- a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c > +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c > @@ -239,7 +239,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node) > uint32_t insn_len = sizeof(struct load_op) > + sizeof(struct field_ref); > struct field_ref ref_offset; > - uint16_t reloc_offset; > + uint32_t reloc_offset; > > insn = calloc(insn_len, 1); > if (!insn) > -- > 1.7.11.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From christian.babeux at efficios.com Thu Sep 6 13:51:38 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 6 Sep 2012 13:51:38 -0400 Subject: [lttng-dev] [PATCH v2 lttng-ust] Fix: Filter ABI changes to support FILTER_BYTECODE_MAX_LEN (65536) In-Reply-To: <1346799744-23032-1-git-send-email-christian.babeux@efficios.com> References: <1346799744-23032-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1346953899-15422-1-git-send-email-christian.babeux@efficios.com> v2 Changelog: - Add a check when receiving data on the reloc_offset to ensure it lies within the data. Christian Babeux (1): Fix: Accept bytecode of length 65536 bytes include/lttng/ust-abi.h | 4 ++-- include/ust-comm.h | 4 ++-- liblttng-ust/lttng-ust-comm.c | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) -- 1.7.11.4 From christian.babeux at efficios.com Thu Sep 6 13:51:39 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 6 Sep 2012 13:51:39 -0400 Subject: [lttng-dev] [PATCH v2 lttng-ust] Fix: Accept bytecode of length 65536 bytes In-Reply-To: <1346953899-15422-1-git-send-email-christian.babeux@efficios.com> References: <1346799744-23032-1-git-send-email-christian.babeux@efficios.com> <1346953899-15422-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1346953899-15422-2-git-send-email-christian.babeux@efficios.com> In order to support the filter bytecode maximum length (65536 bytes), the lttng_ust_filter_bytecode len field type must be able to hold more than a uint16_t. Change the field type to a uint32_t. Also, since the relocation table is located at the end of the actual bytecode, the reloc_table_offset (reloc_offset in ust-abi) field must support offset values larger than 65535. Change the field type to a uint32_t. This change will allow support of relocation table appended to larger bytecode without breaking the ABI if the need arise in the future. Both changes currently breaks the filter ABI, but this should be a reasonable compromise since the filtering feature has not been released yet. Signed-off-by: Christian Babeux --- include/lttng/ust-abi.h | 4 ++-- include/ust-comm.h | 4 ++-- liblttng-ust/lttng-ust-comm.c | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index 0489e89..91639a7 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -174,8 +174,8 @@ struct lttng_ust_calibrate { #define FILTER_BYTECODE_MAX_LEN 65536 struct lttng_ust_filter_bytecode { - uint16_t len; - uint16_t reloc_offset; + uint32_t len; + uint32_t reloc_offset; char data[0]; }; diff --git a/include/ust-comm.h b/include/ust-comm.h index b09fcca..4a3e4ce 100644 --- a/include/ust-comm.h +++ b/include/ust-comm.h @@ -132,8 +132,8 @@ struct ustcomm_ust_msg { struct lttng_ust_tracer_version version; struct lttng_ust_tracepoint_iter tracepoint; struct { - uint16_t data_size; /* following filter data */ - uint16_t reloc_offset; + uint32_t data_size; /* following filter data */ + uint32_t reloc_offset; } filter; } u; }; diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 842876f..009dc02 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -293,6 +293,14 @@ int handle_message(struct sock_info *sock_info, ret = -EINVAL; goto error; } + + if (lum->u.filter.reloc_offset > lum->u.filter.data_size) { + ERR("Filter reloc offset %u is not within data\n", + lum->u.filter.reloc_offset); + ret = -EINVAL; + goto error; + } + bytecode = zmalloc(sizeof(*bytecode) + lum->u.filter.data_size); if (!bytecode) { ret = -ENOMEM; -- 1.7.11.4 From mathieu.desnoyers at efficios.com Thu Sep 6 13:54:55 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 6 Sep 2012 13:54:55 -0400 Subject: [lttng-dev] [PATCH v2 lttng-ust] Fix: Accept bytecode of length 65536 bytes In-Reply-To: <1346953899-15422-2-git-send-email-christian.babeux@efficios.com> References: <1346799744-23032-1-git-send-email-christian.babeux@efficios.com> <1346953899-15422-1-git-send-email-christian.babeux@efficios.com> <1346953899-15422-2-git-send-email-christian.babeux@efficios.com> Message-ID: <20120906175455.GA8954@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > In order to support the filter bytecode maximum length (65536 bytes), > the lttng_ust_filter_bytecode len field type must be able to > hold more than a uint16_t. Change the field type to a uint32_t. > > Also, since the relocation table is located at the end of the actual > bytecode, the reloc_table_offset (reloc_offset in ust-abi) field must > support offset values larger than 65535. Change the field type to a > uint32_t. This change will allow support of relocation table appended > to larger bytecode without breaking the ABI if the need arise in the > future. > > Both changes currently breaks the filter ABI, but this should be a > reasonable compromise since the filtering feature has not been > released yet. > > Signed-off-by: Christian Babeux > --- > include/lttng/ust-abi.h | 4 ++-- > include/ust-comm.h | 4 ++-- > liblttng-ust/lttng-ust-comm.c | 8 ++++++++ > 3 files changed, 12 insertions(+), 4 deletions(-) > > diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h > index 0489e89..91639a7 100644 > --- a/include/lttng/ust-abi.h > +++ b/include/lttng/ust-abi.h > @@ -174,8 +174,8 @@ struct lttng_ust_calibrate { > > #define FILTER_BYTECODE_MAX_LEN 65536 > struct lttng_ust_filter_bytecode { > - uint16_t len; > - uint16_t reloc_offset; > + uint32_t len; > + uint32_t reloc_offset; > char data[0]; > }; > > diff --git a/include/ust-comm.h b/include/ust-comm.h > index b09fcca..4a3e4ce 100644 > --- a/include/ust-comm.h > +++ b/include/ust-comm.h > @@ -132,8 +132,8 @@ struct ustcomm_ust_msg { > struct lttng_ust_tracer_version version; > struct lttng_ust_tracepoint_iter tracepoint; > struct { > - uint16_t data_size; /* following filter data */ > - uint16_t reloc_offset; > + uint32_t data_size; /* following filter data */ > + uint32_t reloc_offset; > } filter; > } u; > }; > diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c > index 842876f..009dc02 100644 > --- a/liblttng-ust/lttng-ust-comm.c > +++ b/liblttng-ust/lttng-ust-comm.c > @@ -293,6 +293,14 @@ int handle_message(struct sock_info *sock_info, > ret = -EINVAL; > goto error; > } > + > + if (lum->u.filter.reloc_offset > lum->u.filter.data_size) { if (lum->u.filter.reloc_offset > lum->u.filter.data_size - 1) { ? > + ERR("Filter reloc offset %u is not within data\n", > + lum->u.filter.reloc_offset); > + ret = -EINVAL; > + goto error; > + } > + > bytecode = zmalloc(sizeof(*bytecode) + lum->u.filter.data_size); > if (!bytecode) { > ret = -ENOMEM; > -- > 1.7.11.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From christian.babeux at efficios.com Thu Sep 6 14:13:11 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 6 Sep 2012 14:13:11 -0400 Subject: [lttng-dev] [PATCH v3 lttng-ust] Fix: Filter ABI changes to support FILTER_BYTECODE_MAX_LEN (65536) In-Reply-To: <1346799744-23032-1-git-send-email-christian.babeux@efficios.com> References: <1346799744-23032-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1346955191-15984-1-git-send-email-christian.babeux@efficios.com> In order to support the filter bytecode maximum length (65536 bytes), the lttng_ust_filter_bytecode len field type must be able to hold more than a uint16_t. Change the field type to a uint32_t. Also, since the relocation table is located at the end of the actual bytecode, the reloc_table_offset (reloc_offset in ust-abi) field must support offset values larger than 65535. Change the field type to a uint32_t. This change will allow support of relocation table appended to larger bytecode without breaking the ABI if the need arise in the future. Both changes currently breaks the filter ABI, but this should be a reasonable compromise since the filtering feature has not been released yet. Signed-off-by: Christian Babeux --- include/lttng/ust-abi.h | 4 ++-- include/ust-comm.h | 4 ++-- liblttng-ust/lttng-ust-comm.c | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index 0489e89..91639a7 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -174,8 +174,8 @@ struct lttng_ust_calibrate { #define FILTER_BYTECODE_MAX_LEN 65536 struct lttng_ust_filter_bytecode { - uint16_t len; - uint16_t reloc_offset; + uint32_t len; + uint32_t reloc_offset; char data[0]; }; diff --git a/include/ust-comm.h b/include/ust-comm.h index b09fcca..4a3e4ce 100644 --- a/include/ust-comm.h +++ b/include/ust-comm.h @@ -132,8 +132,8 @@ struct ustcomm_ust_msg { struct lttng_ust_tracer_version version; struct lttng_ust_tracepoint_iter tracepoint; struct { - uint16_t data_size; /* following filter data */ - uint16_t reloc_offset; + uint32_t data_size; /* following filter data */ + uint32_t reloc_offset; } filter; } u; }; diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 842876f..be64acd 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -293,6 +293,14 @@ int handle_message(struct sock_info *sock_info, ret = -EINVAL; goto error; } + + if (lum->u.filter.reloc_offset > lum->u.filter.data_size - 1) { + ERR("Filter reloc offset %u is not within data\n", + lum->u.filter.reloc_offset); + ret = -EINVAL; + goto error; + } + bytecode = zmalloc(sizeof(*bytecode) + lum->u.filter.data_size); if (!bytecode) { ret = -ENOMEM; -- 1.7.11.4 From mathieu.desnoyers at efficios.com Thu Sep 6 17:05:34 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 6 Sep 2012 17:05:34 -0400 Subject: [lttng-dev] [PATCH v3 lttng-ust] Fix: Filter ABI changes to support FILTER_BYTECODE_MAX_LEN (65536) In-Reply-To: <1346955191-15984-1-git-send-email-christian.babeux@efficios.com> References: <1346799744-23032-1-git-send-email-christian.babeux@efficios.com> <1346955191-15984-1-git-send-email-christian.babeux@efficios.com> Message-ID: <20120906210534.GA10606@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > In order to support the filter bytecode maximum length (65536 bytes), > the lttng_ust_filter_bytecode len field type must be able to > hold more than a uint16_t. Change the field type to a uint32_t. > > Also, since the relocation table is located at the end of the actual > bytecode, the reloc_table_offset (reloc_offset in ust-abi) field must > support offset values larger than 65535. Change the field type to a > uint32_t. This change will allow support of relocation table appended > to larger bytecode without breaking the ABI if the need arise in the > future. > > Both changes currently breaks the filter ABI, but this should be a > reasonable compromise since the filtering feature has not been > released yet. merged, thanks! > > Signed-off-by: Christian Babeux > --- > include/lttng/ust-abi.h | 4 ++-- > include/ust-comm.h | 4 ++-- > liblttng-ust/lttng-ust-comm.c | 8 ++++++++ > 3 files changed, 12 insertions(+), 4 deletions(-) > > diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h > index 0489e89..91639a7 100644 > --- a/include/lttng/ust-abi.h > +++ b/include/lttng/ust-abi.h > @@ -174,8 +174,8 @@ struct lttng_ust_calibrate { > > #define FILTER_BYTECODE_MAX_LEN 65536 > struct lttng_ust_filter_bytecode { > - uint16_t len; > - uint16_t reloc_offset; > + uint32_t len; > + uint32_t reloc_offset; > char data[0]; > }; > > diff --git a/include/ust-comm.h b/include/ust-comm.h > index b09fcca..4a3e4ce 100644 > --- a/include/ust-comm.h > +++ b/include/ust-comm.h > @@ -132,8 +132,8 @@ struct ustcomm_ust_msg { > struct lttng_ust_tracer_version version; > struct lttng_ust_tracepoint_iter tracepoint; > struct { > - uint16_t data_size; /* following filter data */ > - uint16_t reloc_offset; > + uint32_t data_size; /* following filter data */ > + uint32_t reloc_offset; > } filter; > } u; > }; > diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c > index 842876f..be64acd 100644 > --- a/liblttng-ust/lttng-ust-comm.c > +++ b/liblttng-ust/lttng-ust-comm.c > @@ -293,6 +293,14 @@ int handle_message(struct sock_info *sock_info, > ret = -EINVAL; > goto error; > } > + > + if (lum->u.filter.reloc_offset > lum->u.filter.data_size - 1) { > + ERR("Filter reloc offset %u is not within data\n", > + lum->u.filter.reloc_offset); > + ret = -EINVAL; > + goto error; > + } > + > bytecode = zmalloc(sizeof(*bytecode) + lum->u.filter.data_size); > if (!bytecode) { > ret = -ENOMEM; > -- > 1.7.11.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 6 17:07:08 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 6 Sep 2012 17:07:08 -0400 Subject: [lttng-dev] [PATCH] fix timestamps on architectures without CONFIG_KTIME_SCALAR In-Reply-To: <20120906142726.GJ3630@Krystal> References: <1346340992-27307-1-git-send-email-gerlando.falauto@keymile.com> <20120906142726.GJ3630@Krystal> Message-ID: <20120906210708.GB10606@Krystal> * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote: > * Gerlando Falauto (gerlando.falauto at keymile.com) wrote: > > trace_clock_monotonic_wrapper() should return a u64 representing the > > number of nanoseconds since system startup. > > ktime_get() provides that value directly within its .tv64 field only > > on those architectures defining CONFIG_KTIME_SCALAR, whereas in all > > other cases (e.g. PowerPC) a ktime_to_ns() conversion (which > > translates back to .tv64 when CONFIG_KTIME_SCALAR is defined) > > becomes necessary. > > merged! > > Will make its way into stable-2.0 too. I did manage to mess the "From" of the patch in my merge though. I forgot to attribute the commit to you as the author. Sorry about that ! You still appear in the signed-off-by lines though. Thanks, Mathieu > > Thanks! > > Mathieu > > > > > Signed-off-by: Gerlando Falauto > > --- > > wrapper/trace-clock.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h > > index 6ea9e81..bced61c 100644 > > --- a/wrapper/trace-clock.h > > +++ b/wrapper/trace-clock.h > > @@ -46,7 +46,7 @@ static inline u64 trace_clock_monotonic_wrapper(void) > > return (u64) -EIO; > > > > ktime = ktime_get(); > > - return (u64) ktime.tv64; > > + return ktime_to_ns(ktime); > > } > > > > static inline u32 trace_clock_read32(void) > > -- > > 1.7.10.1 > > > > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 6 19:07:25 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 6 Sep 2012 19:07:25 -0400 Subject: [lttng-dev] [PATCH 2/2] urcu: add notice to URCU_TLS() for it is not async-signal-safe In-Reply-To: <1344414673-14714-2-git-send-email-laijs@cn.fujitsu.com> References: <1344414673-14714-1-git-send-email-laijs@cn.fujitsu.com> <1344414673-14714-2-git-send-email-laijs@cn.fujitsu.com> Message-ID: <20120906230725.GA11601@Krystal> * Lai Jiangshan (laijs at cn.fujitsu.com) wrote: > Signed-off-by: Lai Jiangshan Finally, I'm merging this patch, and I won't go for the signal-disabling implementation, mainly because we have the same kind of behavior with the TLS fixup for TLS variables in DSO. So this comment apply both to the TLS and pthread getspecific implementation of the URCU_TLS, so I'm moving it slightly higher in the header file. Thanks! Mathieu > --- > urcu/tls-compat.h | 14 ++++++++++++++ > 1 files changed, 14 insertions(+), 0 deletions(-) > > diff --git a/urcu/tls-compat.h b/urcu/tls-compat.h > index 192a536..b7bf363 100644 > --- a/urcu/tls-compat.h > +++ b/urcu/tls-compat.h > @@ -59,6 +59,20 @@ extern "C" { > > #else /* #ifndef CONFIG_RCU_TLS */ > > +/* > + * NOTE: URCU_TLS() is NOT async-signal-safe, you can't use it > + * inside any function which can be called from signal handler. > + * > + * But if pthread_getspecific() is async-signal-safe in your > + * platform, you can make URCU_TLS() async-signal-safe via: > + * ensuring the first call to URCU_TLS() of a given TLS variable of > + * all threads is called earliest from a non-signal handler function. > + * > + * Exmaple: In any thread, the first call of URCU_TLS(rcu_reader) > + * is called from rcu_register_thread(), so we can ensure all later > + * URCU_TLS(rcu_reader) in any thread is async-signal-safe. > + */ > + > # include > > struct urcu_tls { > -- > 1.7.4.4 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 6 21:20:43 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 6 Sep 2012 21:20:43 -0400 Subject: [lttng-dev] [PATCH] Ensure that read-side functions meet 10-line LGPL criterion In-Reply-To: <20120904221323.GO2593@linux.vnet.ibm.com> References: <20120902005911.GA26326@linux.vnet.ibm.com> <20120903180300.GA14133@Krystal> <20120904221323.GO2593@linux.vnet.ibm.com> Message-ID: <20120907012042.GA12803@Krystal> * Paul E. McKenney (paulmck at linux.vnet.ibm.com) wrote: > On Mon, Sep 03, 2012 at 02:03:00PM -0400, Mathieu Desnoyers wrote: > > * Paul E. McKenney (paulmck at linux.vnet.ibm.com) wrote: > > > This commit ensures that all read-side functions meet the 10-line LGPL > > > criterion that permits them to be expanded directly into non-LGPL code, > > > without function-call instructions. It also documents this as the intent. > > > > > > Signed-off-by: Paul E. McKenney > > > > > > diff --git a/urcu/static/urcu-bp.h b/urcu/static/urcu-bp.h > > > index e7b2eda..881b4a4 100644 > > > --- a/urcu/static/urcu-bp.h > > > +++ b/urcu/static/urcu-bp.h > > > @@ -6,8 +6,8 @@ > > > * > > > * Userspace RCU header. > > > * > > > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking > > > - * dynamically with the userspace rcu library. > > > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > > > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > > > * > > > * Copyright (c) 2009 Mathieu Desnoyers > > > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > > > @@ -162,32 +162,48 @@ static inline int rcu_old_gp_ongoing(long *value) > > > ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); > > > } > > > > > > +/* > > > + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as > > > + * the per-thread rcu_reader.ctr) has the upper bits containing a count of > > > + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero > > > + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in > > > + * _rcu_read_lock() happen before the subsequent read-side critical section. > > > + */ > > > +static inline void _rcu_read_lock_help(unsigned long tmp) > > > > could we rename the "_rcu_read_lock_help" to "_rcu_read_lock_update" ? > > > > I think it would fit better the role of this function in the algorithm. > > > > As Josh pointed out, "directloy" -> "directly" below, > > > > The rest looks good. I'll wait for an updated version. > > Here you go! Merged as: commit a5a9f428a238e790d6c97299bc214b5cca815cd7 Author: Paul E. McKenney Date: Thu Sep 6 21:15:53 2012 -0400 Ensure that read-side functions meet 10-line LGPL criterion This commit ensures that all read-side functions meet the 10-line LGPL criterion that permits them to be expanded directly into non-LGPL code, without function-call instructions. It also documents this as the intent. [ paulmck: Spelling fixes called out by Josh Triplett and name change called out by Mathieu Desnoyers (_rcu_read_lock_help() -> _rcu_read_lock_update(). ] [ Mathieu Desnoyers: _rcu_read_unlock_help renamed to _rcu_read_unlock_update_and_wakeup, and spelling fix for preced -> precede. ] Signed-off-by: Paul E. McKenney Signed-off-by: Mathieu Desnoyers Thanks! Now we should possibly find another #define than _LGPL_SOURCE to let non-lgpl code specify that they want to use the inline versions ? E.g. _URCU_INLINE maybe ? Thanks, Mathieu > > Thanx, Paul > > ------------------------------------------------------------------------ > > Ensure that read-side functions meet 10-line LGPL criterion > > This commit ensures that all read-side functions meet the 10-line LGPL > criterion that permits them to be expanded directly into non-LGPL code, > without function-call instructions. It also documents this as the intent. > > [ paulmck: Spelling fixes called out by Josh Triplett and name > change called out by Mathieu Desnoyers (_rcu_read_lock_help() -> > _rcu_read_lock_update(). ] > > Signed-off-by: Paul E. McKenney > > diff --git a/urcu/static/urcu-bp.h b/urcu/static/urcu-bp.h > index e7b2eda..a2f7368 100644 > --- a/urcu/static/urcu-bp.h > +++ b/urcu/static/urcu-bp.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU header. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking > - * dynamically with the userspace rcu library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -162,32 +162,48 @@ static inline int rcu_old_gp_ongoing(long *value) > ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); > } > > +/* > + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as > + * the per-thread rcu_reader.ctr) has the upper bits containing a count of > + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero > + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in > + * _rcu_read_lock() happen before the subsequent read-side critical section. > + */ > +static inline void _rcu_read_lock_update(unsigned long tmp) > +{ > + if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > + cmm_smp_mb(); > + } else > + _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); > +} > + > +/* > + * Enter an RCU read-side critical section. > + * > + * The first cmm_barrier() call ensures that the compiler does not reorder > + * the body of _rcu_read_lock() with a mutex. > + * > + * This function and its helper are both less than 10 lines long. The > + * intent is that this function meets the 10-line criterion in LGPL, > + * allowing this function to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_read_lock(void) > { > long tmp; > > - /* Check if registered */ > if (caa_unlikely(!URCU_TLS(rcu_reader))) > - rcu_bp_register(); > - > + rcu_bp_register(); /* If not yet registered. */ > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > tmp = URCU_TLS(rcu_reader)->ctr; > - /* > - * rcu_gp_ctr is > - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) > - */ > - if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > - /* > - * Set active readers count for outermost nesting level before > - * accessing the pointer. > - */ > - cmm_smp_mb(); > - } else { > - _CMM_STORE_SHARED(URCU_TLS(rcu_reader)->ctr, tmp + RCU_GP_COUNT); > - } > + _rcu_read_lock_update(tmp); > } > > +/* > + * Exit an RCU read-side critical section. This function is less than > + * 10 lines of code, and is intended to be usable by non-LGPL code, as > + * called out in LGPL. > + */ > static inline void _rcu_read_unlock(void) > { > /* > diff --git a/urcu/static/urcu-pointer.h b/urcu/static/urcu-pointer.h > index 48dc5bf..4361156 100644 > --- a/urcu/static/urcu-pointer.h > +++ b/urcu/static/urcu-pointer.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU header. Operations on pointers. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-pointer.h for > - * linking dynamically with the userspace rcu library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -59,8 +59,11 @@ extern "C" { > * addition to forthcoming C++ standard. > * > * Should match rcu_assign_pointer() or rcu_xchg_pointer(). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directly in non-LGPL code. > */ > - > #define _rcu_dereference(p) ({ \ > __typeof__(p) _________p1 = CMM_LOAD_SHARED(p); \ > cmm_smp_read_barrier_depends(); \ > @@ -73,8 +76,11 @@ extern "C" { > * data structure, which can be safely freed after waiting for a quiescent state > * using synchronize_rcu(). If fails (unexpected value), returns old (which > * should not be freed !). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directly in non-LGPL code. > */ > - > #define _rcu_cmpxchg_pointer(p, old, _new) \ > ({ \ > __typeof__(*p) _________pold = (old); \ > @@ -89,8 +95,11 @@ extern "C" { > * _rcu_xchg_pointer - same as rcu_assign_pointer, but returns the previous > * pointer to the data structure, which can be safely freed after waiting for a > * quiescent state using synchronize_rcu(). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directly in non-LGPL code. > */ > - > #define _rcu_xchg_pointer(p, v) \ > ({ \ > __typeof__(*p) _________pv = (v); \ > @@ -121,8 +130,11 @@ extern "C" { > * data structure before its publication. > * > * Should match rcu_dereference_pointer(). > + * > + * This macro is less than 10 lines long. The intent is that this macro > + * meets the 10-line criterion in LGPL, allowing this function to be > + * expanded directly in non-LGPL code. > */ > - > #define _rcu_assign_pointer(p, v) _rcu_set_pointer(&(p), v) > > #ifdef __cplusplus > diff --git a/urcu/static/urcu-qsbr.h b/urcu/static/urcu-qsbr.h > index 22908a4..5580092 100644 > --- a/urcu/static/urcu-qsbr.h > +++ b/urcu/static/urcu-qsbr.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU QSBR header. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-qsbr.h for linking > - * dynamically with the userspace rcu QSBR library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -157,15 +157,36 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) > return v && (v != rcu_gp_ctr); > } > > +/* > + * Enter an RCU read-side critical section. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_read_lock(void) > { > rcu_assert(URCU_TLS(rcu_reader).ctr); > } > > +/* > + * Exit an RCU read-side critical section. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_read_unlock(void) > { > } > > +/* > + * Inform RCU of a quiescent state. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_quiescent_state(void) > { > cmm_smp_mb(); > @@ -175,6 +196,14 @@ static inline void _rcu_quiescent_state(void) > cmm_smp_mb(); > } > > +/* > + * Take a thread offline, prohibiting it from entering further RCU > + * read-side critical sections. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_thread_offline(void) > { > cmm_smp_mb(); > @@ -184,6 +213,14 @@ static inline void _rcu_thread_offline(void) > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > } > > +/* > + * Bring a thread online, allowing it to once again enter RCU > + * read-side critical sections. > + * > + * This function is less than 10 lines long. The intent is that this > + * function meets the 10-line criterion for LGPL, allowing this function > + * to be invoked directly from non-LGPL code. > + */ > static inline void _rcu_thread_online(void) > { > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > diff --git a/urcu/static/urcu.h b/urcu/static/urcu.h > index f27f8b6..f211dab 100644 > --- a/urcu/static/urcu.h > +++ b/urcu/static/urcu.h > @@ -6,8 +6,8 @@ > * > * Userspace RCU header. > * > - * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu.h for linking > - * dynamically with the userspace rcu library. > + * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU > + * RELEASE. See urcu.h for linking dynamically with the userspace rcu library. > * > * Copyright (c) 2009 Mathieu Desnoyers > * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. > @@ -252,46 +252,71 @@ static inline int rcu_gp_ongoing(unsigned long *ctr) > ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); > } > > -static inline void _rcu_read_lock(void) > +/* > + * Helper for _rcu_read_lock(). The format of rcu_gp_ctr (as well as > + * the per-thread rcu_reader.ctr) has the upper bits containing a count of > + * _rcu_read_lock() nesting, and a lower-order bit that contains either zero > + * or RCU_GP_CTR_PHASE. The smp_mb_slave() ensures that the accesses in > + * _rcu_read_lock() happen before the subsequent read-side critical section. > + */ > +static inline void _rcu_read_lock_update(unsigned long tmp) > { > - unsigned long tmp; > - > - cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > - tmp = URCU_TLS(rcu_reader).ctr; > - /* > - * rcu_gp_ctr is > - * RCU_GP_COUNT | (~RCU_GP_CTR_PHASE or RCU_GP_CTR_PHASE) > - */ > if (caa_likely(!(tmp & RCU_GP_CTR_NEST_MASK))) { > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, _CMM_LOAD_SHARED(rcu_gp_ctr)); > - /* > - * Set active readers count for outermost nesting level before > - * accessing the pointer. See smp_mb_master(). > - */ > smp_mb_slave(RCU_MB_GROUP); > - } else { > + } else > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, tmp + RCU_GP_COUNT); > - } > } > > -static inline void _rcu_read_unlock(void) > +/* > + * Enter an RCU read-side critical section. > + * > + * The first cmm_barrier() call ensures that the compiler does not reorder > + * the body of _rcu_read_lock() with a mutex. > + * > + * This function and its helper are both less than 10 lines long. The > + * intent is that this function meets the 10-line criterion in LGPL, > + * allowing this function to be invoked directly from non-LGPL code. > + */ > +static inline void _rcu_read_lock(void) > { > unsigned long tmp; > > + cmm_barrier(); > tmp = URCU_TLS(rcu_reader).ctr; > - /* > - * Finish using rcu before decrementing the pointer. > - * See smp_mb_master(). > - */ > + _rcu_read_lock_update(tmp); > +} > + > +/* > + * This is a helper function for _rcu_read_unlock(). > + * > + * The first smp_mb_slave() call ensures that the critical section is > + * seen to preced the store to rcu_reader.ctr. > + * The second smp_mb_slave() call ensures that we write to rcu_reader.ctr > + * before reading the update-side futex. > + */ > +static inline void _rcu_read_unlock_help(unsigned long tmp) > +{ > if (caa_likely((tmp & RCU_GP_CTR_NEST_MASK) == RCU_GP_COUNT)) { > smp_mb_slave(RCU_MB_GROUP); > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); > - /* write URCU_TLS(rcu_reader).ctr before read futex */ > smp_mb_slave(RCU_MB_GROUP); > wake_up_gp(); > - } else { > + } else > _CMM_STORE_SHARED(URCU_TLS(rcu_reader).ctr, URCU_TLS(rcu_reader).ctr - RCU_GP_COUNT); > - } > +} > + > +/* > + * Exit an RCU read-side crtical section. Both this function and its > + * helper are smaller than 10 lines of code, and are intended to be > + * usable by non-LGPL code, as called out in LGPL. > + */ > +static inline void _rcu_read_unlock(void) > +{ > + unsigned long tmp; > + > + tmp = URCU_TLS(rcu_reader).ctr; > + _rcu_read_unlock_help(tmp); > cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ > } > > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From laijs at cn.fujitsu.com Thu Sep 6 23:23:56 2012 From: laijs at cn.fujitsu.com (Lai Jiangshan) Date: Fri, 07 Sep 2012 11:23:56 +0800 Subject: [lttng-dev] [RFC URCU PATCH] wfqueue: ABI v1, simplify implementation, 2.3x to 2.6x performance boost In-Reply-To: <20120906134346.GE3630@Krystal> References: <20120815213107.GB17224@Krystal> <5032054D.7050508@cn.fujitsu.com> <20120820131642.GA551@Krystal> <50330371.6060401@cn.fujitsu.com> <50357FF8.9060704@cn.fujitsu.com> <20120906134346.GE3630@Krystal> Message-ID: <504968CC.4090101@cn.fujitsu.com> On 09/06/2012 09:43 PM, Mathieu Desnoyers wrote: > * Lai Jiangshan (laijs at cn.fujitsu.com) wrote: >> ping > > we discussed a "batch" design offline. Do you think you would have time > to spin a patch implementing it ? > I prefer separated enqueue_struct dequeue_struct a little, so I'm waiting for you. DEADLOCK! thanks, Lai From teawater at gmail.com Fri Sep 7 03:40:14 2012 From: teawater at gmail.com (Hui Zhu) Date: Fri, 7 Sep 2012 15:40:14 +0800 Subject: [lttng-dev] [PATCH/babeltrace] Fix babeltrace-log crash Message-ID: Hi, Got a crash with babeltrace-log. #0 0x00007ffff744504c in free () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007ffff7ba6fc9 in munmap_align (mma=0x7ffff7ffe620) at ../../../babeltrace/include/babeltrace/mmap-align.h:78 #2 0x00007ffff7ba82db in ctf_packet_seek (stream_pos=0x7fffffffde60, index=0, whence=0) at ../../../babeltrace/formats/ctf/ctf.c:623 #3 0x00007ffff7ba8141 in ctf_init_pos (pos=0x7fffffffde60, fd=8, open_flags=2) at ../../../babeltrace/formats/ctf/ctf.c:576 #4 0x0000000000401146 in trace_text (output=8, input=0x7ffff7779340 <_IO_2_1_stdin_>) at ../../babeltrace/converter/babeltrace-log.c:233 #5 main (argc=, argv=) at ../../babeltrace/converter/babeltrace-log.c:342 This issue because pos is used before it init. This patch init it in function ctf_init_pos. Thanks, Hui --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -550,6 +550,7 @@ error: void ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags) { + memset(pos, 0, sizeof(*pos)); pos->fd = fd; if (fd >= 0) { pos->packet_cycles_index = g_array_new(FALSE, TRUE, From teawater at gmail.com Fri Sep 7 03:47:02 2012 From: teawater at gmail.com (Hui Zhu) Date: Fri, 7 Sep 2012 15:47:02 +0800 Subject: [lttng-dev] [PATCH/babeltrace] Fix babeltrace-log crash In-Reply-To: References: Message-ID: Looks it cannot be init in ctf_init_pos. So move init to trace_text. Thanks, Hui On Fri, Sep 7, 2012 at 3:40 PM, Hui Zhu wrote: > Hi, > > Got a crash with babeltrace-log. > > #0 0x00007ffff744504c in free () from /lib/x86_64-linux-gnu/libc.so.6 > #1 0x00007ffff7ba6fc9 in munmap_align (mma=0x7ffff7ffe620) at > ../../../babeltrace/include/babeltrace/mmap-align.h:78 > #2 0x00007ffff7ba82db in ctf_packet_seek (stream_pos=0x7fffffffde60, > index=0, whence=0) > at ../../../babeltrace/formats/ctf/ctf.c:623 > #3 0x00007ffff7ba8141 in ctf_init_pos (pos=0x7fffffffde60, fd=8, open_flags=2) > at ../../../babeltrace/formats/ctf/ctf.c:576 > #4 0x0000000000401146 in trace_text (output=8, input=0x7ffff7779340 > <_IO_2_1_stdin_>) > at ../../babeltrace/converter/babeltrace-log.c:233 > #5 main (argc=, argv=) at > ../../babeltrace/converter/babeltrace-log.c:342 > > This issue because pos is used before it init. This patch init it in > function ctf_init_pos. > > Thanks, > Hui > > --- a/formats/ctf/ctf.c > +++ b/formats/ctf/ctf.c > @@ -550,6 +550,7 @@ error: > > void ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags) > { > + memset(pos, 0, sizeof(*pos)); > pos->fd = fd; > if (fd >= 0) { > pos->packet_cycles_index = g_array_new(FALSE, TRUE, --- a/converter/babeltrace-log.c +++ b/converter/babeltrace-log.c @@ -230,6 +230,7 @@ void trace_text(FILE *input, int output) char *line = NULL, *nl; size_t linesize; + memset(&pos, 0, sizeof(pos)); ctf_init_pos(&pos, output, O_RDWR); write_packet_header(&pos, s_uuid); From mathieu.desnoyers at efficios.com Fri Sep 7 08:37:48 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 7 Sep 2012 08:37:48 -0400 Subject: [lttng-dev] [PATCH/babeltrace] Fix babeltrace-log crash In-Reply-To: References: Message-ID: <20120907123748.GB22241@Krystal> * Hui Zhu (teawater at gmail.com) wrote: > Hi, > > Got a crash with babeltrace-log. > > #0 0x00007ffff744504c in free () from /lib/x86_64-linux-gnu/libc.so.6 > #1 0x00007ffff7ba6fc9 in munmap_align (mma=0x7ffff7ffe620) at > ../../../babeltrace/include/babeltrace/mmap-align.h:78 > #2 0x00007ffff7ba82db in ctf_packet_seek (stream_pos=0x7fffffffde60, > index=0, whence=0) > at ../../../babeltrace/formats/ctf/ctf.c:623 > #3 0x00007ffff7ba8141 in ctf_init_pos (pos=0x7fffffffde60, fd=8, open_flags=2) > at ../../../babeltrace/formats/ctf/ctf.c:576 > #4 0x0000000000401146 in trace_text (output=8, input=0x7ffff7779340 > <_IO_2_1_stdin_>) > at ../../babeltrace/converter/babeltrace-log.c:233 > #5 main (argc=, argv=) at > ../../babeltrace/converter/babeltrace-log.c:342 > > This issue because pos is used before it init. This patch init it in > function ctf_init_pos. Merged as: commit 36741bea2b53007c29ac0391ee9086722e00653a Author: Hui Zhu Date: Fri Sep 7 08:36:28 2012 -0400 Fix babeltrace-log uninitialized memory Got a crash with babeltrace-log. ../../../babeltrace/include/babeltrace/mmap-align.h:78 index=0, whence=0) at ../../../babeltrace/formats/ctf/ctf.c:623 at ../../../babeltrace/formats/ctf/ctf.c:576 <_IO_2_1_stdin_>) at ../../babeltrace/converter/babeltrace-log.c:233 ../../babeltrace/converter/babeltrace-log.c:342 This issue because pos is used before it init. This patch init it in function ctf_init_pos. Signed-off-by: Mathieu Desnoyers Thanks! Mathieu > > Thanks, > Hui > > --- a/formats/ctf/ctf.c > +++ b/formats/ctf/ctf.c > @@ -550,6 +550,7 @@ error: > > void ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags) > { > + memset(pos, 0, sizeof(*pos)); > pos->fd = fd; > if (fd >= 0) { > pos->packet_cycles_index = g_array_new(FALSE, TRUE, > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From teawater at gmail.com Fri Sep 7 09:01:38 2012 From: teawater at gmail.com (Hui Zhu) Date: Fri, 7 Sep 2012 21:01:38 +0800 Subject: [lttng-dev] [PATCH/babeltrace] Fix babeltrace-log crash In-Reply-To: <20120907123748.GB22241@Krystal> References: <20120907123748.GB22241@Krystal> Message-ID: On Fri, Sep 7, 2012 at 8:37 PM, Mathieu Desnoyers wrote: > * Hui Zhu (teawater at gmail.com) wrote: >> Hi, >> >> Got a crash with babeltrace-log. >> >> #0 0x00007ffff744504c in free () from /lib/x86_64-linux-gnu/libc.so.6 >> #1 0x00007ffff7ba6fc9 in munmap_align (mma=0x7ffff7ffe620) at >> ../../../babeltrace/include/babeltrace/mmap-align.h:78 >> #2 0x00007ffff7ba82db in ctf_packet_seek (stream_pos=0x7fffffffde60, >> index=0, whence=0) >> at ../../../babeltrace/formats/ctf/ctf.c:623 >> #3 0x00007ffff7ba8141 in ctf_init_pos (pos=0x7fffffffde60, fd=8, open_flags=2) >> at ../../../babeltrace/formats/ctf/ctf.c:576 >> #4 0x0000000000401146 in trace_text (output=8, input=0x7ffff7779340 >> <_IO_2_1_stdin_>) >> at ../../babeltrace/converter/babeltrace-log.c:233 >> #5 main (argc=, argv=) at >> ../../babeltrace/converter/babeltrace-log.c:342 >> >> This issue because pos is used before it init. This patch init it in >> function ctf_init_pos. > > Merged as: > > > commit 36741bea2b53007c29ac0391ee9086722e00653a > Author: Hui Zhu > Date: Fri Sep 7 08:36:28 2012 -0400 > > Fix babeltrace-log uninitialized memory > > Got a crash with babeltrace-log. > > ../../../babeltrace/include/babeltrace/mmap-align.h:78 > index=0, whence=0) > at ../../../babeltrace/formats/ctf/ctf.c:623 > at ../../../babeltrace/formats/ctf/ctf.c:576 > <_IO_2_1_stdin_>) > at ../../babeltrace/converter/babeltrace-log.c:233 > ../../babeltrace/converter/babeltrace-log.c:342 > > This issue because pos is used before it init. This patch init it in > function ctf_init_pos. > > Signed-off-by: Mathieu Desnoyers > > Thanks! > > Mathieu Hi Mathieu, The first one will make babeltrace crash. Please revert it and use the second one. Thanks, Hui > > >> >> Thanks, >> Hui >> >> --- a/formats/ctf/ctf.c >> +++ b/formats/ctf/ctf.c >> @@ -550,6 +550,7 @@ error: >> >> void ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags) >> { >> + memset(pos, 0, sizeof(*pos)); >> pos->fd = fd; >> if (fd >= 0) { >> pos->packet_cycles_index = g_array_new(FALSE, TRUE, >> >> _______________________________________________ >> lttng-dev mailing list >> lttng-dev at lists.lttng.org >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com -------------- next part -------------- --- a/converter/babeltrace-log.c +++ b/converter/babeltrace-log.c @@ -230,6 +230,7 @@ void trace_text(FILE *input, int output) char *line = NULL, *nl; size_t linesize; + memset(&pos, 0, sizeof(pos)); ctf_init_pos(&pos, output, O_RDWR); write_packet_header(&pos, s_uuid); From mathieu.desnoyers at efficios.com Fri Sep 7 09:03:25 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 7 Sep 2012 09:03:25 -0400 Subject: [lttng-dev] [RFC URCU PATCH] wfqueue: ABI v1, simplify implementation, 2.3x to 2.6x performance boost In-Reply-To: <504968CC.4090101@cn.fujitsu.com> References: <20120815213107.GB17224@Krystal> <5032054D.7050508@cn.fujitsu.com> <20120820131642.GA551@Krystal> <50330371.6060401@cn.fujitsu.com> <50357FF8.9060704@cn.fujitsu.com> <20120906134346.GE3630@Krystal> <504968CC.4090101@cn.fujitsu.com> Message-ID: <20120907130325.GA22377@Krystal> * Lai Jiangshan (laijs at cn.fujitsu.com) wrote: > On 09/06/2012 09:43 PM, Mathieu Desnoyers wrote: > > * Lai Jiangshan (laijs at cn.fujitsu.com) wrote: > >> ping > > > > we discussed a "batch" design offline. Do you think you would have time > > to spin a patch implementing it ? > > > > I prefer separated enqueue_struct dequeue_struct a little, so I'm > waiting for you. > > DEADLOCK! Hahaha :-) OK, I'm planning to discuss this with Paul next week, to get a 3rd opinion. I don't want to make choices too quickly for APIs. So meanwhile, let's try to sum up the possible solutions, those I recall are: 1) The current API, with a single struct cds_wfqueue for enqueue and dequeue, with false-sharing between enqueue and dequeue, but on the plus side it provides a compact structure to put on the stack. 2) An API with cache-aligned fields of struct cds_wfqueue for enqueue and dequeue. Removes false-sharing, but requires a larger structure when extracted onto the stack with our new splice operation. 3) An API with two different queue representations: a "queue" and a "batch". The "queue" is bullet (2) above, and when we splice elements onto the stack, we put them in a "batch", described by bullet (1) above. 4) An API that takes separate enqueue/dequeue structures: it would allow the caller to decide the memory layout of those structures. We could possibly provide macros helpers for the common cases. E.g. struct cds_enq { struct cds_wfq_node *tail; }; struct cds_deq { struct cds_wfq_node head; pthread_mutex_t lock; }; #define DEFINE_CDS_Q_ON_STACK(q) \ struct wfenqueue __cds_wfqenqueue_##q = { NULL }; \ struct wfdequeue __cds_wfqdequeue_##q = \ { { NULL }, PTHREAD_MUTEX_INITIALIZER, } /* For queue head/tail in data */ #define DEFINE_CDS_Q(q) \ struct cds_enq __cds_enq_##q \ __attribute__((aligned((CAA_CACHE_LINE_SIZE)))) \ = { NULL }; \ struct cds_deq __cds_deq_##q \ __attribute__((aligned((CAA_CACHE_LINE_SIZE)))) \ = { { NULL }, PTHREAD_MUTEX_INITIALIZER, } And for dynamic allocation, then the user could specify the alignment they want for their allocated memory (not sure it is worth it to do helpers for that). #define CDS_Q(q) __cds_enq_##q, __cds_deq_##q Then, when those structures would be passed to enqueue/dequeue: static DEFINE_CDS_Q(myqueue); void fct(void) { ... cds_wfq_enqueue(CDS_Q(myqueue), somenode); } Thoughts ? Thanks, Mathieu > > thanks, > Lai -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Fri Sep 7 09:18:07 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 7 Sep 2012 09:18:07 -0400 Subject: [lttng-dev] [PATCH/babeltrace] Fix babeltrace-log crash In-Reply-To: References: <20120907123748.GB22241@Krystal> Message-ID: <20120907131807.GC22377@Krystal> * Hui Zhu (teawater at gmail.com) wrote: > On Fri, Sep 7, 2012 at 8:37 PM, Mathieu Desnoyers > wrote: > > * Hui Zhu (teawater at gmail.com) wrote: > >> Hi, > >> > >> Got a crash with babeltrace-log. > >> > >> #0 0x00007ffff744504c in free () from /lib/x86_64-linux-gnu/libc.so.6 > >> #1 0x00007ffff7ba6fc9 in munmap_align (mma=0x7ffff7ffe620) at > >> ../../../babeltrace/include/babeltrace/mmap-align.h:78 > >> #2 0x00007ffff7ba82db in ctf_packet_seek (stream_pos=0x7fffffffde60, > >> index=0, whence=0) > >> at ../../../babeltrace/formats/ctf/ctf.c:623 > >> #3 0x00007ffff7ba8141 in ctf_init_pos (pos=0x7fffffffde60, fd=8, open_flags=2) > >> at ../../../babeltrace/formats/ctf/ctf.c:576 > >> #4 0x0000000000401146 in trace_text (output=8, input=0x7ffff7779340 > >> <_IO_2_1_stdin_>) > >> at ../../babeltrace/converter/babeltrace-log.c:233 > >> #5 main (argc=, argv=) at > >> ../../babeltrace/converter/babeltrace-log.c:342 > >> > >> This issue because pos is used before it init. This patch init it in > >> function ctf_init_pos. > > > > Merged as: > > > > > > commit 36741bea2b53007c29ac0391ee9086722e00653a > > Author: Hui Zhu > > Date: Fri Sep 7 08:36:28 2012 -0400 > > > > Fix babeltrace-log uninitialized memory > > > > Got a crash with babeltrace-log. > > > > ../../../babeltrace/include/babeltrace/mmap-align.h:78 > > index=0, whence=0) > > at ../../../babeltrace/formats/ctf/ctf.c:623 > > at ../../../babeltrace/formats/ctf/ctf.c:576 > > <_IO_2_1_stdin_>) > > at ../../babeltrace/converter/babeltrace-log.c:233 > > ../../babeltrace/converter/babeltrace-log.c:342 > > > > This issue because pos is used before it init. This patch init it in > > function ctf_init_pos. > > > > Signed-off-by: Mathieu Desnoyers > > > > Thanks! > > > > Mathieu > > Hi Mathieu, > > The first one will make babeltrace crash. > Please revert it and use the second one. Done, thanks, Mathieu > > Thanks, > Hui > > > > > > >> > >> Thanks, > >> Hui > >> > >> --- a/formats/ctf/ctf.c > >> +++ b/formats/ctf/ctf.c > >> @@ -550,6 +550,7 @@ error: > >> > >> void ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags) > >> { > >> + memset(pos, 0, sizeof(*pos)); > >> pos->fd = fd; > >> if (fd >= 0) { > >> pos->packet_cycles_index = g_array_new(FALSE, TRUE, > >> > >> _______________________________________________ > >> lttng-dev mailing list > >> lttng-dev at lists.lttng.org > >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > > -- > > Mathieu Desnoyers > > Operating System Efficiency R&D Consultant > > EfficiOS Inc. > > http://www.efficios.com > --- a/converter/babeltrace-log.c > +++ b/converter/babeltrace-log.c > @@ -230,6 +230,7 @@ void trace_text(FILE *input, int output) > char *line = NULL, *nl; > size_t linesize; > > + memset(&pos, 0, sizeof(pos)); > ctf_init_pos(&pos, output, O_RDWR); > > write_packet_header(&pos, s_uuid); > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Fri Sep 7 13:37:14 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 07 Sep 2012 13:37:14 -0400 Subject: [lttng-dev] [PATCH v3 lttng-tools] Filter allocation and large bytecode fixes In-Reply-To: <1346953219-9001-1-git-send-email-christian.babeux@efficios.com> References: <1346093301-25274-1-git-send-email-christian.babeux@efficios.com> <1346953219-9001-1-git-send-email-christian.babeux@efficios.com> Message-ID: <504A30CA.7020209@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Merged! Christian Babeux: > Previous iteration of patch 2/3 was missing a typo fix in the > LTTNG_FILTER_MAX_LEN define. > > Also, Mathieu suggested that we put a check on the > reloc_table_offset in the sessiond to check its bounds when > receiving the LTTNG_SET_FILTER command. This is not necessary > because the reloc_table_offset does not exist in the filter struct > of the lttcomm_session_msg union. > > Changelog v3: > > 1/3 - Already merged. 2/3 - Add missing typo fix in > LTTNG_FILTER_MAX_LEN define. 3/3 - Already merged. > > Changelog v2: > > 1/3 - Already merged. 2/3 - Respin. Support 65536 bytes bytecode > len + filter ABI changes. 3/3 - Already merged. > > Thanks, > > Christian Babeux (1): Fix: Accept bytecode of length 65536 bytes > > src/bin/lttng-sessiond/lttng-ust-abi.h | 6 > +++--- src/bin/lttng-sessiond/main.c > | 2 +- src/common/sessiond-comm/sessiond-comm.h > | 6 +++--- > src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c | 2 +- > 4 files changed, 8 insertions(+), 8 deletions(-) > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQSjDAAAoJEELoaioR9I02atsIAIQtPFOgFQrc4akLIbZTqIOi AjdzJXkD8HPd4tpYdmLfSLZWi/Ia4rwl2quhWv/+PHOrt5ykBzBApTpjYGzc86oL 2m5ucrK4BFT9sMKU/hLm5eJ2+KVMjTL31Ek9LRt96YmmF2a2QMk/vfAEAJ6VA8XT 3IVfnT9bDNMn/WdwZRP5Dseob38xlumTMN4x/giz4BxBZDM8T4LV+fziFNSdwDvv ZWros1eSeznUU3uCZ1/85YqYb/CK09LbDv0bD5e+Hv9t4j/WadwyVV/BAuBOh+9m zBdoZtoxx+Fx6jrGJCNtyeV4/cEDNHfyaVW51ZAyaW4yS7yygQmlvIbs0OJ/SMc= =F7Wm -----END PGP SIGNATURE----- From kxhdyx at gmail.com Sun Sep 9 22:14:41 2012 From: kxhdyx at gmail.com (=?GB2312?B?v9zP/urN?=) Date: Mon, 10 Sep 2012 10:14:41 +0800 Subject: [lttng-dev] Can LTTng use across multiple system? Message-ID: I saw this :Tracing across multiple systems is also possible. Now i want to deploy LTTng on a cluster system(such as 4 machines,one is the control machine,and this on also can collect all other 3 machines trace results),but i can't find any documentation about that. Are there any suggestions for me? Thanks all. -------------- next part -------------- An HTML attachment was scrubbed... URL: From desa.carlos at gmail.com Mon Sep 10 02:42:32 2012 From: desa.carlos at gmail.com (Carlos de Sa) Date: Mon, 10 Sep 2012 12:12:32 +0530 Subject: [lttng-dev] Trace files not getting generated Message-ID: Hi, I've been trying to get kernel tracing working on a TI AM355X EVM using the standard arago 05.05 toolchain, kernel & ti-sdk filesystem; but seem to have some buffer issues. Any help on this would be much appreciated. After starting a trace session I ran a few programs - the graphics package apps and standard demo apps. After stopping all seems to be fine but when I destroy the session it generates a warning. And the session dir (session2-20120727-122650) is empty as can be seen below - root at am335x-evm:~/lttng-traces# arm-arago-linux-gnueabi-lttng enable-event sched _switch,sched_wakeup -k kernel event sched_switch created in channel channel0 kernel event sched_wakeup created in channel channel0 root at am335x-evm:~/lttng-traces# arm-arago-linux-gnueabi-lttng add-context -k -e sched_switch -t pid kernel context pid added to event sched_switch root at am335x-evm:~/lttng-traces# arm-arago-linux-gnueabi-lttng start Tracing started for session session2 root at am335x-evm:~/lttng-traces# arm-arago-linux-gnueabi-lttng stop Tracing stopped for session session2 root at am335x-evm:~/lttng-traces# ls session1-20120727-122409 session2-20120727-122650 root at am335x-evm:~/lttng-traces# ls session2-20120727-122650/kernel/ root at am335x-evm:~/lttng-traces# ls session2-20120727-122650/kernel/ root at am335x-evm:~/lttng-traces# arm-arago-linux-gnueabi-lttng destroy [ 1049.263275] ring buffer relay-discard, cpu 0: records were lost. Caused by: [ 1049.263275] [ 21949 buffer full, 0 nest buffer wrap-around, 0 event too big ] Session session2 destroyed at /home/root root at am335x-evm:~# ls lttng-traces/session2-20120727-122650/kernel/ root at am335x-evm:~# ls lttng-traces/session2-20120727-122650/ Any idea whats going wrong? Fyi I also have debugfs enabled and mounted. And sessiond when run with -vvv option does not show any errors. Previously when enabling all traces (enable-event -a -k) I got the error at "LTTng: Failure to write metadata to buffers (timeout)" when starting. I thought this may have been a kernel buffer issue due to enabling all possible events. But the above log does not show the same issue so thought this case of only a few events should have worked. Regards, Carlos From Paul_Woegerer at mentor.com Mon Sep 10 07:25:34 2012 From: Paul_Woegerer at mentor.com (Woegerer, Paul) Date: Mon, 10 Sep 2012 13:25:34 +0200 Subject: [lttng-dev] lttng command line user-friendliness Message-ID: <504DCE2E.7020000@mentor.com> As much as I like the lttng command line tool (that we have since LTTng2) I still see people (who are not yet familiar with lttng) struggle with the simple fact that it takes more than one command to actually get something traced. Issuing a sequence of commands like: lttng create lttng enable-event -u -a lttng start my_foobar_traced_application 1 2 3 lttng stop lttng destroy seems to be perceived as complicated compared to: perf record -- my_foobar_traced_application 1 2 3 My argument usually is that providing detailed settings as options (like perf) does not scale as well as the lttng approach (if you have more things to configure). On the other hand most users just want something like the above. Also arguing that they should write a shell-script that encodes their use case generally causes irritation ("... please understand, I do not want to write a shell-script I just want to do simple tracing of my executable ..."). What about adding something similar to "perf record" to lower the barrier for such users. For example: lttng record [--session-name ] [--session-template ] -- [] Where the optional session_template_file may only contain "enable-channel, enable-event and add-context" commands. If omitted the following could be the (trivial) default session template: enable-event -u -a Would this make sense for others as well ? Any alternative suggestions ? Thanks, Paul -- Paul Woegerer | SW Development Engineer http://go.mentor.com/sourceryanalyzer Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.wwwhich From francis.giraldeau at gmail.com Mon Sep 10 09:44:02 2012 From: francis.giraldeau at gmail.com (Francis Giraldeau) Date: Mon, 10 Sep 2012 09:44:02 -0400 Subject: [lttng-dev] lttng command line user-friendliness In-Reply-To: <504DCE2E.7020000@mentor.com> References: <504DCE2E.7020000@mentor.com> Message-ID: <504DEEA2.2000305@gmail.com> Le 2012-09-10 07:25, Woegerer, Paul a ?crit : > What about adding something similar to "perf record" to lower the > barrier for such users. For example: > > lttng record [--session-name ] [--session-template > ] -- [] > > Where the optional session_template_file may only contain > "enable-channel, enable-event and add-context" commands. If omitted the > following could be the (trivial) default session template: > > enable-event -u -a > > > Would this make sense for others as well ? Any alternative suggestions ? I totally agree with you. For that purpose, I did a small python script lttng-simple that wraps commands and create a trace in the current directory, like perf does. While it does what I need, a more generic solution should be provided using the API instead of the ugly command line subprocess ;) https://github.com/giraldeau/workload-kit/tree/master/utils Cheers, Francis -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4489 bytes Desc: Signature cryptographique S/MIME URL: From per.e.nilsson at ericsson.com Mon Sep 10 03:32:31 2012 From: per.e.nilsson at ericsson.com (Per Nilsson) Date: Mon, 10 Sep 2012 09:32:31 +0200 Subject: [lttng-dev] User space tracing Message-ID: Hi, I am trying to get started with userspace tracing with LTTng, but I am having a hard time to get it to work. I'm using Ubunto 11.04, with kernel version: 2.6.38-8-generic. I downloaded and compiled the following lttng software: Userspace-rcu-0.7.4 Lttng-ust-2.0.5 Lttng-tools-2-0.4 Babeltrace-1.0.0-rc5 Maybe some one can tell me what is wrong. // This is command line command I use to start the trace session. per at per-VirtualBox:~$ sudo lttng create foo [sudo] password for per: Session foo created. Traces will be written in /home/per/lttng-traces/foo-20120905-135905 per at per-VirtualBox:~$ sudo lttng enable-event -a -u All UST events are enabled in channel channel0 per at per-VirtualBox:~$ sudo lttng start Tracing started for session foo per at per-VirtualBox:~$ sudo lttng stop Tracing stopped for session foo per at per-VirtualBox:~$ sudo ls /home/per/lttng-traces/foo-20120905-135905/ust per at per-VirtualBox:~$ sudo babeltrace /home/per/lttng-traces/foo-20120905-135905/ust [error] Cannot open any trace for reading. [error] opening trace "/home/per/lttng-traces/foo-20120905-135905/ust" for reading. [error] none of the specified trace paths could be opened. // This is the traces from the lttng-sessiond per at per-VirtualBox:~$ sudo lttng-sessiond --verbose --verbose-consumer DEBUG3: Creating LTTng run directory: /var/run/lttng [in create_lttng_rundir() at main.c:4317] DEBUG1: Client socket path /var/run/lttng/client-lttng-sessiond [in main() at main.c:4609] DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond [in main() at main.c:4610] DEBUG1: LTTng run directory path: /var/run/lttng [in main() at main.c:4611] DEBUG3: Created hashtable size 4 at 0x1d4e0a0 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d4e340 of type 1 [in lttng_ht_new() at hashtable.c:96] FATAL: Module lttng_tracer not found. Error: Unable to load module lttng-tracer DEBUG1: Failed to open /proc/lttng [in init_kernel_tracer() at main.c:1871] Error: Unable to remove module lttng-tracer Warning: No kernel tracer available DEBUG1: Signal handler set for SIGTERM, SIGPIPE and SIGINT [in set_signal_handler() at main.c:4451] Warning: No tracing group detected DEBUG1: epoll set max size is 100188 [in compat_epoll_set_max_size() at compat-epoll.c:224] DEBUG1: Thread manage kernel started [in thread_manage_kernel() at main.c:876] DEBUG1: Updating kernel poll set [in update_kernel_poll() at main.c:748] DEBUG1: Thread kernel polling on 2 fds [in thread_manage_kernel() at main.c:905] DEBUG1: [thread] Manage application started [in thread_manage_apps() at main.c:1179] DEBUG1: Apps thread polling on 2 fds [in thread_manage_apps() at main.c:1200] DEBUG1: [thread] Manage application registration started [in thread_registration_apps() at main.c:1392] DEBUG1: Notifying applications of session daemon state: 1 [in notify_ust_apps() at main.c:687] DEBUG1: Got the wait shm fd 17 [in get_wait_shm() at shm.c:117] DEBUG1: Futex wait update active 1 [in futex_wait_update() at futex.c:62] DEBUG1: Accepting application registration [in thread_registration_apps() at main.c:1423] DEBUG1: [thread] Dispatch UST command started [in thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex n to 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: Woken up but nothing in the UST command queue [in thread_dispatch_ust_registration() at main.c:1334] DEBUG1: [thread] Manage client started [in thread_manage_clients() at main.c:3794] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 8 [in process_client_msg() at main.c:3309] DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905 with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] DEBUG1: Using run_as_clone [in run_as() at runas.c:323] DEBUG1: Tracing session foo created in /home/per/lttng-traces/foo-20120905-135905 with ID 1 by UID 0 GID 0 [in session_create() at session.c:232] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 6 [in process_client_msg() at main.c:3309] DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] DEBUG1: Creating UST session [in create_ust_session() at main.c:1965] DEBUG3: Created hashtable size 4 at 0x1d55840 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d55b00 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d55dc0 of type 0 [in lttng_ht_new() at hashtable.c:96] DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905/ust with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] DEBUG1: Using run_as_clone [in run_as() at runas.c:323] DEBUG1: Spawning consumerd [in spawn_consumerd() at main.c:1659] DEBUG1: [thread] Manage consumer started [in thread_manage_consumer() at main.c:982] DEBUG1: Using 64-bit UST consumer at: /usr/local/lib/lttng/libexec/lttng-consumerd [in spawn_consumerd() at main.c:1733] DEBUG3: Created hashtable size 4 at 0x247d030 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x247d2f0 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG1: Connecting to error socket /var/run/lttng/ustconsumerd64/error [in main() at lttng-consumerd.c:349] DEBUG1: Updating poll fd array [in consumer_update_poll_array() at consumer.c:521] DEBUG1: polling on 1 fd [in lttng_consumer_thread_poll_fds() at consumer.c:1013] DEBUG1: Creating command socket /var/run/lttng/ustconsumerd64/command [in lttng_consumer_thread_receive_fds() at consumer.c:1160] DEBUG1: Sending ready command to lttng-sessiond [in lttng_consumer_thread_receive_fds() at consumer.c:1173] DEBUG1: consumer command socket ready [in thread_manage_consumer() at main.c:1062] DEBUG3: Created hashtable size 4 at 0x1d57720 of type 0 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d579e0 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d57f00 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG1: UST app creating event * for all apps for session id 1 [in ust_app_create_event_glb() at ust-app.c:1916] DEBUG1: Event UST * created in channel channel0 [in event_ust_enable_tracepoint() at event.c:486] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Connection on client_socket [in lttng_consumer_thread_receive_fds() at consumer.c:1196] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 16 [in process_client_msg() at main.c:3309] DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] DEBUG1: Starting all UST traces [in ust_app_start_trace_all() at ust-app.c:2207] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 17 [in process_client_msg() at main.c:3309] DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] DEBUG1: Stopping all UST traces [in ust_app_stop_trace_all() at ust-app.c:2233] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] // this is the traces from the small test application per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ export LTTNG_UST_DEBUG=1 per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ ./sample liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x7f431694fc38 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) liblttng_ust_tracepoint[1748/1748]: registered tracepoint: lttng_ust:metadata (in tracepoint_register_lib() at tracepoint.c:646) libust[1748/1748]: LTT : ltt ring buffer client init (in ltt_ring_buffer_metadata_client_init() at ltt-ring-buffer-metadata-client.h:334) libust[1748/1748]: LTT : ltt ring buffer client init (in ltt_ring_buffer_client_overwrite_init() at ltt-ring-buffer-client.h:584) libust[1748/1748]: LTT : ltt ring buffer client init (in ltt_ring_buffer_client_discard_init() at ltt-ring-buffer-client.h:584) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Waiting for local apps sessiond (in wait_for_sessiond() at lttng-ust-comm.c:638) libust[1748/1750]: Linux kernels 2.6.33 to 3.0 (with the exception of stable versions) do not support FUTEX_WAKE on read-only memory mappings correctly. Please upgrade your kernel (fix is commit 9ea71503a8ed9184d2d0b8ccc4d269d05f7940ae in Linux kernel mainline). LTTng-UST will use polling mode fallback. (in wait_for_sessiond() at lttng-ust-comm.c:651) libust[1748/1750]: Error: futex: Bad address (in wait_for_sessiond() at lttng-ust-comm.c:653) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1748]: just registered probe sample_tracepoint containing 1 events (in ltt_probe_register() at ltt-probes.c:109) libust[1748/1748]: Registered event probe "sample_tracepoint:message" with signature "char *, text" (in ltt_probe_register() at ltt-probes.c:118) liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x602138 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) liblttng_ust_tracepoint[1748/1748]: registered tracepoint: sample_tracepoint:message (in tracepoint_register_lib() at tracepoint.c:646) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) BR /Per Nilsson -------------- next part -------------- An HTML attachment was scrubbed... URL: From irina.guilman at ericsson.com Mon Sep 10 10:45:00 2012 From: irina.guilman at ericsson.com (Irina Guilman) Date: Mon, 10 Sep 2012 10:45:00 -0400 Subject: [lttng-dev] User space tracing In-Reply-To: References: Message-ID: <450AE4BEC513614F96969DDA34F35934412F2D721C@EUSAACMS0701.eamcs.ericsson.se> Per, You dont get traces at all, or you do get them but babeltrace fails to convert them? If you open /home/per/lttng-traces/foo-20120905-135905/ust/*/metadata can you see your events? ________________________________ From: Per Nilsson [mailto:per.e.nilsson at ericsson.com] Sent: September-10-12 3:33 AM To: lttng-dev at lists.lttng.org Subject: [lttng-dev] User space tracing Hi, I am trying to get started with userspace tracing with LTTng, but I am having a hard time to get it to work. I'm using Ubunto 11.04, with kernel version: 2.6.38-8-generic. I downloaded and compiled the following lttng software: Userspace-rcu-0.7.4 Lttng-ust-2.0.5 Lttng-tools-2-0.4 Babeltrace-1.0.0-rc5 Maybe some one can tell me what is wrong. // This is command line command I use to start the trace session. per at per-VirtualBox:~$ sudo lttng create foo [sudo] password for per: Session foo created. Traces will be written in /home/per/lttng-traces/foo-20120905-135905 per at per-VirtualBox:~$ sudo lttng enable-event -a -u All UST events are enabled in channel channel0 per at per-VirtualBox:~$ sudo lttng start Tracing started for session foo per at per-VirtualBox:~$ sudo lttng stop Tracing stopped for session foo per at per-VirtualBox:~$ sudo ls /home/per/lttng-traces/foo-20120905-135905/ust per at per-VirtualBox:~$ sudo babeltrace /home/per/lttng-traces/foo-20120905-135905/ust [error] Cannot open any trace for reading. [error] opening trace "/home/per/lttng-traces/foo-20120905-135905/ust" for reading. [error] none of the specified trace paths could be opened. // This is the traces from the lttng-sessiond per at per-VirtualBox:~$ sudo lttng-sessiond --verbose --verbose-consumer DEBUG3: Creating LTTng run directory: /var/run/lttng [in create_lttng_rundir() at main.c:4317] DEBUG1: Client socket path /var/run/lttng/client-lttng-sessiond [in main() at main.c:4609] DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond [in main() at main.c:4610] DEBUG1: LTTng run directory path: /var/run/lttng [in main() at main.c:4611] DEBUG3: Created hashtable size 4 at 0x1d4e0a0 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d4e340 of type 1 [in lttng_ht_new() at hashtable.c:96] FATAL: Module lttng_tracer not found. Error: Unable to load module lttng-tracer DEBUG1: Failed to open /proc/lttng [in init_kernel_tracer() at main.c:1871] Error: Unable to remove module lttng-tracer Warning: No kernel tracer available DEBUG1: Signal handler set for SIGTERM, SIGPIPE and SIGINT [in set_signal_handler() at main.c:4451] Warning: No tracing group detected DEBUG1: epoll set max size is 100188 [in compat_epoll_set_max_size() at compat-epoll.c:224] DEBUG1: Thread manage kernel started [in thread_manage_kernel() at main.c:876] DEBUG1: Updating kernel poll set [in update_kernel_poll() at main.c:748] DEBUG1: Thread kernel polling on 2 fds [in thread_manage_kernel() at main.c:905] DEBUG1: [thread] Manage application started [in thread_manage_apps() at main.c:1179] DEBUG1: Apps thread polling on 2 fds [in thread_manage_apps() at main.c:1200] DEBUG1: [thread] Manage application registration started [in thread_registration_apps() at main.c:1392] DEBUG1: Notifying applications of session daemon state: 1 [in notify_ust_apps() at main.c:687] DEBUG1: Got the wait shm fd 17 [in get_wait_shm() at shm.c:117] DEBUG1: Futex wait update active 1 [in futex_wait_update() at futex.c:62] DEBUG1: Accepting application registration [in thread_registration_apps() at main.c:1423] DEBUG1: [thread] Dispatch UST command started [in thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex n to 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: Woken up but nothing in the UST command queue [in thread_dispatch_ust_registration() at main.c:1334] DEBUG1: [thread] Manage client started [in thread_manage_clients() at main.c:3794] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 8 [in process_client_msg() at main.c:3309] DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905 with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] DEBUG1: Using run_as_clone [in run_as() at runas.c:323] DEBUG1: Tracing session foo created in /home/per/lttng-traces/foo-20120905-135905 with ID 1 by UID 0 GID 0 [in session_create() at session.c:232] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 6 [in process_client_msg() at main.c:3309] DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] DEBUG1: Creating UST session [in create_ust_session() at main.c:1965] DEBUG3: Created hashtable size 4 at 0x1d55840 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d55b00 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d55dc0 of type 0 [in lttng_ht_new() at hashtable.c:96] DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905/ust with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] DEBUG1: Using run_as_clone [in run_as() at runas.c:323] DEBUG1: Spawning consumerd [in spawn_consumerd() at main.c:1659] DEBUG1: [thread] Manage consumer started [in thread_manage_consumer() at main.c:982] DEBUG1: Using 64-bit UST consumer at: /usr/local/lib/lttng/libexec/lttng-consumerd [in spawn_consumerd() at main.c:1733] DEBUG3: Created hashtable size 4 at 0x247d030 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x247d2f0 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG1: Connecting to error socket /var/run/lttng/ustconsumerd64/error [in main() at lttng-consumerd.c:349] DEBUG1: Updating poll fd array [in consumer_update_poll_array() at consumer.c:521] DEBUG1: polling on 1 fd [in lttng_consumer_thread_poll_fds() at consumer.c:1013] DEBUG1: Creating command socket /var/run/lttng/ustconsumerd64/command [in lttng_consumer_thread_receive_fds() at consumer.c:1160] DEBUG1: Sending ready command to lttng-sessiond [in lttng_consumer_thread_receive_fds() at consumer.c:1173] DEBUG1: consumer command socket ready [in thread_manage_consumer() at main.c:1062] DEBUG3: Created hashtable size 4 at 0x1d57720 of type 0 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d579e0 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d57f00 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG1: UST app creating event * for all apps for session id 1 [in ust_app_create_event_glb() at ust-app.c:1916] DEBUG1: Event UST * created in channel channel0 [in event_ust_enable_tracepoint() at event.c:486] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Connection on client_socket [in lttng_consumer_thread_receive_fds() at consumer.c:1196] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 16 [in process_client_msg() at main.c:3309] DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] DEBUG1: Starting all UST traces [in ust_app_start_trace_all() at ust-app.c:2207] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 17 [in process_client_msg() at main.c:3309] DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] DEBUG1: Stopping all UST traces [in ust_app_stop_trace_all() at ust-app.c:2233] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] // this is the traces from the small test application per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ export LTTNG_UST_DEBUG=1 per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ ./sample liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x7f431694fc38 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) liblttng_ust_tracepoint[1748/1748]: registered tracepoint: lttng_ust:metadata (in tracepoint_register_lib() at tracepoint.c:646) libust[1748/1748]: LTT : ltt ring buffer client init (in ltt_ring_buffer_metadata_client_init() at ltt-ring-buffer-metadata-client.h:334) libust[1748/1748]: LTT : ltt ring buffer client init (in ltt_ring_buffer_client_overwrite_init() at ltt-ring-buffer-client.h:584) libust[1748/1748]: LTT : ltt ring buffer client init (in ltt_ring_buffer_client_discard_init() at ltt-ring-buffer-client.h:584) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Waiting for local apps sessiond (in wait_for_sessiond() at lttng-ust-comm.c:638) libust[1748/1750]: Linux kernels 2.6.33 to 3.0 (with the exception of stable versions) do not support FUTEX_WAKE on read-only memory mappings correctly. Please upgrade your kernel (fix is commit 9ea71503a8ed9184d2d0b8ccc4d269d05f7940ae in Linux kernel mainline). LTTng-UST will use polling mode fallback. (in wait_for_sessiond() at lttng-ust-comm.c:651) libust[1748/1750]: Error: futex: Bad address (in wait_for_sessiond() at lttng-ust-comm.c:653) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1748]: just registered probe sample_tracepoint containing 1 events (in ltt_probe_register() at ltt-probes.c:109) libust[1748/1748]: Registered event probe "sample_tracepoint:message" with signature "char *, text" (in ltt_probe_register() at ltt-probes.c:118) liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x602138 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) liblttng_ust_tracepoint[1748/1748]: registered tracepoint: sample_tracepoint:message (in tracepoint_register_lib() at tracepoint.c:646) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) BR /Per Nilsson -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexmonthy at voxpopuli.im Mon Sep 10 10:50:31 2012 From: alexmonthy at voxpopuli.im (Alexandre Montplaisir) Date: Mon, 10 Sep 2012 10:50:31 -0400 Subject: [lttng-dev] User space tracing In-Reply-To: References: Message-ID: <504DFE37.6090803@voxpopuli.im> Hi, In your example, you are running the tracer as root (with "sudo") but your application is run by your own user. Somebody correct me if I'm wrong, but I assume that in a case like this the root tracer will not see the other user's applications. Could you try running the lttng commands without sudo, so that it creates a session for your user only. Cheers, Alexandre On 12-09-10 03:32 AM, Per Nilsson wrote: > Hi, > I am trying to get started with userspace tracing with LTTng, but I am having a hard time to get it to work. > I'm using Ubunto 11.04, with kernel version: 2.6.38-8-generic. > > I downloaded and compiled the following lttng software: > > Userspace-rcu-0.7.4 > Lttng-ust-2.0.5 > Lttng-tools-2-0.4 > Babeltrace-1.0.0-rc5 > > Maybe some one can tell me what is wrong. > > // This is command line command I use to start the trace session. > > per at per-VirtualBox:~$ sudo lttng create foo > [sudo] password for per: > Session foo created. > Traces will be written in /home/per/lttng-traces/foo-20120905-135905 > per at per-VirtualBox:~$ sudo lttng enable-event -a -u > All UST events are enabled in channel channel0 > per at per-VirtualBox:~$ sudo lttng start > Tracing started for session foo > per at per-VirtualBox:~$ sudo lttng stop > Tracing stopped for session foo > per at per-VirtualBox:~$ sudo ls /home/per/lttng-traces/foo-20120905-135905/ust > per at per-VirtualBox:~$ sudo babeltrace /home/per/lttng-traces/foo-20120905-135905/ust > [error] Cannot open any trace for reading. > > [error] opening trace "/home/per/lttng-traces/foo-20120905-135905/ust" for reading. > > [error] none of the specified trace paths could be opened. > > // This is the traces from the lttng-sessiond > > per at per-VirtualBox:~$ sudo lttng-sessiond --verbose --verbose-consumer > DEBUG3: Creating LTTng run directory: /var/run/lttng [in create_lttng_rundir() at main.c:4317] > DEBUG1: Client socket path /var/run/lttng/client-lttng-sessiond [in main() at main.c:4609] > DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond [in main() at main.c:4610] > DEBUG1: LTTng run directory path: /var/run/lttng [in main() at main.c:4611] > DEBUG3: Created hashtable size 4 at 0x1d4e0a0 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d4e340 of type 1 [in lttng_ht_new() at hashtable.c:96] > FATAL: Module lttng_tracer not found. > Error: Unable to load module lttng-tracer > DEBUG1: Failed to open /proc/lttng [in init_kernel_tracer() at main.c:1871] > Error: Unable to remove module lttng-tracer > Warning: No kernel tracer available > DEBUG1: Signal handler set for SIGTERM, SIGPIPE and SIGINT [in set_signal_handler() at main.c:4451] > Warning: No tracing group detected > DEBUG1: epoll set max size is 100188 [in compat_epoll_set_max_size() at compat-epoll.c:224] > DEBUG1: Thread manage kernel started [in thread_manage_kernel() at main.c:876] > DEBUG1: Updating kernel poll set [in update_kernel_poll() at main.c:748] > DEBUG1: Thread kernel polling on 2 fds [in thread_manage_kernel() at main.c:905] > DEBUG1: [thread] Manage application started [in thread_manage_apps() at main.c:1179] > DEBUG1: Apps thread polling on 2 fds [in thread_manage_apps() at main.c:1200] > DEBUG1: [thread] Manage application registration started [in thread_registration_apps() at main.c:1392] > DEBUG1: Notifying applications of session daemon state: 1 [in notify_ust_apps() at main.c:687] > DEBUG1: Got the wait shm fd 17 [in get_wait_shm() at shm.c:117] > DEBUG1: Futex wait update active 1 [in futex_wait_update() at futex.c:62] > DEBUG1: Accepting application registration [in thread_registration_apps() at main.c:1423] > DEBUG1: [thread] Dispatch UST command started [in thread_dispatch_ust_registration() at main.c:1324] > DEBUG1: Futex n to 1 prepare done [in futex_nto1_prepare() at futex.c:73] > DEBUG1: Woken up but nothing in the UST command queue [in thread_dispatch_ust_registration() at main.c:1334] > DEBUG1: [thread] Manage client started [in thread_manage_clients() at main.c:3794] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 8 [in process_client_msg() at main.c:3309] > DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905 with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] > DEBUG1: Using run_as_clone [in run_as() at runas.c:323] > DEBUG1: Tracing session foo created in /home/per/lttng-traces/foo-20120905-135905 with ID 1 by UID 0 GID 0 [in session_create() at session.c:232] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 6 [in process_client_msg() at main.c:3309] > DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] > DEBUG1: Creating UST session [in create_ust_session() at main.c:1965] > DEBUG3: Created hashtable size 4 at 0x1d55840 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d55b00 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d55dc0 of type 0 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905/ust with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] > DEBUG1: Using run_as_clone [in run_as() at runas.c:323] > DEBUG1: Spawning consumerd [in spawn_consumerd() at main.c:1659] > DEBUG1: [thread] Manage consumer started [in thread_manage_consumer() at main.c:982] > DEBUG1: Using 64-bit UST consumer at: /usr/local/lib/lttng/libexec/lttng-consumerd [in spawn_consumerd() at main.c:1733] > DEBUG3: Created hashtable size 4 at 0x247d030 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x247d2f0 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG1: Connecting to error socket /var/run/lttng/ustconsumerd64/error [in main() at lttng-consumerd.c:349] > DEBUG1: Updating poll fd array [in consumer_update_poll_array() at consumer.c:521] > DEBUG1: polling on 1 fd [in lttng_consumer_thread_poll_fds() at consumer.c:1013] > DEBUG1: Creating command socket /var/run/lttng/ustconsumerd64/command [in lttng_consumer_thread_receive_fds() at consumer.c:1160] > DEBUG1: Sending ready command to lttng-sessiond [in lttng_consumer_thread_receive_fds() at consumer.c:1173] > DEBUG1: consumer command socket ready [in thread_manage_consumer() at main.c:1062] > DEBUG3: Created hashtable size 4 at 0x1d57720 of type 0 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d579e0 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d57f00 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG1: UST app creating event * for all apps for session id 1 [in ust_app_create_event_glb() at ust-app.c:1916] > DEBUG1: Event UST * created in channel channel0 [in event_ust_enable_tracepoint() at event.c:486] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Connection on client_socket [in lttng_consumer_thread_receive_fds() at consumer.c:1196] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 16 [in process_client_msg() at main.c:3309] > DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] > DEBUG1: Starting all UST traces [in ust_app_start_trace_all() at ust-app.c:2207] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 17 [in process_client_msg() at main.c:3309] > DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] > DEBUG1: Stopping all UST traces [in ust_app_stop_trace_all() at ust-app.c:2233] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > > // this is the traces from the small test application > > per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ export LTTNG_UST_DEBUG=1 > per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ ./sample liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x7f431694fc38 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) > liblttng_ust_tracepoint[1748/1748]: registered tracepoint: lttng_ust:metadata (in tracepoint_register_lib() at tracepoint.c:646) > libust[1748/1748]: LTT : ltt ring buffer client init > (in ltt_ring_buffer_metadata_client_init() at ltt-ring-buffer-metadata-client.h:334) > libust[1748/1748]: LTT : ltt ring buffer client init > (in ltt_ring_buffer_client_overwrite_init() at ltt-ring-buffer-client.h:584) > libust[1748/1748]: LTT : ltt ring buffer client init > (in ltt_ring_buffer_client_discard_init() at ltt-ring-buffer-client.h:584) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Waiting for local apps sessiond (in wait_for_sessiond() at lttng-ust-comm.c:638) > libust[1748/1750]: Linux kernels 2.6.33 to 3.0 (with the exception of stable versions) do not support FUTEX_WAKE on read-only memory mappings correctly. Please upgrade your kernel (fix is commit 9ea71503a8ed9184d2d0b8ccc4d269d05f7940ae in Linux kernel mainline). LTTng-UST will use polling mode fallback. (in wait_for_sessiond() at lttng-ust-comm.c:651) > libust[1748/1750]: Error: futex: Bad address (in wait_for_sessiond() at lttng-ust-comm.c:653) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1748]: just registered probe sample_tracepoint containing 1 events (in ltt_probe_register() at ltt-probes.c:109) > libust[1748/1748]: Registered event probe "sample_tracepoint:message" with signature "char *, text" (in ltt_probe_register() at ltt-probes.c:118) > liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x602138 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) > liblttng_ust_tracepoint[1748/1748]: registered tracepoint: sample_tracepoint:message (in tracepoint_register_lib() at tracepoint.c:646) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > > BR > /Per Nilsson > > > > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: From yannick.brosseau at gmail.com Mon Sep 10 10:53:30 2012 From: yannick.brosseau at gmail.com (Brosseau, Yannick) Date: Mon, 10 Sep 2012 10:53:30 -0400 Subject: [lttng-dev] User space tracing In-Reply-To: <504DFE37.6090803@voxpopuli.im> References: <504DFE37.6090803@voxpopuli.im> Message-ID: The root session deamon will see all application from any users On Sep 10, 2012 10:51 AM, "Alexandre Montplaisir" wrote: > Hi, > > In your example, you are running the tracer as root (with "sudo") but your > application is run by your own user. Somebody correct me if I'm wrong, but > I assume that in a case like this the root tracer will not see the other > user's applications. > > Could you try running the lttng commands without sudo, so that it creates > a session for your user only. > > > Cheers, > Alexandre > > > > On 12-09-10 03:32 AM, Per Nilsson wrote: > > Hi, > I am trying to get started with userspace tracing with LTTng, but I am having a hard time to get it to work. > I'm using Ubunto 11.04, with kernel version: 2.6.38-8-generic. > > I downloaded and compiled the following lttng software: > > Userspace-rcu-0.7.4 > Lttng-ust-2.0.5 > Lttng-tools-2-0.4 > Babeltrace-1.0.0-rc5 > > Maybe some one can tell me what is wrong. > > // This is command line command I use to start the trace session. > > per at per-VirtualBox:~$ sudo lttng create foo > [sudo] password for per: > Session foo created. > Traces will be written in /home/per/lttng-traces/foo-20120905-135905 > per at per-VirtualBox:~$ sudo lttng enable-event -a -u > All UST events are enabled in channel channel0 > per at per-VirtualBox:~$ sudo lttng start > Tracing started for session foo > per at per-VirtualBox:~$ sudo lttng stop > Tracing stopped for session foo > per at per-VirtualBox:~$ sudo ls /home/per/lttng-traces/foo-20120905-135905/ust > per at per-VirtualBox:~$ sudo babeltrace /home/per/lttng-traces/foo-20120905-135905/ust > [error] Cannot open any trace for reading. > > [error] opening trace "/home/per/lttng-traces/foo-20120905-135905/ust" for reading. > > [error] none of the specified trace paths could be opened. > > // This is the traces from the lttng-sessiond > > per at per-VirtualBox:~$ sudo lttng-sessiond --verbose --verbose-consumer > DEBUG3: Creating LTTng run directory: /var/run/lttng [in create_lttng_rundir() at main.c:4317] > DEBUG1: Client socket path /var/run/lttng/client-lttng-sessiond [in main() at main.c:4609] > DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond [in main() at main.c:4610] > DEBUG1: LTTng run directory path: /var/run/lttng [in main() at main.c:4611] > DEBUG3: Created hashtable size 4 at 0x1d4e0a0 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d4e340 of type 1 [in lttng_ht_new() at hashtable.c:96] > FATAL: Module lttng_tracer not found. > Error: Unable to load module lttng-tracer > DEBUG1: Failed to open /proc/lttng [in init_kernel_tracer() at main.c:1871] > Error: Unable to remove module lttng-tracer > Warning: No kernel tracer available > DEBUG1: Signal handler set for SIGTERM, SIGPIPE and SIGINT [in set_signal_handler() at main.c:4451] > Warning: No tracing group detected > DEBUG1: epoll set max size is 100188 [in compat_epoll_set_max_size() at compat-epoll.c:224] > DEBUG1: Thread manage kernel started [in thread_manage_kernel() at main.c:876] > DEBUG1: Updating kernel poll set [in update_kernel_poll() at main.c:748] > DEBUG1: Thread kernel polling on 2 fds [in thread_manage_kernel() at main.c:905] > DEBUG1: [thread] Manage application started [in thread_manage_apps() at main.c:1179] > DEBUG1: Apps thread polling on 2 fds [in thread_manage_apps() at main.c:1200] > DEBUG1: [thread] Manage application registration started [in thread_registration_apps() at main.c:1392] > DEBUG1: Notifying applications of session daemon state: 1 [in notify_ust_apps() at main.c:687] > DEBUG1: Got the wait shm fd 17 [in get_wait_shm() at shm.c:117] > DEBUG1: Futex wait update active 1 [in futex_wait_update() at futex.c:62] > DEBUG1: Accepting application registration [in thread_registration_apps() at main.c:1423] > DEBUG1: [thread] Dispatch UST command started [in thread_dispatch_ust_registration() at main.c:1324] > DEBUG1: Futex n to 1 prepare done [in futex_nto1_prepare() at futex.c:73] > DEBUG1: Woken up but nothing in the UST command queue [in thread_dispatch_ust_registration() at main.c:1334] > DEBUG1: [thread] Manage client started [in thread_manage_clients() at main.c:3794] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 8 [in process_client_msg() at main.c:3309] > DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905 with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] > DEBUG1: Using run_as_clone [in run_as() at runas.c:323] > DEBUG1: Tracing session foo created in /home/per/lttng-traces/foo-20120905-135905 with ID 1 by UID 0 GID 0 [in session_create() at session.c:232] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 6 [in process_client_msg() at main.c:3309] > DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] > DEBUG1: Creating UST session [in create_ust_session() at main.c:1965] > DEBUG3: Created hashtable size 4 at 0x1d55840 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d55b00 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d55dc0 of type 0 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905/ust with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] > DEBUG1: Using run_as_clone [in run_as() at runas.c:323] > DEBUG1: Spawning consumerd [in spawn_consumerd() at main.c:1659] > DEBUG1: [thread] Manage consumer started [in thread_manage_consumer() at main.c:982] > DEBUG1: Using 64-bit UST consumer at: /usr/local/lib/lttng/libexec/lttng-consumerd [in spawn_consumerd() at main.c:1733] > DEBUG3: Created hashtable size 4 at 0x247d030 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x247d2f0 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG1: Connecting to error socket /var/run/lttng/ustconsumerd64/error [in main() at lttng-consumerd.c:349] > DEBUG1: Updating poll fd array [in consumer_update_poll_array() at consumer.c:521] > DEBUG1: polling on 1 fd [in lttng_consumer_thread_poll_fds() at consumer.c:1013] > DEBUG1: Creating command socket /var/run/lttng/ustconsumerd64/command [in lttng_consumer_thread_receive_fds() at consumer.c:1160] > DEBUG1: Sending ready command to lttng-sessiond [in lttng_consumer_thread_receive_fds() at consumer.c:1173] > DEBUG1: consumer command socket ready [in thread_manage_consumer() at main.c:1062] > DEBUG3: Created hashtable size 4 at 0x1d57720 of type 0 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d579e0 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d57f00 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG1: UST app creating event * for all apps for session id 1 [in ust_app_create_event_glb() at ust-app.c:1916] > DEBUG1: Event UST * created in channel channel0 [in event_ust_enable_tracepoint() at event.c:486] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Connection on client_socket [in lttng_consumer_thread_receive_fds() at consumer.c:1196] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 16 [in process_client_msg() at main.c:3309] > DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] > DEBUG1: Starting all UST traces [in ust_app_start_trace_all() at ust-app.c:2207] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 17 [in process_client_msg() at main.c:3309] > DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] > DEBUG1: Stopping all UST traces [in ust_app_stop_trace_all() at ust-app.c:2233] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > > // this is the traces from the small test application > per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ export LTTNG_UST_DEBUG=1per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ ./sample liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x7f431694fc38 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) > liblttng_ust_tracepoint[1748/1748]: registered tracepoint: lttng_ust:metadata (in tracepoint_register_lib() at tracepoint.c:646) > libust[1748/1748]: LTT : ltt ring buffer client init > (in ltt_ring_buffer_metadata_client_init() at ltt-ring-buffer-metadata-client.h:334) > libust[1748/1748]: LTT : ltt ring buffer client init > (in ltt_ring_buffer_client_overwrite_init() at ltt-ring-buffer-client.h:584) > libust[1748/1748]: LTT : ltt ring buffer client init > (in ltt_ring_buffer_client_discard_init() at ltt-ring-buffer-client.h:584) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Waiting for local apps sessiond (in wait_for_sessiond() at lttng-ust-comm.c:638) > libust[1748/1750]: Linux kernels 2.6.33 to 3.0 (with the exception of stable versions) do not support FUTEX_WAKE on read-only memory mappings correctly. Please upgrade your kernel (fix is commit 9ea71503a8ed9184d2d0b8ccc4d269d05f7940ae in Linux kernel mainline). LTTng-UST will use polling mode fallback. (in wait_for_sessiond() at lttng-ust-comm.c:651) > libust[1748/1750]: Error: futex: Bad address (in wait_for_sessiond() at lttng-ust-comm.c:653) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1748]: just registered probe sample_tracepoint containing 1 events (in ltt_probe_register() at ltt-probes.c:109) > libust[1748/1748]: Registered event probe "sample_tracepoint:message" with signature "char *, text" (in ltt_probe_register() at ltt-probes.c:118) > liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x602138 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) > liblttng_ust_tracepoint[1748/1748]: registered tracepoint: sample_tracepoint:message (in tracepoint_register_lib() at tracepoint.c:646) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > > BR > /Per Nilsson > > > > > > > > _______________________________________________ > lttng-dev mailing listlttng-dev at lists.lttng.orghttp://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Mon Sep 10 10:54:31 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 10 Sep 2012 10:54:31 -0400 Subject: [lttng-dev] [commit for review] Fix recent filter regressions Message-ID: <20120910145431.GA15712@Krystal> Hi! Please review this patch from my pull queue for lttng-tools. As soon as we get your Acked-by, David will pull it. Thanks, Mathieu commit 0efe3e86f1143393016e1ab7623827c06c466e9f Author: Mathieu Desnoyers Date: Mon Sep 10 10:45:41 2012 -0400 Fix filter: fix recent regressions Fix: commit d93c4f1ffcffa73102e3299276f2f83951a68c36 Author: Christian Babeux Date: Thu Sep 6 13:40:19 2012 -0400 Fix: Accept bytecode of length 65536 bytes Broke the filter: it changed the reloc table format, without knowledge of UST, and without good reason: it should stay { uint16_t, string } -- it does not need a uint32_t offset. Add a check for the value returned by bytecode_get_len() when populating the reloc table. Fix: commit 5ddb0a08c5c3ca917b025032b864d78e53c7c68a Author: Christian Babeux Date: Mon Aug 27 14:48:21 2012 -0400 Fix: Generation of bytecode longer than 32768 bytes fails Mixed the concepts of "len" and "alloc_len". It was therefore not checking the bounds correctly, and was not zeroing the memory range expected to be zeroed, causing out-of-bound array access. Signed-off-by: Mathieu Desnoyers diff --git a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c index 332a387..0d65585 100644 --- a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c @@ -94,21 +94,21 @@ int32_t bytecode_reserve(struct lttng_filter_bytecode_alloc **fb, uint32_t align { int32_t ret; uint32_t padding = offset_align((*fb)->b.len, align); + uint32_t new_len = (*fb)->b.len + padding + len; + uint32_t new_alloc_len = sizeof(struct lttng_filter_bytecode) + new_len; + uint32_t old_alloc_len = (*fb)->alloc_len; - if ((*fb)->b.len + padding + len > LTTNG_FILTER_MAX_LEN) + if (new_len > LTTNG_FILTER_MAX_LEN) return -EINVAL; - if ((*fb)->b.len + padding + len > (*fb)->alloc_len) { - uint32_t new_len = - max_t(uint32_t, 1U << get_count_order((*fb)->b.len + padding + len), - (*fb)->alloc_len << 1); - uint32_t old_len = (*fb)->alloc_len; - - *fb = realloc(*fb, sizeof(struct lttng_filter_bytecode_alloc) + new_len); + if (new_alloc_len > old_alloc_len) { + new_alloc_len = + max_t(uint32_t, 1U << get_count_order(new_alloc_len), old_alloc_len << 1); + *fb = realloc(*fb, new_alloc_len); if (!*fb) return -ENOMEM; - memset(&(*fb)->b.data[old_len], 0, new_len - old_len); - (*fb)->alloc_len = new_len; + memset(&((char *) *fb)[old_alloc_len], 0, new_alloc_len - old_alloc_len); + (*fb)->alloc_len = new_alloc_len; } (*fb)->b.len += padding; ret = (*fb)->b.len; @@ -239,7 +239,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node) uint32_t insn_len = sizeof(struct load_op) + sizeof(struct field_ref); struct field_ref ref_offset; - uint32_t reloc_offset; + uint16_t reloc_offset; insn = calloc(insn_len, 1); if (!insn) @@ -249,6 +249,9 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node) memcpy(insn->data, &ref_offset, sizeof(ref_offset)); /* reloc_offset points to struct load_op */ reloc_offset = bytecode_get_len(&ctx->bytecode->b); + if (reloc_offset > LTTNG_FILTER_MAX_LEN - 1) { + return -EINVAL; + } ret = bytecode_push(&ctx->bytecode, insn, 1, insn_len); if (ret) { free(insn); -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From alexmonthy at voxpopuli.im Mon Sep 10 10:58:33 2012 From: alexmonthy at voxpopuli.im (Alexandre Montplaisir) Date: Mon, 10 Sep 2012 10:58:33 -0400 Subject: [lttng-dev] lttng command line user-friendliness In-Reply-To: <504DCE2E.7020000@mentor.com> References: <504DCE2E.7020000@mentor.com> Message-ID: <504E0019.905@voxpopuli.im> +1, Like, etc. The following bug was opened some time ago: http://bugs.lttng.org/issues/15 >From what is said in the bug, it will require both the flight-recorder mode in the tracer, and the live-trace-reading feature in Babeltrace. Those are not implemented yet, but they shouldn't be too far around from what I can tell (2.2 maybe?). Cheers, Alexandre On 12-09-10 07:25 AM, Woegerer, Paul wrote: > As much as I like the lttng command line tool (that we have since > LTTng2) I still see people (who are not yet familiar with lttng) > struggle with the simple fact that it takes more than one command to > actually get something traced. > > Issuing a sequence of commands like: > > lttng create > lttng enable-event -u -a > lttng start > my_foobar_traced_application 1 2 3 > lttng stop > lttng destroy > > seems to be perceived as complicated compared to: > > perf record -- my_foobar_traced_application 1 2 3 > > My argument usually is that providing detailed settings as options > (like perf) does not scale as well as the lttng approach (if you have > more things to configure). On the other hand most users just want > something like the above. Also arguing that they should write a > shell-script that encodes their use case generally causes irritation > ("... please understand, I do not want to write a shell-script I just > want to do simple tracing of my executable ..."). > > What about adding something similar to "perf record" to lower the > barrier for such users. For example: > > lttng record [--session-name ] [--session-template > ] -- [] > > Where the optional session_template_file may only contain > "enable-channel, enable-event and add-context" commands. If omitted > the following could be the (trivial) default session template: > > enable-event -u -a > > > Would this make sense for others as well ? Any alternative suggestions ? > > Thanks, > Paul > From mathieu.desnoyers at efficios.com Mon Sep 10 10:59:32 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 10 Sep 2012 10:59:32 -0400 Subject: [lttng-dev] User space tracing In-Reply-To: References: Message-ID: <20120910145931.GB15712@Krystal> * Per Nilsson (per.e.nilsson at ericsson.com) wrote: > Hi, > I am trying to get started with userspace tracing with LTTng, but I am having a hard time to get it to work. > I'm using Ubunto 11.04, with kernel version: 2.6.38-8-generic. > > I downloaded and compiled the following lttng software: > > Userspace-rcu-0.7.4 > Lttng-ust-2.0.5 > Lttng-tools-2-0.4 > Babeltrace-1.0.0-rc5 > > Maybe some one can tell me what is wrong. > > // This is command line command I use to start the trace session. > > per at per-VirtualBox:~$ sudo lttng create foo > [sudo] password for per: > Session foo created. > Traces will be written in /home/per/lttng-traces/foo-20120905-135905 > per at per-VirtualBox:~$ sudo lttng enable-event -a -u > All UST events are enabled in channel channel0 > per at per-VirtualBox:~$ sudo lttng start > Tracing started for session foo > per at per-VirtualBox:~$ sudo lttng stop > Tracing stopped for session foo > per at per-VirtualBox:~$ sudo ls /home/per/lttng-traces/foo-20120905-135905/ust > per at per-VirtualBox:~$ sudo babeltrace /home/per/lttng-traces/foo-20120905-135905/ust > [error] Cannot open any trace for reading. > > [error] opening trace "/home/per/lttng-traces/foo-20120905-135905/ust" for reading. > > [error] none of the specified trace paths could be opened. > > // This is the traces from the lttng-sessiond > > per at per-VirtualBox:~$ sudo lttng-sessiond --verbose --verbose-consumer > DEBUG3: Creating LTTng run directory: /var/run/lttng [in create_lttng_rundir() at main.c:4317] > DEBUG1: Client socket path /var/run/lttng/client-lttng-sessiond [in main() at main.c:4609] > DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond [in main() at main.c:4610] > DEBUG1: LTTng run directory path: /var/run/lttng [in main() at main.c:4611] > DEBUG3: Created hashtable size 4 at 0x1d4e0a0 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d4e340 of type 1 [in lttng_ht_new() at hashtable.c:96] > FATAL: Module lttng_tracer not found. > Error: Unable to load module lttng-tracer > DEBUG1: Failed to open /proc/lttng [in init_kernel_tracer() at main.c:1871] > Error: Unable to remove module lttng-tracer > Warning: No kernel tracer available > DEBUG1: Signal handler set for SIGTERM, SIGPIPE and SIGINT [in set_signal_handler() at main.c:4451] > Warning: No tracing group detected > DEBUG1: epoll set max size is 100188 [in compat_epoll_set_max_size() at compat-epoll.c:224] > DEBUG1: Thread manage kernel started [in thread_manage_kernel() at main.c:876] > DEBUG1: Updating kernel poll set [in update_kernel_poll() at main.c:748] > DEBUG1: Thread kernel polling on 2 fds [in thread_manage_kernel() at main.c:905] > DEBUG1: [thread] Manage application started [in thread_manage_apps() at main.c:1179] > DEBUG1: Apps thread polling on 2 fds [in thread_manage_apps() at main.c:1200] > DEBUG1: [thread] Manage application registration started [in thread_registration_apps() at main.c:1392] > DEBUG1: Notifying applications of session daemon state: 1 [in notify_ust_apps() at main.c:687] > DEBUG1: Got the wait shm fd 17 [in get_wait_shm() at shm.c:117] > DEBUG1: Futex wait update active 1 [in futex_wait_update() at futex.c:62] > DEBUG1: Accepting application registration [in thread_registration_apps() at main.c:1423] > DEBUG1: [thread] Dispatch UST command started [in thread_dispatch_ust_registration() at main.c:1324] > DEBUG1: Futex n to 1 prepare done [in futex_nto1_prepare() at futex.c:73] > DEBUG1: Woken up but nothing in the UST command queue [in thread_dispatch_ust_registration() at main.c:1334] > DEBUG1: [thread] Manage client started [in thread_manage_clients() at main.c:3794] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 8 [in process_client_msg() at main.c:3309] > DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905 with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] > DEBUG1: Using run_as_clone [in run_as() at runas.c:323] > DEBUG1: Tracing session foo created in /home/per/lttng-traces/foo-20120905-135905 with ID 1 by UID 0 GID 0 [in session_create() at session.c:232] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 6 [in process_client_msg() at main.c:3309] > DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] > DEBUG1: Creating UST session [in create_ust_session() at main.c:1965] > DEBUG3: Created hashtable size 4 at 0x1d55840 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d55b00 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d55dc0 of type 0 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905/ust with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] > DEBUG1: Using run_as_clone [in run_as() at runas.c:323] > DEBUG1: Spawning consumerd [in spawn_consumerd() at main.c:1659] > DEBUG1: [thread] Manage consumer started [in thread_manage_consumer() at main.c:982] > DEBUG1: Using 64-bit UST consumer at: /usr/local/lib/lttng/libexec/lttng-consumerd [in spawn_consumerd() at main.c:1733] > DEBUG3: Created hashtable size 4 at 0x247d030 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x247d2f0 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG1: Connecting to error socket /var/run/lttng/ustconsumerd64/error [in main() at lttng-consumerd.c:349] > DEBUG1: Updating poll fd array [in consumer_update_poll_array() at consumer.c:521] > DEBUG1: polling on 1 fd [in lttng_consumer_thread_poll_fds() at consumer.c:1013] > DEBUG1: Creating command socket /var/run/lttng/ustconsumerd64/command [in lttng_consumer_thread_receive_fds() at consumer.c:1160] > DEBUG1: Sending ready command to lttng-sessiond [in lttng_consumer_thread_receive_fds() at consumer.c:1173] > DEBUG1: consumer command socket ready [in thread_manage_consumer() at main.c:1062] > DEBUG3: Created hashtable size 4 at 0x1d57720 of type 0 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d579e0 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG3: Created hashtable size 4 at 0x1d57f00 of type 1 [in lttng_ht_new() at hashtable.c:96] > DEBUG1: UST app creating event * for all apps for session id 1 [in ust_app_create_event_glb() at ust-app.c:1916] > DEBUG1: Event UST * created in channel channel0 [in event_ust_enable_tracepoint() at event.c:486] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Connection on client_socket [in lttng_consumer_thread_receive_fds() at consumer.c:1196] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 16 [in process_client_msg() at main.c:3309] > DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] > DEBUG1: Starting all UST traces [in ust_app_start_trace_all() at ust-app.c:2207] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] > DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] > DEBUG1: Processing client command 17 [in process_client_msg() at main.c:3309] > DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] > DEBUG1: Stopping all UST traces [in ust_app_stop_trace_all() at ust-app.c:2233] > DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] > DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] > DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] > > // this is the traces from the small test application > > per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ export LTTNG_UST_DEBUG=1 > per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ ./sample liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x7f431694fc38 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) > liblttng_ust_tracepoint[1748/1748]: registered tracepoint: lttng_ust:metadata (in tracepoint_register_lib() at tracepoint.c:646) > libust[1748/1748]: LTT : ltt ring buffer client init > (in ltt_ring_buffer_metadata_client_init() at ltt-ring-buffer-metadata-client.h:334) > libust[1748/1748]: LTT : ltt ring buffer client init > (in ltt_ring_buffer_client_overwrite_init() at ltt-ring-buffer-client.h:584) > libust[1748/1748]: LTT : ltt ring buffer client init > (in ltt_ring_buffer_client_discard_init() at ltt-ring-buffer-client.h:584) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Waiting for local apps sessiond (in wait_for_sessiond() at lttng-ust-comm.c:638) > libust[1748/1750]: Linux kernels 2.6.33 to 3.0 (with the exception of stable versions) do not support FUTEX_WAKE on read-only memory mappings correctly. Please upgrade your kernel (fix is commit 9ea71503a8ed9184d2d0b8ccc4d269d05f7940ae in Linux kernel mainline). LTTng-UST will use polling mode fallback. (in wait_for_sessiond() at lttng-ust-comm.c:651) > libust[1748/1750]: Error: futex: Bad address (in wait_for_sessiond() at lttng-ust-comm.c:653) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1748]: just registered probe sample_tracepoint containing 1 events (in ltt_probe_register() at ltt-probes.c:109) > libust[1748/1748]: Registered event probe "sample_tracepoint:message" with signature "char *, text" (in ltt_probe_register() at ltt-probes.c:118) > liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x602138 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) > liblttng_ust_tracepoint[1748/1748]: registered tracepoint: sample_tracepoint:message (in tracepoint_register_lib() at tracepoint.c:646) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) Ref to sessiond message: DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond [in main() at main.c:4610] Please ensure that you application has access to this socket file. Thanks, Mathieu > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) > > BR > /Per Nilsson > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Mon Sep 10 11:00:18 2012 From: dgoulet at efficios.com (David Goulet) Date: Mon, 10 Sep 2012 11:00:18 -0400 Subject: [lttng-dev] lttng command line user-friendliness In-Reply-To: <504DCE2E.7020000@mentor.com> References: <504DCE2E.7020000@mentor.com> Message-ID: <504E0082.9040502@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi Paul, Woegerer, Paul: > As much as I like the lttng command line tool (that we have since > LTTng2) I still see people (who are not yet familiar with lttng) > struggle with the simple fact that it takes more than one command > to actually get something traced. > > Issuing a sequence of commands like: > > lttng create lttng enable-event -u -a lttng start > my_foobar_traced_application 1 2 3 lttng stop lttng destroy > Small note here that the "destroy" is not needed. The stop forces a subbuffer switch meaning that the current data collected is written to the trace files. > seems to be perceived as complicated compared to: > > perf record -- my_foobar_traced_application 1 2 3 > > My argument usually is that providing detailed settings as options > (like perf) does not scale as well as the lttng approach (if you > have more things to configure). On the other hand most users just > want something like the above. Also arguing that they should write > a shell-script that encodes their use case generally causes > irritation ("... please understand, I do not want to write a > shell-script I just want to do simple tracing of my executable > ..."). > > What about adding something similar to "perf record" to lower the > barrier for such users. For example: > > lttng record [--session-name ] [--session-template > ] -- [] > > Where the optional session_template_file may only contain > "enable-channel, enable-event and add-context" commands. If omitted > the following could be the (trivial) default session template: > > enable-event -u -a > > > Would this make sense for others as well ? Any alternative > suggestions ? This totally makes sense and is also something we are looking to do for a long time. We were thinking of a "lttng trace [...]" command that would wrap the session creation, enabling all events for a domain (kernel or/and user space) and start the trace by outputting either the trace live like strace or at an output destination. For the live tracing, it's our next step right NOW so the next 2.2 version *should* have this and would make total sense also to have this command! To be honest, we have almost everything (on the technical side) to create this command (except the live tracing), we just don't have it now because of a priority/time issue :). I would however encourage everyone on this list who is willing to continue this thread in order to come up with a small RFC for the command. RFC/Discussion: lttng record [--session-name ] [--session-template ] -- [] Either "trace" or "record", I guess it's a simple aesthetic choice here :). With more options here to set either a custom destination or live trace. What's the default? (no opts given). I would personally go for a default one being to record in the session default trace files and add a "-l" for the live. -o, --output=DST -l, --live Add a domain option where nothing enables kernel AND ust or else the command can take either -u or -k. Please, contribute to this, no bad ideas, only bad answers! :) Cheers and thanks Paul for comment! David > > Thanks, Paul > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQTgB+AAoJEELoaioR9I02zzoIAMd+nG8KLZnmHiFQU9Tcqq9Q N+jLVU/JjMuzjpQluD+1Xe3O9yLDu/mEqGAddYBQ5RnkHS7DveFwfY697nESqJPR qV0Y3ajbIC30WMrnweZSypsj9xAv33ZzFn4C/DuYIylicqpcX8mxcMgLzI9duoRQ /kxOqIeBLvl5C/pFSR55vki3fxhHPg67f2S9TgFDiBEPmaL0UkxpfOaB3G86Bj8z Kp7oKCCbQzv0R3J4BlcNRNUXKTClo3Qjb/ZyWGgFwwErZJoADcd+osvIU9raA7MY yEEExx5t4OMjEyrb3eqJgihH+xMx6eW1275vz2TV4ayBIg1YuJrIzUY/zgVkYn0= =f6QB -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Mon Sep 10 11:08:55 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 10 Sep 2012 11:08:55 -0400 Subject: [lttng-dev] [commit for review] Fix recent filter regressions In-Reply-To: <20120910145431.GA15712@Krystal> References: <20120910145431.GA15712@Krystal> Message-ID: <20120910150855.GC15712@Krystal> * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote: > Hi! > > Please review this patch from my pull queue for lttng-tools. As soon as > we get your Acked-by, David will pull it. As per our private irc discussion, how about the following update ? commit aa06477c0d844bb5b68c8f8070fd0cae3a80de52 Author: Mathieu Desnoyers Date: Mon Sep 10 10:45:41 2012 -0400 Fix filter: fix recent regressions Fix: commit d93c4f1ffcffa73102e3299276f2f83951a68c36 Author: Christian Babeux Date: Thu Sep 6 13:40:19 2012 -0400 Fix: Accept bytecode of length 65536 bytes Broke the filter: it changed the reloc table format, without knowledge of UST, and without good reason: it should stay { uint16_t, string } -- it does not need a uint32_t offset. Add a check for the value returned by bytecode_get_len() when populating the reloc table. Fix: commit 5ddb0a08c5c3ca917b025032b864d78e53c7c68a Author: Christian Babeux Date: Mon Aug 27 14:48:21 2012 -0400 Fix: Generation of bytecode longer than 32768 bytes fails Mixed the concepts of "len" and "alloc_len". It was therefore not checking the bounds correctly, and was not zeroing the memory range expected to be zeroed, causing out-of-bound array access. Signed-off-by: Mathieu Desnoyers diff --git a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c index 332a387..8d44f4b 100644 --- a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c @@ -94,21 +94,21 @@ int32_t bytecode_reserve(struct lttng_filter_bytecode_alloc **fb, uint32_t align { int32_t ret; uint32_t padding = offset_align((*fb)->b.len, align); + uint32_t new_len = (*fb)->b.len + padding + len; + uint32_t new_alloc_len = sizeof(struct lttng_filter_bytecode) + new_len; + uint32_t old_alloc_len = (*fb)->alloc_len; - if ((*fb)->b.len + padding + len > LTTNG_FILTER_MAX_LEN) + if (new_len > LTTNG_FILTER_MAX_LEN) return -EINVAL; - if ((*fb)->b.len + padding + len > (*fb)->alloc_len) { - uint32_t new_len = - max_t(uint32_t, 1U << get_count_order((*fb)->b.len + padding + len), - (*fb)->alloc_len << 1); - uint32_t old_len = (*fb)->alloc_len; - - *fb = realloc(*fb, sizeof(struct lttng_filter_bytecode_alloc) + new_len); + if (new_alloc_len > old_alloc_len) { + new_alloc_len = + max_t(uint32_t, 1U << get_count_order(new_alloc_len), old_alloc_len << 1); + *fb = realloc(*fb, new_alloc_len); if (!*fb) return -ENOMEM; - memset(&(*fb)->b.data[old_len], 0, new_len - old_len); - (*fb)->alloc_len = new_len; + memset(&((char *) *fb)[old_alloc_len], 0, new_alloc_len - old_alloc_len); + (*fb)->alloc_len = new_alloc_len; } (*fb)->b.len += padding; ret = (*fb)->b.len; @@ -239,7 +239,8 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node) uint32_t insn_len = sizeof(struct load_op) + sizeof(struct field_ref); struct field_ref ref_offset; - uint32_t reloc_offset; + uint32_t reloc_offset_u32; + uint16_t reloc_offset; insn = calloc(insn_len, 1); if (!insn) @@ -248,7 +249,12 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node) ref_offset.offset = (uint16_t) -1U; memcpy(insn->data, &ref_offset, sizeof(ref_offset)); /* reloc_offset points to struct load_op */ - reloc_offset = bytecode_get_len(&ctx->bytecode->b); + reloc_offset_u32 = bytecode_get_len(&ctx->bytecode->b); + if (reloc_offset_u32 > LTTNG_FILTER_MAX_LEN - 1) { + free(insn); + return -EINVAL; + } + reloc_offset = (uint16_t) reloc_offset_u32; ret = bytecode_push(&ctx->bytecode, insn, 1, insn_len); if (ret) { free(insn); -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Mon Sep 10 11:12:29 2012 From: dgoulet at efficios.com (David Goulet) Date: Mon, 10 Sep 2012 11:12:29 -0400 Subject: [lttng-dev] Trace files not getting generated In-Reply-To: References: Message-ID: <504E035D.9050906@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi Carlos, One thing you could do is to make sure the lttng-consumerd is installed and accessible by the session daemon. You'll see that in the lttng-sessiond -vvv logs during the session creation. It would help us a lot if you could send us the full session daemon debug output using "-vvv --verbose-consumer". Could you use the LTTng bug tracker for that so we have a reference in the future and help us track the issue overtime. https://bugs.lttng.org Thanks a lot! David Carlos de Sa: > Hi, > > I've been trying to get kernel tracing working on a TI AM355X EVM > using the standard arago 05.05 toolchain, kernel & ti-sdk > filesystem; but seem to have some buffer issues. Any help on this > would be much appreciated. > > After starting a trace session I ran a few programs - the graphics > package apps and standard demo apps. After stopping all seems to > be fine but when I destroy the session it generates a warning. And > the session dir (session2-20120727-122650) is empty as can be seen > below - > > root at am335x-evm:~/lttng-traces# arm-arago-linux-gnueabi-lttng > enable-event sched _switch,sched_wakeup -k kernel event > sched_switch created in channel channel0 kernel event sched_wakeup > created in channel channel0 root at am335x-evm:~/lttng-traces# > arm-arago-linux-gnueabi-lttng add-context -k -e sched_switch -t > pid kernel context pid added to event sched_switch > root at am335x-evm:~/lttng-traces# arm-arago-linux-gnueabi-lttng > start Tracing started for session session2 > root at am335x-evm:~/lttng-traces# arm-arago-linux-gnueabi-lttng stop > Tracing stopped for session session2 > root at am335x-evm:~/lttng-traces# ls session1-20120727-122409 > session2-20120727-122650 root at am335x-evm:~/lttng-traces# ls > session2-20120727-122650/kernel/ root at am335x-evm:~/lttng-traces# ls > session2-20120727-122650/kernel/ root at am335x-evm:~/lttng-traces# > arm-arago-linux-gnueabi-lttng destroy [ 1049.263275] ring buffer > relay-discard, cpu 0: records were lost. Caused by: [ 1049.263275] > [ 21949 buffer full, 0 nest buffer wrap-around, 0 event too big ] > Session session2 destroyed at /home/root root at am335x-evm:~# ls > lttng-traces/session2-20120727-122650/kernel/ root at am335x-evm:~# ls > lttng-traces/session2-20120727-122650/ > > Any idea whats going wrong? Fyi I also have debugfs enabled and > mounted. And sessiond when run with -vvv option does not show any > errors. > > Previously when enabling all traces (enable-event -a -k) I got the > error at "LTTng: Failure to write metadata to buffers (timeout)" > when starting. I thought this may have been a kernel buffer issue > due to enabling all possible events. But the above log does not > show the same issue so thought this case of only a few events > should have worked. > > Regards, Carlos > > _______________________________________________ lttng-dev mailing > list lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQTgNdAAoJEELoaioR9I029CsIAKiZQTTHd7Sn4p92fXz+2IK4 2nauu0wwkijcB6hwF/rFsajYrjdtlwwe9aIPapZJB8NsJJ5u80YlpzRatYZFgom3 gGuNJG7Ck1K/3jT501YdIJetmRKUWybKLgIuEpeEv/OJ3w1YKwqenOEBPxHP7RYJ pEd7J18CnPfUR+Br9ctf/2uS8XT3byqc7u5E8c3Bf1QgMuJyeSBgxgr+O0ovhZkq StuDt1sV+1F5VOhWYuzJ70LmCNrkjSQzwDNzenYlb+Pko3C9/Mq4AMGo9fczwIkz n0slfFEX7rCNeeGOszgqwmLBE7k3m94Om5G7CCAfX2j/0X8OnZRhxNHUSeVmpJk= =7zT5 -----END PGP SIGNATURE----- From christian.babeux at efficios.com Mon Sep 10 11:27:14 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Mon, 10 Sep 2012 11:27:14 -0400 Subject: [lttng-dev] [commit for review] Fix recent filter regressions In-Reply-To: <20120910150855.GC15712@Krystal> References: <20120910145431.GA15712@Krystal> <20120910150855.GC15712@Krystal> Message-ID: Looks good to me! Acked-by: Christian Babeux On Mon, Sep 10, 2012 at 11:08 AM, Mathieu Desnoyers wrote: > * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote: >> Hi! >> >> Please review this patch from my pull queue for lttng-tools. As soon as >> we get your Acked-by, David will pull it. > > As per our private irc discussion, how about the following update ? > > commit aa06477c0d844bb5b68c8f8070fd0cae3a80de52 > Author: Mathieu Desnoyers > Date: Mon Sep 10 10:45:41 2012 -0400 > > Fix filter: fix recent regressions > > Fix: > commit d93c4f1ffcffa73102e3299276f2f83951a68c36 > Author: Christian Babeux > Date: Thu Sep 6 13:40:19 2012 -0400 > > Fix: Accept bytecode of length 65536 bytes > > Broke the filter: it changed the reloc table format, without knowledge > of UST, and without good reason: it should stay { uint16_t, string } -- > it does not need a uint32_t offset. Add a check for the value returned > by bytecode_get_len() when populating the reloc table. > > Fix: > commit 5ddb0a08c5c3ca917b025032b864d78e53c7c68a > Author: Christian Babeux > Date: Mon Aug 27 14:48:21 2012 -0400 > > Fix: Generation of bytecode longer than 32768 bytes fails > > Mixed the concepts of "len" and "alloc_len". It was therefore not > checking the bounds correctly, and was not zeroing the memory range > expected to be zeroed, causing out-of-bound array access. > > Signed-off-by: Mathieu Desnoyers > > diff --git a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c > index 332a387..8d44f4b 100644 > --- a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c > +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c > @@ -94,21 +94,21 @@ int32_t bytecode_reserve(struct lttng_filter_bytecode_alloc **fb, uint32_t align > { > int32_t ret; > uint32_t padding = offset_align((*fb)->b.len, align); > + uint32_t new_len = (*fb)->b.len + padding + len; > + uint32_t new_alloc_len = sizeof(struct lttng_filter_bytecode) + new_len; > + uint32_t old_alloc_len = (*fb)->alloc_len; > > - if ((*fb)->b.len + padding + len > LTTNG_FILTER_MAX_LEN) > + if (new_len > LTTNG_FILTER_MAX_LEN) > return -EINVAL; > > - if ((*fb)->b.len + padding + len > (*fb)->alloc_len) { > - uint32_t new_len = > - max_t(uint32_t, 1U << get_count_order((*fb)->b.len + padding + len), > - (*fb)->alloc_len << 1); > - uint32_t old_len = (*fb)->alloc_len; > - > - *fb = realloc(*fb, sizeof(struct lttng_filter_bytecode_alloc) + new_len); > + if (new_alloc_len > old_alloc_len) { > + new_alloc_len = > + max_t(uint32_t, 1U << get_count_order(new_alloc_len), old_alloc_len << 1); > + *fb = realloc(*fb, new_alloc_len); > if (!*fb) > return -ENOMEM; > - memset(&(*fb)->b.data[old_len], 0, new_len - old_len); > - (*fb)->alloc_len = new_len; > + memset(&((char *) *fb)[old_alloc_len], 0, new_alloc_len - old_alloc_len); > + (*fb)->alloc_len = new_alloc_len; > } > (*fb)->b.len += padding; > ret = (*fb)->b.len; > @@ -239,7 +239,8 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node) > uint32_t insn_len = sizeof(struct load_op) > + sizeof(struct field_ref); > struct field_ref ref_offset; > - uint32_t reloc_offset; > + uint32_t reloc_offset_u32; > + uint16_t reloc_offset; > > insn = calloc(insn_len, 1); > if (!insn) > @@ -248,7 +249,12 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node) > ref_offset.offset = (uint16_t) -1U; > memcpy(insn->data, &ref_offset, sizeof(ref_offset)); > /* reloc_offset points to struct load_op */ > - reloc_offset = bytecode_get_len(&ctx->bytecode->b); > + reloc_offset_u32 = bytecode_get_len(&ctx->bytecode->b); > + if (reloc_offset_u32 > LTTNG_FILTER_MAX_LEN - 1) { > + free(insn); > + return -EINVAL; > + } > + reloc_offset = (uint16_t) reloc_offset_u32; > ret = bytecode_push(&ctx->bytecode, insn, 1, insn_len); > if (ret) { > free(insn); > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com From Paul_Woegerer at mentor.com Mon Sep 10 11:39:09 2012 From: Paul_Woegerer at mentor.com (Woegerer, Paul) Date: Mon, 10 Sep 2012 17:39:09 +0200 Subject: [lttng-dev] lttng command line user-friendliness In-Reply-To: <504E0082.9040502@efficios.com> References: <504DCE2E.7020000@mentor.com> <504E0082.9040502@efficios.com> Message-ID: <504E099D.6030407@mentor.com> On 09/10/2012 05:00 PM, David Goulet wrote: > Issuing a sequence of commands like: > > lttng create lttng enable-event -u -a lttng start > my_foobar_traced_application 1 2 3 lttng stop lttng destroy > > Small note here that the "destroy" is not needed. The stop forces a > subbuffer switch meaning that the current data collected is written to > the trace files. Agreed, "destroy" is pointless. Also the user would want to have the result of "lttng record" visible when it runs "lttng list" afterwards. > I would however encourage everyone on this list who is willing to > continue this thread in order to come up with a small RFC for the command. > > RFC/Discussion: > > lttng record [--session-name ] [--session-template > ] -- [] > > Either "trace" or "record", I guess it's a simple aesthetic choice > here :). Using command name "trace" makes more sense. "record" does not go so well with "--live" (where nothing gets actually recorded). So far [--session-template ] leaves open where to look for session_template_files if no absolute path is given. It might be good to also have a user specific directory (e.g. .lttng/session-templates) in addition to a system wide directory (e.g. /etc/lttng/session-templates). -- Paul > With more options here to set either a custom destination or live > trace. What's the default? (no opts given). I would personally go for > a default one being to record in the session default trace files and > add a "-l" for the live. > > -o, --output=DST > -l, --live > > Add a domain option where nothing enables kernel AND ust or else the > command can take either -u or -k. > > Please, contribute to this, no bad ideas, only bad answers! :) > > Cheers and thanks Paul for comment! > David > >> Thanks, Paul >> > -----BEGIN PGP SIGNATURE----- > > iQEcBAEBCgAGBQJQTgB+AAoJEELoaioR9I02zzoIAMd+nG8KLZnmHiFQU9Tcqq9Q > N+jLVU/JjMuzjpQluD+1Xe3O9yLDu/mEqGAddYBQ5RnkHS7DveFwfY697nESqJPR > qV0Y3ajbIC30WMrnweZSypsj9xAv33ZzFn4C/DuYIylicqpcX8mxcMgLzI9duoRQ > /kxOqIeBLvl5C/pFSR55vki3fxhHPg67f2S9TgFDiBEPmaL0UkxpfOaB3G86Bj8z > Kp7oKCCbQzv0R3J4BlcNRNUXKTClo3Qjb/ZyWGgFwwErZJoADcd+osvIU9raA7MY > yEEExx5t4OMjEyrb3eqJgihH+xMx6eW1275vz2TV4ayBIg1YuJrIzUY/zgVkYn0= > =f6QB > -----END PGP SIGNATURE----- -- Paul Woegerer | SW Development Engineer http://go.mentor.com/sourceryanalyzer Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. From mathieu.desnoyers at efficios.com Mon Sep 10 17:34:57 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 10 Sep 2012 17:34:57 -0400 Subject: [lttng-dev] [RELEASE] LTTng-UST 2.1.0-rc1 Message-ID: <20120910213457.GA22400@Krystal> LTTng-UST, the Linux Trace Toolkit Next Generation Userspace Tracer, is port of the low-overhead tracing capabilities of the LTTng kernel tracer to user-space. The library "liblttng-ust" enables tracing of applications and libraries. Major new features: - filtering by event content, - basic java tracing. Changelog: 2012-09-10 lttng-ust 2.1.0-rc1 * Fix make dist: fix liblttng-ust-java dependencies * Fix make dist: add missing filter header * Fix: backward compatibility with UST 2.0 app probes * Fix: Filter ABI changes to support FILTER_BYTECODE_MAX_LEN (65536) * Export "written" information about fields * Fix filter: pointer to string, not string, should be on stack * Fix: tracepoint float nowrite * Fix: accept 65536 bytes long bytecodes * Add hostname to env * ABI change: bump internal version to 3.0.0 * Fix: threads should be created in DETACHED state * Fix: 32-bit x86 strict-aliasing warnings * Fix UST SIGPIPE handling * Fix: Libtool fails to find dependent libraries when cross-compiling lttng-ust * Cleanup: filter: turn bytecode linking error msg into debug * Make lttng-ust robust against -finstrument-functions. * Filter: keep aliased ax and bx registers * Filter: remove interpreter dynamic typing * Filter: add missing specialized op names * Filter: specialize double-s64 binary comparators * Fix filter: fix stack leak on taken branch * Filter: Implement stack-based interpreter * Filter: double comparator produces s64 * Filter: use hash table to check merge points * Filter: split passes into separate components * Filter: cleanup macros * Filter: validate range overflow with end of insn * Filter: validate that field ref strings are non-NULL * Filter: ensure logical operator merge is always s64 * Filter: we don't care if double/s64 are literals * Filter: specialize 'and' and 'or' ops. * Implement dispatch-table based interpretor * Filter: Specialize unary operators * Define switch use as macro in interpreter * Filter interpreter: mark float test as unlikely * Filter: fix bytecode validation typo * Filter: specialize comparators * Specialize load and unary ops * Validate registers, no need to initialize to 0 * Filter: opcode for ref loads * Remove redundant validation from interpreter * filter: Add bytecode validation pass * TRACEPOINT_EVENT: add *_nowrite fields for filter * Only print filter errors if LTTNG_UST_DEBUG is set * Cleanup: remove debug define * Filter: add floating point support * Remove filter test printouts * Implement filter bytecode interpreter and linker * Filter: receive, attach and link empty filter * Filter: prepare filter stack data * Wrap dynamic len array into stackvar union * liblttng-ust-comm/lttng-ust-com.c: remove unnecessary goto in ustcomm_accept_unix_sock() * liblttng-ust/lttng-ust-comm.c: fixing typo. * Fix: remove unused texinfo dep from configure.ac * Fix C99 strict compatibility: don't use void * for function pointers * Fix c99 compatibility: tp_rcu_dereference_bp() should not use braced-groups within expressions * Revert "Fix c99 compatibility: tp_rcu_dereference_bp() should not use braced-groups within expressions" * Fix c99 compatibility: tp_rcu_dereference_bp() should not use braced-groups within expressions * Fix: perform TLS fixup of nest count outside of UST mutex * Fix: liblttng-ust-fork deadlock * Fix: handle pthread errors * Fix: local apps allowed should disable local (not global) tracing * Fix strict ISO-C compatibility for ust-tracepoint-event.h public header * Fix: support -std=c99 in tracepoint macros * Fix c99 compatibility: use __typeof__ instead of typeof in public headers * hello test: fail on old style definition * Fix: tracepoint.h should not generate old-style definitions * Fix: don't define variables in headers * test "hello": add boolean test * Fix: perform macro expansion on tracepoint signatures * UST check pointer/de-reference order * Fix list field: handle error * Implement event fields listing * Implement field listing command * Fix: Block all signals in listener thread * Add CodingStyle document to tarball * Add coding style document * endian.h: support cygwin * align.h: support cygwin page size * Add cygwin support to libringbuffer getcpu.h * Add "2x int" and "2x long" types to the Java interface * Add Integer and Long tracepoint types to the Java interface * Fix: don't SIGBUS when filesystem is full * tracepoint: include stdio.h for NULL definition * manpage update: document that probes need gcc * Fix: remove # in front on extern "C" { * Cleanup: don't use GNU old-style field designator extension * Fix: remove padding field after variable sized array * Use unsigned long type for events discarded counter * Fix: getcpu build with modern uClibc versions * Fix: lttng-ust.pc needs to specify -ldl * Fix: examples Makefiles should pass $(LIBS) at last * Build a jar for the Java side of the JNI interface * Fix: ustctl need to send the second fd upon error of 1st fd * Fix: Add missing fork test program dependency library * Fix: Make the JNI interface actually work * Merge branch 'dev' * Fix: stringify version description -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Mon Sep 10 17:38:33 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 10 Sep 2012 17:38:33 -0400 Subject: [lttng-dev] [RELEASE] LTTng modules 2.1.0-rc1 Message-ID: <20120910213833.GB22400@Krystal> The LTTng modules provide Linux kernel tracing capability to the LTTng 2.0 tracer toolset. The main change in this 2.1 cycle for lttng-modules is the newly introduced support for kernels 2.6.32 to 2.6.37, along with MIPS support, and added hostname context. (note: kernels 2.6.32 to 2.6.34 require up to 3 patches provided in linux-patches/ within the lttng-modules tree) Changelog: 2012-09-10 LTTng modules 2.1.0-rc1 * fix timestamps on architectures without CONFIG_KTIME_SCALAR * Support for linux kernels 2.6.32 through 2.6.37 * Document limitation of vppid and ppid context wrt eventual RCU instrumentation * Cleanup: no need to hold RCU read-side lock when reading current nsproxy * Add env hostname information * Fix: lttng_statedump_process_state for each PID NS has infinite loop * lttng_statedump_process_state for each PID NS * Support the hostname context * Fix: statedump namespaced pid, tid and ppid * Fix: statedump: disable vm maps enumeration * Fix: ensure userspace accesses are done with _inatomic * Fix: vppid context should test for current nsproxy * Add MIPS system call support * Change mode of lttng-syscalls-generate-headers.sh to 755 * cleanup: fix typo in syscall instrumentation header * Cleanup: remove trailing whitespace in README * trace event: introduce TP_MODULE_NOAUTOLOAD and TP_MODULE_NOINIT * LTTng: probe-statedump: add #include * fix: signal_generate event should print utf8 for comm field * Makes write operation a parameter for tp_memcpy macro * Add coding style document * Update instrumentation/events README file * Add makefile target for preprocessor * Fix: free_event_id check should compare unsigned int with -1U * Use unsigned long type for events discarded counter * Fix: update signal instrumentation for 3.4 kernel * LTTng Modules ARM syscall instrumentation * Fix: generate header missing echo -e for escape chars * Fix: add missing uaccess.h include (for ARM) * README: Document that CONFIG_MODULES is required * Fix: README typo * Fix: document required and optional kernel config options in README Project website: http://lttng.org Download link: http://lttng.org/download (please refer to the README files for installation instructions and lttng-tools doc/quickstart.txt for usage information) -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From kxhdyx at gmail.com Tue Sep 11 02:44:01 2012 From: kxhdyx at gmail.com (=?GB2312?B?v9zP/urN?=) Date: Tue, 11 Sep 2012 14:44:01 +0800 Subject: [lttng-dev] Why can't i install lttng-modules-kmp-trace rpm? Message-ID: I downloaded these rpms from: http://download.opensuse.org/repositories/devel:/tools:/lttng/SLE_11_SP2/ Include: lttng-tools-2.0.3-1.1.x86_64.rpm liburcu-devel-0.7.3-1.1.x86_64.rpm lttng-tools-2.0.3.tar.bz2 liburcu0-0.7.3-1.1.x86_64.rpm lttng-tools-devel-2.0.3-1.1.x86_64.rpm lttng-ust-2.0.4-1.1.x86_64.rpm babeltrace-1.0.0.rc4-1.1.x86_64.rpm babeltrace-devel-1.0.0.rc4-1.1.x86_64.rpm lttng-modules-2.0.4-1.1.src.rpm lttng-ust-devel-2.0.4-1.1.x86_64.rpm lttng-modules-kmp-default-2.0.4_3.0.13_0.27-1.1.x86_64.rpm urcu-docs-0.7.3-1.1.x86_64.rpm lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64.rpm . I can install all these rpms except this one:* lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64.rpm*. Can anyone help me solve this? rpm -ivh lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64.rpm warning: lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 32567f38 error: Failed dependencies: kernel(trace:kernel_sched) = 99e1a28a02fcf93e is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:mm_slab) = 41ec84771cffa132 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_timer) = 423e9e985483e429 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:fs_pipe) = 93362caf20e7d178 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_panic) = 7737fe7a37eaa833 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:fs_open) = 93d537158f7206d3 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:arch_x86_kernel_x8664_ksyms_64) = 20a930ecfce90836 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:vmlinux) = bc43b4188c6e39ac is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:mm_page_alloc) = 15949994327e24b4 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_printk) = 583f33f84f1e6f70 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_events_core) = 11ff0ab182b98514 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_kprobes) = 1af9e4fed0911559 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:mm_swap) = 0c127c7b0413b462 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_time) = b91606e281206d82 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_cpu) = aa72f1964aa3a83a is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_module) = 09015e13ab1a76db is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_workqueue) = 935a39c08f5e6a71 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:arch_x86_kernel_setup_percpu) = 1e35c1127e2872e6 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:fs_anon_inodes) = 0293c39657d3900a is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:arch_x86_kernel_cpu_common) = 95de3588b03a487e is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:lib_bitmap) = 1bd5f25878fbbd41 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_time_timekeeping) = 80d2df62da4c5dfe is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_notifier) = 6397242c08a00e2f is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:mm_percpu) = 9b2dd7458bddd517 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:lib_uuid) = 4d6572de13cd1d91 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:fs_proc_proc) = 4892b3aeab273f95 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:net_core_dev) = a22e6b28924118a4 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_smp) = a9e07a77cb18ac0e is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:net_core_net_namespace) = 1649fc5fe111db92 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_pid) = 9bdfa3eddb0f5b90 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_spinlock) = 54d2f29207dc84d4 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:fs_seq_file) = 51ac01ba7204b9a7 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_fork) = fb49e52bebfee7d1 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:arch_x86_kernel_paravirt) = bbbc793c79ac8606 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_time_jiffies) = 0a1119a9d9ca3d67 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:fs_dcache) = 9de82f5ed77a3b8b is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:fs_dcache) = b3349160560caee2 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_mutex) = 6e60d96216b54f32 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:fs_file) = 0d187f43ec401899 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:arch_x86_mm_numa) = fec4d81d3e200eed is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_wait) = a8a7455479775eed is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:fs_file_table) = 3e2425c6e8c37533 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:net_ipv4_devinet) = 587ab6c4880180f6 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_tracepoint) = e653a58bd9b4c6bc is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_rcutree) = bb9ce712db2a1247 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:mm_util) = f362a46517fac8df is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_rwsem) = 7d1e7477de0d09d3 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_irq_irqdesc) = 0dd3e98de8c0f26b is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_trace_trace_irqsoff) = a03e17eae6467036 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:kernel_kallsyms) = f7b9f9d69b15ce4b is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 kernel(trace:lib_kasprintf) = 49add60e50526694 is needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 -------------- next part -------------- An HTML attachment was scrubbed... URL: From teawater at gmail.com Tue Sep 11 03:19:09 2012 From: teawater at gmail.com (Hui Zhu) Date: Tue, 11 Sep 2012 15:19:09 +0800 Subject: [lttng-dev] [PATCH/babeltrace] Fix babeltrace-log get big line when the input file last line don't have enter Message-ID: Hi, I got: [Error] Line too large for packet size (32kB) (discarded) When I input a file to babeltrace-log. That is because the last line of the input file doesn't have enter and "babeltrace-log" have bug with the line that doesn't have enter. So I post a patch for it. Thanks, Hui --- a/converter/babeltrace-log.c +++ b/converter/babeltrace-log.c @@ -240,9 +240,11 @@ void trace_text(FILE *input, int output) if (len < 0) break; nl = strrchr(line, '\n'); - if (nl) + if (nl) { *nl = '\0'; - trace_string(line, &pos, nl - line + 1); + trace_string(line, &pos, nl - line + 1); + } else + trace_string(line, &pos, strlen(line) + 1); } ctf_fini_pos(&pos); } From Paul_Woegerer at mentor.com Tue Sep 11 03:22:04 2012 From: Paul_Woegerer at mentor.com (Woegerer, Paul) Date: Tue, 11 Sep 2012 09:22:04 +0200 Subject: [lttng-dev] lttng command line user-friendliness In-Reply-To: <504E099D.6030407@mentor.com> References: <504DCE2E.7020000@mentor.com> <504E0082.9040502@efficios.com> <504E099D.6030407@mentor.com> Message-ID: <504EE69C.9090407@mentor.com> On 09/10/2012 05:39 PM, Woegerer, Paul wrote: > On 09/10/2012 05:00 PM, David Goulet wrote: >> With more options here to set either a custom destination or live >> trace. What's the default? (no opts given). I would personally go for >> a default one being to record in the session default trace files and >> add a "-l" for the live. >> >> -o, --output=DST >> -l, --live >> >> Add a domain option where nothing enables kernel AND ust or else the >> command can take either -u or -k. >> >> Please, contribute to this, no bad ideas, only bad answers! :) While sleeping over it two more things came to my mind: *) The exit status of the that gets trace-executed with "lttng trace []" would need to be forwarded to the exit status of the wrapping lttng. This would allow users to use "lttng trace" as a drop-in replacement in contexts where the return value of the invoked cannot be ignored. *) There should be something like "-q [], --quiet []" where the output of the traced does not get mixed with lttng info/debug/error output. If the optional is given all lttng relevant communication should go into the . Example without --quiet: Session met-2012-09-11_09-08-30 created. Traces will be written in /home/pwoegere/lttng-traces/met-2012-09-11_09-08-30-20120911-090830 UST channel met_tools enabled for session met-2012-09-11_09-08-30 UST event met_func:* created in channel met_tools UST event met_call:* created in channel met_tools Error: Events: Tracing the kernel requires a root lttng-sessiond daemon and "tracing" group user membership (channel channel0, session met-2012-09-11_09-08-30) Tracing started for session met-2012-09-11_09-08-30 Solved MultiThread done... delta 131673329 Tracing stopped for session met-2012-09-11_09-08-30 Session met-2012-09-11_09-08-30 destroyed Example with --quiet Solved MultiThread done... delta 131673329 -- PaulW -- Paul Woegerer | SW Development Engineer http://go.mentor.com/sourceryanalyzer Mentor Embedded(tm) | Prinz Eugen Stra?e 72/2/4, Vienna, 1040 Austria Nucleus? | Linux? | Android(tm) | Services | UI | Multi-OS Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. From per.e.nilsson at ericsson.com Tue Sep 11 06:47:02 2012 From: per.e.nilsson at ericsson.com (Per Nilsson) Date: Tue, 11 Sep 2012 12:47:02 +0200 Subject: [lttng-dev] User space tracing In-Reply-To: <450AE4BEC513614F96969DDA34F35934412F2D721C@EUSAACMS0701.eamcs.ericsson.se> References: <450AE4BEC513614F96969DDA34F35934412F2D721C@EUSAACMS0701.eamcs.ericsson.se> Message-ID: Hi, The directory is empty. This is what I try to show in the following command sequence below. per at per-VirtualBox:~$ sudo ls /home/per/lttng-traces/foo-20120905-135905/ust per at per-VirtualBox:~$ sudo babeltrace /home/per/lttng-traces/foo-20120905-135905/ust BR /per ________________________________ From: Irina Guilman Sent: den 10 september 2012 16:45 To: Per Nilsson; lttng-dev at lists.lttng.org Subject: RE: User space tracing Per, You dont get traces at all, or you do get them but babeltrace fails to convert them? If you open /home/per/lttng-traces/foo-20120905-135905/ust/*/metadata can you see your events? ________________________________ From: Per Nilsson [mailto:per.e.nilsson at ericsson.com] Sent: September-10-12 3:33 AM To: lttng-dev at lists.lttng.org Subject: [lttng-dev] User space tracing Hi, I am trying to get started with userspace tracing with LTTng, but I am having a hard time to get it to work. I'm using Ubunto 11.04, with kernel version: 2.6.38-8-generic. I downloaded and compiled the following lttng software: Userspace-rcu-0.7.4 Lttng-ust-2.0.5 Lttng-tools-2-0.4 Babeltrace-1.0.0-rc5 Maybe some one can tell me what is wrong. // This is command line command I use to start the trace session. per at per-VirtualBox:~$ sudo lttng create foo [sudo] password for per: Session foo created. Traces will be written in /home/per/lttng-traces/foo-20120905-135905 per at per-VirtualBox:~$ sudo lttng enable-event -a -u All UST events are enabled in channel channel0 per at per-VirtualBox:~$ sudo lttng start Tracing started for session foo per at per-VirtualBox:~$ sudo lttng stop Tracing stopped for session foo per at per-VirtualBox:~$ sudo ls /home/per/lttng-traces/foo-20120905-135905/ust per at per-VirtualBox:~$ sudo babeltrace /home/per/lttng-traces/foo-20120905-135905/ust [error] Cannot open any trace for reading. [error] opening trace "/home/per/lttng-traces/foo-20120905-135905/ust" for reading. [error] none of the specified trace paths could be opened. // This is the traces from the lttng-sessiond per at per-VirtualBox:~$ sudo lttng-sessiond --verbose --verbose-consumer DEBUG3: Creating LTTng run directory: /var/run/lttng [in create_lttng_rundir() at main.c:4317] DEBUG1: Client socket path /var/run/lttng/client-lttng-sessiond [in main() at main.c:4609] DEBUG1: Application socket path /var/run/lttng/apps-lttng-sessiond [in main() at main.c:4610] DEBUG1: LTTng run directory path: /var/run/lttng [in main() at main.c:4611] DEBUG3: Created hashtable size 4 at 0x1d4e0a0 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d4e340 of type 1 [in lttng_ht_new() at hashtable.c:96] FATAL: Module lttng_tracer not found. Error: Unable to load module lttng-tracer DEBUG1: Failed to open /proc/lttng [in init_kernel_tracer() at main.c:1871] Error: Unable to remove module lttng-tracer Warning: No kernel tracer available DEBUG1: Signal handler set for SIGTERM, SIGPIPE and SIGINT [in set_signal_handler() at main.c:4451] Warning: No tracing group detected DEBUG1: epoll set max size is 100188 [in compat_epoll_set_max_size() at compat-epoll.c:224] DEBUG1: Thread manage kernel started [in thread_manage_kernel() at main.c:876] DEBUG1: Updating kernel poll set [in update_kernel_poll() at main.c:748] DEBUG1: Thread kernel polling on 2 fds [in thread_manage_kernel() at main.c:905] DEBUG1: [thread] Manage application started [in thread_manage_apps() at main.c:1179] DEBUG1: Apps thread polling on 2 fds [in thread_manage_apps() at main.c:1200] DEBUG1: [thread] Manage application registration started [in thread_registration_apps() at main.c:1392] DEBUG1: Notifying applications of session daemon state: 1 [in notify_ust_apps() at main.c:687] DEBUG1: Got the wait shm fd 17 [in get_wait_shm() at shm.c:117] DEBUG1: Futex wait update active 1 [in futex_wait_update() at futex.c:62] DEBUG1: Accepting application registration [in thread_registration_apps() at main.c:1423] DEBUG1: [thread] Dispatch UST command started [in thread_dispatch_ust_registration() at main.c:1324] DEBUG1: Futex n to 1 prepare done [in futex_nto1_prepare() at futex.c:73] DEBUG1: Woken up but nothing in the UST command queue [in thread_dispatch_ust_registration() at main.c:1334] DEBUG1: [thread] Manage client started [in thread_manage_clients() at main.c:3794] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 8 [in process_client_msg() at main.c:3309] DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905 with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] DEBUG1: Using run_as_clone [in run_as() at runas.c:323] DEBUG1: Tracing session foo created in /home/per/lttng-traces/foo-20120905-135905 with ID 1 by UID 0 GID 0 [in session_create() at session.c:232] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 6 [in process_client_msg() at main.c:3309] DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] DEBUG1: Creating UST session [in create_ust_session() at main.c:1965] DEBUG3: Created hashtable size 4 at 0x1d55840 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d55b00 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d55dc0 of type 0 [in lttng_ht_new() at hashtable.c:96] DEBUG3: mkdir() recursive /home/per/lttng-traces/foo-20120905-135905/ust with mode 504 for uid 0 and gid 0 [in run_as_mkdir_recursive() at runas.c:339] DEBUG1: Using run_as_clone [in run_as() at runas.c:323] DEBUG1: Spawning consumerd [in spawn_consumerd() at main.c:1659] DEBUG1: [thread] Manage consumer started [in thread_manage_consumer() at main.c:982] DEBUG1: Using 64-bit UST consumer at: /usr/local/lib/lttng/libexec/lttng-consumerd [in spawn_consumerd() at main.c:1733] DEBUG3: Created hashtable size 4 at 0x247d030 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x247d2f0 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG1: Connecting to error socket /var/run/lttng/ustconsumerd64/error [in main() at lttng-consumerd.c:349] DEBUG1: Updating poll fd array [in consumer_update_poll_array() at consumer.c:521] DEBUG1: polling on 1 fd [in lttng_consumer_thread_poll_fds() at consumer.c:1013] DEBUG1: Creating command socket /var/run/lttng/ustconsumerd64/command [in lttng_consumer_thread_receive_fds() at consumer.c:1160] DEBUG1: Sending ready command to lttng-sessiond [in lttng_consumer_thread_receive_fds() at consumer.c:1173] DEBUG1: consumer command socket ready [in thread_manage_consumer() at main.c:1062] DEBUG3: Created hashtable size 4 at 0x1d57720 of type 0 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d579e0 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG3: Created hashtable size 4 at 0x1d57f00 of type 1 [in lttng_ht_new() at hashtable.c:96] DEBUG1: UST app creating event * for all apps for session id 1 [in ust_app_create_event_glb() at ust-app.c:1916] DEBUG1: Event UST * created in channel channel0 [in event_ust_enable_tracepoint() at event.c:486] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Connection on client_socket [in lttng_consumer_thread_receive_fds() at consumer.c:1196] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 16 [in process_client_msg() at main.c:3309] DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] DEBUG1: Starting all UST traces [in ust_app_start_trace_all() at ust-app.c:2207] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Nothing recv() from client... continuing [in thread_manage_clients() at main.c:3902] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] DEBUG1: Wait for client response [in thread_manage_clients() at main.c:3863] DEBUG1: Receiving data from client ... [in thread_manage_clients() at main.c:3898] DEBUG1: Processing client command 17 [in process_client_msg() at main.c:3309] DEBUG1: Getting session foo by name [in process_client_msg() at main.c:3364] DEBUG1: Stopping all UST traces [in ust_app_stop_trace_all() at ust-app.c:2233] DEBUG1: Sending response (size: 16, retcode: Success) [in thread_manage_clients() at main.c:3936] DEBUG1: Clean command context structure [in clean_command_ctx() at main.c:534] DEBUG1: Accepting client command ... [in thread_manage_clients() at main.c:3826] // this is the traces from the small test application per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ export LTTNG_UST_DEBUG=1 per at per-VirtualBox:/usr/local/src/lttng-ust-2.0.5/doc/examples/gen-tp$ ./sample liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x7f431694fc38 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) liblttng_ust_tracepoint[1748/1748]: registered tracepoint: lttng_ust:metadata (in tracepoint_register_lib() at tracepoint.c:646) libust[1748/1748]: LTT : ltt ring buffer client init (in ltt_ring_buffer_metadata_client_init() at ltt-ring-buffer-metadata-client.h:334) libust[1748/1748]: LTT : ltt ring buffer client init (in ltt_ring_buffer_client_overwrite_init() at ltt-ring-buffer-client.h:584) libust[1748/1748]: LTT : ltt ring buffer client init (in ltt_ring_buffer_client_discard_init() at ltt-ring-buffer-client.h:584) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Waiting for local apps sessiond (in wait_for_sessiond() at lttng-ust-comm.c:638) libust[1748/1750]: Linux kernels 2.6.33 to 3.0 (with the exception of stable versions) do not support FUTEX_WAKE on read-only memory mappings correctly. Please upgrade your kernel (fix is commit 9ea71503a8ed9184d2d0b8ccc4d269d05f7940ae in Linux kernel mainline). LTTng-UST will use polling mode fallback. (in wait_for_sessiond() at lttng-ust-comm.c:651) libust[1748/1750]: Error: futex: Bad address (in wait_for_sessiond() at lttng-ust-comm.c:653) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1748]: just registered probe sample_tracepoint containing 1 events (in ltt_probe_register() at ltt-probes.c:109) libust[1748/1748]: Registered event probe "sample_tracepoint:message" with signature "char *, text" (in ltt_probe_register() at ltt-probes.c:118) liblttng_ust_tracepoint[1748/1748]: just registered a tracepoints section from 0x602138 and having 1 tracepoints (in tracepoint_register_lib() at tracepoint.c:641) liblttng_ust_tracepoint[1748/1748]: registered tracepoint: sample_tracepoint:message (in tracepoint_register_lib() at tracepoint.c:646) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1749]: Info: sessiond not accepting connections to global apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) libust[1748/1750]: Info: sessiond not accepting connections to local apps socket (in ust_listener_thread() at lttng-ust-comm.c:716) BR /Per Nilsson -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Tue Sep 11 08:54:14 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 11 Sep 2012 08:54:14 -0400 Subject: [lttng-dev] Why can't i install lttng-modules-kmp-trace rpm? In-Reply-To: References: Message-ID: <20120911125414.GA4448@Krystal> * ??? (kxhdyx at gmail.com) wrote: > I downloaded these rpms from: > http://download.opensuse.org/repositories/devel:/tools:/lttng/SLE_11_SP2/ This looks like missing dependencies. Please ask this question to your distribution vendor (SuSE). Thanks, Mathieu > Include: lttng-tools-2.0.3-1.1.x86_64.rpm > liburcu-devel-0.7.3-1.1.x86_64.rpm lttng-tools-2.0.3.tar.bz2 > liburcu0-0.7.3-1.1.x86_64.rpm > lttng-tools-devel-2.0.3-1.1.x86_64.rpm > lttng-ust-2.0.4-1.1.x86_64.rpm babeltrace-1.0.0.rc4-1.1.x86_64.rpm > babeltrace-devel-1.0.0.rc4-1.1.x86_64.rpm > lttng-modules-2.0.4-1.1.src.rpm > lttng-ust-devel-2.0.4-1.1.x86_64.rpm > lttng-modules-kmp-default-2.0.4_3.0.13_0.27-1.1.x86_64.rpm > urcu-docs-0.7.3-1.1.x86_64.rpm > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64.rpm . > > I can install all these rpms except this one:* > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64.rpm*. Can anyone help > me solve this? > rpm -ivh lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64.rpm > warning: lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64.rpm: Header > V3 DSA signature: NOKEY, key ID 32567f38 > error: Failed dependencies: > kernel(trace:kernel_sched) = 99e1a28a02fcf93e is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:mm_slab) = 41ec84771cffa132 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_timer) = 423e9e985483e429 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:fs_pipe) = 93362caf20e7d178 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_panic) = 7737fe7a37eaa833 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:fs_open) = 93d537158f7206d3 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:arch_x86_kernel_x8664_ksyms_64) = 20a930ecfce90836 is > needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:vmlinux) = bc43b4188c6e39ac is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:mm_page_alloc) = 15949994327e24b4 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_printk) = 583f33f84f1e6f70 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_events_core) = 11ff0ab182b98514 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_kprobes) = 1af9e4fed0911559 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:mm_swap) = 0c127c7b0413b462 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_time) = b91606e281206d82 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_cpu) = aa72f1964aa3a83a is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_module) = 09015e13ab1a76db is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_workqueue) = 935a39c08f5e6a71 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:arch_x86_kernel_setup_percpu) = 1e35c1127e2872e6 is > needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:fs_anon_inodes) = 0293c39657d3900a is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:arch_x86_kernel_cpu_common) = 95de3588b03a487e is > needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:lib_bitmap) = 1bd5f25878fbbd41 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_time_timekeeping) = 80d2df62da4c5dfe is needed > by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_notifier) = 6397242c08a00e2f is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:mm_percpu) = 9b2dd7458bddd517 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:lib_uuid) = 4d6572de13cd1d91 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:fs_proc_proc) = 4892b3aeab273f95 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:net_core_dev) = a22e6b28924118a4 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_smp) = a9e07a77cb18ac0e is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:net_core_net_namespace) = 1649fc5fe111db92 is needed > by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_pid) = 9bdfa3eddb0f5b90 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_spinlock) = 54d2f29207dc84d4 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:fs_seq_file) = 51ac01ba7204b9a7 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_fork) = fb49e52bebfee7d1 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:arch_x86_kernel_paravirt) = bbbc793c79ac8606 is needed > by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_time_jiffies) = 0a1119a9d9ca3d67 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:fs_dcache) = 9de82f5ed77a3b8b is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:fs_dcache) = b3349160560caee2 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_mutex) = 6e60d96216b54f32 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:fs_file) = 0d187f43ec401899 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:arch_x86_mm_numa) = fec4d81d3e200eed is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_wait) = a8a7455479775eed is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:fs_file_table) = 3e2425c6e8c37533 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:net_ipv4_devinet) = 587ab6c4880180f6 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_tracepoint) = e653a58bd9b4c6bc is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_rcutree) = bb9ce712db2a1247 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:mm_util) = f362a46517fac8df is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_rwsem) = 7d1e7477de0d09d3 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_irq_irqdesc) = 0dd3e98de8c0f26b is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_trace_trace_irqsoff) = a03e17eae6467036 is > needed by lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:kernel_kallsyms) = f7b9f9d69b15ce4b is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > kernel(trace:lib_kasprintf) = 49add60e50526694 is needed by > lttng-modules-kmp-trace-2.0.4_3.0.13_0.27-1.1.x86_64 > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Tue Sep 11 09:29:54 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 11 Sep 2012 09:29:54 -0400 Subject: [lttng-dev] [PATCH/babeltrace] Fix babeltrace-log get big line when the input file last line don't have enter In-Reply-To: References: Message-ID: <20120911132954.GA4710@Krystal> * Hui Zhu (teawater at gmail.com) wrote: > Hi, > > I got: > [Error] Line too large for packet size (32kB) (discarded) > When I input a file to babeltrace-log. > That is because the last line of the input file doesn't have enter and > "babeltrace-log" have bug with the line that doesn't have enter. > So I post a patch for it. Merged, thanks! Mathieu > > Thanks, > Hui > > --- a/converter/babeltrace-log.c > +++ b/converter/babeltrace-log.c > @@ -240,9 +240,11 @@ void trace_text(FILE *input, int output) > if (len < 0) > break; > nl = strrchr(line, '\n'); > - if (nl) > + if (nl) { > *nl = '\0'; > - trace_string(line, &pos, nl - line + 1); > + trace_string(line, &pos, nl - line + 1); > + } else > + trace_string(line, &pos, strlen(line) + 1); > } > ctf_fini_pos(&pos); > } > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From francis.giraldeau at gmail.com Tue Sep 11 13:36:27 2012 From: francis.giraldeau at gmail.com (Francis Giraldeau) Date: Tue, 11 Sep 2012 13:36:27 -0400 Subject: [lttng-dev] Query about LTTng 2.0 Debian packages In-Reply-To: <20120717002030.GA19871@quintessa> References: <20120621012622.GA1387@Krystal> <20120621191452.GA18195@quintessa> <20120717002030.GA19871@quintessa> Message-ID: <504F769B.5060807@gmail.com> Le 2012-07-16 20:20, Jon Bernard a ?crit : > * Jon Bernard wrote: >> * Mathieu Desnoyers wrote: >>> Hi Jon, >>> >>> I wanted to get in touch with you regarding LTTng 2.0 Debian packages. >>> Is there anything we can do to help you getting those packages into >>> Debian ? They have been out for a while now, and even Ubuntu picked them >>> up. I understand that you are probably busy, hence my offer for help. >> >> I've just uploaded another package I've been working on and LTTng 2.0 packages >> are next on my list. Give me a few days to get things sorted, I'll post an >> update next week with my status. > > I am just now waiting on lttng-modules and babeltrace to be accepted into the > archive. Once this happens, lttng-utils can be uploaded and the 2.0 packages > should be complete. I just checked the status of packages in testing, experimental and the new queue, and it seems that it's not there yet. Is there any show-stopper? Cheers, Francis -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4489 bytes Desc: Signature cryptographique S/MIME URL: From mathieu.desnoyers at efficios.com Tue Sep 11 14:00:21 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 11 Sep 2012 14:00:21 -0400 Subject: [lttng-dev] Query about LTTng 2.0 Debian packages In-Reply-To: <504F769B.5060807@gmail.com> References: <20120621012622.GA1387@Krystal> <20120621191452.GA18195@quintessa> <20120717002030.GA19871@quintessa> <504F769B.5060807@gmail.com> Message-ID: <20120911180021.GA9698@Krystal> * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > Le 2012-07-16 20:20, Jon Bernard a ?crit : > > * Jon Bernard wrote: > >> * Mathieu Desnoyers wrote: > >>> Hi Jon, > >>> > >>> I wanted to get in touch with you regarding LTTng 2.0 Debian packages. > >>> Is there anything we can do to help you getting those packages into > >>> Debian ? They have been out for a while now, and even Ubuntu picked them > >>> up. I understand that you are probably busy, hence my offer for help. > >> > >> I've just uploaded another package I've been working on and LTTng 2.0 packages > >> are next on my list. Give me a few days to get things sorted, I'll post an > >> update next week with my status. > > > > I am just now waiting on lttng-modules and babeltrace to be accepted into the > > archive. Once this happens, lttng-utils can be uploaded and the 2.0 packages > > should be complete. > > I just checked the status of packages in testing, experimental and the > new queue, and it seems that it's not there yet. Is there any show-stopper? Hi Francis, Hi Jon, My guess is that Jon Bernard does not have enough cycles to work on the lttng packages. Jon, is there anything we can do to help ? What is the status of LTTng 2.0 packages inclusion in Debian ? Thanks, Mathieu > > Cheers, > > Francis > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Tue Sep 11 14:49:10 2012 From: dgoulet at efficios.com (David Goulet) Date: Tue, 11 Sep 2012 14:49:10 -0400 Subject: [lttng-dev] [lttng-tools PATCH] Add new thread in consumer for metadata handling Message-ID: <1347389351-19792-1-git-send-email-dgoulet@efficios.com> To prioritize the consumption of the metadata, this patch introduce a new thread in the consumer which exclusively handles metadata in order to separate them from the trace data. The motivation behind this change is that once a start command is done on the tracer (kernel or UST), the start waits up to 10 seconds for the metadata to be written (LTTNG_METADATA_TIMEOUT_MSEC). However, there is a case where there is not enough space in the metadata buffers and the tracer waits so to not drop data. After the timeout, if the write(s) is unsuccessful, the start session command fails. The previous problem can occur with network streaming with high throughput data such as enable-event -a -k and a poor bandwitdh connection. The separation between metadata and trace data does the trick where consuming metadata does not depend anymore on the arbitrary time to stream trace data while metadata buffers needs to get consumed. Of course, this fix is more _visible_ on multiprocessor/core machines but can also help on single processor to prioritize metadata consumption. Signed-off-by: David Goulet --- src/bin/lttng-consumerd/lttng-consumerd.c | 8 +- src/common/compat/compat-epoll.c | 2 +- src/common/consumer.c | 455 ++++++++++++++++++++++---- src/common/consumer.h | 7 +- src/common/kernel-consumer/kernel-consumer.c | 39 ++- src/common/ust-consumer/ust-consumer.c | 27 +- 6 files changed, 453 insertions(+), 85 deletions(-) diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c index d49c3eb..5952334 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.c +++ b/src/bin/lttng-consumerd/lttng-consumerd.c @@ -44,14 +44,15 @@ #include #include #include +#include #include #include "lttng-consumerd.h" /* TODO : support UST (all direct kernel-ctl accesses). */ -/* the two threads (receive fd and poll) */ -static pthread_t threads[2]; +/* the two threads (receive fd, poll and metadata) */ +static pthread_t threads[3]; /* to count the number of times the user pressed ctrl+c */ static int sigintcount = 0; @@ -283,6 +284,9 @@ int main(int argc, char **argv) } } + /* Set up max poll set size */ + lttng_poll_set_max_size(); + if (strlen(command_sock_path) == 0) { switch (opt_type) { case LTTNG_CONSUMER_KERNEL: diff --git a/src/common/compat/compat-epoll.c b/src/common/compat/compat-epoll.c index e584972..939aaac 100644 --- a/src/common/compat/compat-epoll.c +++ b/src/common/compat/compat-epoll.c @@ -43,7 +43,7 @@ int compat_epoll_create(struct lttng_poll_event *events, int size, int flags) } /* Don't bust the limit here */ - if (size > poll_max_size) { + if (size > poll_max_size && poll_max_size != 0) { size = poll_max_size; } diff --git a/src/common/consumer.c b/src/common/consumer.c index 008bf8e..2ce33a6 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -30,6 +30,8 @@ #include #include +#include +#include #include #include #include @@ -440,20 +442,6 @@ int consumer_add_stream(struct lttng_consumer_stream *stream) consumer_data.stream_count++; consumer_data.need_update = 1; - switch (consumer_data.type) { - case LTTNG_CONSUMER_KERNEL: - break; - case LTTNG_CONSUMER32_UST: - case LTTNG_CONSUMER64_UST: - /* Streams are in CPU number order (we rely on this) */ - stream->cpu = stream->chan->nr_streams++; - break; - default: - ERR("Unknown consumer_data type"); - assert(0); - goto end; - } - end: pthread_mutex_unlock(&consumer_data.lock); @@ -698,7 +686,6 @@ struct lttng_consumer_channel *consumer_allocate_channel( channel->mmap_len = mmap_len; channel->max_sb_size = max_sb_size; channel->refcount = 0; - channel->nr_streams = 0; lttng_ht_node_init_ulong(&channel->node, channel->key); switch (consumer_data.type) { @@ -766,8 +753,7 @@ end: */ int consumer_update_poll_array( struct lttng_consumer_local_data *ctx, struct pollfd **pollfd, - struct lttng_consumer_stream **local_stream, - struct lttng_ht *metadata_ht) + struct lttng_consumer_stream **local_stream) { int i = 0; struct lttng_ht_iter iter; @@ -783,10 +769,6 @@ int consumer_update_poll_array( DBG("Active FD %d", stream->wait_fd); (*pollfd)[i].fd = stream->wait_fd; (*pollfd)[i].events = POLLIN | POLLPRI; - if (stream->metadata_flag && metadata_ht) { - lttng_ht_add_unique_ulong(metadata_ht, &stream->waitfd_node); - DBG("Active FD added to metadata hash table"); - } local_stream[i] = stream; i++; } @@ -1025,9 +1007,22 @@ struct lttng_consumer_local_data *lttng_consumer_create( goto error_thread_pipe; } - return ctx; + ret = utils_create_pipe(ctx->consumer_metadata_pipe); + if (ret < 0) { + goto error_metadata_pipe; + } + ret = utils_create_pipe(ctx->consumer_splice_metadata_pipe); + if (ret < 0) { + goto error_splice_pipe; + } + + return ctx; +error_splice_pipe: + utils_close_pipe(ctx->consumer_metadata_pipe); +error_metadata_pipe: + utils_close_pipe(ctx->consumer_thread_pipe); error_thread_pipe: for (i = 0; i < 2; i++) { int err; @@ -1088,6 +1083,8 @@ void lttng_consumer_destroy(struct lttng_consumer_local_data *ctx) if (ret) { PERROR("close"); } + utils_close_pipe(ctx->consumer_splice_metadata_pipe); + unlink(ctx->consumer_command_sock_path); free(ctx); } @@ -1258,6 +1255,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( /* Default is on the disk */ int outfd = stream->out_fd; struct consumer_relayd_sock_pair *relayd = NULL; + int *splice_pipe; switch (consumer_data.type) { case LTTNG_CONSUMER_KERNEL: @@ -1282,6 +1280,17 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( } } + /* + * Choose right pipe for splice. Metadata and trace data are handled by + * different threads hence the use of two pipes in order not to race or + * corrupt the written data. + */ + if (stream->metadata_flag) { + splice_pipe = ctx->consumer_splice_metadata_pipe; + } else { + splice_pipe = ctx->consumer_thread_pipe; + } + /* Write metadata stream id before payload */ if (stream->metadata_flag && relayd) { /* @@ -1290,8 +1299,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( */ pthread_mutex_lock(&relayd->ctrl_sock_mutex); - ret = write_relayd_metadata_id(ctx->consumer_thread_pipe[1], - stream, relayd); + ret = write_relayd_metadata_id(splice_pipe[1], stream, relayd); if (ret < 0) { written = ret; goto end; @@ -1301,7 +1309,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( while (len > 0) { DBG("splice chan to pipe offset %lu of len %lu (fd : %d)", (unsigned long)offset, len, fd); - ret_splice = splice(fd, &offset, ctx->consumer_thread_pipe[1], NULL, len, + ret_splice = splice(fd, &offset, splice_pipe[1], NULL, len, SPLICE_F_MOVE | SPLICE_F_MORE); DBG("splice chan to pipe, ret %zd", ret_splice); if (ret_splice < 0) { @@ -1337,7 +1345,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( } /* Splice data out */ - ret_splice = splice(ctx->consumer_thread_pipe[0], NULL, outfd, NULL, + ret_splice = splice(splice_pipe[0], NULL, outfd, NULL, ret_splice, SPLICE_F_MOVE | SPLICE_F_MORE); DBG("Kernel consumer splice pipe to file, ret %zd", ret_splice); if (ret_splice < 0) { @@ -1460,6 +1468,331 @@ int lttng_consumer_recv_cmd(struct lttng_consumer_local_data *ctx, } /* + * Iterate over all stream element of the hashtable and free them. This is race + * free since the hashtable pass MUST be in a race free synchronization state. + * It's the caller responsability to make sure of that. + */ +void destroy_stream_ht(struct lttng_ht *ht) +{ + int ret; + struct lttng_ht_iter iter; + struct lttng_consumer_stream *stream; + + if (ht == NULL) { + return; + } + + cds_lfht_for_each_entry(ht->ht, &iter.iter, stream, node.node) { + ret = lttng_ht_del(ht, &iter); + assert(ret); + + free(stream); + } + + lttng_ht_destroy(ht); +} + +/* + * Clean up a metadata stream and free it's memory. + */ +void consumer_del_metadata_stream(struct lttng_consumer_stream *stream) +{ + int ret; + struct lttng_consumer_channel *free_chan = NULL; + struct consumer_relayd_sock_pair *relayd; + + assert(stream); + /* + * This call should NEVER receive regular stream. It must always be + * metadata stream and this is crucial for data structure synchronization. + */ + assert(stream->metadata_flag); + + pthread_mutex_lock(&consumer_data.lock); + switch (consumer_data.type) { + case LTTNG_CONSUMER_KERNEL: + if (stream->mmap_base != NULL) { + ret = munmap(stream->mmap_base, stream->mmap_len); + if (ret != 0) { + PERROR("munmap metadata stream"); + } + } + break; + case LTTNG_CONSUMER32_UST: + case LTTNG_CONSUMER64_UST: + lttng_ustconsumer_del_stream(stream); + break; + default: + ERR("Unknown consumer_data type"); + assert(0); + } + pthread_mutex_unlock(&consumer_data.lock); + + if (stream->out_fd >= 0) { + ret = close(stream->out_fd); + if (ret) { + PERROR("close"); + } + } + + if (stream->wait_fd >= 0 && !stream->wait_fd_is_copy) { + ret = close(stream->wait_fd); + if (ret) { + PERROR("close"); + } + } + + if (stream->shm_fd >= 0 && stream->wait_fd != stream->shm_fd) { + ret = close(stream->shm_fd); + if (ret) { + PERROR("close"); + } + } + + /* Check and cleanup relayd */ + rcu_read_lock(); + relayd = consumer_find_relayd(stream->net_seq_idx); + if (relayd != NULL) { + uatomic_dec(&relayd->refcount); + assert(uatomic_read(&relayd->refcount) >= 0); + + /* Closing streams requires to lock the control socket. */ + pthread_mutex_lock(&relayd->ctrl_sock_mutex); + ret = relayd_send_close_stream(&relayd->control_sock, + stream->relayd_stream_id, stream->next_net_seq_num - 1); + pthread_mutex_unlock(&relayd->ctrl_sock_mutex); + if (ret < 0) { + DBG("Unable to close stream on the relayd. Continuing"); + /* + * Continue here. There is nothing we can do for the relayd. + * Chances are that the relayd has closed the socket so we just + * continue cleaning up. + */ + } + + /* Both conditions are met, we destroy the relayd. */ + if (uatomic_read(&relayd->refcount) == 0 && + uatomic_read(&relayd->destroy_flag)) { + consumer_destroy_relayd(relayd); + } + } + rcu_read_unlock(); + + /* Atomically decrement channel refcount since other threads can use it. */ + uatomic_dec(&stream->chan->refcount); + if (!uatomic_read(&stream->chan->refcount)) { + free_chan = stream->chan; + } + + if (free_chan) { + consumer_del_channel(free_chan); + } + + free(stream); +} + +/* + * Action done with the metadata stream when adding it to the consumer internal + * data structures to handle it. + */ +void consumer_add_metadata_stream(struct lttng_consumer_stream *stream) +{ + struct consumer_relayd_sock_pair *relayd; + + /* Find relayd and, if one, increment refcount. */ + rcu_read_lock(); + relayd = consumer_find_relayd(stream->net_seq_idx); + if (relayd != NULL) { + uatomic_inc(&relayd->refcount); + } + rcu_read_unlock(); +} + +/* + * Thread polls on metadata file descriptor and write them on disk or on the + * network. + */ +void *lttng_consumer_thread_poll_metadata(void *data) +{ + int ret, i, pollfd; + uint32_t revents, nb_fd; + struct lttng_consumer_stream *stream; + struct lttng_ht_iter iter; + struct lttng_ht_node_ulong *node; + struct lttng_ht *metadata_ht = NULL; + struct lttng_poll_event events; + struct lttng_consumer_local_data *ctx = data; + ssize_t len; + + rcu_register_thread(); + + DBG("Thread metadata poll started"); + + metadata_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); + if (metadata_ht == NULL) { + goto end; + } + + /* Size is set to 1 for the consumer_metadata pipe */ + ret = lttng_poll_create(&events, 2, LTTNG_CLOEXEC); + if (ret < 0) { + ERR("Poll set creation failed"); + goto end; + } + + ret = lttng_poll_add(&events, ctx->consumer_metadata_pipe[0], LPOLLIN); + if (ret < 0) { + goto end; + } + + /* Main loop */ + DBG("Metadata main loop started"); + + while (1) { + lttng_poll_reset(&events); + + nb_fd = LTTNG_POLL_GETNB(&events); + + /* Only the metadata pipe is set */ + if (nb_fd == 0 && consumer_quit == 1) { + goto end; + } + +restart: + DBG("Metadata poll wait with %d fd(s)", nb_fd); + ret = lttng_poll_wait(&events, -1); + DBG("Metadata event catched in thread"); + if (ret < 0) { + if (errno == EINTR) { + goto restart; + } + goto error; + } + + for (i = 0; i < nb_fd; i++) { + revents = LTTNG_POLL_GETEV(&events, i); + pollfd = LTTNG_POLL_GETFD(&events, i); + + /* Check the metadata pipe for incoming metadata. */ + if (pollfd == ctx->consumer_metadata_pipe[0]) { + if (revents & (LPOLLERR | LPOLLHUP | LPOLLNVAL)) { + DBG("Metadata thread pipe hung up"); + /* + * Remove the pipe from the poll set and continue the loop + * since their might be data to consume. + */ + lttng_poll_del(&events, ctx->consumer_metadata_pipe[0]); + close(ctx->consumer_metadata_pipe[0]); + continue; + } else if (revents & LPOLLIN) { + stream = zmalloc(sizeof(struct lttng_consumer_stream)); + if (stream == NULL) { + PERROR("zmalloc metadata consumer stream"); + goto error; + } + + do { + /* Get the stream and add it to the local hash table */ + ret = read(pollfd, stream, + sizeof(struct lttng_consumer_stream)); + } while (ret < 0 && errno == EINTR); + if (ret < 0 || ret < sizeof(struct lttng_consumer_stream)) { + PERROR("read metadata stream"); + free(stream); + /* + * Let's continue here and hope we can still work + * without stopping the consumer. XXX: Should we? + */ + continue; + } + + DBG("Adding metadata stream %d to poll set", + stream->wait_fd); + + /* The node should be init at this point */ + lttng_ht_add_unique_ulong(metadata_ht, + &stream->waitfd_node); + + /* Add metadata stream to the global poll events list */ + lttng_poll_add(&events, stream->wait_fd, + LPOLLIN | LPOLLPRI); + + consumer_add_metadata_stream(stream); + } + + /* Metadata pipe handled. Continue handling the others */ + continue; + } + + /* From here, the event is a metadata wait fd */ + + lttng_ht_lookup(metadata_ht, (void *)((unsigned long) pollfd), + &iter); + node = lttng_ht_iter_get_node_ulong(&iter); + if (node == NULL) { + /* FD not found, continue loop */ + continue; + } + + stream = caa_container_of(node, struct lttng_consumer_stream, + waitfd_node); + + /* Get the data out of the metadata file descriptor */ + if (revents & (LPOLLIN | LPOLLPRI)) { + DBG("Metadata available on fd %d", pollfd); + assert(stream->wait_fd == pollfd); + + len = ctx->on_buffer_ready(stream, ctx); + /* It's ok to have an unavailable sub-buffer */ + if (len < 0 && len != -EAGAIN) { + goto end; + } else if (len > 0) { + stream->data_read = 1; + } + } + + /* + * Remove the stream from the hash table since there is no data + * left on the fd because we previously did a read on the buffer. + */ + if (revents & (LPOLLERR | LPOLLHUP | LPOLLNVAL)) { + DBG("Metadata fd %d is hup|err|nval.", pollfd); + if (!stream->hangup_flush_done + && (consumer_data.type == LTTNG_CONSUMER32_UST + || consumer_data.type == LTTNG_CONSUMER64_UST)) { + DBG("Attempting to flush and consume the UST buffers"); + lttng_ustconsumer_on_stream_hangup(stream); + + /* We just flushed the stream now read it. */ + len = ctx->on_buffer_ready(stream, ctx); + /* It's ok to have an unavailable sub-buffer */ + if (len < 0 && len != -EAGAIN) { + goto end; + } + } + + /* Removing it from hash table, poll set and free memory */ + lttng_ht_del(metadata_ht, &iter); + lttng_poll_del(&events, stream->wait_fd); + consumer_del_metadata_stream(stream); + } + } + } + +error: +end: + DBG("Metadata poll thread exiting"); + lttng_poll_clean(&events); + + if (metadata_ht) { + destroy_stream_ht(metadata_ht); + } + + rcu_unregister_thread(); + return NULL; +} + +/* * This thread polls the fds in the set to consume the data and write * it to tracefile if necessary. */ @@ -1472,16 +1805,20 @@ void *lttng_consumer_thread_poll_fds(void *data) /* local view of consumer_data.fds_count */ int nb_fd = 0; struct lttng_consumer_local_data *ctx = data; - struct lttng_ht *metadata_ht; - struct lttng_ht_iter iter; - struct lttng_ht_node_ulong *node; - struct lttng_consumer_stream *metadata_stream; ssize_t len; - - metadata_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); + pthread_t metadata_thread; + void *status; rcu_register_thread(); + /* Start metadata polling thread */ + ret = pthread_create(&metadata_thread, NULL, + lttng_consumer_thread_poll_metadata, (void *) ctx); + if (ret < 0) { + PERROR("pthread_create metadata thread"); + goto end; + } + local_stream = zmalloc(sizeof(struct lttng_consumer_stream)); while (1) { @@ -1519,8 +1856,7 @@ void *lttng_consumer_thread_poll_fds(void *data) pthread_mutex_unlock(&consumer_data.lock); goto end; } - ret = consumer_update_poll_array(ctx, &pollfd, local_stream, - metadata_ht); + ret = consumer_update_poll_array(ctx, &pollfd, local_stream); if (ret < 0) { ERR("Error in allocating pollfd or local_outfds"); lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_POLL_ERROR); @@ -1575,24 +1911,7 @@ void *lttng_consumer_thread_poll_fds(void *data) /* Take care of high priority channels first. */ for (i = 0; i < nb_fd; i++) { - /* Lookup for metadata which is the highest priority */ - lttng_ht_lookup(metadata_ht, - (void *)((unsigned long) pollfd[i].fd), &iter); - node = lttng_ht_iter_get_node_ulong(&iter); - if (node != NULL && - (pollfd[i].revents & (POLLIN | POLLPRI))) { - DBG("Urgent metadata read on fd %d", pollfd[i].fd); - metadata_stream = caa_container_of(node, - struct lttng_consumer_stream, waitfd_node); - high_prio = 1; - len = ctx->on_buffer_ready(metadata_stream, ctx); - /* it's ok to have an unavailable sub-buffer */ - if (len < 0 && len != -EAGAIN) { - goto end; - } else if (len > 0) { - metadata_stream->data_read = 1; - } - } else if (pollfd[i].revents & POLLPRI) { + if (pollfd[i].revents & POLLPRI) { DBG("Urgent read on fd %d", pollfd[i].fd); high_prio = 1; len = ctx->on_buffer_ready(local_stream[i], ctx); @@ -1648,33 +1967,18 @@ void *lttng_consumer_thread_poll_fds(void *data) if ((pollfd[i].revents & POLLHUP)) { DBG("Polling fd %d tells it has hung up.", pollfd[i].fd); if (!local_stream[i]->data_read) { - if (local_stream[i]->metadata_flag) { - iter.iter.node = &local_stream[i]->waitfd_node.node; - ret = lttng_ht_del(metadata_ht, &iter); - assert(!ret); - } consumer_del_stream(local_stream[i]); num_hup++; } } else if (pollfd[i].revents & POLLERR) { ERR("Error returned in polling fd %d.", pollfd[i].fd); if (!local_stream[i]->data_read) { - if (local_stream[i]->metadata_flag) { - iter.iter.node = &local_stream[i]->waitfd_node.node; - ret = lttng_ht_del(metadata_ht, &iter); - assert(!ret); - } consumer_del_stream(local_stream[i]); num_hup++; } } else if (pollfd[i].revents & POLLNVAL) { ERR("Polling fd %d tells fd is not open.", pollfd[i].fd); if (!local_stream[i]->data_read) { - if (local_stream[i]->metadata_flag) { - iter.iter.node = &local_stream[i]->waitfd_node.node; - ret = lttng_ht_del(metadata_ht, &iter); - assert(!ret); - } consumer_del_stream(local_stream[i]); num_hup++; } @@ -1692,6 +1996,23 @@ end: free(local_stream); local_stream = NULL; } + + /* + * Close the write side of the pipe so epoll_wait() in + * lttng_consumer_thread_poll_metadata can catch it. The thread is + * monitoring the read side of the pipe. If we close them both, epoll_wait + * strangely does not return and could create a endless wait period if the + * pipe is the only tracked fd in the poll set. The thread will take care + * of closing the read side. + */ + close(ctx->consumer_metadata_pipe[1]); + if (ret) { + ret = pthread_join(metadata_thread, &status); + if (ret < 0) { + PERROR("pthread_join metadata thread"); + } + } + rcu_unregister_thread(); return NULL; } diff --git a/src/common/consumer.h b/src/common/consumer.h index fc5d5ef..e307b18 100644 --- a/src/common/consumer.h +++ b/src/common/consumer.h @@ -83,7 +83,6 @@ struct lttng_consumer_channel { void *mmap_base; size_t mmap_len; struct lttng_ust_shm_handle *handle; - int nr_streams; int wait_fd_is_copy; int cpucount; }; @@ -224,10 +223,13 @@ struct lttng_consumer_local_data { char *consumer_command_sock_path; /* communication with splice */ int consumer_thread_pipe[2]; + int consumer_splice_metadata_pipe[2]; /* pipe to wake the poll thread when necessary */ int consumer_poll_pipe[2]; /* to let the signal handler wake up the fd receiver thread */ int consumer_should_quit[2]; + /* Metadata poll thread pipe. Transfer metadata stream to it */ + int consumer_metadata_pipe[2]; }; /* @@ -318,8 +320,7 @@ extern int lttng_consumer_poll_socket(struct pollfd *kconsumer_sockpoll); extern int consumer_update_poll_array( struct lttng_consumer_local_data *ctx, struct pollfd **pollfd, - struct lttng_consumer_stream **local_consumer_streams, - struct lttng_ht *metadata_ht); + struct lttng_consumer_stream **local_consumer_streams); extern struct lttng_consumer_stream *consumer_allocate_stream( int channel_key, int stream_key, diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index 86e4051..ca82f96 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -171,6 +171,18 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, goto end_nosignal; } + /* + * XXX: Kernel workaround. The buffer flush is done on the session + * daemon side for the kernel so no need for the stream + * "hangup_flush_done" variable to be tracked. So, we just set it to be + * always true meaning that the flush was done on the stream at + * anytime. + * + * We should think of doing the kernel flush on the consumer side in + * order to standardize our operations on streams whatever the domain. + */ + new_stream->hangup_flush_done = 1; + /* The stream is not metadata. Get relayd reference if exists. */ relayd = consumer_find_relayd(msg.u.stream.net_index); if (relayd != NULL) { @@ -190,14 +202,29 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, goto end_nosignal; } - if (ctx->on_recv_stream != NULL) { - ret = ctx->on_recv_stream(new_stream); - if (ret == 0) { - consumer_add_stream(new_stream); - } else if (ret < 0) { - goto end_nosignal; + /* Send stream to the metadata thread */ + if (new_stream->metadata_flag) { + if (ctx->on_recv_stream) { + ret = ctx->on_recv_stream(new_stream); + if (ret < 0) { + goto end_nosignal; + } + } + + do { + ret = write(ctx->consumer_metadata_pipe[1], new_stream, + sizeof(struct lttng_consumer_stream)); + } while (ret < 0 && errno == EINTR); + if (ret < 0) { + PERROR("write metadata pipe"); } } else { + if (ctx->on_recv_stream) { + ret = ctx->on_recv_stream(new_stream); + if (ret < 0) { + goto end_nosignal; + } + } consumer_add_stream(new_stream); } diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 855d071..c984e33 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -223,14 +223,29 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, goto end_nosignal; } - if (ctx->on_recv_stream != NULL) { - ret = ctx->on_recv_stream(new_stream); - if (ret == 0) { - consumer_add_stream(new_stream); - } else if (ret < 0) { - goto end_nosignal; + /* Send stream to the metadata thread */ + if (new_stream->metadata_flag) { + if (ctx->on_recv_stream) { + ret = ctx->on_recv_stream(new_stream); + if (ret < 0) { + goto end_nosignal; + } + } + + do { + ret = write(ctx->consumer_metadata_pipe[1], new_stream, + sizeof(struct lttng_consumer_stream)); + } while (ret < 0 && errno == EINTR); + if (ret < 0) { + PERROR("write metadata pipe"); } } else { + if (ctx->on_recv_stream) { + ret = ctx->on_recv_stream(new_stream); + if (ret < 0) { + goto end_nosignal; + } + } consumer_add_stream(new_stream); } -- 1.7.10.4 From mathieu.desnoyers at efficios.com Tue Sep 11 15:52:35 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 11 Sep 2012 15:52:35 -0400 Subject: [lttng-dev] [lttng-tools PATCH] Add new thread in consumer for metadata handling In-Reply-To: <1347389351-19792-1-git-send-email-dgoulet@efficios.com> References: <1347389351-19792-1-git-send-email-dgoulet@efficios.com> Message-ID: <20120911195235.GA11196@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > To prioritize the consumption of the metadata, this patch introduce a > new thread in the consumer which exclusively handles metadata in order > to separate them from the trace data. > > The motivation behind this change is that once a start command is done > on the tracer (kernel or UST), the start waits up to 10 seconds for the > metadata to be written (LTTNG_METADATA_TIMEOUT_MSEC). However, there is > a case where there is not enough space in the metadata buffers and the > tracer waits so to not drop data. After the timeout, if the write(s) is > unsuccessful, the start session command fails. > > The previous problem can occur with network streaming with high > throughput data such as enable-event -a -k and a poor bandwitdh poor -> low > connection. > > The separation between metadata and trace data does the trick where > consuming metadata does not depend anymore on the arbitrary time to > stream trace data while metadata buffers needs to get consumed. > > Of course, this fix is more _visible_ on multiprocessor/core machines > but can also help on single processor to prioritize metadata > consumption. It helps on single-processor too because the scheduler will schedule both the data and metadata threads. Even if the data thread need to send many MB of data, if the metadata thread sends small enough metadata we should be good with half of the CPU time. I see that the metadata reaches easily 192k for kernel traces though. On a 5KB/s connection, this sums up to 38s. However, thanks to the fact that the 10s delay is allowed between each sub-buffer, we don't reach the limit. This limits us to small trace packet sizes though, if we ever have lots of metadata. E.g. on a 5KB/s connection, metadata buffers configured as 2x64KB, with metadata size of e.g. 512KB, would trigger the 10s delay error. So we should be good for now, but removing this arbitrary 10s delay is something to keep in mind as future improvement. > > Signed-off-by: David Goulet > --- > src/bin/lttng-consumerd/lttng-consumerd.c | 8 +- > src/common/compat/compat-epoll.c | 2 +- > src/common/consumer.c | 455 ++++++++++++++++++++++---- > src/common/consumer.h | 7 +- > src/common/kernel-consumer/kernel-consumer.c | 39 ++- > src/common/ust-consumer/ust-consumer.c | 27 +- > 6 files changed, 453 insertions(+), 85 deletions(-) > > diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c > index d49c3eb..5952334 100644 > --- a/src/bin/lttng-consumerd/lttng-consumerd.c > +++ b/src/bin/lttng-consumerd/lttng-consumerd.c > @@ -44,14 +44,15 @@ > #include > #include > #include > +#include > #include > > #include "lttng-consumerd.h" > > /* TODO : support UST (all direct kernel-ctl accesses). */ > > -/* the two threads (receive fd and poll) */ > -static pthread_t threads[2]; > +/* the two threads (receive fd, poll and metadata) */ > +static pthread_t threads[3]; > > /* to count the number of times the user pressed ctrl+c */ > static int sigintcount = 0; > @@ -283,6 +284,9 @@ int main(int argc, char **argv) > } > } > > + /* Set up max poll set size */ > + lttng_poll_set_max_size(); > + > if (strlen(command_sock_path) == 0) { > switch (opt_type) { > case LTTNG_CONSUMER_KERNEL: > diff --git a/src/common/compat/compat-epoll.c b/src/common/compat/compat-epoll.c > index e584972..939aaac 100644 > --- a/src/common/compat/compat-epoll.c > +++ b/src/common/compat/compat-epoll.c > @@ -43,7 +43,7 @@ int compat_epoll_create(struct lttng_poll_event *events, int size, int flags) > } > > /* Don't bust the limit here */ > - if (size > poll_max_size) { > + if (size > poll_max_size && poll_max_size != 0) { > size = poll_max_size; > } > > diff --git a/src/common/consumer.c b/src/common/consumer.c > index 008bf8e..2ce33a6 100644 > --- a/src/common/consumer.c > +++ b/src/common/consumer.c > @@ -30,6 +30,8 @@ > #include > > #include > +#include > +#include > #include > #include > #include > @@ -440,20 +442,6 @@ int consumer_add_stream(struct lttng_consumer_stream *stream) > consumer_data.stream_count++; > consumer_data.need_update = 1; > > - switch (consumer_data.type) { > - case LTTNG_CONSUMER_KERNEL: > - break; > - case LTTNG_CONSUMER32_UST: > - case LTTNG_CONSUMER64_UST: > - /* Streams are in CPU number order (we rely on this) */ > - stream->cpu = stream->chan->nr_streams++; > - break; > - default: > - ERR("Unknown consumer_data type"); > - assert(0); > - goto end; > - } > - > end: > pthread_mutex_unlock(&consumer_data.lock); > > @@ -698,7 +686,6 @@ struct lttng_consumer_channel *consumer_allocate_channel( > channel->mmap_len = mmap_len; > channel->max_sb_size = max_sb_size; > channel->refcount = 0; > - channel->nr_streams = 0; > lttng_ht_node_init_ulong(&channel->node, channel->key); > > switch (consumer_data.type) { > @@ -766,8 +753,7 @@ end: > */ > int consumer_update_poll_array( > struct lttng_consumer_local_data *ctx, struct pollfd **pollfd, > - struct lttng_consumer_stream **local_stream, > - struct lttng_ht *metadata_ht) > + struct lttng_consumer_stream **local_stream) > { > int i = 0; > struct lttng_ht_iter iter; > @@ -783,10 +769,6 @@ int consumer_update_poll_array( > DBG("Active FD %d", stream->wait_fd); > (*pollfd)[i].fd = stream->wait_fd; > (*pollfd)[i].events = POLLIN | POLLPRI; > - if (stream->metadata_flag && metadata_ht) { > - lttng_ht_add_unique_ulong(metadata_ht, &stream->waitfd_node); > - DBG("Active FD added to metadata hash table"); > - } > local_stream[i] = stream; > i++; > } > @@ -1025,9 +1007,22 @@ struct lttng_consumer_local_data *lttng_consumer_create( > goto error_thread_pipe; > } > > - return ctx; > + ret = utils_create_pipe(ctx->consumer_metadata_pipe); > + if (ret < 0) { > + goto error_metadata_pipe; > + } > > + ret = utils_create_pipe(ctx->consumer_splice_metadata_pipe); > + if (ret < 0) { > + goto error_splice_pipe; > + } > + > + return ctx; > > +error_splice_pipe: > + utils_close_pipe(ctx->consumer_metadata_pipe); > +error_metadata_pipe: > + utils_close_pipe(ctx->consumer_thread_pipe); > error_thread_pipe: > for (i = 0; i < 2; i++) { > int err; > @@ -1088,6 +1083,8 @@ void lttng_consumer_destroy(struct lttng_consumer_local_data *ctx) > if (ret) { > PERROR("close"); > } > + utils_close_pipe(ctx->consumer_splice_metadata_pipe); hrm, utils_close_pipe(ctx->consumer_thread_pipe); too ? > + > unlink(ctx->consumer_command_sock_path); > free(ctx); > } > @@ -1258,6 +1255,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( > /* Default is on the disk */ > int outfd = stream->out_fd; > struct consumer_relayd_sock_pair *relayd = NULL; > + int *splice_pipe; > > switch (consumer_data.type) { > case LTTNG_CONSUMER_KERNEL: > @@ -1282,6 +1280,17 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( > } > } > > + /* > + * Choose right pipe for splice. Metadata and trace data are handled by > + * different threads hence the use of two pipes in order not to race or > + * corrupt the written data. > + */ > + if (stream->metadata_flag) { > + splice_pipe = ctx->consumer_splice_metadata_pipe; > + } else { > + splice_pipe = ctx->consumer_thread_pipe; > + } > + > /* Write metadata stream id before payload */ > if (stream->metadata_flag && relayd) { > /* > @@ -1290,8 +1299,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( > */ > pthread_mutex_lock(&relayd->ctrl_sock_mutex); > > - ret = write_relayd_metadata_id(ctx->consumer_thread_pipe[1], > - stream, relayd); > + ret = write_relayd_metadata_id(splice_pipe[1], stream, relayd); > if (ret < 0) { > written = ret; > goto end; > @@ -1301,7 +1309,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( > while (len > 0) { > DBG("splice chan to pipe offset %lu of len %lu (fd : %d)", > (unsigned long)offset, len, fd); > - ret_splice = splice(fd, &offset, ctx->consumer_thread_pipe[1], NULL, len, > + ret_splice = splice(fd, &offset, splice_pipe[1], NULL, len, > SPLICE_F_MOVE | SPLICE_F_MORE); > DBG("splice chan to pipe, ret %zd", ret_splice); > if (ret_splice < 0) { > @@ -1337,7 +1345,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( > } > > /* Splice data out */ > - ret_splice = splice(ctx->consumer_thread_pipe[0], NULL, outfd, NULL, > + ret_splice = splice(splice_pipe[0], NULL, outfd, NULL, > ret_splice, SPLICE_F_MOVE | SPLICE_F_MORE); > DBG("Kernel consumer splice pipe to file, ret %zd", ret_splice); > if (ret_splice < 0) { > @@ -1460,6 +1468,331 @@ int lttng_consumer_recv_cmd(struct lttng_consumer_local_data *ctx, > } > > /* > + * Iterate over all stream element of the hashtable and free them. This is race > + * free since the hashtable pass MUST be in a race free synchronization state. pass -> received > + * It's the caller responsability to make sure of that. > + */ static > +void destroy_stream_ht(struct lttng_ht *ht) > +{ > + int ret; > + struct lttng_ht_iter iter; > + struct lttng_consumer_stream *stream; > + > + if (ht == NULL) { > + return; > + } > + > + cds_lfht_for_each_entry(ht->ht, &iter.iter, stream, node.node) { > + ret = lttng_ht_del(ht, &iter); > + assert(ret); hrm, weird ? shouldn't it be assert(!ret); ? Why doesn't it fail then ? > + > + free(stream); > + } > + > + lttng_ht_destroy(ht); > +} > + > +/* > + * Clean up a metadata stream and free it's memory. it's -> its > + */ static > +void consumer_del_metadata_stream(struct lttng_consumer_stream *stream) > +{ > + int ret; > + struct lttng_consumer_channel *free_chan = NULL; > + struct consumer_relayd_sock_pair *relayd; > + > + assert(stream); > + /* > + * This call should NEVER receive regular stream. It must always be > + * metadata stream and this is crucial for data structure synchronization. > + */ > + assert(stream->metadata_flag); > + > + pthread_mutex_lock(&consumer_data.lock); > + switch (consumer_data.type) { > + case LTTNG_CONSUMER_KERNEL: > + if (stream->mmap_base != NULL) { > + ret = munmap(stream->mmap_base, stream->mmap_len); > + if (ret != 0) { > + PERROR("munmap metadata stream"); > + } > + } > + break; > + case LTTNG_CONSUMER32_UST: > + case LTTNG_CONSUMER64_UST: > + lttng_ustconsumer_del_stream(stream); > + break; > + default: > + ERR("Unknown consumer_data type"); > + assert(0); > + } > + pthread_mutex_unlock(&consumer_data.lock); > + > + if (stream->out_fd >= 0) { > + ret = close(stream->out_fd); > + if (ret) { > + PERROR("close"); > + } > + } > + > + if (stream->wait_fd >= 0 && !stream->wait_fd_is_copy) { > + ret = close(stream->wait_fd); > + if (ret) { > + PERROR("close"); > + } > + } > + > + if (stream->shm_fd >= 0 && stream->wait_fd != stream->shm_fd) { > + ret = close(stream->shm_fd); > + if (ret) { > + PERROR("close"); > + } > + } > + > + /* Check and cleanup relayd */ > + rcu_read_lock(); > + relayd = consumer_find_relayd(stream->net_seq_idx); > + if (relayd != NULL) { > + uatomic_dec(&relayd->refcount); > + assert(uatomic_read(&relayd->refcount) >= 0); > + > + /* Closing streams requires to lock the control socket. */ > + pthread_mutex_lock(&relayd->ctrl_sock_mutex); > + ret = relayd_send_close_stream(&relayd->control_sock, > + stream->relayd_stream_id, stream->next_net_seq_num - 1); > + pthread_mutex_unlock(&relayd->ctrl_sock_mutex); > + if (ret < 0) { > + DBG("Unable to close stream on the relayd. Continuing"); > + /* > + * Continue here. There is nothing we can do for the relayd. > + * Chances are that the relayd has closed the socket so we just > + * continue cleaning up. > + */ > + } > + > + /* Both conditions are met, we destroy the relayd. */ > + if (uatomic_read(&relayd->refcount) == 0 && > + uatomic_read(&relayd->destroy_flag)) { > + consumer_destroy_relayd(relayd); > + } > + } > + rcu_read_unlock(); > + > + /* Atomically decrement channel refcount since other threads can use it. */ > + uatomic_dec(&stream->chan->refcount); > + if (!uatomic_read(&stream->chan->refcount)) { > + free_chan = stream->chan; > + } > + > + if (free_chan) { > + consumer_del_channel(free_chan); > + } > + > + free(stream); > +} > + > +/* > + * Action done with the metadata stream when adding it to the consumer internal > + * data structures to handle it. > + */ static > +void consumer_add_metadata_stream(struct lttng_consumer_stream *stream) > +{ > + struct consumer_relayd_sock_pair *relayd; > + > + /* Find relayd and, if one, increment refcount. */ if one -> if one is found > + rcu_read_lock(); > + relayd = consumer_find_relayd(stream->net_seq_idx); > + if (relayd != NULL) { > + uatomic_inc(&relayd->refcount); > + } > + rcu_read_unlock(); > +} > + > +/* > + * Thread polls on metadata file descriptor and write them on disk or on the > + * network. > + */ > +void *lttng_consumer_thread_poll_metadata(void *data) > +{ > + int ret, i, pollfd; > + uint32_t revents, nb_fd; > + struct lttng_consumer_stream *stream; > + struct lttng_ht_iter iter; > + struct lttng_ht_node_ulong *node; > + struct lttng_ht *metadata_ht = NULL; > + struct lttng_poll_event events; > + struct lttng_consumer_local_data *ctx = data; > + ssize_t len; > + > + rcu_register_thread(); > + > + DBG("Thread metadata poll started"); > + > + metadata_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); > + if (metadata_ht == NULL) { > + goto end; > + } > + > + /* Size is set to 1 for the consumer_metadata pipe */ > + ret = lttng_poll_create(&events, 2, LTTNG_CLOEXEC); > + if (ret < 0) { > + ERR("Poll set creation failed"); > + goto end; > + } > + > + ret = lttng_poll_add(&events, ctx->consumer_metadata_pipe[0], LPOLLIN); > + if (ret < 0) { > + goto end; > + } > + > + /* Main loop */ > + DBG("Metadata main loop started"); > + > + while (1) { > + lttng_poll_reset(&events); > + > + nb_fd = LTTNG_POLL_GETNB(&events); > + > + /* Only the metadata pipe is set */ > + if (nb_fd == 0 && consumer_quit == 1) { > + goto end; > + } > + > +restart: > + DBG("Metadata poll wait with %d fd(s)", nb_fd); > + ret = lttng_poll_wait(&events, -1); > + DBG("Metadata event catched in thread"); > + if (ret < 0) { > + if (errno == EINTR) { > + goto restart; > + } > + goto error; > + } > + > + for (i = 0; i < nb_fd; i++) { > + revents = LTTNG_POLL_GETEV(&events, i); > + pollfd = LTTNG_POLL_GETFD(&events, i); > + > + /* Check the metadata pipe for incoming metadata. */ > + if (pollfd == ctx->consumer_metadata_pipe[0]) { > + if (revents & (LPOLLERR | LPOLLHUP | LPOLLNVAL)) { > + DBG("Metadata thread pipe hung up"); > + /* > + * Remove the pipe from the poll set and continue the loop > + * since their might be data to consume. > + */ > + lttng_poll_del(&events, ctx->consumer_metadata_pipe[0]); > + close(ctx->consumer_metadata_pipe[0]); > + continue; > + } else if (revents & LPOLLIN) { > + stream = zmalloc(sizeof(struct lttng_consumer_stream)); > + if (stream == NULL) { > + PERROR("zmalloc metadata consumer stream"); > + goto error; > + } > + > + do { > + /* Get the stream and add it to the local hash table */ > + ret = read(pollfd, stream, > + sizeof(struct lttng_consumer_stream)); > + } while (ret < 0 && errno == EINTR); > + if (ret < 0 || ret < sizeof(struct lttng_consumer_stream)) { > + PERROR("read metadata stream"); > + free(stream); > + /* > + * Let's continue here and hope we can still work > + * without stopping the consumer. XXX: Should we? > + */ > + continue; > + } > + > + DBG("Adding metadata stream %d to poll set", > + stream->wait_fd); > + > + /* The node should be init at this point */ > + lttng_ht_add_unique_ulong(metadata_ht, > + &stream->waitfd_node); > + > + /* Add metadata stream to the global poll events list */ > + lttng_poll_add(&events, stream->wait_fd, > + LPOLLIN | LPOLLPRI); > + > + consumer_add_metadata_stream(stream); > + } > + > + /* Metadata pipe handled. Continue handling the others */ > + continue; > + } > + > + /* From here, the event is a metadata wait fd */ > + > + lttng_ht_lookup(metadata_ht, (void *)((unsigned long) pollfd), > + &iter); > + node = lttng_ht_iter_get_node_ulong(&iter); > + if (node == NULL) { > + /* FD not found, continue loop */ > + continue; > + } > + > + stream = caa_container_of(node, struct lttng_consumer_stream, > + waitfd_node); > + > + /* Get the data out of the metadata file descriptor */ > + if (revents & (LPOLLIN | LPOLLPRI)) { > + DBG("Metadata available on fd %d", pollfd); > + assert(stream->wait_fd == pollfd); > + > + len = ctx->on_buffer_ready(stream, ctx); > + /* It's ok to have an unavailable sub-buffer */ > + if (len < 0 && len != -EAGAIN) { > + goto end; > + } else if (len > 0) { > + stream->data_read = 1; > + } > + } > + > + /* > + * Remove the stream from the hash table since there is no data > + * left on the fd because we previously did a read on the buffer. > + */ > + if (revents & (LPOLLERR | LPOLLHUP | LPOLLNVAL)) { > + DBG("Metadata fd %d is hup|err|nval.", pollfd); > + if (!stream->hangup_flush_done > + && (consumer_data.type == LTTNG_CONSUMER32_UST > + || consumer_data.type == LTTNG_CONSUMER64_UST)) { > + DBG("Attempting to flush and consume the UST buffers"); > + lttng_ustconsumer_on_stream_hangup(stream); > + > + /* We just flushed the stream now read it. */ > + len = ctx->on_buffer_ready(stream, ctx); > + /* It's ok to have an unavailable sub-buffer */ > + if (len < 0 && len != -EAGAIN) { > + goto end; > + } > + } > + > + /* Removing it from hash table, poll set and free memory */ > + lttng_ht_del(metadata_ht, &iter); > + lttng_poll_del(&events, stream->wait_fd); > + consumer_del_metadata_stream(stream); > + } > + } > + } > + > +error: > +end: > + DBG("Metadata poll thread exiting"); > + lttng_poll_clean(&events); > + > + if (metadata_ht) { > + destroy_stream_ht(metadata_ht); > + } > + > + rcu_unregister_thread(); > + return NULL; > +} > + > +/* > * This thread polls the fds in the set to consume the data and write > * it to tracefile if necessary. > */ > @@ -1472,16 +1805,20 @@ void *lttng_consumer_thread_poll_fds(void *data) > /* local view of consumer_data.fds_count */ > int nb_fd = 0; > struct lttng_consumer_local_data *ctx = data; > - struct lttng_ht *metadata_ht; > - struct lttng_ht_iter iter; > - struct lttng_ht_node_ulong *node; > - struct lttng_consumer_stream *metadata_stream; > ssize_t len; > - > - metadata_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); > + pthread_t metadata_thread; > + void *status; > > rcu_register_thread(); > > + /* Start metadata polling thread */ > + ret = pthread_create(&metadata_thread, NULL, > + lttng_consumer_thread_poll_metadata, (void *) ctx); > + if (ret < 0) { > + PERROR("pthread_create metadata thread"); > + goto end; > + } > + > local_stream = zmalloc(sizeof(struct lttng_consumer_stream)); > > while (1) { > @@ -1519,8 +1856,7 @@ void *lttng_consumer_thread_poll_fds(void *data) > pthread_mutex_unlock(&consumer_data.lock); > goto end; > } > - ret = consumer_update_poll_array(ctx, &pollfd, local_stream, > - metadata_ht); > + ret = consumer_update_poll_array(ctx, &pollfd, local_stream); > if (ret < 0) { > ERR("Error in allocating pollfd or local_outfds"); > lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_POLL_ERROR); > @@ -1575,24 +1911,7 @@ void *lttng_consumer_thread_poll_fds(void *data) > > /* Take care of high priority channels first. */ > for (i = 0; i < nb_fd; i++) { > - /* Lookup for metadata which is the highest priority */ > - lttng_ht_lookup(metadata_ht, > - (void *)((unsigned long) pollfd[i].fd), &iter); > - node = lttng_ht_iter_get_node_ulong(&iter); > - if (node != NULL && > - (pollfd[i].revents & (POLLIN | POLLPRI))) { > - DBG("Urgent metadata read on fd %d", pollfd[i].fd); > - metadata_stream = caa_container_of(node, > - struct lttng_consumer_stream, waitfd_node); > - high_prio = 1; > - len = ctx->on_buffer_ready(metadata_stream, ctx); > - /* it's ok to have an unavailable sub-buffer */ > - if (len < 0 && len != -EAGAIN) { > - goto end; > - } else if (len > 0) { > - metadata_stream->data_read = 1; > - } > - } else if (pollfd[i].revents & POLLPRI) { > + if (pollfd[i].revents & POLLPRI) { > DBG("Urgent read on fd %d", pollfd[i].fd); > high_prio = 1; > len = ctx->on_buffer_ready(local_stream[i], ctx); > @@ -1648,33 +1967,18 @@ void *lttng_consumer_thread_poll_fds(void *data) > if ((pollfd[i].revents & POLLHUP)) { > DBG("Polling fd %d tells it has hung up.", pollfd[i].fd); > if (!local_stream[i]->data_read) { > - if (local_stream[i]->metadata_flag) { > - iter.iter.node = &local_stream[i]->waitfd_node.node; > - ret = lttng_ht_del(metadata_ht, &iter); > - assert(!ret); > - } > consumer_del_stream(local_stream[i]); > num_hup++; > } > } else if (pollfd[i].revents & POLLERR) { > ERR("Error returned in polling fd %d.", pollfd[i].fd); > if (!local_stream[i]->data_read) { > - if (local_stream[i]->metadata_flag) { > - iter.iter.node = &local_stream[i]->waitfd_node.node; > - ret = lttng_ht_del(metadata_ht, &iter); > - assert(!ret); > - } > consumer_del_stream(local_stream[i]); > num_hup++; > } > } else if (pollfd[i].revents & POLLNVAL) { > ERR("Polling fd %d tells fd is not open.", pollfd[i].fd); > if (!local_stream[i]->data_read) { > - if (local_stream[i]->metadata_flag) { > - iter.iter.node = &local_stream[i]->waitfd_node.node; > - ret = lttng_ht_del(metadata_ht, &iter); > - assert(!ret); > - } > consumer_del_stream(local_stream[i]); > num_hup++; > } > @@ -1692,6 +1996,23 @@ end: > free(local_stream); > local_stream = NULL; > } > + > + /* > + * Close the write side of the pipe so epoll_wait() in > + * lttng_consumer_thread_poll_metadata can catch it. The thread is > + * monitoring the read side of the pipe. If we close them both, epoll_wait > + * strangely does not return and could create a endless wait period if the > + * pipe is the only tracked fd in the poll set. The thread will take care > + * of closing the read side. > + */ > + close(ctx->consumer_metadata_pipe[1]); > + if (ret) { > + ret = pthread_join(metadata_thread, &status); > + if (ret < 0) { > + PERROR("pthread_join metadata thread"); > + } > + } > + > rcu_unregister_thread(); > return NULL; > } > diff --git a/src/common/consumer.h b/src/common/consumer.h > index fc5d5ef..e307b18 100644 > --- a/src/common/consumer.h > +++ b/src/common/consumer.h > @@ -83,7 +83,6 @@ struct lttng_consumer_channel { > void *mmap_base; > size_t mmap_len; > struct lttng_ust_shm_handle *handle; > - int nr_streams; > int wait_fd_is_copy; > int cpucount; > }; > @@ -224,10 +223,13 @@ struct lttng_consumer_local_data { > char *consumer_command_sock_path; > /* communication with splice */ > int consumer_thread_pipe[2]; > + int consumer_splice_metadata_pipe[2]; > /* pipe to wake the poll thread when necessary */ > int consumer_poll_pipe[2]; > /* to let the signal handler wake up the fd receiver thread */ > int consumer_should_quit[2]; > + /* Metadata poll thread pipe. Transfer metadata stream to it */ > + int consumer_metadata_pipe[2]; > }; > > /* > @@ -318,8 +320,7 @@ extern int lttng_consumer_poll_socket(struct pollfd *kconsumer_sockpoll); > > extern int consumer_update_poll_array( > struct lttng_consumer_local_data *ctx, struct pollfd **pollfd, > - struct lttng_consumer_stream **local_consumer_streams, > - struct lttng_ht *metadata_ht); > + struct lttng_consumer_stream **local_consumer_streams); > > extern struct lttng_consumer_stream *consumer_allocate_stream( > int channel_key, int stream_key, > diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c > index 86e4051..ca82f96 100644 > --- a/src/common/kernel-consumer/kernel-consumer.c > +++ b/src/common/kernel-consumer/kernel-consumer.c > @@ -171,6 +171,18 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, > goto end_nosignal; > } > > + /* > + * XXX: Kernel workaround. The buffer flush is done on the session > + * daemon side for the kernel so no need for the stream > + * "hangup_flush_done" variable to be tracked. So, we just set it to be > + * always true meaning that the flush was done on the stream at > + * anytime. > + * > + * We should think of doing the kernel flush on the consumer side in > + * order to standardize our operations on streams whatever the domain. > + */ > + new_stream->hangup_flush_done = 1; As discussed privately, this should be left to 0 for kernel. Thanks, Mathieu > + > /* The stream is not metadata. Get relayd reference if exists. */ > relayd = consumer_find_relayd(msg.u.stream.net_index); > if (relayd != NULL) { > @@ -190,14 +202,29 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, > goto end_nosignal; > } > > - if (ctx->on_recv_stream != NULL) { > - ret = ctx->on_recv_stream(new_stream); > - if (ret == 0) { > - consumer_add_stream(new_stream); > - } else if (ret < 0) { > - goto end_nosignal; > + /* Send stream to the metadata thread */ > + if (new_stream->metadata_flag) { > + if (ctx->on_recv_stream) { > + ret = ctx->on_recv_stream(new_stream); > + if (ret < 0) { > + goto end_nosignal; > + } > + } > + > + do { > + ret = write(ctx->consumer_metadata_pipe[1], new_stream, > + sizeof(struct lttng_consumer_stream)); > + } while (ret < 0 && errno == EINTR); > + if (ret < 0) { > + PERROR("write metadata pipe"); > } > } else { > + if (ctx->on_recv_stream) { > + ret = ctx->on_recv_stream(new_stream); > + if (ret < 0) { > + goto end_nosignal; > + } > + } > consumer_add_stream(new_stream); > } > > diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c > index 855d071..c984e33 100644 > --- a/src/common/ust-consumer/ust-consumer.c > +++ b/src/common/ust-consumer/ust-consumer.c > @@ -223,14 +223,29 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, > goto end_nosignal; > } > > - if (ctx->on_recv_stream != NULL) { > - ret = ctx->on_recv_stream(new_stream); > - if (ret == 0) { > - consumer_add_stream(new_stream); > - } else if (ret < 0) { > - goto end_nosignal; > + /* Send stream to the metadata thread */ > + if (new_stream->metadata_flag) { > + if (ctx->on_recv_stream) { > + ret = ctx->on_recv_stream(new_stream); > + if (ret < 0) { > + goto end_nosignal; > + } > + } > + > + do { > + ret = write(ctx->consumer_metadata_pipe[1], new_stream, > + sizeof(struct lttng_consumer_stream)); > + } while (ret < 0 && errno == EINTR); > + if (ret < 0) { > + PERROR("write metadata pipe"); > } > } else { > + if (ctx->on_recv_stream) { > + ret = ctx->on_recv_stream(new_stream); > + if (ret < 0) { > + goto end_nosignal; > + } > + } > consumer_add_stream(new_stream); > } > > -- > 1.7.10.4 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Tue Sep 11 16:01:54 2012 From: dgoulet at efficios.com (David Goulet) Date: Tue, 11 Sep 2012 16:01:54 -0400 Subject: [lttng-dev] [lttng-tools PATCH] Add new thread in consumer for metadata handling In-Reply-To: <20120911195235.GA11196@Krystal> References: <1347389351-19792-1-git-send-email-dgoulet@efficios.com> <20120911195235.GA11196@Krystal> Message-ID: <504F98B2.2020606@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 All fixed! One comment: Mathieu Desnoyers: > * David Goulet (dgoulet at efficios.com) wrote: >> @@ -1025,9 +1007,22 @@ struct lttng_consumer_local_data >> *lttng_consumer_create( goto error_thread_pipe; } >> >> - return ctx; + ret = >> utils_create_pipe(ctx->consumer_metadata_pipe); + if (ret < 0) { >> + goto error_metadata_pipe; + } >> >> + ret = utils_create_pipe(ctx->consumer_splice_metadata_pipe); + >> if (ret < 0) { + goto error_splice_pipe; + } + + return ctx; >> >> +error_splice_pipe: + >> utils_close_pipe(ctx->consumer_metadata_pipe); >> +error_metadata_pipe: + >> utils_close_pipe(ctx->consumer_thread_pipe); error_thread_pipe: >> for (i = 0; i < 2; i++) { int err; @@ -1088,6 +1083,8 @@ void >> lttng_consumer_destroy(struct lttng_consumer_local_data *ctx) if >> (ret) { PERROR("close"); } + >> utils_close_pipe(ctx->consumer_splice_metadata_pipe); > > hrm, utils_close_pipe(ctx->consumer_thread_pipe); too ? It's already closed just before :) Thanks David -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQT5ivAAoJEELoaioR9I02baEIAMW35FGQeW15nOvQ9+uzBDIH 80Ug2rEQ6MyESzHdj8I9vyvuFD2LNGcY3Ltjz07LRc3pJp7mYU4JrWBDkamKcN7g jMkSmEUQuOY6oWv1VH0YQ9qnNGQrd1shrjh/oHtAZGq1nY+RMIoYPfClX0CbliRY vd3nsXcMJODlT4EStNqnevIDf03RXAEAPEwJT2tk1yByBpFvjbCG2oFym+064KAE b8oqbwVuN3Ffo0szY/1HoChQPkj5SWBuZolxhSNj438BBIF1tzo7iz9cFrdkUvW0 8oeJ5xVAlSy3wuoW1VucYItSsluASGvutbwx/V0jgykxi0BZnKgxZ8lBtbe6mqQ= =iANq -----END PGP SIGNATURE----- From christian.babeux at efficios.com Tue Sep 11 16:56:17 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Tue, 11 Sep 2012 16:56:17 -0400 Subject: [lttng-dev] [PATCH RFC lttng-tools] Testpoint mechanism Message-ID: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> Hi, This is a RFC for a testpoint mechanism to ease and improve testing efforts of the LTTng codebase. Motivation ---------- The main goal behind the testpoint mechanism is to be able to test and validate failure cases in different portion of the LTTng codebase. It could also be used by developers as a debugging aid. By injecting code at runtime in the lttng daemons/processes/executables, we can painlessly trigger faulty behavior, test errors paths or even reproduce race conditions by introducing or exacerbating delays between threads. Requirements ------------ The testpoint mechanism should be able to be triggered via scripts to automate testing efforts. Ideally, the testpoint mechanism should *NOT* incur a significant performance hit if we want to leave it always on, in a similar fashion to the assert() macros. By leaving it always on, any user is able to use our tests and validate the behavior of his installation via a simple 'make check' execution. Proposed solution ----------------- This patch introduce two new macros: TESTPOINT_DECL(name) and testpoint(name). Here a quick example that shows how to use the testpoint mechanism: file: main.c #include #include /* Testpoint declaration */ TESTPOINT_DECL(interesting_function) void interesting_function(void) { testpoint(interesting_function); /* Some processing that can fail */ ... } int main(int argc, char *argv[]) { interesting_function(); ... printf("End"); } file: testpoint.c #include void __testpoint_interesting_function(void) { printf("In testpoint of interesting function!"); } Compile: gcc -o test main.c gcc -fPIC -shared -o testpoint.so testpoint.c Run: > ./test End > export LTTNG_TESTPOINT_ENABLE=1 > LD_PRELOAD=testpoint.so ./test In testpoint of interesting function! End > export LTTNG_TESTPOINT_ENABLE=0 > LD_PRELOAD=testpoint.so ./test End The testpoint mechanism is triggered via the preloading of a shared object containing the appropriate testpoint symbols and by setting the LTTNG_TESTPOINT_ENABLE environment variable. The check on this environment variable is done on the application startup with the help of a constructor (lttng_testpoint_check) which toggle a global state variable indicating whether or not the testpoints should be activated. When enabled, the testpoint() macro calls an underlying wrapper specific to the testpoint and simply try to lookup the testpoint symbol via a dlsym() call. When disabled, the testpoint() call will only incur an additionnal test per testpoint on a global variable. This performance 'hit' should be acceptable for production use. As stated previously, the testpoint mechanism should be *always on*. It can be explicitly disabled via CFLAGS="-DNTESTPOINT" in a way similar to NDEBUG and assert(). Comments, thoughts? Thanks, Christian Babeux (1): New testpoint mechanism to instrument LTTng binaries for testing purpose configure.ac | 1 + src/common/Makefile.am | 2 +- src/common/testpoint/Makefile.am | 6 +++ src/common/testpoint/testpoint.c | 43 +++++++++++++++++++++ src/common/testpoint/testpoint.h | 81 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 src/common/testpoint/Makefile.am create mode 100644 src/common/testpoint/testpoint.c create mode 100644 src/common/testpoint/testpoint.h -- 1.7.11.4 From christian.babeux at efficios.com Tue Sep 11 16:56:18 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Tue, 11 Sep 2012 16:56:18 -0400 Subject: [lttng-dev] [PATCH RFC lttng-tools] New testpoint mechanism to instrument LTTng binaries for testing purpose In-Reply-To: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1347396978-4661-2-git-send-email-christian.babeux@efficios.com> This commit introduce two new macros: TESTPOINT_DECL(name) and testpoint(name). Here a quick example that show how to use the testpoint mechanism: file: main.c /* Testpoint declaration */ TESTPOINT_DECL(interesting_function) void interesting_function(void) { testpoint(interesting_function); /* Some processing that can fail */ ... } int main(int argc, char *argv[]) { interesting_function(); ... printf("End"); } file: testpoint.c void __testpoint_interesting_function(void) { printf("In testpoint of interesting function!"); } Compile: gcc -o test main.c gcc -fPIC -shared -o testpoint.so testpoint.c Run: > ./test End > export LTTNG_TESTPOINT_ENABLE=1 > LD_PRELOAD=testpoint.so ./test In testpoint of interesting function! End > export LTTNG_TESTPOINT_ENABLE=0 > LD_PRELOAD=testpoint.so ./test End The testpoint mechanism is triggered via the preloading of a shared object containing the appropriate testpoint symbols and by setting the LTTNG_TESTPOINT_ENABLE environment variable. The check on this environment variable is done on the application startup with the help of a constructor (lttng_testpoint_check) which toggle a global state variable indicating whether or not the testpoints should be activated. When enabled, the testpoint() macro calls an underlying wrapper specific to the testpoint and simply try to lookup the testpoint symbol via a dlsym() call. When disabled, the testpoint() call will only incur an additionnal test per testpoint on a global variable. This performance 'hit' should be acceptable for production use. The testpoint mechanism should be *always on*. It can be explicitly disabled via CFLAGS="-DNTESTPOINT" in a way similar to NDEBUG and assert(). Signed-off-by: Christian Babeux --- configure.ac | 1 + src/common/Makefile.am | 2 +- src/common/testpoint/Makefile.am | 6 +++ src/common/testpoint/testpoint.c | 43 +++++++++++++++++++++ src/common/testpoint/testpoint.h | 81 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 src/common/testpoint/Makefile.am create mode 100644 src/common/testpoint/testpoint.c create mode 100644 src/common/testpoint/testpoint.h diff --git a/configure.ac b/configure.ac index 7687280..8e61115 100644 --- a/configure.ac +++ b/configure.ac @@ -275,6 +275,7 @@ AC_CONFIG_FILES([ src/common/sessiond-comm/Makefile src/common/compat/Makefile src/common/relayd/Makefile + src/common/testpoint/Makefile src/lib/Makefile src/lib/lttng-ctl/Makefile src/lib/lttng-ctl/filter/Makefile diff --git a/src/common/Makefile.am b/src/common/Makefile.am index ca48153..889b04e 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer +SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer testpoint AM_CFLAGS = -fno-strict-aliasing diff --git a/src/common/testpoint/Makefile.am b/src/common/testpoint/Makefile.am new file mode 100644 index 0000000..7d3df16 --- /dev/null +++ b/src/common/testpoint/Makefile.am @@ -0,0 +1,6 @@ +AM_CPPFLAGS = + +noinst_LTLIBRARIES = libtestpoint.la + +libtestpoint_la_SOURCES = testpoint.h testpoint.c +libtestpoint_la_LIBADD = -ldl diff --git a/src/common/testpoint/testpoint.c b/src/common/testpoint/testpoint.c new file mode 100644 index 0000000..2f6b108 --- /dev/null +++ b/src/common/testpoint/testpoint.c @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2012 - Christian Babeux + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef NTESTPOINT + +#include /* for getenv */ +#include /* for strncmp */ + +#include "testpoint.h" + +const char *LTTNG_TESTPOINT_ENV_VAR = "LTTNG_TESTPOINT_ENABLE"; + +int LTTNG_TESTPOINT_ACTIVATED; + +void lttng_testpoint_check(void) +{ + char *testpoint_env_val = NULL; + + testpoint_env_val = getenv(LTTNG_TESTPOINT_ENV_VAR); + if (testpoint_env_val != NULL + && (strncmp(testpoint_env_val, "1", 1) == 0)) { + LTTNG_TESTPOINT_ACTIVATED = 1; + } else { + LTTNG_TESTPOINT_ACTIVATED = 0; + } +} + +#endif /* NTESTPOINT */ + diff --git a/src/common/testpoint/testpoint.h b/src/common/testpoint/testpoint.h new file mode 100644 index 0000000..a1ac920 --- /dev/null +++ b/src/common/testpoint/testpoint.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2012 - Christian Babeux + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef NTESTPOINT + +#define testpoint(name) +#define TESTPOINT_DECL(name) + +#else /* NTESTPOINT */ + +#ifndef __USE_GNU +#define __USE_GNU /* for RTLD_DEFAULT */ +#endif + +#include /* for dlsym */ + +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) + +/* Environment variable used to enable the testpoints facilities. */ +extern const char *LTTNG_TESTPOINT_ENV_VAR; + +/* Toggled via the lttng_testpoint_check constructor. */ +extern int LTTNG_TESTPOINT_ACTIVATED; + +void __attribute__((constructor)) lttng_testpoint_check(void); + +#define testpoint(name) \ + do { \ + if (unlikely(LTTNG_TESTPOINT_ACTIVATED)) { \ + __testpoint_##name##_wrapper(); \ + } \ + } while (0) + +/* + * One wrapper per testpoint is generated. This is to keep track + * of the symbol lookup status and the corresponding function + * pointer, if any. + */ +#define _TESTPOINT_DECL(_name) \ + static inline void __testpoint_##_name##_wrapper(void) \ + { \ + static void (*tp)(void); \ + static int found; \ + \ + if (tp) { \ + tp(); \ + return; \ + } \ + \ + if (!found) { \ + tp = dlsym(RTLD_DEFAULT, \ + "__testpoint_" #_name); \ + if (tp) { \ + found = 1; \ + tp(); \ + } else { \ + found = -1; \ + } \ + } \ + } + +#define TESTPOINT_DECL(name) \ + _TESTPOINT_DECL(name) + +#endif /* NTESTPOINT */ + -- 1.7.11.4 From jbernard at debian.org Tue Sep 11 17:24:50 2012 From: jbernard at debian.org (Jon Bernard) Date: Tue, 11 Sep 2012 17:24:50 -0400 Subject: [lttng-dev] Query about LTTng 2.0 Debian packages In-Reply-To: <20120911180021.GA9698@Krystal> References: <20120621012622.GA1387@Krystal> <20120621191452.GA18195@quintessa> <20120717002030.GA19871@quintessa> <504F769B.5060807@gmail.com> <20120911180021.GA9698@Krystal> Message-ID: <20120911212450.GA7165@quintessa> * Mathieu Desnoyers wrote: > * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > > Le 2012-07-16 20:20, Jon Bernard a ?crit : > > > * Jon Bernard wrote: > > >> * Mathieu Desnoyers wrote: > > >>> Hi Jon, > > >>> > > >>> I wanted to get in touch with you regarding LTTng 2.0 Debian packages. > > >>> Is there anything we can do to help you getting those packages into > > >>> Debian ? They have been out for a while now, and even Ubuntu picked them > > >>> up. I understand that you are probably busy, hence my offer for help. > > >> > > >> I've just uploaded another package I've been working on and LTTng 2.0 packages > > >> are next on my list. Give me a few days to get things sorted, I'll post an > > >> update next week with my status. > > > > > > I am just now waiting on lttng-modules and babeltrace to be accepted into the > > > archive. Once this happens, lttng-utils can be uploaded and the 2.0 packages > > > should be complete. > > > > I just checked the status of packages in testing, experimental and the > > new queue, and it seems that it's not there yet. Is there any show-stopper? > > Hi Francis, Hi Jon, > > My guess is that Jon Bernard does not have enough cycles to work on the > lttng packages. Jon, is there anything we can do to help ? What is the > status of LTTng 2.0 packages inclusion in Debian ? Everything is now current (2.1.0-rc) although it may take some time for the pulse and for the buildd's to catch up. I've been remarkably terrible at time management lately. I apologize. Cheers -- Jon From mathieu.desnoyers at efficios.com Tue Sep 11 17:58:23 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 11 Sep 2012 17:58:23 -0400 Subject: [lttng-dev] Query about LTTng 2.0 Debian packages In-Reply-To: <20120911212450.GA7165@quintessa> References: <20120621012622.GA1387@Krystal> <20120621191452.GA18195@quintessa> <20120717002030.GA19871@quintessa> <504F769B.5060807@gmail.com> <20120911180021.GA9698@Krystal> <20120911212450.GA7165@quintessa> Message-ID: <20120911215823.GA11922@Krystal> * Jon Bernard (jbernard at debian.org) wrote: > * Mathieu Desnoyers wrote: > > * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > > > Le 2012-07-16 20:20, Jon Bernard a ?crit : > > > > * Jon Bernard wrote: > > > >> * Mathieu Desnoyers wrote: > > > >>> Hi Jon, > > > >>> > > > >>> I wanted to get in touch with you regarding LTTng 2.0 Debian packages. > > > >>> Is there anything we can do to help you getting those packages into > > > >>> Debian ? They have been out for a while now, and even Ubuntu picked them > > > >>> up. I understand that you are probably busy, hence my offer for help. > > > >> > > > >> I've just uploaded another package I've been working on and LTTng 2.0 packages > > > >> are next on my list. Give me a few days to get things sorted, I'll post an > > > >> update next week with my status. > > > > > > > > I am just now waiting on lttng-modules and babeltrace to be accepted into the > > > > archive. Once this happens, lttng-utils can be uploaded and the 2.0 packages > > > > should be complete. > > > > > > I just checked the status of packages in testing, experimental and the > > > new queue, and it seems that it's not there yet. Is there any show-stopper? > > > > Hi Francis, Hi Jon, > > > > My guess is that Jon Bernard does not have enough cycles to work on the > > lttng packages. Jon, is there anything we can do to help ? What is the > > status of LTTng 2.0 packages inclusion in Debian ? > > Everything is now current (2.1.0-rc) although it may take some time for the > pulse and for the buildd's to catch up. Allright, thanks ! > > I've been remarkably terrible at time management lately. I apologize. No worries. Thanks for updating the packages! Mathieu > > Cheers > > -- > Jon -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Tue Sep 11 18:00:17 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 11 Sep 2012 18:00:17 -0400 Subject: [lttng-dev] [lttng-tools PATCH] Add new thread in consumer for metadata handling In-Reply-To: <504F98B2.2020606@efficios.com> References: <1347389351-19792-1-git-send-email-dgoulet@efficios.com> <20120911195235.GA11196@Krystal> <504F98B2.2020606@efficios.com> Message-ID: <20120911220016.GC11922@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > All fixed! > > One comment: > > Mathieu Desnoyers: > > * David Goulet (dgoulet at efficios.com) wrote: > >> @@ -1025,9 +1007,22 @@ struct lttng_consumer_local_data > >> *lttng_consumer_create( goto error_thread_pipe; } > >> > >> - return ctx; + ret = > >> utils_create_pipe(ctx->consumer_metadata_pipe); + if (ret < 0) { > >> + goto error_metadata_pipe; + } > >> > >> + ret = utils_create_pipe(ctx->consumer_splice_metadata_pipe); + > >> if (ret < 0) { + goto error_splice_pipe; + } + + return ctx; > >> > >> +error_splice_pipe: + > >> utils_close_pipe(ctx->consumer_metadata_pipe); > >> +error_metadata_pipe: + > >> utils_close_pipe(ctx->consumer_thread_pipe); error_thread_pipe: > >> for (i = 0; i < 2; i++) { int err; @@ -1088,6 +1083,8 @@ void > >> lttng_consumer_destroy(struct lttng_consumer_local_data *ctx) if > >> (ret) { PERROR("close"); } + > >> utils_close_pipe(ctx->consumer_splice_metadata_pipe); > > > > hrm, utils_close_pipe(ctx->consumer_thread_pipe); too ? > > It's already closed just before :) Oh, right, I got mixed up. Thanks, Mathieu > > Thanks > David > -----BEGIN PGP SIGNATURE----- > > iQEcBAEBCgAGBQJQT5ivAAoJEELoaioR9I02baEIAMW35FGQeW15nOvQ9+uzBDIH > 80Ug2rEQ6MyESzHdj8I9vyvuFD2LNGcY3Ltjz07LRc3pJp7mYU4JrWBDkamKcN7g > jMkSmEUQuOY6oWv1VH0YQ9qnNGQrd1shrjh/oHtAZGq1nY+RMIoYPfClX0CbliRY > vd3nsXcMJODlT4EStNqnevIDf03RXAEAPEwJT2tk1yByBpFvjbCG2oFym+064KAE > b8oqbwVuN3Ffo0szY/1HoChQPkj5SWBuZolxhSNj438BBIF1tzo7iz9cFrdkUvW0 > 8oeJ5xVAlSy3wuoW1VucYItSsluASGvutbwx/V0jgykxi0BZnKgxZ8lBtbe6mqQ= > =iANq > -----END PGP SIGNATURE----- -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Tue Sep 11 18:14:19 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 11 Sep 2012 18:14:19 -0400 Subject: [lttng-dev] [PATCH RFC lttng-tools] New testpoint mechanism to instrument LTTng binaries for testing purpose In-Reply-To: <1347396978-4661-2-git-send-email-christian.babeux@efficios.com> References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> <1347396978-4661-2-git-send-email-christian.babeux@efficios.com> Message-ID: <20120911221419.GD11922@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > This commit introduce two new macros: TESTPOINT_DECL(name) and > testpoint(name). > > Here a quick example that show how to use the testpoint mechanism: > > file: main.c > > /* Testpoint declaration */ > TESTPOINT_DECL(interesting_function) > > void interesting_function(void) > { > testpoint(interesting_function); > /* Some processing that can fail */ > ... > } > > int main(int argc, char *argv[]) > { > interesting_function(); > ... > printf("End"); > } > > file: testpoint.c > void __testpoint_interesting_function(void) > { > printf("In testpoint of interesting function!"); > } > > Compile: > gcc -o test main.c > gcc -fPIC -shared -o testpoint.so testpoint.c > > Run: > > ./test > End > > export LTTNG_TESTPOINT_ENABLE=1 > > LD_PRELOAD=testpoint.so ./test > In testpoint of interesting function! > End > > export LTTNG_TESTPOINT_ENABLE=0 > > LD_PRELOAD=testpoint.so ./test > End > > The testpoint mechanism is triggered via the preloading of a shared > object containing the appropriate testpoint symbols and by setting the > LTTNG_TESTPOINT_ENABLE environment variable. > > The check on this environment variable is done on the application startup > with the help of a constructor (lttng_testpoint_check) which toggle a global > state variable indicating whether or not the testpoints should be activated. > > When enabled, the testpoint() macro calls an underlying wrapper specific to > the testpoint and simply try to lookup the testpoint symbol via a dlsym() > call. > > When disabled, the testpoint() call will only incur an additionnal test > per testpoint on a global variable. This performance 'hit' should be > acceptable for production use. > > The testpoint mechanism should be *always on*. It can be explicitly > disabled via CFLAGS="-DNTESTPOINT" in a way similar to NDEBUG and assert(). > > Signed-off-by: Christian Babeux > --- > configure.ac | 1 + > src/common/Makefile.am | 2 +- > src/common/testpoint/Makefile.am | 6 +++ > src/common/testpoint/testpoint.c | 43 +++++++++++++++++++++ > src/common/testpoint/testpoint.h | 81 ++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 132 insertions(+), 1 deletion(-) > create mode 100644 src/common/testpoint/Makefile.am > create mode 100644 src/common/testpoint/testpoint.c > create mode 100644 src/common/testpoint/testpoint.h > > diff --git a/configure.ac b/configure.ac > index 7687280..8e61115 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -275,6 +275,7 @@ AC_CONFIG_FILES([ > src/common/sessiond-comm/Makefile > src/common/compat/Makefile > src/common/relayd/Makefile > + src/common/testpoint/Makefile > src/lib/Makefile > src/lib/lttng-ctl/Makefile > src/lib/lttng-ctl/filter/Makefile > diff --git a/src/common/Makefile.am b/src/common/Makefile.am > index ca48153..889b04e 100644 > --- a/src/common/Makefile.am > +++ b/src/common/Makefile.am > @@ -1,6 +1,6 @@ > AM_CPPFLAGS = > > -SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer > +SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer testpoint > > AM_CFLAGS = -fno-strict-aliasing > > diff --git a/src/common/testpoint/Makefile.am b/src/common/testpoint/Makefile.am > new file mode 100644 > index 0000000..7d3df16 > --- /dev/null > +++ b/src/common/testpoint/Makefile.am > @@ -0,0 +1,6 @@ > +AM_CPPFLAGS = > + > +noinst_LTLIBRARIES = libtestpoint.la > + > +libtestpoint_la_SOURCES = testpoint.h testpoint.c > +libtestpoint_la_LIBADD = -ldl > diff --git a/src/common/testpoint/testpoint.c b/src/common/testpoint/testpoint.c > new file mode 100644 > index 0000000..2f6b108 > --- /dev/null > +++ b/src/common/testpoint/testpoint.c > @@ -0,0 +1,43 @@ > +/* > + * Copyright (C) 2012 - Christian Babeux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License, version 2 only, > + * as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + * > + * You should have received a copy of the GNU General Public License along > + * with this program; if not, write to the Free Software Foundation, Inc., > + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + */ > + > +#ifndef NTESTPOINT > + > +#include /* for getenv */ > +#include /* for strncmp */ > + > +#include "testpoint.h" > + > +const char *LTTNG_TESTPOINT_ENV_VAR = "LTTNG_TESTPOINT_ENABLE"; please use lowercase for variable names. add static. > + > +int LTTNG_TESTPOINT_ACTIVATED; use lowercase. > + > +void lttng_testpoint_check(void) Please specify the attribute "constructor" here, and add static. > +{ > + char *testpoint_env_val = NULL; > + > + testpoint_env_val = getenv(LTTNG_TESTPOINT_ENV_VAR); > + if (testpoint_env_val != NULL > + && (strncmp(testpoint_env_val, "1", 1) == 0)) { > + LTTNG_TESTPOINT_ACTIVATED = 1; > + } else { > + LTTNG_TESTPOINT_ACTIVATED = 0; This else clause is useless. > + } > +} > + > +#endif /* NTESTPOINT */ > + > diff --git a/src/common/testpoint/testpoint.h b/src/common/testpoint/testpoint.h > new file mode 100644 > index 0000000..a1ac920 > --- /dev/null > +++ b/src/common/testpoint/testpoint.h > @@ -0,0 +1,81 @@ > +/* > + * Copyright (C) 2012 - Christian Babeux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License, version 2 only, > + * as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + * > + * You should have received a copy of the GNU General Public License along > + * with this program; if not, write to the Free Software Foundation, Inc., > + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + */ > + > +#ifdef NTESTPOINT > + > +#define testpoint(name) > +#define TESTPOINT_DECL(name) > + > +#else /* NTESTPOINT */ > + > +#ifndef __USE_GNU > +#define __USE_GNU /* for RTLD_DEFAULT */ > +#endif Adding a __USE_GNU define in a header is something to avoid. > + > +#include /* for dlsym */ We should probably put the dlsym part within testpoint.c. > + > +#define likely(x) __builtin_expect(!!(x), 1) > +#define unlikely(x) __builtin_expect(!!(x), 0) redefining this is likely to cause clashes with other parts. Please use the urcu compiler.h caa_likely/unlikely instead, as done in the rest of lttng-tools. > + > +/* Environment variable used to enable the testpoints facilities. */ > +extern const char *LTTNG_TESTPOINT_ENV_VAR; should be removed. > + > +/* Toggled via the lttng_testpoint_check constructor. */ > +extern int LTTNG_TESTPOINT_ACTIVATED; lowercase. > + > +void __attribute__((constructor)) lttng_testpoint_check(void); to remove. (moved to testpoint.c) > + > +#define testpoint(name) \ > + do { \ > + if (unlikely(LTTNG_TESTPOINT_ACTIVATED)) { \ > + __testpoint_##name##_wrapper(); \ > + } \ > + } while (0) > + > +/* > + * One wrapper per testpoint is generated. This is to keep track > + * of the symbol lookup status and the corresponding function > + * pointer, if any. > + */ > +#define _TESTPOINT_DECL(_name) \ > + static inline void __testpoint_##_name##_wrapper(void) \ > + { \ > + static void (*tp)(void); \ > + static int found; \ > + \ > + if (tp) { \ > + tp(); \ > + return; \ > + } \ > + \ I'd go for if / else here instead of if / return. > + if (!found) { \ > + tp = dlsym(RTLD_DEFAULT, \ > + "__testpoint_" #_name); \ > + if (tp) { \ > + found = 1; \ > + tp(); \ > + } else { \ > + found = -1; \ Hrm I see, so setting found to -1 allows you to not recheck for dlsym on the next call. The rest looks good! Thanks, Mathieu > + } \ > + } \ > + } > + > +#define TESTPOINT_DECL(name) \ > + _TESTPOINT_DECL(name) > + > +#endif /* NTESTPOINT */ > + > -- > 1.7.11.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From yannick.brosseau at gmail.com Tue Sep 11 19:18:16 2012 From: yannick.brosseau at gmail.com (Brosseau, Yannick) Date: Tue, 11 Sep 2012 19:18:16 -0400 Subject: [lttng-dev] [PATCH RFC lttng-tools] Testpoint mechanism In-Reply-To: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> Message-ID: I'm not sure I understand the goal of this feature. Can you explain more? On Sep 11, 2012 4:56 PM, "Christian Babeux" wrote: > Hi, > > This is a RFC for a testpoint mechanism to ease and improve testing > efforts of the LTTng codebase. > > Motivation > ---------- > > The main goal behind the testpoint mechanism is to be able to test and > validate failure cases in different portion of the LTTng codebase. It > could also be used by developers as a debugging aid. > > By injecting code at runtime in the lttng daemons/processes/executables, > we can painlessly trigger faulty behavior, test errors paths or even > reproduce race conditions by introducing or exacerbating delays between > threads. > > Requirements > ------------ > > The testpoint mechanism should be able to be triggered via scripts to > automate testing efforts. > > Ideally, the testpoint mechanism should *NOT* incur a significant > performance hit if we want to leave it always on, in a similar fashion > to the assert() macros. > > By leaving it always on, any user is able to use our tests and validate > the behavior of his installation via a simple 'make check' execution. > > Proposed solution > ----------------- > > This patch introduce two new macros: TESTPOINT_DECL(name) > and testpoint(name). > > Here a quick example that shows how to use the testpoint mechanism: > > file: main.c > #include > #include > > /* Testpoint declaration */ > TESTPOINT_DECL(interesting_function) > > void interesting_function(void) > { > testpoint(interesting_function); > /* Some processing that can fail */ > ... > } > > int main(int argc, char *argv[]) > { > interesting_function(); > ... > printf("End"); > } > > file: testpoint.c > #include > void __testpoint_interesting_function(void) > { > printf("In testpoint of interesting function!"); > } > > Compile: > gcc -o test main.c > gcc -fPIC -shared -o testpoint.so testpoint.c > > Run: > > ./test > End > > export LTTNG_TESTPOINT_ENABLE=1 > > LD_PRELOAD=testpoint.so ./test > In testpoint of interesting function! > End > > export LTTNG_TESTPOINT_ENABLE=0 > > LD_PRELOAD=testpoint.so ./test > End > > The testpoint mechanism is triggered via the preloading of a shared > object containing the appropriate testpoint symbols and by setting the > LTTNG_TESTPOINT_ENABLE environment variable. > > The check on this environment variable is done on the application startup > with the help of a constructor (lttng_testpoint_check) which toggle a > global > state variable indicating whether or not the testpoints should be > activated. > > When enabled, the testpoint() macro calls an underlying wrapper specific to > the testpoint and simply try to lookup the testpoint symbol via a dlsym() > call. > > When disabled, the testpoint() call will only incur an additionnal test > per testpoint on a global variable. This performance 'hit' should be > acceptable for production use. > > As stated previously, the testpoint mechanism should be *always on*. > It can be explicitly disabled via CFLAGS="-DNTESTPOINT" in a way similar > to NDEBUG and assert(). > > Comments, thoughts? > > Thanks, > > Christian Babeux (1): > New testpoint mechanism to instrument LTTng binaries for testing > purpose > > configure.ac | 1 + > src/common/Makefile.am | 2 +- > src/common/testpoint/Makefile.am | 6 +++ > src/common/testpoint/testpoint.c | 43 +++++++++++++++++++++ > src/common/testpoint/testpoint.h | 81 > ++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 132 insertions(+), 1 deletion(-) > create mode 100644 src/common/testpoint/Makefile.am > create mode 100644 src/common/testpoint/testpoint.c > create mode 100644 src/common/testpoint/testpoint.h > > -- > 1.7.11.4 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian.babeux at efficios.com Tue Sep 11 22:26:10 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Tue, 11 Sep 2012 22:26:10 -0400 Subject: [lttng-dev] [PATCH RFC lttng-tools] Testpoint mechanism In-Reply-To: References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> Message-ID: Hi Yannick, > > I'm not sure I understand the goal of this feature. Can you explain more? > This testpoint mechanism is not a LTTng "feature" per se. Think of it has a facility to inject code in order to test different portions of the LTTng codebase. Maybe an example will make things more clear: In the lttng-sessiond, we could add testpoints to some of the threads. The testpoints could trigger a pthread_exit(). This could be useful to verify that the new health check feature is working and properly mark the thread that exited as in "bad health". Without this mechanism, writing tests for that particular feature would be a lot harder. Another example would be to randomly add delays in different threads in order to find race conditions in the codebase. This mechanism is only triggered when the LTTNG_TESTPOINT_ENABLE env. var. is set and a proper library is preloaded with the testpoints symbols (e.g.: LD_PRELOAD=mytestlib.so lttng-sessiond &). The only way to use this facility is to link against the new libtestpoint. I hope this make more sense now :). Christian From hans.nordeback at ericsson.com Wed Sep 12 07:44:19 2012 From: hans.nordeback at ericsson.com (=?ISO-8859-1?Q?Hans_Nordeb=E4ck?=) Date: Wed, 12 Sep 2012 13:44:19 +0200 Subject: [lttng-dev] Problem to get lttng work with a daemon application Message-ID: <50507593.5030206@ericsson.com> Hi, I've just started using lttng and run it in Ubuntu 12.04 in VirtualBox. I have run the sample applications without any problem, but I have problems to get a daemon application work. I have added tracepoint support in the same way as for the sample applications and do the following: 1) The lttng-sessiond (version 2.0.1) is started (with --verbose--verbose-consumer). 2) I start the daemon application with one tracepoint implemented. 3) I can see that the lttng-sessiond gets called regarding this tracepoint: DEBUG1: App registered with pid:18421 ppid:18419 uid:0 gid:0 sock:18 name:osafamfnd (version 2.0) [in ust_app_register() at ust-app.c:1365] 4) I run, strace -f lttng -v list -u, and can see that it "hangs" in recvmsg: write(2, "DEBUG1: Getting UST tracing even"..., 81DEBUG1: Getting UST tracing events [in list_ust_events() at commands/list.c:253] ) = 81 getuid() = 0 socket(PF_FILE, SOCK_STREAM, 0) = 3 connect(3, {sa_family=AF_FILE, path="/var/run/lttng/client-lttng-sessiond"}, 110) = 0 geteuid() = 0 getegid() = 0 sendmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 8784}], msg_controllen=28, {cmsg_len=28, cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS{pid=28878, uid=0, gid=0}}, msg_flags=0}, 0) = 8784 recvmsg(3, 5) the lttng-sessiond outputs only the following and hangs as long as the daemon application is running. DEBUG1: Processing client command 14 [in process_client_msg() at main.c:3309] 6) The only difference between sample app logs and daemon app logs is that the pid and ppid seen at DEBUG1: App registered. In the daemon case in this run it is pid 18421 ppid 18419 but when I print it in the function calling tracepoint it is pid 18430. I don't know if that is related to the problem. Any help on this would be appreciated. /Thanks Hans From mathieu.desnoyers at efficios.com Wed Sep 12 08:35:55 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Wed, 12 Sep 2012 08:35:55 -0400 Subject: [lttng-dev] [RFC] Per-user event ID allocation proposal Message-ID: <20120912123555.GA26893@Krystal> Mathieu Desnoyers September 11, 2012 Per-user event ID allocation proposal The intent of this shared event ID registry is to allow sharing tracing buffers between applications belonging to the same user (UID) for UST (user-space) tracing. A.1) Overview of System-wide, per-ABI (32 and 64-bit), per-user, per-session, LTTng-UST event ID allocation: - Modify LTTng-UST and lttng-tools to keep a system-wide, per-ABI (32 and 64-bit), per-user, per-session registry of enabled events and their associated numeric IDs. - LTTng-UST will have to register its tracepoints to the session daemon, sending the field typing of these tracepoints during registration, - Dynamically check that field types match upon registration of an event in this global registry, refuse registration if the field types do not match, - The metadata will be generated by lttng-tools instead of the application. A.2 Per-user Event ID Details: The event ID registry is shared across all processes for a given session/ABI/channel/user (UID). The intent is to forbid one user to access tracing data from another user, while keeping the system-wide number of buffers small. The event ID registry is attached to a: - session, - specific ABI (32/64-bit), - channel, - user (UID). lttng-session fill this registry by pulling this information as needed from traced processes (a.k.a. applications) to populate the registry. This information is needed only when an event is active for a created session. Therefore, applications need not to notify the sessiond if no session is created. The rationale for using a "pull" scheme, where the sessiond pulls information from applications, in opposition to a "push" scheme, where application would initiate commands to push the information, is that it minimizes the amount of logic required within liblttng-ust, and it does not require liblttng-ust to wait for reply from lttng-sessiond, which minimize the impact on the application behavior, providing application resilience to lttng-sessiond crash. Updates to this registry are triggered by two distinct scenarios: either an "enable-event" command (could also be "start", depending on the sessiond design) is being executed, or, while tracing, a library is being loaded within the application. Before we start describing the algorithms that update the registry, it is _very_ important to understand that an event enabled with "enable-event" can contain a wildcard (e.g.: libc*) and loglevel, and therefore is associated to possibly _many_ events in the application. Algo (1) When an "enable-event"/"start" command is executed, the sessiond will get, in return for sending an enable-event command to the application (which apply to a channel within a session), a variable-sized array of enabled events (remember, we can enable a wildcard!), along with their name, loglevel, field name, and field type. The sessiond proceeds to check that each event does not conflict with another event in the registry with the same name, but having different field names/types or loglevel. If its field names/typing or loglevel differ from a previous event, it prints a warnings. If it matches a previous event, it re-uses the same ID as the previous event. If no match, it allocates a new event ID. It sends a command to the application to let it know the mapping between the event name and ID for the channel. When the application receives that command, it can finally proceed to attach the tracepoint probe to the tracepoint site. The sessiond keeps a per-application/per-channel hash table of already enabled events, so it does not provide the same event name/id mapping twice for a given channel. Algo (2) In the case where a library (.so) is being loaded in the application while tracing, the update sequence goes as follow: the application first checks if there is any session created. It so, it sends a NOTIFY_NEW_EVENTS message to the sessiond through the communication socket (normally used to send ACK to commands). The lttng-sessiond will therefore need to listen (read) to each application communication socket, and will also need to dispatch NOTIFY_NEW_EVENTS messages each time it expects an ACK reply for a command it has sent to the application. When a NOTIFY_NEW_EVENTS is received from an application, the sessiond iterates on each session, each channel, redoing Algo (1). The per-app/per-channel hash table that remembers already enabled events will ensure that we don't end up enabling the same event twice. At application startup, the "registration done" message will only be sent once all the commands setting the mapping between event name and ID are sent. This ensures tracing is not started until all events are enabled (delaying the application for a configurable delay). At library load, a "registration done" will also be sent by the sessiond some time after the NOTIFY_NEW_EVENTS has been received -- at the end of Algo(1). This means that library load, within applications, can be delayed for the same amount of time that apply to application start (configurable). The registry is emptied when the session is destroyed. Event IDs are never freed, only re-used for events with the same name, after loglevel, field name and field type match check. This registry is also used to generate metadata from the sessiond. The sessiond will now be responsible for generation of the metadata stream. -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Wed Sep 12 08:41:50 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Wed, 12 Sep 2012 08:41:50 -0400 Subject: [lttng-dev] Problem to get lttng work with a daemon application In-Reply-To: <50507593.5030206@ericsson.com> References: <50507593.5030206@ericsson.com> Message-ID: <20120912124150.GB26893@Krystal> * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > Hi, I've just started using lttng and run it in Ubuntu 12.04 in VirtualBox. > > I have run the sample applications without any problem, but I have > problems to get a daemon application work. > > I have added tracepoint support in the same way as for the sample > applications and do the following: > > 1) The lttng-sessiond (version 2.0.1) is started (with 2.0.1 is old. Please upgrade to the latest versions of the 2.0.x series for both lttng-tools and lttng-ust and try again. Thanks, Mathieu > --verbose--verbose-consumer). > 2) I start the daemon application with one tracepoint implemented. > 3) I can see that the lttng-sessiond gets called regarding this tracepoint: > > DEBUG1: App registered with pid:18421 ppid:18419 uid:0 gid:0 sock:18 > name:osafamfnd (version 2.0) [in ust_app_register() at ust-app.c:1365] > > 4) I run, strace -f lttng -v list -u, and can see that it "hangs" in > recvmsg: > write(2, "DEBUG1: Getting UST tracing even"..., 81DEBUG1: Getting UST > tracing events [in list_ust_events() at commands/list.c:253] > ) = 81 > getuid() = 0 > socket(PF_FILE, SOCK_STREAM, 0) = 3 > connect(3, {sa_family=AF_FILE, > path="/var/run/lttng/client-lttng-sessiond"}, 110) = 0 > geteuid() = 0 > getegid() = 0 > sendmsg(3, {msg_name(0)=NULL, > msg_iov(1)=[{"\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., > 8784}], msg_controllen=28, {cmsg_len=28, cmsg_level=SOL_SOCKET, > cmsg_type=SCM_CREDENTIALS{pid=28878, uid=0, gid=0}}, msg_flags=0}, 0) = > 8784 > recvmsg(3, > > 5) the lttng-sessiond outputs only the following and hangs as long as > the daemon application is running. > DEBUG1: Processing client command 14 [in process_client_msg() at > main.c:3309] > > 6) The only difference between sample app logs and daemon app logs is > that the pid and ppid seen at DEBUG1: App registered. In the daemon case > in this run it is pid 18421 ppid 18419 but when I print it in the > function calling tracepoint > it is pid 18430. I don't know if that is related to the problem. Any > help on this would be appreciated. > > /Thanks Hans > > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From hans.nordeback at ericsson.com Wed Sep 12 09:38:01 2012 From: hans.nordeback at ericsson.com (=?iso-8859-1?Q?Hans_Nordeb=E4ck?=) Date: Wed, 12 Sep 2012 15:38:01 +0200 Subject: [lttng-dev] Problem to get lttng work with a daemon application In-Reply-To: <20120912124150.GB26893@Krystal> References: <50507593.5030206@ericsson.com> <20120912124150.GB26893@Krystal> Message-ID: <1CE40C84E5A3A646A4386DE2A97629A95E724B1A53@ESESSCMS0361.eemea.ericsson.se> Hi Mathieu, I upgraded to version 2.0.4, but it did not solve the problem./Thanks Hans -----Original Message----- From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] Sent: den 12 september 2012 14:42 To: Hans Nordeb?ck Cc: lttng-dev at lists.lttng.org Subject: Re: [lttng-dev] Problem to get lttng work with a daemon application * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > Hi, I've just started using lttng and run it in Ubuntu 12.04 in VirtualBox. > > I have run the sample applications without any problem, but I have > problems to get a daemon application work. > > I have added tracepoint support in the same way as for the sample > applications and do the following: > > 1) The lttng-sessiond (version 2.0.1) is started (with 2.0.1 is old. Please upgrade to the latest versions of the 2.0.x series for both lttng-tools and lttng-ust and try again. Thanks, Mathieu > --verbose--verbose-consumer). > 2) I start the daemon application with one tracepoint implemented. > 3) I can see that the lttng-sessiond gets called regarding this tracepoint: > > DEBUG1: App registered with pid:18421 ppid:18419 uid:0 gid:0 sock:18 > name:osafamfnd (version 2.0) [in ust_app_register() at ust-app.c:1365] > > 4) I run, strace -f lttng -v list -u, and can see that it "hangs" in > recvmsg: > write(2, "DEBUG1: Getting UST tracing even"..., 81DEBUG1: Getting UST > tracing events [in list_ust_events() at commands/list.c:253] > ) = 81 > getuid() = 0 > socket(PF_FILE, SOCK_STREAM, 0) = 3 > connect(3, {sa_family=AF_FILE, > path="/var/run/lttng/client-lttng-sessiond"}, 110) = 0 > geteuid() = 0 > getegid() = 0 > sendmsg(3, {msg_name(0)=NULL, > msg_iov(1)=[{"\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ > 0\0\0\0\0"..., 8784}], msg_controllen=28, {cmsg_len=28, > cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS{pid=28878, uid=0, > gid=0}}, msg_flags=0}, 0) = > 8784 > recvmsg(3, > > 5) the lttng-sessiond outputs only the following and hangs as long as > the daemon application is running. > DEBUG1: Processing client command 14 [in process_client_msg() at > main.c:3309] > > 6) The only difference between sample app logs and daemon app logs is > that the pid and ppid seen at DEBUG1: App registered. In the daemon > case in this run it is pid 18421 ppid 18419 but when I print it in the > function calling tracepoint it is pid 18430. I don't know if that is > related to the problem. Any help on this would be appreciated. > > /Thanks Hans > > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Wed Sep 12 09:51:54 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Wed, 12 Sep 2012 09:51:54 -0400 Subject: [lttng-dev] Problem to get lttng work with a daemon application In-Reply-To: <1CE40C84E5A3A646A4386DE2A97629A95E724B1A53@ESESSCMS0361.eemea.ericsson.se> References: <50507593.5030206@ericsson.com> <20120912124150.GB26893@Krystal> <1CE40C84E5A3A646A4386DE2A97629A95E724B1A53@ESESSCMS0361.eemea.ericsson.se> Message-ID: <20120912135154.GB28079@Krystal> * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > Hi Mathieu, I upgraded to version 2.0.4, but it did not solve the > problem./Thanks Hans Hi Hans, Please provide the version numbers you use for both lttng-tools and lttng-ust. The lttng.org website lists the latest lttng-ust as 2.0.5, which leads me to think you might have forgotten to upgrade it. Don't forget to restart your test application (just to be sure, rebuild it against the new lttng-ust). Also make sure you kill all lttng-sessiond that might still be active. Thanks, Mathieu > > -----Original Message----- > From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] > Sent: den 12 september 2012 14:42 > To: Hans Nordeb?ck > Cc: lttng-dev at lists.lttng.org > Subject: Re: [lttng-dev] Problem to get lttng work with a daemon application > > * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > > Hi, I've just started using lttng and run it in Ubuntu 12.04 in VirtualBox. > > > > I have run the sample applications without any problem, but I have > > problems to get a daemon application work. > > > > I have added tracepoint support in the same way as for the sample > > applications and do the following: > > > > 1) The lttng-sessiond (version 2.0.1) is started (with > > 2.0.1 is old. Please upgrade to the latest versions of the 2.0.x series for both lttng-tools and lttng-ust and try again. > > Thanks, > > Mathieu > > > --verbose--verbose-consumer). > > 2) I start the daemon application with one tracepoint implemented. > > 3) I can see that the lttng-sessiond gets called regarding this tracepoint: > > > > DEBUG1: App registered with pid:18421 ppid:18419 uid:0 gid:0 sock:18 > > name:osafamfnd (version 2.0) [in ust_app_register() at ust-app.c:1365] > > > > 4) I run, strace -f lttng -v list -u, and can see that it "hangs" in > > recvmsg: > > write(2, "DEBUG1: Getting UST tracing even"..., 81DEBUG1: Getting UST > > tracing events [in list_ust_events() at commands/list.c:253] > > ) = 81 > > getuid() = 0 > > socket(PF_FILE, SOCK_STREAM, 0) = 3 > > connect(3, {sa_family=AF_FILE, > > path="/var/run/lttng/client-lttng-sessiond"}, 110) = 0 > > geteuid() = 0 > > getegid() = 0 > > sendmsg(3, {msg_name(0)=NULL, > > msg_iov(1)=[{"\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ > > 0\0\0\0\0"..., 8784}], msg_controllen=28, {cmsg_len=28, > > cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS{pid=28878, uid=0, > > gid=0}}, msg_flags=0}, 0) = > > 8784 > > recvmsg(3, > > > > 5) the lttng-sessiond outputs only the following and hangs as long as > > the daemon application is running. > > DEBUG1: Processing client command 14 [in process_client_msg() at > > main.c:3309] > > > > 6) The only difference between sample app logs and daemon app logs is > > that the pid and ppid seen at DEBUG1: App registered. In the daemon > > case in this run it is pid 18421 ppid 18419 but when I print it in the > > function calling tracepoint it is pid 18430. I don't know if that is > > related to the problem. Any help on this would be appreciated. > > > > /Thanks Hans > > > > > > > > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant EfficiOS Inc. > http://www.efficios.com -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From Bernd.Hufmann at ericsson.com Wed Sep 12 13:57:58 2012 From: Bernd.Hufmann at ericsson.com (Bernd Hufmann) Date: Wed, 12 Sep 2012 13:57:58 -0400 Subject: [lttng-dev] list configured filters in LTTng Tools 2.1 Message-ID: <5050CD26.6020707@ericsson.com> Hello I configured a filter for UST events (lttng enable event -u ust* --filter 'signal==10101') and I want to retrieve that information afterwards. I used "lttng list mySession" and it only shows [with filters]. Is it possible to retrieve the actual filter expression? If not, it would be good to add this possibility. Best Regards Bernd -- This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer From mathieu.desnoyers at efficios.com Wed Sep 12 15:14:00 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Wed, 12 Sep 2012 15:14:00 -0400 Subject: [lttng-dev] list configured filters in LTTng Tools 2.1 In-Reply-To: <5050CD26.6020707@ericsson.com> References: <5050CD26.6020707@ericsson.com> Message-ID: <20120912191400.GA31291@Krystal> * Bernd Hufmann (Bernd.Hufmann at ericsson.com) wrote: > Hello > > I configured a filter for UST events (lttng enable event -u ust* > --filter 'signal==10101') and I want to retrieve that information > afterwards. I used "lttng list mySession" and it only shows [with > filters]. Is it possible to retrieve the actual filter expression? If > not, it would be good to add this possibility. We could. Please add a feature request on the bugs.lttng.org bugtracker against the lttng-tools project. Thanks, Mathieu > > Best Regards > Bernd > > > -- > This Communication is Confidential. We only send and receive email on > the basis of the terms set out at www.ericsson.com/email_disclaimer > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From Zheng.Chang at emc.com Thu Sep 13 03:27:11 2012 From: Zheng.Chang at emc.com (Chang, Zheng) Date: Thu, 13 Sep 2012 03:27:11 -0400 Subject: [lttng-dev] Deaklock in liblttng-ust Message-ID: <6539770C71C3814BB0BFC2DBEBD1050801062B20@CORPUSMX30B.corp.emc.com> Hi, I built a trace.so as a wrapper of lttng-ust, which predefines some events and APIs based on lttng-ust. And here is demo application linked to this share library. Sometimes the demo hung at launch time. I did test with the demo and easy-ust of lttng-ust on both IA32 and X64 and got the same result. Lttng-ust version is 2.02. I collect some debuging info with gdb here: Parent process: gdb) thread 3 (constructor of liblttng-ust.so) [Switching to thread 3 (Thread 0x7f91d5487950 (LWP 21901))]#0 0x00007f91d82ad400 in wait () from /lib64/libpthread.so.0 (gdb) bt #0 0x00007f91d82ad400 in wait () from /lib64/libpthread.so.0 #1 0x00007f91d64a8c4b in wait_for_sessiond (sock_info=0x7f91d66cc640) at lttng-ust-comm.c:481 #2 0x00007f91d64a9545 in ust_listener_thread (arg=) at lttng-ust-comm.c:669 #3 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 #4 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 (gdb) thread 5 (constructor of demo) [Switching to thread 5 (Thread 0x7f91d690e950 (LWP 21899))]#0 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 (gdb) bt #0 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 #1 0x00007f91d82a72d0 in _L_lock_102 () from /lib64/libpthread.so.0 #2 0x00007f91d82a6bbe in pthread_mutex_lock () from /lib64/libpthread.so.0 #3 0x00007f91d64abf8b in ltt_probe_register (desc=0x7f91d66d0ce0) at ltt-probes.c:77 #4 0x00007f91d66e0cfb in __lttng_events_init__sample_component () at /usr/include/lttng/ust-tracepoint-event.h:550 #5 0x00007f91d66e71b6 in __do_global_ctors_aux () from mytrace.so #6 0x00007f91d66e03c3 in _init () from mytrace.so #7 0x00007f91d66df3d4 in ?? () from mytrace.so #8 0x00007f91d94f78d8 in ?? () from /lib64/ld-linux-x86-64.so.2 #9 0x00007f91d94f7a07 in ?? () from /lib64/ld-linux-x86-64.so.2 #10 0x00007f91d94fbbde in ?? () from /lib64/ld-linux-x86-64.so.2 #11 0x00007f91d94f7566 in ?? () from /lib64/ld-linux-x86-64.so.2 #12 0x00007f91d94fb38b in ?? () from /lib64/ld-linux-x86-64.so.2 #13 0x00007f91d84bbf9b in ?? () from /lib64/libdl.so.2 #14 0x00007f91d94f7566 in ?? () from /lib64/ld-linux-x86-64.so.2 #15 0x00007f91d84bc34c in ?? () from /lib64/libdl.so.2 #16 0x00007f91d84bbf01 in dlopen () from /lib64/libdl.so.2 .............................................. #24 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 #25 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 (gdb) p sessions_mutex $4 = {__data = {__lock = 2, __count = 0, __owner = 21901, __nusers = 1, __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = "\002\000\000\000\000\000\000\000\215U\000\000\001", '\0' , __align = 2} Child process: (gdb) info thread (forked from 21901) * 1 Thread 0x7f91d5487950 (LWP 21902) 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 (gdb) bt #0 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 #1 0x00007f91d82a72d0 in _L_lock_102 () from /lib64/libpthread.so.0 #2 0x00007f91d82a6bbe in pthread_mutex_lock () from /lib64/libpthread.so.0 #3 0x00007f91d64abe58 in ltt_probe_unregister (desc=0x7f91d66d0ce0) at ltt-probes.c:129 #4 0x00007f91d66e0d10 in __lttng_events_exit__sample_component () at /usr/include/lttng/ust-tracepoint-event.h:557 #5 0x00007f91d66e07cf in __do_global_dtors_aux () from mytrace.so #6 0x00007f91d66cd664 in global_apps () from /usr/lib/liblttng-ust.so.0 #7 0x00007f91d5479df0 in ?? () #8 0x00007f91d66e71dd in _real_fini () from mytrace.so #9 0x00007f91d66e71d2 in _fini () from mytrace.so #10 0x00007f91d94f7f54 in ?? () from /lib64/ld-linux-x86-64.so.2 #11 0x00007f91d7a652ed in exit () from /lib64/libc.so.6 #12 0x00007f91d64a9207 in wait_for_sessiond (sock_info=0x7f91d66cc640) at lttng-ust-comm.c:542 #13 0x00007f91d64a9545 in ust_listener_thread (arg=) at lttng-ust-comm.c:669 #14 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 #15 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 #16 0x0000000000000000 in ?? () (gdb) p sessions_mutex $1 = {__data = {__lock = 2, __count = 0, __owner = 21901, __nusers = 1, __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = "\002\000\000\000\000\000\000\000\215U\000\000\001", '\0' , __align = 2} What happened seems like this: lttng_ust_init | |-> ust_listener_thread | |-> wait_for_sessiond | |-> ust_lock (1) |-> get_map_shm | | | |-> get_wait_shm | | | |-> fork | parent -> wait (2) | child -> exit -> _fini -> __do_global_dtors_aux -> ...... -> ltt_probe_unregister -> ust_lock (3) |-> ust_unlock (4) Deadlock happened at point (1) and (3). Parent waited for child's termination and child waited for parent to release the lock. Reproduction conditions: - First time to create share memory (/dev/shm/lttng-ust-apps-wait* don't exist) - Child process got delayed( I'm not quite sure with this, I used gdb to hold child process for a while and it happened either) In normal case, child process didn't call _fini when it exited so that no deadlock happened. Is this a known issue? Thanks -Zheng -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Thu Sep 13 07:37:39 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 13 Sep 2012 07:37:39 -0400 Subject: [lttng-dev] Deaklock in liblttng-ust In-Reply-To: <6539770C71C3814BB0BFC2DBEBD1050801062B20@CORPUSMX30B.corp.emc.com> References: <6539770C71C3814BB0BFC2DBEBD1050801062B20@CORPUSMX30B.corp.emc.com> Message-ID: <20120913113739.GA27777@Krystal> * Chang, Zheng (Zheng.Chang at emc.com) wrote: > Hi, > > > > I built a trace.so as a wrapper of lttng-ust, which predefines some > events and APIs based on lttng-ust. > > And here is demo application linked to this share library. > > > > Sometimes the demo hung at launch time. I did test with the demo and > easy-ust of lttng-ust on both IA32 and X64 and got the same result. > > Lttng-ust version is 2.02. > > > > I collect some debuging info with gdb here: > > > > Parent process: > > > > gdb) thread 3 (constructor of liblttng-ust.so) > > [Switching to thread 3 (Thread 0x7f91d5487950 (LWP 21901))]#0 > 0x00007f91d82ad400 in wait () from /lib64/libpthread.so.0 > > (gdb) bt > > #0 0x00007f91d82ad400 in wait () from /lib64/libpthread.so.0 > > #1 0x00007f91d64a8c4b in wait_for_sessiond (sock_info=0x7f91d66cc640) > at lttng-ust-comm.c:481 > > #2 0x00007f91d64a9545 in ust_listener_thread (arg= out>) at lttng-ust-comm.c:669 > > #3 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 > > #4 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 > > > > (gdb) thread 5 (constructor of demo) > > [Switching to thread 5 (Thread 0x7f91d690e950 (LWP 21899))]#0 > 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 > > (gdb) bt > > #0 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 > > #1 0x00007f91d82a72d0 in _L_lock_102 () from /lib64/libpthread.so.0 > > #2 0x00007f91d82a6bbe in pthread_mutex_lock () from > /lib64/libpthread.so.0 > > #3 0x00007f91d64abf8b in ltt_probe_register (desc=0x7f91d66d0ce0) at > ltt-probes.c:77 > > #4 0x00007f91d66e0cfb in __lttng_events_init__sample_component () at > /usr/include/lttng/ust-tracepoint-event.h:550 > > #5 0x00007f91d66e71b6 in __do_global_ctors_aux () from mytrace.so > > #6 0x00007f91d66e03c3 in _init () from mytrace.so > > #7 0x00007f91d66df3d4 in ?? () from mytrace.so > > #8 0x00007f91d94f78d8 in ?? () from /lib64/ld-linux-x86-64.so.2 > > #9 0x00007f91d94f7a07 in ?? () from /lib64/ld-linux-x86-64.so.2 > > #10 0x00007f91d94fbbde in ?? () from /lib64/ld-linux-x86-64.so.2 > > #11 0x00007f91d94f7566 in ?? () from /lib64/ld-linux-x86-64.so.2 > > #12 0x00007f91d94fb38b in ?? () from /lib64/ld-linux-x86-64.so.2 > > #13 0x00007f91d84bbf9b in ?? () from /lib64/libdl.so.2 > > #14 0x00007f91d94f7566 in ?? () from /lib64/ld-linux-x86-64.so.2 > > #15 0x00007f91d84bc34c in ?? () from /lib64/libdl.so.2 > > #16 0x00007f91d84bbf01 in dlopen () from /lib64/libdl.so.2 > > .............................................. > > #24 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 > > #25 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 > > > > (gdb) p sessions_mutex > > $4 = {__data = {__lock = 2, __count = 0, __owner = 21901, __nusers = 1, > __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, > > __size = "\002\000\000\000\000\000\000\000\215U\000\000\001", '\0' > , __align = 2} > > > > Child process: > > > > (gdb) info thread (forked from 21901) > > * 1 Thread 0x7f91d5487950 (LWP 21902) 0x00007f91d82ac344 in > __lll_lock_wait () from /lib64/libpthread.so.0 > > (gdb) bt > > #0 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 > > #1 0x00007f91d82a72d0 in _L_lock_102 () from /lib64/libpthread.so.0 > > #2 0x00007f91d82a6bbe in pthread_mutex_lock () from > /lib64/libpthread.so.0 > > #3 0x00007f91d64abe58 in ltt_probe_unregister (desc=0x7f91d66d0ce0) at > ltt-probes.c:129 > > #4 0x00007f91d66e0d10 in __lttng_events_exit__sample_component () at > /usr/include/lttng/ust-tracepoint-event.h:557 > > #5 0x00007f91d66e07cf in __do_global_dtors_aux () from mytrace.so > > #6 0x00007f91d66cd664 in global_apps () from /usr/lib/liblttng-ust.so.0 > > #7 0x00007f91d5479df0 in ?? () > > #8 0x00007f91d66e71dd in _real_fini () from mytrace.so > > #9 0x00007f91d66e71d2 in _fini () from mytrace.so > > #10 0x00007f91d94f7f54 in ?? () from /lib64/ld-linux-x86-64.so.2 > > #11 0x00007f91d7a652ed in exit () from /lib64/libc.so.6 > > #12 0x00007f91d64a9207 in wait_for_sessiond (sock_info=0x7f91d66cc640) > at lttng-ust-comm.c:542 > > #13 0x00007f91d64a9545 in ust_listener_thread (arg= out>) at lttng-ust-comm.c:669 > > #14 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 > > #15 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 > > #16 0x0000000000000000 in ?? () > > (gdb) p sessions_mutex > > $1 = {__data = {__lock = 2, __count = 0, __owner = 21901, __nusers = 1, > __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, > > __size = "\002\000\000\000\000\000\000\000\215U\000\000\001", '\0' > , __align = 2} > > > > What happened seems like this: > > > > lttng_ust_init > > | > > |-> ust_listener_thread > > | > > |-> wait_for_sessiond > > | > > |-> > ust_lock > (1) > > |-> > get_map_shm > > | > | > > | > |-> get_wait_shm > > | > | > > | > |-> fork > > | > parent -> wait > (2) > > | > child -> exit -> _fini -> __do_global_dtors_aux -> ...... -> > ltt_probe_unregister -> ust_lock (3) > > |-> > ust_unlock > (4) > > > > Deadlock happened at point (1) and (3). Parent waited for child's > termination and child waited for parent to release the lock. > > > > Reproduction conditions: > > - First time to create share memory > (/dev/shm/lttng-ust-apps-wait* don't exist) > > - Child process got delayed( I'm not quite sure with this, I > used gdb to hold child process for a while and it happened either) > > > > In normal case, child process didn't call _fini when it exited so that > no deadlock happened. > > > > Is this a known issue? Yes, see: commit 3b8b68e73ec9b2b3cf550048046d3f7f69050688 Author: Mathieu Desnoyers Date: Wed Jun 13 04:26:34 2012 -0400 Fix: liblttng-ust-fork deadlock * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote: > * Burton, Michael (mburton at ciena.com) wrote: > > Mathieu, > > > > I think there is a deadlock scenario in UST, which has been causing my p > > Good catch ! > > > > > sessiond is started as root: > > - creates global sockets ONLY > > - DOES NOT CREATE shm in $HOME/lttng-ust-wait- > > > > application linked against ust is run as root: > > - in lttng_ust_init constructor > > - ust_listener_thread (local_apps) > > - fails to connect to local_apps in $HOME/.lttng (as expected) > > - prev_connect_failed=1 > > - ust_unlock() > > - restart > > - wait_for_sessiond() > > --> - ust_lock() > > | - get_map_shm() > > | - get_wait_shm() > > DEADLOCK - shm_open() FAILS (not created by sessiond when run by root > > | - fork() (trying to create shared memory itself) > > | - ust_before_fork() > > ------------> - ust_lock() > > > > > > You should be able to create this with an empty main, with no > > tracepoints. As long as sessiond is started as root so > > $HOME/lttng-ust-wait- is not created. You can also make the > > lttng-ust constructor (lttng_ust_init) wait forever and then you'll be > > able to see the deadlock in gdb without even leaving the > > lttng_ust_init constructor. > > Ah, I see. This deadlock is caused by the interaction between > [ liblttng-ust-fork ] and liblttng-ust (the fork override is > performed by [ liblttng-ust-fork ]). This can be reproduced easily with the in-tree tests: by removing the lttng-ust-apps-wait* files belonging to the user in /dev/shm, running the "tests/fork" test (with ./run) hangs. If we run "hello" first, and then the fork test, it works fine. Fixing this by keeping a nesting counter around the fork() call, so we return immediately from the pre/post fork handlers if they are overridden by liblttng-ust-fork. Reported-by: Michael Burton Signed-off-by: Mathieu Desnoyers You should upgrade your lttng-ust to latest 2.0.x. Thanks, Mathieu > > > > Thanks > > -Zheng > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From Bernd.Hufmann at ericsson.com Thu Sep 13 08:42:22 2012 From: Bernd.Hufmann at ericsson.com (Bernd Hufmann) Date: Thu, 13 Sep 2012 08:42:22 -0400 Subject: [lttng-dev] list configured filters in LTTng Tools 2.1 In-Reply-To: <20120912191400.GA31291@Krystal> References: <5050CD26.6020707@ericsson.com> <20120912191400.GA31291@Krystal> Message-ID: <5051D4AE.8040201@ericsson.com> Hi Mathieu Thanks for the info. I've opened a feature request (#334). Best Regards Bernd On 09/12/2012 03:14 PM, Mathieu Desnoyers wrote: > * Bernd Hufmann (Bernd.Hufmann at ericsson.com) wrote: >> Hello >> >> I configured a filter for UST events (lttng enable event -u ust* >> --filter 'signal==10101') and I want to retrieve that information >> afterwards. I used "lttng list mySession" and it only shows [with >> filters]. Is it possible to retrieve the actual filter expression? If >> not, it would be good to add this possibility. > We could. Please add a feature request on the bugs.lttng.org bugtracker > against the lttng-tools project. > > Thanks, > > Mathieu > >> Best Regards >> Bernd >> >> >> -- >> This Communication is Confidential. We only send and receive email on >> the basis of the terms set out at www.ericsson.com/email_disclaimer >> >> _______________________________________________ >> lttng-dev mailing list >> lttng-dev at lists.lttng.org >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer From hans.nordeback at ericsson.com Thu Sep 13 09:07:56 2012 From: hans.nordeback at ericsson.com (=?iso-8859-1?Q?Hans_Nordeb=E4ck?=) Date: Thu, 13 Sep 2012 15:07:56 +0200 Subject: [lttng-dev] Problem to get lttng work with a daemon application In-Reply-To: <20120912135154.GB28079@Krystal> References: <50507593.5030206@ericsson.com> <20120912124150.GB26893@Krystal> <1CE40C84E5A3A646A4386DE2A97629A95E724B1A53@ESESSCMS0361.eemea.ericsson.se> <20120912135154.GB28079@Krystal> Message-ID: <1CE40C84E5A3A646A4386DE2A97629A95E724B1ECE@ESESSCMS0361.eemea.ericsson.se> Hi Mathieu, I have installed lttng-ust 2.0.5 and lttng-tools 2.0.4, I run a gdb session and realized what the problem is. I noticed that lttng threads are created before main via __attribute__(constructor), and the problem with the daemon is that the lttng threads "disappears" after "daemonizing" the daemon, causing recvmsg in ustcomm_recv_unix_sock to hang. I removed the __attribute__(constructor) and called lttng_ust_init explicitly, it works, but I have to search for a more general solution./Thanks Hans -----Original Message----- From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] Sent: den 12 september 2012 15:52 To: Hans Nordeb?ck Cc: lttng-dev at lists.lttng.org Subject: Re: [lttng-dev] Problem to get lttng work with a daemon application * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > Hi Mathieu, I upgraded to version 2.0.4, but it did not solve the > problem./Thanks Hans Hi Hans, Please provide the version numbers you use for both lttng-tools and lttng-ust. The lttng.org website lists the latest lttng-ust as 2.0.5, which leads me to think you might have forgotten to upgrade it. Don't forget to restart your test application (just to be sure, rebuild it against the new lttng-ust). Also make sure you kill all lttng-sessiond that might still be active. Thanks, Mathieu > > -----Original Message----- > From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] > Sent: den 12 september 2012 14:42 > To: Hans Nordeb?ck > Cc: lttng-dev at lists.lttng.org > Subject: Re: [lttng-dev] Problem to get lttng work with a daemon > application > > * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > > Hi, I've just started using lttng and run it in Ubuntu 12.04 in VirtualBox. > > > > I have run the sample applications without any problem, but I have > > problems to get a daemon application work. > > > > I have added tracepoint support in the same way as for the sample > > applications and do the following: > > > > 1) The lttng-sessiond (version 2.0.1) is started (with > > 2.0.1 is old. Please upgrade to the latest versions of the 2.0.x series for both lttng-tools and lttng-ust and try again. > > Thanks, > > Mathieu > > > --verbose--verbose-consumer). > > 2) I start the daemon application with one tracepoint implemented. > > 3) I can see that the lttng-sessiond gets called regarding this tracepoint: > > > > DEBUG1: App registered with pid:18421 ppid:18419 uid:0 gid:0 sock:18 > > name:osafamfnd (version 2.0) [in ust_app_register() at > > ust-app.c:1365] > > > > 4) I run, strace -f lttng -v list -u, and can see that it "hangs" in > > recvmsg: > > write(2, "DEBUG1: Getting UST tracing even"..., 81DEBUG1: Getting UST > > tracing events [in list_ust_events() at commands/list.c:253] > > ) = 81 > > getuid() = 0 > > socket(PF_FILE, SOCK_STREAM, 0) = 3 > > connect(3, {sa_family=AF_FILE, > > path="/var/run/lttng/client-lttng-sessiond"}, 110) = 0 > > geteuid() = 0 > > getegid() = 0 > > sendmsg(3, {msg_name(0)=NULL, > > msg_iov(1)=[{"\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ > > 0\ 0\0\0\0\0"..., 8784}], msg_controllen=28, {cmsg_len=28, > > cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS{pid=28878, uid=0, > > gid=0}}, msg_flags=0}, 0) = > > 8784 > > recvmsg(3, > > > > 5) the lttng-sessiond outputs only the following and hangs as long > > as the daemon application is running. > > DEBUG1: Processing client command 14 [in process_client_msg() at > > main.c:3309] > > > > 6) The only difference between sample app logs and daemon app logs > > is that the pid and ppid seen at DEBUG1: App registered. In the > > daemon case in this run it is pid 18421 ppid 18419 but when I print > > it in the function calling tracepoint it is pid 18430. I don't know > > if that is related to the problem. Any help on this would be appreciated. > > > > /Thanks Hans > > > > > > > > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant EfficiOS Inc. > http://www.efficios.com -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 13 09:38:09 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 13 Sep 2012 09:38:09 -0400 Subject: [lttng-dev] Problem to get lttng work with a daemon application In-Reply-To: <1CE40C84E5A3A646A4386DE2A97629A95E724B1ECE@ESESSCMS0361.eemea.ericsson.se> References: <50507593.5030206@ericsson.com> <20120912124150.GB26893@Krystal> <1CE40C84E5A3A646A4386DE2A97629A95E724B1A53@ESESSCMS0361.eemea.ericsson.se> <20120912135154.GB28079@Krystal> <1CE40C84E5A3A646A4386DE2A97629A95E724B1ECE@ESESSCMS0361.eemea.ericsson.se> Message-ID: <20120913133809.GA29390@Krystal> * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > Hi Mathieu, I have installed lttng-ust 2.0.5 and lttng-tools 2.0.4, I run a gdb session and realized what > the problem is. I noticed that lttng threads are created before main via __attribute__(constructor), > and the problem with the daemon is that the lttng threads "disappears" after "daemonizing" the daemon, > causing recvmsg in ustcomm_recv_unix_sock to hang. I removed the __attribute__(constructor) and called > lttng_ust_init explicitly, it works, but I have to search for a more general solution./Thanks Hans Ah! yes! how do you deamonize your daemon ? Do you, for instance, close all file descriptors between 0 and 100 ? This will not behave well with lttng-ust. The following bug entry is keeping track of this issue: http://bugs.lttng.org/issues/253 Indeed, initializing lttng-ust only after the file descriptors has been closed could work. Maybe we could do a work-around for this issue, where we could wrap the constructor within a getenv("LTTNG_UST_MANUAL_INIT") == "1" strcmp check, and, in that case, require that the application call some init API provided by lttng-ust. However, given that we want liblttng-ust to be a dependency that is not strictly required by applications (such as the demo-trace example in tests/demo), we'd need to look up the symbol of the initialization function with dlsym(). Thoughts ? Thanks, Mathieu > > -----Original Message----- > From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] > Sent: den 12 september 2012 15:52 > To: Hans Nordeb?ck > Cc: lttng-dev at lists.lttng.org > Subject: Re: [lttng-dev] Problem to get lttng work with a daemon application > > * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > > Hi Mathieu, I upgraded to version 2.0.4, but it did not solve the > > problem./Thanks Hans > > Hi Hans, > > Please provide the version numbers you use for both lttng-tools and lttng-ust. The lttng.org website lists the latest lttng-ust as 2.0.5, which leads me to think you might have forgotten to upgrade it. > > Don't forget to restart your test application (just to be sure, rebuild it against the new lttng-ust). Also make sure you kill all lttng-sessiond that might still be active. > > Thanks, > > Mathieu > > > > > -----Original Message----- > > From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] > > Sent: den 12 september 2012 14:42 > > To: Hans Nordeb?ck > > Cc: lttng-dev at lists.lttng.org > > Subject: Re: [lttng-dev] Problem to get lttng work with a daemon > > application > > > > * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > > > Hi, I've just started using lttng and run it in Ubuntu 12.04 in VirtualBox. > > > > > > I have run the sample applications without any problem, but I have > > > problems to get a daemon application work. > > > > > > I have added tracepoint support in the same way as for the sample > > > applications and do the following: > > > > > > 1) The lttng-sessiond (version 2.0.1) is started (with > > > > 2.0.1 is old. Please upgrade to the latest versions of the 2.0.x series for both lttng-tools and lttng-ust and try again. > > > > Thanks, > > > > Mathieu > > > > > --verbose--verbose-consumer). > > > 2) I start the daemon application with one tracepoint implemented. > > > 3) I can see that the lttng-sessiond gets called regarding this tracepoint: > > > > > > DEBUG1: App registered with pid:18421 ppid:18419 uid:0 gid:0 sock:18 > > > name:osafamfnd (version 2.0) [in ust_app_register() at > > > ust-app.c:1365] > > > > > > 4) I run, strace -f lttng -v list -u, and can see that it "hangs" in > > > recvmsg: > > > write(2, "DEBUG1: Getting UST tracing even"..., 81DEBUG1: Getting UST > > > tracing events [in list_ust_events() at commands/list.c:253] > > > ) = 81 > > > getuid() = 0 > > > socket(PF_FILE, SOCK_STREAM, 0) = 3 > > > connect(3, {sa_family=AF_FILE, > > > path="/var/run/lttng/client-lttng-sessiond"}, 110) = 0 > > > geteuid() = 0 > > > getegid() = 0 > > > sendmsg(3, {msg_name(0)=NULL, > > > msg_iov(1)=[{"\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ > > > 0\ 0\0\0\0\0"..., 8784}], msg_controllen=28, {cmsg_len=28, > > > cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS{pid=28878, uid=0, > > > gid=0}}, msg_flags=0}, 0) = > > > 8784 > > > recvmsg(3, > > > > > > 5) the lttng-sessiond outputs only the following and hangs as long > > > as the daemon application is running. > > > DEBUG1: Processing client command 14 [in process_client_msg() at > > > main.c:3309] > > > > > > 6) The only difference between sample app logs and daemon app logs > > > is that the pid and ppid seen at DEBUG1: App registered. In the > > > daemon case in this run it is pid 18421 ppid 18419 but when I print > > > it in the function calling tracepoint it is pid 18430. I don't know > > > if that is related to the problem. Any help on this would be appreciated. > > > > > > /Thanks Hans > > > > > > > > > > > > > > > _______________________________________________ > > > lttng-dev mailing list > > > lttng-dev at lists.lttng.org > > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > > -- > > Mathieu Desnoyers > > Operating System Efficiency R&D Consultant EfficiOS Inc. > > http://www.efficios.com > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant EfficiOS Inc. > http://www.efficios.com -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Thu Sep 13 10:29:52 2012 From: dgoulet at efficios.com (David Goulet) Date: Thu, 13 Sep 2012 10:29:52 -0400 Subject: [lttng-dev] [RFC] Per-user event ID allocation proposal In-Reply-To: <20120912123555.GA26893@Krystal> References: <20120912123555.GA26893@Krystal> Message-ID: <5051EDE0.3070900@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi Mathieu, This looks good! I have some questions to clarify part of the RFC. Mathieu Desnoyers: > Mathieu Desnoyers September 11, 2012 > > Per-user event ID allocation proposal > > The intent of this shared event ID registry is to allow sharing > tracing buffers between applications belonging to the same user > (UID) for UST (user-space) tracing. > > A.1) Overview of System-wide, per-ABI (32 and 64-bit), per-user, > per-session, LTTng-UST event ID allocation: > > - Modify LTTng-UST and lttng-tools to keep a system-wide, per-ABI > (32 and 64-bit), per-user, per-session registry of enabled events > and their associated numeric IDs. - LTTng-UST will have to register > its tracepoints to the session daemon, sending the field typing of > these tracepoints during registration, - Dynamically check that > field types match upon registration of an event in this global > registry, refuse registration if the field types do not match, - > The metadata will be generated by lttng-tools instead of the > application. > > A.2 Per-user Event ID Details: > > The event ID registry is shared across all processes for a given > session/ABI/channel/user (UID). The intent is to forbid one user > to access tracing data from another user, while keeping the > system-wide number of buffers small. > > The event ID registry is attached to a: - session, - specific ABI > (32/64-bit), - channel, - user (UID). > > lttng-session fill this registry by pulling this information as > needed from traced processes (a.k.a. applications) to populate the > registry. This information is needed only when an event is active > for a created session. Therefore, applications need not to notify > the sessiond if no session is created. > > The rationale for using a "pull" scheme, where the sessiond pulls > information from applications, in opposition to a "push" scheme, > where application would initiate commands to push the information, > is that it minimizes the amount of logic required within > liblttng-ust, and it does not require liblttng-ust to wait for > reply from lttng-sessiond, which minimize the impact on the > application behavior, providing application resilience to > lttng-sessiond crash. > > Updates to this registry are triggered by two distinct scenarios: > either an "enable-event" command (could also be "start", depending > on the sessiond design) is being executed, or, while tracing, a > library is being loaded within the application. > > Before we start describing the algorithms that update the registry, > it is _very_ important to understand that an event enabled with > "enable-event" can contain a wildcard (e.g.: libc*) and loglevel, > and therefore is associated to possibly _many_ events in the > application. > > Algo (1) When an "enable-event"/"start" command is executed, the > sessiond will get, in return for sending an enable-event command to > the application (which apply to a channel within a session), a > variable-sized array of enabled events (remember, we can enable a > wildcard!), along with their name, loglevel, field name, and field > type. The sessiond proceeds to check that each event does not > conflict with another event in the registry with the same name, but > having different field names/types or loglevel. If its field > names/typing or loglevel differ from a previous event, it prints a > warnings. If it matches a previous event, it re-uses the same ID as > the previous event. If no match, it allocates a new event ID. It > sends a command to the application to let it know the mapping > between the event name and ID for the channel. When the > application receives that command, it can finally proceed to attach > the tracepoint probe to the tracepoint site. > The sessiond keeps a per-application/per-channel hash table of > already enabled events, so it does not provide the same event > name/id mapping twice for a given channel. and per-session ? Of what I understand of this proposal, an event is associated to per-user/per-session/per-apps/per-channel values. (I have a question at the end about how an event ID should be generated) > > Algo (2) In the case where a library (.so) is being loaded in the > application while tracing, the update sequence goes as follow: the > application first checks if there is any session created. It so, it > sends a NOTIFY_NEW_EVENTS message to the sessiond through the > communication socket (normally used to send ACK to commands). The > lttng-sessiond will therefore need to listen (read) to each > application communication socket, and will also need to dispatch > NOTIFY_NEW_EVENTS messages each time it expects an ACK reply for a > command it has sent to the application. Taking back the last sentence, can you explain more or clarify the mechanism here of "dispatching a NOTIFY_NEW_EVENTS" each time an ACK reply is expected?... Do you mean that each time we are waiting for an ACK, if we get a NOTIFY instead (which could happen due to a race between notification and command handling) you will launch a NOTIFY code path where the session daemon check the events hash table and check for event(s) to pull from the UST tracer? ... so what about getting the real ACK after that ? > When a NOTIFY_NEW_EVENTS is received from an application, the > sessiond iterates on each session, each channel, redoing Algo (1). > The per-app/per-channel hash table that remembers already enabled > events will ensure that we don't end up enabling the same event > twice. > > At application startup, the "registration done" message will only > be sent once all the commands setting the mapping between event > name and ID are sent. This ensures tracing is not started until all > events are enabled (delaying the application for a configurable > delay). > > At library load, a "registration done" will also be sent by the > sessiond some time after the NOTIFY_NEW_EVENTS has been received -- > at the end of Algo(1). This means that library load, within > applications, can be delayed for the same amount of time that apply > to application start (configurable). > > The registry is emptied when the session is destroyed. Event IDs > are never freed, only re-used for events with the same name, after > loglevel, field name and field type match check. This means that event IDs here should be some kind of a hash using a combination of values of the event to make sure it's unique on a per-event/per-channel/per-session basis ? (considering the sessiond should keep them in a separate registry) > > This registry is also used to generate metadata from the sessiond. > The sessiond will now be responsible for generation of the metadata > stream. > This implies that the session daemon will need to keep track of the global memory location of each applications in order to consumer metadata streams ? Cheers! David -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQUe3dAAoJEELoaioR9I024JUH/14NpMtoMxKR+Y+oNd9AH6TW Wj23HMJDwfhbRK8T1Mz6oMI/jWkSLVrJxoB3fh3Tbx5dJBwePXrkD+Da5NqV7MMV PEc3Hqx66YYNh9EcbkYkg/LJfEmc4XwLxvi4x8DA4LIFwG9SDzs0N/i+e6pWs/Dy blUFq/Kk7t9Ah72DCzjnSqQU+plW8Nr9wuxjpFV7uiXYpMrQsArhtuengtXmv7+7 R+KfokIccnKXZURTdEPg5aZg1NRc4QnOl8CPjX/rcD64N32EllRIIdoLFjHAxens aGsv2U19/53J8nvMl93qswKWNyvt59yr3a7uobKnvmSZMMSyTgApZpxqaB9Y41I= =cN91 -----END PGP SIGNATURE----- From dgoulet at efficios.com Thu Sep 13 14:25:15 2012 From: dgoulet at efficios.com (David Goulet) Date: Thu, 13 Sep 2012 14:25:15 -0400 Subject: [lttng-dev] [lttng-tools PATCH] Don't send the subbuffer padding for streaming Message-ID: <1347560715-18710-1-git-send-email-dgoulet@efficios.com> For network streaming, with the mmap() mechanism only for now, the consumer does NOT send the padding over the network. Instead, the size of the padding is specified in the data header or metadata payload. The lttng-relayd now is the one appending the zeros to the trace files. Again, this functionnality is NOT available yet for splice output. Signed-off-by: David Goulet --- src/bin/lttng-relayd/main.c | 39 ++++++++++ src/common/consumer.c | 97 ++++++++++++++---------- src/common/consumer.h | 6 +- src/common/kernel-consumer/kernel-consumer.c | 105 +++++++++++++++----------- src/common/sessiond-comm/relayd.h | 2 + src/common/ust-consumer/ust-consumer.c | 19 +++-- src/common/ust-consumer/ust-consumer.h | 6 +- 7 files changed, 183 insertions(+), 91 deletions(-) diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index e9b70a3..f60199b 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -1145,6 +1145,31 @@ end: } /* + * Append padding to the file pointed by the file descriptor fd. + */ +static int write_padding_to_file(int fd, uint32_t size) +{ + int ret = 0; + char zeros[size]; + + if (size == 0) { + goto end; + } + + memset(zeros, 0, size); + + do { + ret = write(fd, zeros, size); + } while (ret < 0 && errno == EINTR); + if (ret < 0) { + PERROR("write padding to file"); + } + +end: + return ret; +} + +/* * relay_recv_metadata: receive the metada for the session. */ static @@ -1208,6 +1233,14 @@ int relay_recv_metadata(struct lttcomm_relayd_hdr *recv_hdr, ret = -1; goto end_unlock; } + + + ret = write_padding_to_file(metadata_stream->fd, + be32toh(metadata_struct->padding_size)); + if (ret < 0) { + goto end_unlock; + } + DBG2("Relay metadata written"); end_unlock: @@ -1357,6 +1390,12 @@ int relay_process_data(struct relay_command *cmd, struct lttng_ht *streams_ht) ret = -1; goto end_unlock; } + + ret = write_padding_to_file(stream->fd, be32toh(data_hdr.padding_size)); + if (ret < 0) { + goto end_unlock; + } + DBG2("Relay wrote %d bytes to tracefile for stream id %" PRIu64, ret, stream->stream_handle); diff --git a/src/common/consumer.c b/src/common/consumer.c index f093f0c..16a6c47 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -542,7 +542,8 @@ error: * Return destination file descriptor or negative value on error. */ static int write_relayd_stream_header(struct lttng_consumer_stream *stream, - size_t data_size, struct consumer_relayd_sock_pair *relayd) + size_t data_size, unsigned long padding, + struct consumer_relayd_sock_pair *relayd) { int outfd = -1, ret; struct lttcomm_relayd_data_hdr data_hdr; @@ -567,6 +568,7 @@ static int write_relayd_stream_header(struct lttng_consumer_stream *stream, /* Set header with stream information */ data_hdr.stream_id = htobe64(stream->relayd_stream_id); data_hdr.data_size = htobe32(data_size); + data_hdr.padding_size = htobe32(padding); data_hdr.net_seq_num = htobe64(stream->next_net_seq_num++); /* Other fields are zeroed previously */ @@ -1094,22 +1096,23 @@ void lttng_consumer_destroy(struct lttng_consumer_local_data *ctx) */ static int write_relayd_metadata_id(int fd, struct lttng_consumer_stream *stream, - struct consumer_relayd_sock_pair *relayd) + struct consumer_relayd_sock_pair *relayd, + unsigned long padding) { int ret; - uint64_t metadata_id; + struct lttcomm_relayd_metadata_payload hdr; - metadata_id = htobe64(stream->relayd_stream_id); + hdr.stream_id = htobe64(stream->relayd_stream_id); + hdr.padding_size = htobe32(padding); do { - ret = write(fd, (void *) &metadata_id, - sizeof(stream->relayd_stream_id)); + ret = write(fd, (void *) &hdr, sizeof(hdr)); } while (ret < 0 && errno == EINTR); if (ret < 0) { PERROR("write metadata stream id"); goto end; } - DBG("Metadata stream id %" PRIu64 " written before data", - stream->relayd_stream_id); + DBG("Metadata stream id %" PRIu64 " with padding %lu written before data", + stream->relayd_stream_id, padding); end: return ret; @@ -1126,7 +1129,8 @@ end: */ ssize_t lttng_consumer_on_read_subbuffer_mmap( struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream, unsigned long len) + struct lttng_consumer_stream *stream, unsigned long len, + unsigned long padding) { unsigned long mmap_offset; ssize_t ret = 0, written = 0; @@ -1178,17 +1182,17 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap( if (stream->metadata_flag) { /* Metadata requires the control socket. */ pthread_mutex_lock(&relayd->ctrl_sock_mutex); - netlen += sizeof(stream->relayd_stream_id); + netlen += sizeof(struct lttcomm_relayd_metadata_payload); } - ret = write_relayd_stream_header(stream, netlen, relayd); + ret = write_relayd_stream_header(stream, netlen, padding, relayd); if (ret >= 0) { /* Use the returned socket. */ outfd = ret; /* Write metadata stream id before payload */ if (stream->metadata_flag) { - ret = write_relayd_metadata_id(outfd, stream, relayd); + ret = write_relayd_metadata_id(outfd, stream, relayd, padding); if (ret < 0) { written = ret; goto end; @@ -1196,12 +1200,16 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap( } } /* Else, use the default set before which is the filesystem. */ + } else { + /* No streaming, we have to set the len with the full padding */ + len += padding; } while (len > 0) { do { ret = write(outfd, stream->mmap_base + mmap_offset, len); } while (ret < 0 && errno == EINTR); + DBG("Consumer mmap write() ret %zd (len %lu)", ret, len); if (ret < 0) { PERROR("Error in file write"); if (written == 0) { @@ -1216,7 +1224,6 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap( len -= ret; mmap_offset += ret; } - DBG("Consumer mmap write() ret %zd (len %lu)", ret, len); /* This call is useless on a socket so better save a syscall. */ if (!relayd) { @@ -1246,7 +1253,8 @@ end: */ ssize_t lttng_consumer_on_read_subbuffer_splice( struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream, unsigned long len) + struct lttng_consumer_stream *stream, unsigned long len, + unsigned long padding) { ssize_t ret = 0, written = 0, ret_splice = 0; loff_t offset = 0; @@ -1292,23 +1300,42 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( } /* Write metadata stream id before payload */ - if (stream->metadata_flag && relayd) { - /* - * Lock the control socket for the complete duration of the function - * since from this point on we will use the socket. - */ - pthread_mutex_lock(&relayd->ctrl_sock_mutex); + if (relayd) { + int total_len = len; - ret = write_relayd_metadata_id(splice_pipe[1], stream, relayd); - if (ret < 0) { - written = ret; + if (stream->metadata_flag) { + /* + * Lock the control socket for the complete duration of the function + * since from this point on we will use the socket. + */ + pthread_mutex_lock(&relayd->ctrl_sock_mutex); + + ret = write_relayd_metadata_id(splice_pipe[1], stream, relayd, + padding); + if (ret < 0) { + written = ret; + goto end; + } + + total_len += sizeof(struct lttcomm_relayd_metadata_payload); + } + + ret = write_relayd_stream_header(stream, total_len, padding, relayd); + if (ret >= 0) { + /* Use the returned socket. */ + outfd = ret; + } else { + ERR("Remote relayd disconnected. Stopping"); goto end; } + } else { + /* No streaming, we have to set the len with the full padding */ + len += padding; } while (len > 0) { - DBG("splice chan to pipe offset %lu of len %lu (fd : %d)", - (unsigned long)offset, len, fd); + DBG("splice chan to pipe offset %lu of len %lu (fd : %d, pipe: %d)", + (unsigned long)offset, len, fd, splice_pipe[1]); ret_splice = splice(fd, &offset, splice_pipe[1], NULL, len, SPLICE_F_MOVE | SPLICE_F_MORE); DBG("splice chan to pipe, ret %zd", ret_splice); @@ -1324,30 +1351,24 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( /* Handle stream on the relayd if the output is on the network */ if (relayd) { if (stream->metadata_flag) { + size_t metadata_payload_size = + sizeof(struct lttcomm_relayd_metadata_payload); + /* Update counter to fit the spliced data */ - ret_splice += sizeof(stream->relayd_stream_id); - len += sizeof(stream->relayd_stream_id); + ret_splice += metadata_payload_size; + len += metadata_payload_size; /* * We do this so the return value can match the len passed as * argument to this function. */ - written -= sizeof(stream->relayd_stream_id); - } - - ret = write_relayd_stream_header(stream, ret_splice, relayd); - if (ret >= 0) { - /* Use the returned socket. */ - outfd = ret; - } else { - ERR("Remote relayd disconnected. Stopping"); - goto end; + written -= metadata_payload_size; } } /* Splice data out */ ret_splice = splice(splice_pipe[0], NULL, outfd, NULL, ret_splice, SPLICE_F_MOVE | SPLICE_F_MORE); - DBG("Kernel consumer splice pipe to file, ret %zd", ret_splice); + DBG("Consumer splice pipe to file, ret %zd", ret_splice); if (ret_splice < 0) { PERROR("Error in file splice"); if (written == 0) { diff --git a/src/common/consumer.h b/src/common/consumer.h index e307b18..4da4b70 100644 --- a/src/common/consumer.h +++ b/src/common/consumer.h @@ -364,10 +364,12 @@ extern struct lttng_consumer_local_data *lttng_consumer_create( extern void lttng_consumer_destroy(struct lttng_consumer_local_data *ctx); extern ssize_t lttng_consumer_on_read_subbuffer_mmap( struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream, unsigned long len); + struct lttng_consumer_stream *stream, unsigned long len, + unsigned long padding); extern ssize_t lttng_consumer_on_read_subbuffer_splice( struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream, unsigned long len); + struct lttng_consumer_stream *stream, unsigned long len, + unsigned long padding); extern int lttng_consumer_take_snapshot(struct lttng_consumer_local_data *ctx, struct lttng_consumer_stream *stream); extern int lttng_consumer_get_produced_snapshot( diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index fe93c2e..56f3011 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -295,7 +295,7 @@ end_nosignal: ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, struct lttng_consumer_local_data *ctx) { - unsigned long len; + unsigned long len, subbuf_size, padding; int err; ssize_t ret = 0; int infd = stream->wait_fd; @@ -304,7 +304,7 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, /* Get the next subbuffer */ err = kernctl_get_next_subbuf(infd); if (err != 0) { - ret = -err; + ret = err; /* * This is a debug message even for single-threaded consumer, * because poll() have more relaxed criterions than get subbuf, @@ -316,51 +316,68 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, goto end; } + /* Get the full subbuffer size including padding */ + err = kernctl_get_padded_subbuf_size(infd, &len); + if (err != 0) { + errno = -err; + perror("Getting sub-buffer len failed."); + ret = -err; + goto end; + } + switch (stream->output) { - case LTTNG_EVENT_SPLICE: - /* read the whole subbuffer */ - err = kernctl_get_padded_subbuf_size(infd, &len); - if (err != 0) { - errno = -err; - perror("Getting sub-buffer len failed."); - ret = -err; - goto end; - } + case LTTNG_EVENT_SPLICE: - /* splice the subbuffer to the tracefile */ - ret = lttng_consumer_on_read_subbuffer_splice(ctx, stream, len); - if (ret != len) { - /* - * display the error but continue processing to try - * to release the subbuffer - */ - ERR("Error splicing to tracefile (ret: %zd != len: %lu)", - ret, len); - } + /* + * XXX: The lttng-modules splice "actor" does not handle copying + * partial pages hence only using the subbuffer size without the + * padding makes the splice fail. + */ + subbuf_size = len; + padding = 0; + + /* splice the subbuffer to the tracefile */ + ret = lttng_consumer_on_read_subbuffer_splice(ctx, stream, + subbuf_size, padding); + if (ret != subbuf_size) { + /* + * display the error but continue processing to try + * to release the subbuffer + */ + ERR("Error splicing to tracefile (ret: %zd != len: %lu)", + ret, subbuf_size); + } + break; + case LTTNG_EVENT_MMAP: + /* Get subbuffer size without padding */ + err = kernctl_get_subbuf_size(infd, &subbuf_size); + if (err != 0) { + errno = -err; + perror("Getting sub-buffer len failed."); + ret = -err; + goto end; + } - break; - case LTTNG_EVENT_MMAP: - /* read the used subbuffer size */ - err = kernctl_get_padded_subbuf_size(infd, &len); - if (err != 0) { - errno = -err; - perror("Getting sub-buffer len failed."); - ret = -err; - goto end; - } - /* write the subbuffer to the tracefile */ - ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if (ret != len) { - /* - * display the error but continue processing to try - * to release the subbuffer - */ - ERR("Error writing to tracefile"); - } - break; - default: - ERR("Unknown output method"); - ret = -1; + /* Make sure the tracer is not gone mad on us! */ + assert(len >= subbuf_size); + + padding = len - subbuf_size; + + /* write the subbuffer to the tracefile */ + ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, + subbuf_size, padding); + if (ret != subbuf_size) { + /* + * display the error but continue processing to try + * to release the subbuffer + */ + ERR("Error writing to tracefile (ret: %zd != len: %lu", + ret, subbuf_size); + } + break; + default: + ERR("Unknown output method"); + ret = -1; } err = kernctl_put_next_subbuf(infd); diff --git a/src/common/sessiond-comm/relayd.h b/src/common/sessiond-comm/relayd.h index 24b7c91..5d4fddf 100644 --- a/src/common/sessiond-comm/relayd.h +++ b/src/common/sessiond-comm/relayd.h @@ -49,6 +49,7 @@ struct lttcomm_relayd_data_hdr { uint64_t stream_id; /* Stream ID known by the relayd */ uint64_t net_seq_num; /* Network sequence number, per stream. */ uint32_t data_size; /* data size following this header */ + uint32_t padding_size; /* Size of 0 padding the data */ } __attribute__ ((__packed__)); /* @@ -94,6 +95,7 @@ struct lttcomm_relayd_version { */ struct lttcomm_relayd_metadata_payload { uint64_t stream_id; + uint32_t padding_size; char payload[]; } __attribute__ ((__packed__)); diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 1544ddb..e7d6dd4 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -399,7 +399,7 @@ void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream) int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, struct lttng_consumer_local_data *ctx) { - unsigned long len; + unsigned long len, subbuf_size, padding; int err; long ret = 0; struct lttng_ust_shm_handle *handle; @@ -426,7 +426,7 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, /* Get the next subbuffer */ err = ustctl_get_next_subbuf(handle, buf); if (err != 0) { - ret = -err; /* ustctl_get_next_subbuf returns negative, caller expect positive. */ + ret = err; /* ustctl_get_next_subbuf returns negative, caller expect positive. */ /* * This is a debug message even for single-threaded consumer, * because poll() have more relaxed criterions than get subbuf, @@ -438,12 +438,21 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, goto end; } assert(stream->output == LTTNG_EVENT_MMAP); - /* read the used subbuffer size */ + /* Get the full padded subbuffer size */ err = ustctl_get_padded_subbuf_size(handle, buf, &len); assert(err == 0); + + /* Get subbuffer data size (without padding) */ + err = ustctl_get_subbuf_size(handle, buf, &subbuf_size); + assert(err == 0); + + /* Make sure we don't get a subbuffer size bigger than the padded */ + assert(len >= subbuf_size); + + padding = len - subbuf_size; /* write the subbuffer to the tracefile */ - ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if (ret != len) { + ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, subbuf_size, padding); + if (ret != subbuf_size) { /* * display the error but continue processing to try * to release the subbuffer diff --git a/src/common/ust-consumer/ust-consumer.h b/src/common/ust-consumer/ust-consumer.h index 7e055a9..3f76f23 100644 --- a/src/common/ust-consumer/ust-consumer.h +++ b/src/common/ust-consumer/ust-consumer.h @@ -67,7 +67,8 @@ extern int lttng_ustctl_get_mmap_read_offset( static inline ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream, unsigned long len) + struct lttng_consumer_stream *stream, unsigned long len, + unsigned long padding) { return -ENOSYS; } @@ -75,7 +76,8 @@ ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( static inline ssize_t lttng_ustconsumer_on_read_subbuffer_splice( struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *uststream, unsigned long len) + struct lttng_consumer_stream *uststream, unsigned long len, + unsigned long padding) { return -ENOSYS; } -- 1.7.10.4 From mathieu.desnoyers at efficios.com Thu Sep 13 15:52:06 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 13 Sep 2012 15:52:06 -0400 Subject: [lttng-dev] [lttng-tools PATCH] Don't send the subbuffer padding for streaming In-Reply-To: <1347560715-18710-1-git-send-email-dgoulet@efficios.com> References: <1347560715-18710-1-git-send-email-dgoulet@efficios.com> Message-ID: <20120913195205.GA3404@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > For network streaming, with the mmap() mechanism only for now, the > consumer does NOT send the padding over the network. Instead, the size > of the padding is specified in the data header or metadata payload. > > The lttng-relayd now is the one appending the zeros to the trace files. > > Again, this functionnality is NOT available yet for splice output. functionality -> feature > > Signed-off-by: David Goulet > --- > src/bin/lttng-relayd/main.c | 39 ++++++++++ > src/common/consumer.c | 97 ++++++++++++++---------- > src/common/consumer.h | 6 +- > src/common/kernel-consumer/kernel-consumer.c | 105 +++++++++++++++----------- > src/common/sessiond-comm/relayd.h | 2 + > src/common/ust-consumer/ust-consumer.c | 19 +++-- > src/common/ust-consumer/ust-consumer.h | 6 +- > 7 files changed, 183 insertions(+), 91 deletions(-) > > diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c > index e9b70a3..f60199b 100644 > --- a/src/bin/lttng-relayd/main.c > +++ b/src/bin/lttng-relayd/main.c > @@ -1145,6 +1145,31 @@ end: > } > > /* > + * Append padding to the file pointed by the file descriptor fd. > + */ > +static int write_padding_to_file(int fd, uint32_t size) > +{ > + int ret = 0; > + char zeros[size]; Ouch, I don't like to see this on the stack. In user-space, the stack is usually limited to 8MB, but pthread could be configured to less than that. A quick solution is to allocate memory dynamically for that, and free it at the end of the function. > + > + if (size == 0) { > + goto end; > + } > + > + memset(zeros, 0, size); > + > + do { > + ret = write(fd, zeros, size); > + } while (ret < 0 && errno == EINTR); > + if (ret < 0) { > + PERROR("write padding to file"); > + } > + > +end: > + return ret; > +} > + > +/* > * relay_recv_metadata: receive the metada for the session. > */ > static > @@ -1208,6 +1233,14 @@ int relay_recv_metadata(struct lttcomm_relayd_hdr *recv_hdr, > ret = -1; > goto end_unlock; > } > + > + Could remove a newline here. > + ret = write_padding_to_file(metadata_stream->fd, > + be32toh(metadata_struct->padding_size)); > + if (ret < 0) { > + goto end_unlock; > + } > + > DBG2("Relay metadata written"); > > end_unlock: > @@ -1357,6 +1390,12 @@ int relay_process_data(struct relay_command *cmd, struct lttng_ht *streams_ht) > ret = -1; > goto end_unlock; > } > + > + ret = write_padding_to_file(stream->fd, be32toh(data_hdr.padding_size)); > + if (ret < 0) { > + goto end_unlock; > + } > + > DBG2("Relay wrote %d bytes to tracefile for stream id %" PRIu64, > ret, stream->stream_handle); > > diff --git a/src/common/consumer.c b/src/common/consumer.c > index f093f0c..16a6c47 100644 > --- a/src/common/consumer.c > +++ b/src/common/consumer.c > @@ -542,7 +542,8 @@ error: > * Return destination file descriptor or negative value on error. > */ > static int write_relayd_stream_header(struct lttng_consumer_stream *stream, > - size_t data_size, struct consumer_relayd_sock_pair *relayd) > + size_t data_size, unsigned long padding, > + struct consumer_relayd_sock_pair *relayd) > { > int outfd = -1, ret; > struct lttcomm_relayd_data_hdr data_hdr; > @@ -567,6 +568,7 @@ static int write_relayd_stream_header(struct lttng_consumer_stream *stream, > /* Set header with stream information */ > data_hdr.stream_id = htobe64(stream->relayd_stream_id); > data_hdr.data_size = htobe32(data_size); > + data_hdr.padding_size = htobe32(padding); > data_hdr.net_seq_num = htobe64(stream->next_net_seq_num++); > /* Other fields are zeroed previously */ > > @@ -1094,22 +1096,23 @@ void lttng_consumer_destroy(struct lttng_consumer_local_data *ctx) > */ > static int write_relayd_metadata_id(int fd, > struct lttng_consumer_stream *stream, > - struct consumer_relayd_sock_pair *relayd) > + struct consumer_relayd_sock_pair *relayd, > + unsigned long padding) > { > int ret; > - uint64_t metadata_id; > + struct lttcomm_relayd_metadata_payload hdr; > > - metadata_id = htobe64(stream->relayd_stream_id); > + hdr.stream_id = htobe64(stream->relayd_stream_id); > + hdr.padding_size = htobe32(padding); > do { > - ret = write(fd, (void *) &metadata_id, > - sizeof(stream->relayd_stream_id)); > + ret = write(fd, (void *) &hdr, sizeof(hdr)); > } while (ret < 0 && errno == EINTR); > if (ret < 0) { > PERROR("write metadata stream id"); > goto end; > } > - DBG("Metadata stream id %" PRIu64 " written before data", > - stream->relayd_stream_id); > + DBG("Metadata stream id %" PRIu64 " with padding %lu written before data", > + stream->relayd_stream_id, padding); > > end: > return ret; > @@ -1126,7 +1129,8 @@ end: > */ > ssize_t lttng_consumer_on_read_subbuffer_mmap( > struct lttng_consumer_local_data *ctx, > - struct lttng_consumer_stream *stream, unsigned long len) > + struct lttng_consumer_stream *stream, unsigned long len, > + unsigned long padding) > { > unsigned long mmap_offset; > ssize_t ret = 0, written = 0; > @@ -1178,17 +1182,17 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap( > if (stream->metadata_flag) { > /* Metadata requires the control socket. */ > pthread_mutex_lock(&relayd->ctrl_sock_mutex); > - netlen += sizeof(stream->relayd_stream_id); > + netlen += sizeof(struct lttcomm_relayd_metadata_payload); > } > > - ret = write_relayd_stream_header(stream, netlen, relayd); > + ret = write_relayd_stream_header(stream, netlen, padding, relayd); > if (ret >= 0) { > /* Use the returned socket. */ > outfd = ret; > > /* Write metadata stream id before payload */ > if (stream->metadata_flag) { > - ret = write_relayd_metadata_id(outfd, stream, relayd); > + ret = write_relayd_metadata_id(outfd, stream, relayd, padding); > if (ret < 0) { > written = ret; > goto end; > @@ -1196,12 +1200,16 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap( > } > } > /* Else, use the default set before which is the filesystem. */ > + } else { > + /* No streaming, we have to set the len with the full padding */ > + len += padding; > } > > while (len > 0) { > do { > ret = write(outfd, stream->mmap_base + mmap_offset, len); > } while (ret < 0 && errno == EINTR); > + DBG("Consumer mmap write() ret %zd (len %lu)", ret, len); > if (ret < 0) { > PERROR("Error in file write"); > if (written == 0) { > @@ -1216,7 +1224,6 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap( > len -= ret; > mmap_offset += ret; > } > - DBG("Consumer mmap write() ret %zd (len %lu)", ret, len); > > /* This call is useless on a socket so better save a syscall. */ > if (!relayd) { > @@ -1246,7 +1253,8 @@ end: > */ > ssize_t lttng_consumer_on_read_subbuffer_splice( > struct lttng_consumer_local_data *ctx, > - struct lttng_consumer_stream *stream, unsigned long len) > + struct lttng_consumer_stream *stream, unsigned long len, > + unsigned long padding) > { > ssize_t ret = 0, written = 0, ret_splice = 0; > loff_t offset = 0; > @@ -1292,23 +1300,42 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( > } > > /* Write metadata stream id before payload */ > - if (stream->metadata_flag && relayd) { > - /* > - * Lock the control socket for the complete duration of the function > - * since from this point on we will use the socket. > - */ > - pthread_mutex_lock(&relayd->ctrl_sock_mutex); > + if (relayd) { > + int total_len = len; > > - ret = write_relayd_metadata_id(splice_pipe[1], stream, relayd); > - if (ret < 0) { > - written = ret; > + if (stream->metadata_flag) { > + /* > + * Lock the control socket for the complete duration of the function > + * since from this point on we will use the socket. > + */ > + pthread_mutex_lock(&relayd->ctrl_sock_mutex); > + > + ret = write_relayd_metadata_id(splice_pipe[1], stream, relayd, > + padding); > + if (ret < 0) { > + written = ret; > + goto end; > + } > + > + total_len += sizeof(struct lttcomm_relayd_metadata_payload); > + } > + > + ret = write_relayd_stream_header(stream, total_len, padding, relayd); > + if (ret >= 0) { > + /* Use the returned socket. */ > + outfd = ret; > + } else { > + ERR("Remote relayd disconnected. Stopping"); > goto end; > } > + } else { > + /* No streaming, we have to set the len with the full padding */ > + len += padding; > } > > while (len > 0) { > - DBG("splice chan to pipe offset %lu of len %lu (fd : %d)", > - (unsigned long)offset, len, fd); > + DBG("splice chan to pipe offset %lu of len %lu (fd : %d, pipe: %d)", > + (unsigned long)offset, len, fd, splice_pipe[1]); > ret_splice = splice(fd, &offset, splice_pipe[1], NULL, len, > SPLICE_F_MOVE | SPLICE_F_MORE); > DBG("splice chan to pipe, ret %zd", ret_splice); > @@ -1324,30 +1351,24 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( > /* Handle stream on the relayd if the output is on the network */ > if (relayd) { > if (stream->metadata_flag) { > + size_t metadata_payload_size = > + sizeof(struct lttcomm_relayd_metadata_payload); > + > /* Update counter to fit the spliced data */ > - ret_splice += sizeof(stream->relayd_stream_id); > - len += sizeof(stream->relayd_stream_id); > + ret_splice += metadata_payload_size; > + len += metadata_payload_size; > /* > * We do this so the return value can match the len passed as > * argument to this function. > */ > - written -= sizeof(stream->relayd_stream_id); > - } > - > - ret = write_relayd_stream_header(stream, ret_splice, relayd); > - if (ret >= 0) { > - /* Use the returned socket. */ > - outfd = ret; > - } else { > - ERR("Remote relayd disconnected. Stopping"); > - goto end; > + written -= metadata_payload_size; > } > } > > /* Splice data out */ > ret_splice = splice(splice_pipe[0], NULL, outfd, NULL, > ret_splice, SPLICE_F_MOVE | SPLICE_F_MORE); > - DBG("Kernel consumer splice pipe to file, ret %zd", ret_splice); > + DBG("Consumer splice pipe to file, ret %zd", ret_splice); > if (ret_splice < 0) { > PERROR("Error in file splice"); > if (written == 0) { > diff --git a/src/common/consumer.h b/src/common/consumer.h > index e307b18..4da4b70 100644 > --- a/src/common/consumer.h > +++ b/src/common/consumer.h > @@ -364,10 +364,12 @@ extern struct lttng_consumer_local_data *lttng_consumer_create( > extern void lttng_consumer_destroy(struct lttng_consumer_local_data *ctx); > extern ssize_t lttng_consumer_on_read_subbuffer_mmap( > struct lttng_consumer_local_data *ctx, > - struct lttng_consumer_stream *stream, unsigned long len); > + struct lttng_consumer_stream *stream, unsigned long len, > + unsigned long padding); > extern ssize_t lttng_consumer_on_read_subbuffer_splice( > struct lttng_consumer_local_data *ctx, > - struct lttng_consumer_stream *stream, unsigned long len); > + struct lttng_consumer_stream *stream, unsigned long len, > + unsigned long padding); > extern int lttng_consumer_take_snapshot(struct lttng_consumer_local_data *ctx, > struct lttng_consumer_stream *stream); > extern int lttng_consumer_get_produced_snapshot( > diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c > index fe93c2e..56f3011 100644 > --- a/src/common/kernel-consumer/kernel-consumer.c > +++ b/src/common/kernel-consumer/kernel-consumer.c > @@ -295,7 +295,7 @@ end_nosignal: > ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, > struct lttng_consumer_local_data *ctx) > { > - unsigned long len; > + unsigned long len, subbuf_size, padding; > int err; > ssize_t ret = 0; > int infd = stream->wait_fd; > @@ -304,7 +304,7 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, > /* Get the next subbuffer */ > err = kernctl_get_next_subbuf(infd); > if (err != 0) { > - ret = -err; > + ret = err; > /* > * This is a debug message even for single-threaded consumer, > * because poll() have more relaxed criterions than get subbuf, > @@ -316,51 +316,68 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream, > goto end; > } > > + /* Get the full subbuffer size including padding */ > + err = kernctl_get_padded_subbuf_size(infd, &len); > + if (err != 0) { > + errno = -err; > + perror("Getting sub-buffer len failed."); > + ret = -err; ret = err instead ? > + goto end; > + } > + > switch (stream->output) { > - case LTTNG_EVENT_SPLICE: > - /* read the whole subbuffer */ > - err = kernctl_get_padded_subbuf_size(infd, &len); > - if (err != 0) { > - errno = -err; > - perror("Getting sub-buffer len failed."); > - ret = -err; > - goto end; > - } > + case LTTNG_EVENT_SPLICE: > > - /* splice the subbuffer to the tracefile */ > - ret = lttng_consumer_on_read_subbuffer_splice(ctx, stream, len); > - if (ret != len) { > - /* > - * display the error but continue processing to try > - * to release the subbuffer > - */ > - ERR("Error splicing to tracefile (ret: %zd != len: %lu)", > - ret, len); > - } > + /* > + * XXX: The lttng-modules splice "actor" does not handle copying > + * partial pages hence only using the subbuffer size without the > + * padding makes the splice fail. > + */ > + subbuf_size = len; > + padding = 0; > + > + /* splice the subbuffer to the tracefile */ > + ret = lttng_consumer_on_read_subbuffer_splice(ctx, stream, > + subbuf_size, padding); > + if (ret != subbuf_size) { > + /* > + * display the error but continue processing to try > + * to release the subbuffer > + */ > + ERR("Error splicing to tracefile (ret: %zd != len: %lu)", > + ret, subbuf_size); > + } > + break; > + case LTTNG_EVENT_MMAP: > + /* Get subbuffer size without padding */ > + err = kernctl_get_subbuf_size(infd, &subbuf_size); > + if (err != 0) { > + errno = -err; > + perror("Getting sub-buffer len failed."); > + ret = -err; ret = err ? Thanks, Mathieu > + goto end; > + } > > - break; > - case LTTNG_EVENT_MMAP: > - /* read the used subbuffer size */ > - err = kernctl_get_padded_subbuf_size(infd, &len); > - if (err != 0) { > - errno = -err; > - perror("Getting sub-buffer len failed."); > - ret = -err; > - goto end; > - } > - /* write the subbuffer to the tracefile */ > - ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); > - if (ret != len) { > - /* > - * display the error but continue processing to try > - * to release the subbuffer > - */ > - ERR("Error writing to tracefile"); > - } > - break; > - default: > - ERR("Unknown output method"); > - ret = -1; > + /* Make sure the tracer is not gone mad on us! */ > + assert(len >= subbuf_size); > + > + padding = len - subbuf_size; > + > + /* write the subbuffer to the tracefile */ > + ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, > + subbuf_size, padding); > + if (ret != subbuf_size) { > + /* > + * display the error but continue processing to try > + * to release the subbuffer > + */ > + ERR("Error writing to tracefile (ret: %zd != len: %lu", > + ret, subbuf_size); > + } > + break; > + default: > + ERR("Unknown output method"); > + ret = -1; > } > > err = kernctl_put_next_subbuf(infd); > diff --git a/src/common/sessiond-comm/relayd.h b/src/common/sessiond-comm/relayd.h > index 24b7c91..5d4fddf 100644 > --- a/src/common/sessiond-comm/relayd.h > +++ b/src/common/sessiond-comm/relayd.h > @@ -49,6 +49,7 @@ struct lttcomm_relayd_data_hdr { > uint64_t stream_id; /* Stream ID known by the relayd */ > uint64_t net_seq_num; /* Network sequence number, per stream. */ > uint32_t data_size; /* data size following this header */ > + uint32_t padding_size; /* Size of 0 padding the data */ > } __attribute__ ((__packed__)); > > /* > @@ -94,6 +95,7 @@ struct lttcomm_relayd_version { > */ > struct lttcomm_relayd_metadata_payload { > uint64_t stream_id; > + uint32_t padding_size; > char payload[]; > } __attribute__ ((__packed__)); > > diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c > index 1544ddb..e7d6dd4 100644 > --- a/src/common/ust-consumer/ust-consumer.c > +++ b/src/common/ust-consumer/ust-consumer.c > @@ -399,7 +399,7 @@ void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream) > int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, > struct lttng_consumer_local_data *ctx) > { > - unsigned long len; > + unsigned long len, subbuf_size, padding; > int err; > long ret = 0; > struct lttng_ust_shm_handle *handle; > @@ -426,7 +426,7 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, > /* Get the next subbuffer */ > err = ustctl_get_next_subbuf(handle, buf); > if (err != 0) { > - ret = -err; /* ustctl_get_next_subbuf returns negative, caller expect positive. */ > + ret = err; /* ustctl_get_next_subbuf returns negative, caller expect positive. */ > /* > * This is a debug message even for single-threaded consumer, > * because poll() have more relaxed criterions than get subbuf, > @@ -438,12 +438,21 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, > goto end; > } > assert(stream->output == LTTNG_EVENT_MMAP); > - /* read the used subbuffer size */ > + /* Get the full padded subbuffer size */ > err = ustctl_get_padded_subbuf_size(handle, buf, &len); > assert(err == 0); > + > + /* Get subbuffer data size (without padding) */ > + err = ustctl_get_subbuf_size(handle, buf, &subbuf_size); > + assert(err == 0); > + > + /* Make sure we don't get a subbuffer size bigger than the padded */ > + assert(len >= subbuf_size); > + > + padding = len - subbuf_size; > /* write the subbuffer to the tracefile */ > - ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); > - if (ret != len) { > + ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, subbuf_size, padding); > + if (ret != subbuf_size) { > /* > * display the error but continue processing to try > * to release the subbuffer > diff --git a/src/common/ust-consumer/ust-consumer.h b/src/common/ust-consumer/ust-consumer.h > index 7e055a9..3f76f23 100644 > --- a/src/common/ust-consumer/ust-consumer.h > +++ b/src/common/ust-consumer/ust-consumer.h > @@ -67,7 +67,8 @@ extern int lttng_ustctl_get_mmap_read_offset( > static inline > ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( > struct lttng_consumer_local_data *ctx, > - struct lttng_consumer_stream *stream, unsigned long len) > + struct lttng_consumer_stream *stream, unsigned long len, > + unsigned long padding) > { > return -ENOSYS; > } > @@ -75,7 +76,8 @@ ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( > static inline > ssize_t lttng_ustconsumer_on_read_subbuffer_splice( > struct lttng_consumer_local_data *ctx, > - struct lttng_consumer_stream *uststream, unsigned long len) > + struct lttng_consumer_stream *uststream, unsigned long len, > + unsigned long padding) > { > return -ENOSYS; > } > -- > 1.7.10.4 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Thu Sep 13 15:57:17 2012 From: dgoulet at efficios.com (David Goulet) Date: Thu, 13 Sep 2012 15:57:17 -0400 Subject: [lttng-dev] [lttng-tools PATCH] Don't send the subbuffer padding for streaming In-Reply-To: <20120913195205.GA3404@Krystal> References: <1347560715-18710-1-git-send-email-dgoulet@efficios.com> <20120913195205.GA3404@Krystal> Message-ID: <50523A9D.9040002@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Mathieu Desnoyers: > * David Goulet (dgoulet at efficios.com) wrote: >> For network streaming, with the mmap() mechanism only for now, >> the consumer does NOT send the padding over the network. Instead, >> the size of the padding is specified in the data header or >> metadata payload. >> >> The lttng-relayd now is the one appending the zeros to the trace >> files. >> >> Again, this functionnality is NOT available yet for splice >> output. > > functionality -> feature > >> >> Signed-off-by: David Goulet --- >> src/bin/lttng-relayd/main.c | 39 ++++++++++ >> src/common/consumer.c | 97 >> ++++++++++++++---------- src/common/consumer.h >> | 6 +- src/common/kernel-consumer/kernel-consumer.c | 105 >> +++++++++++++++----------- src/common/sessiond-comm/relayd.h >> | 2 + src/common/ust-consumer/ust-consumer.c | 19 >> +++-- src/common/ust-consumer/ust-consumer.h | 6 +- 7 >> files changed, 183 insertions(+), 91 deletions(-) >> >> diff --git a/src/bin/lttng-relayd/main.c >> b/src/bin/lttng-relayd/main.c index e9b70a3..f60199b 100644 --- >> a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c >> @@ -1145,6 +1145,31 @@ end: } >> >> /* + * Append padding to the file pointed by the file descriptor >> fd. + */ +static int write_padding_to_file(int fd, uint32_t >> size) +{ + int ret = 0; + char zeros[size]; > > Ouch, I don't like to see this on the stack. In user-space, the > stack is usually limited to 8MB, but pthread could be configured to > less than that. > > A quick solution is to allocate memory dynamically for that, and > free it at the end of the function. Hmmm right! > >> + + if (size == 0) { + goto end; + } + + memset(zeros, 0, >> size); + + do { + ret = write(fd, zeros, size); + } while (ret < >> 0 && errno == EINTR); + if (ret < 0) { + PERROR("write padding >> to file"); + } + +end: + return ret; +} + +/* * >> relay_recv_metadata: receive the metada for the session. */ >> static @@ -1208,6 +1233,14 @@ int relay_recv_metadata(struct >> lttcomm_relayd_hdr *recv_hdr, ret = -1; goto end_unlock; } + + > > Could remove a newline here. > >> + ret = write_padding_to_file(metadata_stream->fd, + >> be32toh(metadata_struct->padding_size)); + if (ret < 0) { + goto >> end_unlock; + } + DBG2("Relay metadata written"); >> >> end_unlock: @@ -1357,6 +1390,12 @@ int relay_process_data(struct >> relay_command *cmd, struct lttng_ht *streams_ht) ret = -1; goto >> end_unlock; } + + ret = write_padding_to_file(stream->fd, >> be32toh(data_hdr.padding_size)); + if (ret < 0) { + goto >> end_unlock; + } + DBG2("Relay wrote %d bytes to tracefile for >> stream id %" PRIu64, ret, stream->stream_handle); >> >> diff --git a/src/common/consumer.c b/src/common/consumer.c index >> f093f0c..16a6c47 100644 --- a/src/common/consumer.c +++ >> b/src/common/consumer.c @@ -542,7 +542,8 @@ error: * Return >> destination file descriptor or negative value on error. */ static >> int write_relayd_stream_header(struct lttng_consumer_stream >> *stream, - size_t data_size, struct consumer_relayd_sock_pair >> *relayd) + size_t data_size, unsigned long padding, + struct >> consumer_relayd_sock_pair *relayd) { int outfd = -1, ret; struct >> lttcomm_relayd_data_hdr data_hdr; @@ -567,6 +568,7 @@ static int >> write_relayd_stream_header(struct lttng_consumer_stream *stream, >> /* Set header with stream information */ data_hdr.stream_id = >> htobe64(stream->relayd_stream_id); data_hdr.data_size = >> htobe32(data_size); + data_hdr.padding_size = htobe32(padding); >> data_hdr.net_seq_num = htobe64(stream->next_net_seq_num++); /* >> Other fields are zeroed previously */ >> >> @@ -1094,22 +1096,23 @@ void lttng_consumer_destroy(struct >> lttng_consumer_local_data *ctx) */ static int >> write_relayd_metadata_id(int fd, struct lttng_consumer_stream >> *stream, - struct consumer_relayd_sock_pair *relayd) + struct >> consumer_relayd_sock_pair *relayd, + unsigned long padding) { >> int ret; - uint64_t metadata_id; + struct >> lttcomm_relayd_metadata_payload hdr; >> >> - metadata_id = htobe64(stream->relayd_stream_id); + >> hdr.stream_id = htobe64(stream->relayd_stream_id); + >> hdr.padding_size = htobe32(padding); do { - ret = write(fd, >> (void *) &metadata_id, - sizeof(stream->relayd_stream_id)); + >> ret = write(fd, (void *) &hdr, sizeof(hdr)); } while (ret < 0 && >> errno == EINTR); if (ret < 0) { PERROR("write metadata stream >> id"); goto end; } - DBG("Metadata stream id %" PRIu64 " written >> before data", - stream->relayd_stream_id); + DBG("Metadata >> stream id %" PRIu64 " with padding %lu written before data", + >> stream->relayd_stream_id, padding); >> >> end: return ret; @@ -1126,7 +1129,8 @@ end: */ ssize_t >> lttng_consumer_on_read_subbuffer_mmap( struct >> lttng_consumer_local_data *ctx, - struct lttng_consumer_stream >> *stream, unsigned long len) + struct lttng_consumer_stream >> *stream, unsigned long len, + unsigned long padding) { unsigned >> long mmap_offset; ssize_t ret = 0, written = 0; @@ -1178,17 >> +1182,17 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap( if >> (stream->metadata_flag) { /* Metadata requires the control >> socket. */ pthread_mutex_lock(&relayd->ctrl_sock_mutex); - >> netlen += sizeof(stream->relayd_stream_id); + netlen += >> sizeof(struct lttcomm_relayd_metadata_payload); } >> >> - ret = write_relayd_stream_header(stream, netlen, relayd); + >> ret = write_relayd_stream_header(stream, netlen, padding, >> relayd); if (ret >= 0) { /* Use the returned socket. */ outfd = >> ret; >> >> /* Write metadata stream id before payload */ if >> (stream->metadata_flag) { - ret = >> write_relayd_metadata_id(outfd, stream, relayd); + ret = >> write_relayd_metadata_id(outfd, stream, relayd, padding); if (ret >> < 0) { written = ret; goto end; @@ -1196,12 +1200,16 @@ ssize_t >> lttng_consumer_on_read_subbuffer_mmap( } } /* Else, use the >> default set before which is the filesystem. */ + } else { + /* >> No streaming, we have to set the len with the full padding */ + >> len += padding; } >> >> while (len > 0) { do { ret = write(outfd, stream->mmap_base + >> mmap_offset, len); } while (ret < 0 && errno == EINTR); + >> DBG("Consumer mmap write() ret %zd (len %lu)", ret, len); if (ret >> < 0) { PERROR("Error in file write"); if (written == 0) { @@ >> -1216,7 +1224,6 @@ ssize_t >> lttng_consumer_on_read_subbuffer_mmap( len -= ret; mmap_offset += >> ret; } - DBG("Consumer mmap write() ret %zd (len %lu)", ret, >> len); >> >> /* This call is useless on a socket so better save a syscall. */ >> if (!relayd) { @@ -1246,7 +1253,8 @@ end: */ ssize_t >> lttng_consumer_on_read_subbuffer_splice( struct >> lttng_consumer_local_data *ctx, - struct lttng_consumer_stream >> *stream, unsigned long len) + struct lttng_consumer_stream >> *stream, unsigned long len, + unsigned long padding) { ssize_t >> ret = 0, written = 0, ret_splice = 0; loff_t offset = 0; @@ >> -1292,23 +1300,42 @@ ssize_t >> lttng_consumer_on_read_subbuffer_splice( } >> >> /* Write metadata stream id before payload */ - if >> (stream->metadata_flag && relayd) { - /* - * Lock the control >> socket for the complete duration of the function - * since from >> this point on we will use the socket. - */ - >> pthread_mutex_lock(&relayd->ctrl_sock_mutex); + if (relayd) { + >> int total_len = len; >> >> - ret = write_relayd_metadata_id(splice_pipe[1], stream, >> relayd); - if (ret < 0) { - written = ret; + if >> (stream->metadata_flag) { + /* + * Lock the control socket >> for the complete duration of the function + * since from this >> point on we will use the socket. + */ + >> pthread_mutex_lock(&relayd->ctrl_sock_mutex); + + ret = >> write_relayd_metadata_id(splice_pipe[1], stream, relayd, + >> padding); + if (ret < 0) { + written = ret; + goto end; + >> } + + total_len += sizeof(struct >> lttcomm_relayd_metadata_payload); + } + + ret = >> write_relayd_stream_header(stream, total_len, padding, relayd); + >> if (ret >= 0) { + /* Use the returned socket. */ + outfd = >> ret; + } else { + ERR("Remote relayd disconnected. >> Stopping"); goto end; } + } else { + /* No streaming, we have to >> set the len with the full padding */ + len += padding; } >> >> while (len > 0) { - DBG("splice chan to pipe offset %lu of len >> %lu (fd : %d)", - (unsigned long)offset, len, fd); + >> DBG("splice chan to pipe offset %lu of len %lu (fd : %d, pipe: >> %d)", + (unsigned long)offset, len, fd, splice_pipe[1]); >> ret_splice = splice(fd, &offset, splice_pipe[1], NULL, len, >> SPLICE_F_MOVE | SPLICE_F_MORE); DBG("splice chan to pipe, ret >> %zd", ret_splice); @@ -1324,30 +1351,24 @@ ssize_t >> lttng_consumer_on_read_subbuffer_splice( /* Handle stream on the >> relayd if the output is on the network */ if (relayd) { if >> (stream->metadata_flag) { + size_t metadata_payload_size = + >> sizeof(struct lttcomm_relayd_metadata_payload); + /* Update >> counter to fit the spliced data */ - ret_splice += >> sizeof(stream->relayd_stream_id); - len += >> sizeof(stream->relayd_stream_id); + ret_splice += >> metadata_payload_size; + len += metadata_payload_size; /* * We >> do this so the return value can match the len passed as * >> argument to this function. */ - written -= >> sizeof(stream->relayd_stream_id); - } - - ret = >> write_relayd_stream_header(stream, ret_splice, relayd); - if >> (ret >= 0) { - /* Use the returned socket. */ - outfd = >> ret; - } else { - ERR("Remote relayd disconnected. >> Stopping"); - goto end; + written -= >> metadata_payload_size; } } >> >> /* Splice data out */ ret_splice = splice(splice_pipe[0], NULL, >> outfd, NULL, ret_splice, SPLICE_F_MOVE | SPLICE_F_MORE); - >> DBG("Kernel consumer splice pipe to file, ret %zd", ret_splice); >> + DBG("Consumer splice pipe to file, ret %zd", ret_splice); if >> (ret_splice < 0) { PERROR("Error in file splice"); if (written == >> 0) { diff --git a/src/common/consumer.h b/src/common/consumer.h >> index e307b18..4da4b70 100644 --- a/src/common/consumer.h +++ >> b/src/common/consumer.h @@ -364,10 +364,12 @@ extern struct >> lttng_consumer_local_data *lttng_consumer_create( extern void >> lttng_consumer_destroy(struct lttng_consumer_local_data *ctx); >> extern ssize_t lttng_consumer_on_read_subbuffer_mmap( struct >> lttng_consumer_local_data *ctx, - struct lttng_consumer_stream >> *stream, unsigned long len); + struct lttng_consumer_stream >> *stream, unsigned long len, + unsigned long padding); extern >> ssize_t lttng_consumer_on_read_subbuffer_splice( struct >> lttng_consumer_local_data *ctx, - struct lttng_consumer_stream >> *stream, unsigned long len); + struct lttng_consumer_stream >> *stream, unsigned long len, + unsigned long padding); extern int >> lttng_consumer_take_snapshot(struct lttng_consumer_local_data >> *ctx, struct lttng_consumer_stream *stream); extern int >> lttng_consumer_get_produced_snapshot( diff --git >> a/src/common/kernel-consumer/kernel-consumer.c >> b/src/common/kernel-consumer/kernel-consumer.c index >> fe93c2e..56f3011 100644 --- >> a/src/common/kernel-consumer/kernel-consumer.c +++ >> b/src/common/kernel-consumer/kernel-consumer.c @@ -295,7 +295,7 >> @@ end_nosignal: ssize_t lttng_kconsumer_read_subbuffer(struct >> lttng_consumer_stream *stream, struct lttng_consumer_local_data >> *ctx) { - unsigned long len; + unsigned long len, subbuf_size, >> padding; int err; ssize_t ret = 0; int infd = stream->wait_fd; @@ >> -304,7 +304,7 @@ ssize_t lttng_kconsumer_read_subbuffer(struct >> lttng_consumer_stream *stream, /* Get the next subbuffer */ err = >> kernctl_get_next_subbuf(infd); if (err != 0) { - ret = -err; + >> ret = err; /* * This is a debug message even for single-threaded >> consumer, * because poll() have more relaxed criterions than get >> subbuf, @@ -316,51 +316,68 @@ ssize_t >> lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream >> *stream, goto end; } >> >> + /* Get the full subbuffer size including padding */ + err = >> kernctl_get_padded_subbuf_size(infd, &len); + if (err != 0) { + >> errno = -err; + perror("Getting sub-buffer len failed."); + ret >> = -err; > > ret = err instead ? Yes and yes for the followings :P Thanks David > >> + goto end; + } + switch (stream->output) { - case >> LTTNG_EVENT_SPLICE: - /* read the whole subbuffer */ - err = >> kernctl_get_padded_subbuf_size(infd, &len); - if (err != 0) { - >> errno = -err; - perror("Getting sub-buffer len failed."); - >> ret = -err; - goto end; - } + case LTTNG_EVENT_SPLICE: >> >> - /* splice the subbuffer to the tracefile */ - ret = >> lttng_consumer_on_read_subbuffer_splice(ctx, stream, len); - if >> (ret != len) { - /* - * display the error but continue >> processing to try - * to release the subbuffer - */ - >> ERR("Error splicing to tracefile (ret: %zd != len: %lu)", - >> ret, len); - } + /* + * XXX: The lttng-modules splice >> "actor" does not handle copying + * partial pages hence only >> using the subbuffer size without the + * padding makes the >> splice fail. + */ + subbuf_size = len; + padding = 0; + + /* >> splice the subbuffer to the tracefile */ + ret = >> lttng_consumer_on_read_subbuffer_splice(ctx, stream, + >> subbuf_size, padding); + if (ret != subbuf_size) { + /* + * >> display the error but continue processing to try + * to >> release the subbuffer + */ + ERR("Error splicing to >> tracefile (ret: %zd != len: %lu)", + ret, subbuf_size); + } >> + break; + case LTTNG_EVENT_MMAP: + /* Get subbuffer size >> without padding */ + err = kernctl_get_subbuf_size(infd, >> &subbuf_size); + if (err != 0) { + errno = -err; + >> perror("Getting sub-buffer len failed."); + ret = -err; > > ret = err ? > > Thanks, > > Mathieu > >> + goto end; + } >> >> - break; - case LTTNG_EVENT_MMAP: - /* read the used >> subbuffer size */ - err = kernctl_get_padded_subbuf_size(infd, >> &len); - if (err != 0) { - errno = -err; - >> perror("Getting sub-buffer len failed."); - ret = -err; - >> goto end; - } - /* write the subbuffer to the tracefile */ - >> ret = lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - >> if (ret != len) { - /* - * display the error but continue >> processing to try - * to release the subbuffer - */ - >> ERR("Error writing to tracefile"); - } - break; - default: - >> ERR("Unknown output method"); - ret = -1; + /* Make sure the >> tracer is not gone mad on us! */ + assert(len >= subbuf_size); >> + + padding = len - subbuf_size; + + /* write the subbuffer to >> the tracefile */ + ret = >> lttng_consumer_on_read_subbuffer_mmap(ctx, stream, + >> subbuf_size, padding); + if (ret != subbuf_size) { + /* + * >> display the error but continue processing to try + * to >> release the subbuffer + */ + ERR("Error writing to tracefile >> (ret: %zd != len: %lu", + ret, subbuf_size); + } + break; + >> default: + ERR("Unknown output method"); + ret = -1; } >> >> err = kernctl_put_next_subbuf(infd); diff --git >> a/src/common/sessiond-comm/relayd.h >> b/src/common/sessiond-comm/relayd.h index 24b7c91..5d4fddf >> 100644 --- a/src/common/sessiond-comm/relayd.h +++ >> b/src/common/sessiond-comm/relayd.h @@ -49,6 +49,7 @@ struct >> lttcomm_relayd_data_hdr { uint64_t stream_id; /* Stream ID >> known by the relayd */ uint64_t net_seq_num; /* Network >> sequence number, per stream. */ uint32_t data_size; /* data >> size following this header */ + uint32_t padding_size; /* Size >> of 0 padding the data */ } __attribute__ ((__packed__)); >> >> /* @@ -94,6 +95,7 @@ struct lttcomm_relayd_version { */ struct >> lttcomm_relayd_metadata_payload { uint64_t stream_id; + uint32_t >> padding_size; char payload[]; } __attribute__ ((__packed__)); >> >> diff --git a/src/common/ust-consumer/ust-consumer.c >> b/src/common/ust-consumer/ust-consumer.c index 1544ddb..e7d6dd4 >> 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ >> b/src/common/ust-consumer/ust-consumer.c @@ -399,7 +399,7 @@ void >> lttng_ustconsumer_del_stream(struct lttng_consumer_stream >> *stream) int lttng_ustconsumer_read_subbuffer(struct >> lttng_consumer_stream *stream, struct lttng_consumer_local_data >> *ctx) { - unsigned long len; + unsigned long len, subbuf_size, >> padding; int err; long ret = 0; struct lttng_ust_shm_handle >> *handle; @@ -426,7 +426,7 @@ int >> lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream >> *stream, /* Get the next subbuffer */ err = >> ustctl_get_next_subbuf(handle, buf); if (err != 0) { - ret = >> -err; /* ustctl_get_next_subbuf returns negative, caller expect >> positive. */ + ret = err; /* ustctl_get_next_subbuf returns >> negative, caller expect positive. */ /* * This is a debug message >> even for single-threaded consumer, * because poll() have more >> relaxed criterions than get subbuf, @@ -438,12 +438,21 @@ int >> lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream >> *stream, goto end; } assert(stream->output == LTTNG_EVENT_MMAP); >> - /* read the used subbuffer size */ + /* Get the full padded >> subbuffer size */ err = ustctl_get_padded_subbuf_size(handle, >> buf, &len); assert(err == 0); + + /* Get subbuffer data size >> (without padding) */ + err = ustctl_get_subbuf_size(handle, buf, >> &subbuf_size); + assert(err == 0); + + /* Make sure we don't get >> a subbuffer size bigger than the padded */ + assert(len >= >> subbuf_size); + + padding = len - subbuf_size; /* write the >> subbuffer to the tracefile */ - ret = >> lttng_consumer_on_read_subbuffer_mmap(ctx, stream, len); - if >> (ret != len) { + ret = lttng_consumer_on_read_subbuffer_mmap(ctx, >> stream, subbuf_size, padding); + if (ret != subbuf_size) { /* * >> display the error but continue processing to try * to release the >> subbuffer diff --git a/src/common/ust-consumer/ust-consumer.h >> b/src/common/ust-consumer/ust-consumer.h index 7e055a9..3f76f23 >> 100644 --- a/src/common/ust-consumer/ust-consumer.h +++ >> b/src/common/ust-consumer/ust-consumer.h @@ -67,7 +67,8 @@ extern >> int lttng_ustctl_get_mmap_read_offset( static inline ssize_t >> lttng_ustconsumer_on_read_subbuffer_mmap( struct >> lttng_consumer_local_data *ctx, - struct lttng_consumer_stream >> *stream, unsigned long len) + struct lttng_consumer_stream >> *stream, unsigned long len, + unsigned long padding) { return >> -ENOSYS; } @@ -75,7 +76,8 @@ ssize_t >> lttng_ustconsumer_on_read_subbuffer_mmap( static inline ssize_t >> lttng_ustconsumer_on_read_subbuffer_splice( struct >> lttng_consumer_local_data *ctx, - struct lttng_consumer_stream >> *uststream, unsigned long len) + struct lttng_consumer_stream >> *uststream, unsigned long len, + unsigned long padding) { return >> -ENOSYS; } -- 1.7.10.4 >> >> >> _______________________________________________ lttng-dev mailing >> list lttng-dev at lists.lttng.org >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQUjqaAAoJEELoaioR9I02JP8H+gJDu79hoYKiyysdPNwq9f5d afC0l5StJttWH3tntC50KTQbl2fg/ghQ65tsxVUbfRe3BG0FngVH99vf06Lg23XL IEpk+m9EmvmtIYZAcqzO1dzPrEL8Ij5/frZ5fU7RxtNa3xVwr9IEnvBAuKYKYyXj 6ilpXje6rz5Uxcv5M+MNNfgbdZC86rfh4ZzZtDwJywJwR5XJmIV8YzRrBr8FpAkL Exu1NyrxVuI3GnHSVKBRZJTVJBz1qIa8VfzSWF3FHJ99ZXUju76PMzEeFSUU7lOp rlYqviwBu9fxrYxfJNwfpms/VyyC15t2pp7V++/LHOFc0NU62QI41CP3OFGzmAs= =pfLj -----END PGP SIGNATURE----- From christian.babeux at efficios.com Thu Sep 13 16:49:39 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 13 Sep 2012 16:49:39 -0400 Subject: [lttng-dev] [PATCH RFC v2 lttng-tools] Testpoint mechanism In-Reply-To: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1347569380-6409-1-git-send-email-christian.babeux@efficios.com> Hi, Here a few style and minor fixes to the original testpoints patch. Changelog v2: - Moved dlsym call to a separate function in testpoint.c. This is to avoid to have to define __USE_GNU in the testpoint header and possibly contaminate others with this define. - Use caa_likely/unlikely instead of defining likely/unlikely. - Style and comments fixes. Thanks, Christian Babeux (1): New testpoint mechanism to instrument LTTng binaries for testing purpose configure.ac | 1 + src/common/Makefile.am | 2 +- src/common/testpoint/Makefile.am | 6 ++++ src/common/testpoint/testpoint.c | 69 ++++++++++++++++++++++++++++++++++++++ src/common/testpoint/testpoint.h | 72 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 src/common/testpoint/Makefile.am create mode 100644 src/common/testpoint/testpoint.c create mode 100644 src/common/testpoint/testpoint.h -- 1.7.11.4 From christian.babeux at efficios.com Thu Sep 13 16:49:40 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 13 Sep 2012 16:49:40 -0400 Subject: [lttng-dev] [PATCH RFC v2 lttng-tools] New testpoint mechanism to instrument LTTng binaries for testing purpose In-Reply-To: <1347569380-6409-1-git-send-email-christian.babeux@efficios.com> References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> <1347569380-6409-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1347569380-6409-2-git-send-email-christian.babeux@efficios.com> This commit introduce two new macros: TESTPOINT_DECL(name) and testpoint(name). Here a quick example that show how to use the testpoint mechanism: file: main.c /* Testpoint declaration */ TESTPOINT_DECL(interesting_function) void interesting_function(void) { testpoint(interesting_function); /* Some processing that can fail */ ... } int main(int argc, char *argv[]) { interesting_function(); ... printf("End"); } file: testpoint.c void __testpoint_interesting_function(void) { printf("In testpoint of interesting function!"); } Compile: gcc -o test main.c gcc -fPIC -shared -o testpoint.so testpoint.c Run: > ./test End > export LTTNG_TESTPOINT_ENABLE=1 > LD_PRELOAD=testpoint.so ./test In testpoint of interesting function! End > export LTTNG_TESTPOINT_ENABLE=0 > LD_PRELOAD=testpoint.so ./test End The testpoint mechanism is triggered via the preloading of a shared object containing the appropriate testpoint symbols and by setting the LTTNG_TESTPOINT_ENABLE environment variable. The check on this environment variable is done on the application startup with the help of a constructor (lttng_testpoint_check) which toggle a global state variable indicating whether or not the testpoints should be activated. When enabled, the testpoint() macro calls an underlying wrapper specific to the testpoint and simply try to lookup the testpoint symbol via a dlsym() call. When disabled, the testpoint() call will only incur an additionnal test per testpoint on a global variable. This performance 'hit' should be acceptable for production use. The testpoint mechanism should be *always on*. It can be explicitly disabled via CFLAGS="-DNTESTPOINT" in a way similar to NDEBUG and assert(). Signed-off-by: Christian Babeux --- configure.ac | 1 + src/common/Makefile.am | 2 +- src/common/testpoint/Makefile.am | 6 ++++ src/common/testpoint/testpoint.c | 69 ++++++++++++++++++++++++++++++++++++++ src/common/testpoint/testpoint.h | 72 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 src/common/testpoint/Makefile.am create mode 100644 src/common/testpoint/testpoint.c create mode 100644 src/common/testpoint/testpoint.h diff --git a/configure.ac b/configure.ac index 7687280..8e61115 100644 --- a/configure.ac +++ b/configure.ac @@ -275,6 +275,7 @@ AC_CONFIG_FILES([ src/common/sessiond-comm/Makefile src/common/compat/Makefile src/common/relayd/Makefile + src/common/testpoint/Makefile src/lib/Makefile src/lib/lttng-ctl/Makefile src/lib/lttng-ctl/filter/Makefile diff --git a/src/common/Makefile.am b/src/common/Makefile.am index ca48153..889b04e 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer +SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer testpoint AM_CFLAGS = -fno-strict-aliasing diff --git a/src/common/testpoint/Makefile.am b/src/common/testpoint/Makefile.am new file mode 100644 index 0000000..7d3df16 --- /dev/null +++ b/src/common/testpoint/Makefile.am @@ -0,0 +1,6 @@ +AM_CPPFLAGS = + +noinst_LTLIBRARIES = libtestpoint.la + +libtestpoint_la_SOURCES = testpoint.h testpoint.c +libtestpoint_la_LIBADD = -ldl diff --git a/src/common/testpoint/testpoint.c b/src/common/testpoint/testpoint.c new file mode 100644 index 0000000..da0e221 --- /dev/null +++ b/src/common/testpoint/testpoint.c @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2012 - Christian Babeux + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef NTESTPOINT + +#include /* for getenv */ +#include /* for strncmp */ + +#ifndef __USE_GNU +#define __USE_GNU /* for RTLD_DEFAULT */ +#endif + +#include /* for dlsym */ + +#include "testpoint.h" + +/* Environment variable used to enable the testpoints facilities. */ +static const char *lttng_testpoint_env_var = "LTTNG_TESTPOINT_ENABLE"; + +/* Testpoint toggle flag */ +int lttng_testpoint_activated; + +/* + * Toggle the support for testpoints on the application startup. + */ +static void __attribute__((constructor)) lttng_testpoint_check(void) +{ + char *testpoint_env_val = NULL; + + testpoint_env_val = getenv(lttng_testpoint_env_var); + if (testpoint_env_val != NULL + && (strncmp(testpoint_env_val, "1", 1) == 0)) { + lttng_testpoint_activated = 1; + } +} + +/* + * Lookup a symbol by name. + * + * Return the address where the symbol is loaded + * or NULL if the symbol was not found. + */ +inline void *lttng_testpoint_lookup(const char *name) +{ + void *fp = NULL; + + if (name) { + fp = dlsym(RTLD_DEFAULT, name); + } + + return fp; +} + +#endif /* NTESTPOINT */ + diff --git a/src/common/testpoint/testpoint.h b/src/common/testpoint/testpoint.h new file mode 100644 index 0000000..03fb8f1 --- /dev/null +++ b/src/common/testpoint/testpoint.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2012 - Christian Babeux + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef NTESTPOINT + +#define testpoint(name) +#define TESTPOINT_DECL(name) + +#else /* NTESTPOINT */ + +#include /* for caa_likely/unlikely */ + +extern int lttng_testpoint_activated; + +void *lttng_testpoint_lookup(const char *name); + +/* + * Testpoint is only active if the global + * lttng_testpoint_activated flag is set. + */ +#define testpoint(name) \ + do { \ + if (caa_unlikely(lttng_testpoint_activated)) { \ + __testpoint_##name##_wrapper(); \ + } \ + } while (0) + +/* + * One wrapper per testpoint is generated. This is to keep track + * of the symbol lookup status and the corresponding function + * pointer, if any. + */ +#define _TESTPOINT_DECL(_name) \ + static inline void __testpoint_##_name##_wrapper(void) \ + { \ + static void (*tp)(void); \ + static int found; \ + const char *tp_name = "__testpoint_" #_name; \ + \ + if (tp) { \ + tp(); \ + } else if (!found) { \ + tp = lttng_testpoint_lookup(tp_name); \ + if (tp) { \ + found = 1; \ + tp(); \ + } else { \ + found = -1; \ + } \ + } \ + } + +/* Testpoint declaration */ +#define TESTPOINT_DECL(name) \ + _TESTPOINT_DECL(name) + +#endif /* NTESTPOINT */ + -- 1.7.11.4 From mathieu.desnoyers at efficios.com Thu Sep 13 18:46:52 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 13 Sep 2012 18:46:52 -0400 Subject: [lttng-dev] [PATCH RFC v2 lttng-tools] New testpoint mechanism to instrument LTTng binaries for testing purpose In-Reply-To: <1347569380-6409-2-git-send-email-christian.babeux@efficios.com> References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> <1347569380-6409-1-git-send-email-christian.babeux@efficios.com> <1347569380-6409-2-git-send-email-christian.babeux@efficios.com> Message-ID: <20120913224652.GA6318@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > This commit introduce two new macros: TESTPOINT_DECL(name) and > testpoint(name). > > Here a quick example that show how to use the testpoint mechanism: > > file: main.c > > /* Testpoint declaration */ > TESTPOINT_DECL(interesting_function) > > void interesting_function(void) > { > testpoint(interesting_function); > /* Some processing that can fail */ > ... > } > > int main(int argc, char *argv[]) > { > interesting_function(); > ... > printf("End"); > } > > file: testpoint.c > void __testpoint_interesting_function(void) > { > printf("In testpoint of interesting function!"); > } > > Compile: > gcc -o test main.c > gcc -fPIC -shared -o testpoint.so testpoint.c > > Run: > > ./test > End > > export LTTNG_TESTPOINT_ENABLE=1 > > LD_PRELOAD=testpoint.so ./test > In testpoint of interesting function! > End > > export LTTNG_TESTPOINT_ENABLE=0 > > LD_PRELOAD=testpoint.so ./test > End > > The testpoint mechanism is triggered via the preloading of a shared > object containing the appropriate testpoint symbols and by setting the > LTTNG_TESTPOINT_ENABLE environment variable. > > The check on this environment variable is done on the application startup > with the help of a constructor (lttng_testpoint_check) which toggle a global > state variable indicating whether or not the testpoints should be activated. > > When enabled, the testpoint() macro calls an underlying wrapper specific to > the testpoint and simply try to lookup the testpoint symbol via a dlsym() > call. > > When disabled, the testpoint() call will only incur an additionnal test > per testpoint on a global variable. This performance 'hit' should be > acceptable for production use. > > The testpoint mechanism should be *always on*. It can be explicitly > disabled via CFLAGS="-DNTESTPOINT" in a way similar to NDEBUG and assert(). > > Signed-off-by: Christian Babeux > --- > configure.ac | 1 + > src/common/Makefile.am | 2 +- > src/common/testpoint/Makefile.am | 6 ++++ > src/common/testpoint/testpoint.c | 69 ++++++++++++++++++++++++++++++++++++++ > src/common/testpoint/testpoint.h | 72 ++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 149 insertions(+), 1 deletion(-) > create mode 100644 src/common/testpoint/Makefile.am > create mode 100644 src/common/testpoint/testpoint.c > create mode 100644 src/common/testpoint/testpoint.h > > diff --git a/configure.ac b/configure.ac > index 7687280..8e61115 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -275,6 +275,7 @@ AC_CONFIG_FILES([ > src/common/sessiond-comm/Makefile > src/common/compat/Makefile > src/common/relayd/Makefile > + src/common/testpoint/Makefile > src/lib/Makefile > src/lib/lttng-ctl/Makefile > src/lib/lttng-ctl/filter/Makefile > diff --git a/src/common/Makefile.am b/src/common/Makefile.am > index ca48153..889b04e 100644 > --- a/src/common/Makefile.am > +++ b/src/common/Makefile.am > @@ -1,6 +1,6 @@ > AM_CPPFLAGS = > > -SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer > +SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer testpoint > > AM_CFLAGS = -fno-strict-aliasing > > diff --git a/src/common/testpoint/Makefile.am b/src/common/testpoint/Makefile.am > new file mode 100644 > index 0000000..7d3df16 > --- /dev/null > +++ b/src/common/testpoint/Makefile.am > @@ -0,0 +1,6 @@ > +AM_CPPFLAGS = > + > +noinst_LTLIBRARIES = libtestpoint.la > + > +libtestpoint_la_SOURCES = testpoint.h testpoint.c > +libtestpoint_la_LIBADD = -ldl > diff --git a/src/common/testpoint/testpoint.c b/src/common/testpoint/testpoint.c > new file mode 100644 > index 0000000..da0e221 > --- /dev/null > +++ b/src/common/testpoint/testpoint.c > @@ -0,0 +1,69 @@ > +/* > + * Copyright (C) 2012 - Christian Babeux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License, version 2 only, > + * as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + * > + * You should have received a copy of the GNU General Public License along > + * with this program; if not, write to the Free Software Foundation, Inc., > + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + */ > + > +#ifndef NTESTPOINT > + > +#include /* for getenv */ > +#include /* for strncmp */ > + > +#ifndef __USE_GNU > +#define __USE_GNU /* for RTLD_DEFAULT */ > +#endif I don't think the ifndef/endif protection is needed here, since we are in a .c ? Normally, we define those before any include (before the stdlib include above). > + > +#include /* for dlsym */ > + > +#include "testpoint.h" > + > +/* Environment variable used to enable the testpoints facilities. */ > +static const char *lttng_testpoint_env_var = "LTTNG_TESTPOINT_ENABLE"; > + > +/* Testpoint toggle flag */ > +int lttng_testpoint_activated; > + > +/* > + * Toggle the support for testpoints on the application startup. > + */ > +static void __attribute__((constructor)) lttng_testpoint_check(void) > +{ > + char *testpoint_env_val = NULL; > + > + testpoint_env_val = getenv(lttng_testpoint_env_var); > + if (testpoint_env_val != NULL > + && (strncmp(testpoint_env_val, "1", 1) == 0)) { > + lttng_testpoint_activated = 1; > + } > +} > + > +/* > + * Lookup a symbol by name. > + * > + * Return the address where the symbol is loaded > + * or NULL if the symbol was not found. > + */ > +inline void *lttng_testpoint_lookup(const char *name) I think the "inline" here is useless ? > +{ > + void *fp = NULL; > + > + if (name) { > + fp = dlsym(RTLD_DEFAULT, name); > + } > + > + return fp; for a function that simple, is the local variable really needed ? e.g. if (!name) { return NULL; } return dlsym(RTLD_DEFAULT, name); > +} > + > +#endif /* NTESTPOINT */ > + > diff --git a/src/common/testpoint/testpoint.h b/src/common/testpoint/testpoint.h > new file mode 100644 > index 0000000..03fb8f1 > --- /dev/null > +++ b/src/common/testpoint/testpoint.h > @@ -0,0 +1,72 @@ > +/* > + * Copyright (C) 2012 - Christian Babeux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License, version 2 only, > + * as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + * > + * You should have received a copy of the GNU General Public License along > + * with this program; if not, write to the Free Software Foundation, Inc., > + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + */ > + > +#ifdef NTESTPOINT > + > +#define testpoint(name) > +#define TESTPOINT_DECL(name) > + > +#else /* NTESTPOINT */ > + > +#include /* for caa_likely/unlikely */ > + > +extern int lttng_testpoint_activated; > + > +void *lttng_testpoint_lookup(const char *name); > + > +/* > + * Testpoint is only active if the global > + * lttng_testpoint_activated flag is set. > + */ > +#define testpoint(name) \ > + do { \ > + if (caa_unlikely(lttng_testpoint_activated)) { \ > + __testpoint_##name##_wrapper(); \ > + } \ > + } while (0) > + > +/* > + * One wrapper per testpoint is generated. This is to keep track > + * of the symbol lookup status and the corresponding function > + * pointer, if any. > + */ > +#define _TESTPOINT_DECL(_name) \ > + static inline void __testpoint_##_name##_wrapper(void) \ > + { \ > + static void (*tp)(void); \ > + static int found; \ > + const char *tp_name = "__testpoint_" #_name; \ > + \ > + if (tp) { \ > + tp(); \ > + } else if (!found) { \ > + tp = lttng_testpoint_lookup(tp_name); \ > + if (tp) { \ > + found = 1; \ > + tp(); \ > + } else { \ > + found = -1; \ > + } \ > + } \ Hrm, I don't very much like the if() / else if() / nothing construct: it's easy to forget that there is a "skip" in the case the second if is not taken. How about ? if (tp) { tp(); } else { if (!found) { tp = lttng_testpoint_lookup(tp_name); if (tp) { found = 1; tp(); } else { found = -1; } } } like that, it's crystal clear that the else of (!found) just skips through. This comment might seem a bit pedantic, but I've seen too much code evolve into bugs starting with this kind of construct. Thanks, Mathieu > + } > + > +/* Testpoint declaration */ > +#define TESTPOINT_DECL(name) \ > + _TESTPOINT_DECL(name) > + > +#endif /* NTESTPOINT */ > + > -- > 1.7.11.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From zheng.chang at emc.com Fri Sep 14 00:01:42 2012 From: zheng.chang at emc.com (changz) Date: Fri, 14 Sep 2012 12:01:42 +0800 Subject: [lttng-dev] Deaklock in liblttng-ust In-Reply-To: <20120913113739.GA27777@Krystal> References: <6539770C71C3814BB0BFC2DBEBD1050801062B20@CORPUSMX30B.corp.emc.com> <20120913113739.GA27777@Krystal> Message-ID: <5052AC26.5050904@emc.com> On 9/13/2012 19:37 PM, Mathieu Desnoyers wrote: > Re: [lttng-dev] Deaklock in liblttng-ust > > * Chang, Zheng (Zheng.Chang at emc.com) wrote: > > Hi, > > > > > > > > I built a trace.so as a wrapper of lttng-ust, which predefines some > > events and APIs based on lttng-ust. > > > > And here is demo application linked to this share library. > > > > > > > > Sometimes the demo hung at launch time. I did test with the demo and > > easy-ust of lttng-ust on both IA32 and X64 and got the same result. > > > > Lttng-ust version is 2.02. > > > > > > > > I collect some debuging info with gdb here: > > > > > > > > Parent process: > > > > > > > > gdb) thread 3 (constructor of liblttng-ust.so) > > > > [Switching to thread 3 (Thread 0x7f91d5487950 (LWP 21901))]#0 > > 0x00007f91d82ad400 in wait () from /lib64/libpthread.so.0 > > > > (gdb) bt > > > > #0 0x00007f91d82ad400 in wait () from /lib64/libpthread.so.0 > > > > #1 0x00007f91d64a8c4b in wait_for_sessiond (sock_info=0x7f91d66cc640) > > at lttng-ust-comm.c:481 > > > > #2 0x00007f91d64a9545 in ust_listener_thread (arg= > out>) at lttng-ust-comm.c:669 > > > > #3 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 > > > > #4 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 > > > > > > > > (gdb) thread 5 (constructor of demo) > > > > [Switching to thread 5 (Thread 0x7f91d690e950 (LWP 21899))]#0 > > 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 > > > > (gdb) bt > > > > #0 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 > > > > #1 0x00007f91d82a72d0 in _L_lock_102 () from /lib64/libpthread.so.0 > > > > #2 0x00007f91d82a6bbe in pthread_mutex_lock () from > > /lib64/libpthread.so.0 > > > > #3 0x00007f91d64abf8b in ltt_probe_register (desc=0x7f91d66d0ce0) at > > ltt-probes.c:77 > > > > #4 0x00007f91d66e0cfb in __lttng_events_init__sample_component () at > > /usr/include/lttng/ust-tracepoint-event.h:550 > > > > #5 0x00007f91d66e71b6 in __do_global_ctors_aux () from mytrace.so > > > > #6 0x00007f91d66e03c3 in _init () from mytrace.so > > > > #7 0x00007f91d66df3d4 in ?? () from mytrace.so > > > > #8 0x00007f91d94f78d8 in ?? () from /lib64/ld-linux-x86-64.so.2 > > > > #9 0x00007f91d94f7a07 in ?? () from /lib64/ld-linux-x86-64.so.2 > > > > #10 0x00007f91d94fbbde in ?? () from /lib64/ld-linux-x86-64.so.2 > > > > #11 0x00007f91d94f7566 in ?? () from /lib64/ld-linux-x86-64.so.2 > > > > #12 0x00007f91d94fb38b in ?? () from /lib64/ld-linux-x86-64.so.2 > > > > #13 0x00007f91d84bbf9b in ?? () from /lib64/libdl.so.2 > > > > #14 0x00007f91d94f7566 in ?? () from /lib64/ld-linux-x86-64.so.2 > > > > #15 0x00007f91d84bc34c in ?? () from /lib64/libdl.so.2 > > > > #16 0x00007f91d84bbf01 in dlopen () from /lib64/libdl.so.2 > > > > .............................................. > > > > #24 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 > > > > #25 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 > > > > > > > > (gdb) p sessions_mutex > > > > $4 = {__data = {__lock = 2, __count = 0, __owner = 21901, __nusers = 1, > > __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, > > > > __size = "\002\000\000\000\000\000\000\000\215U\000\000\001", '\0' > > , __align = 2} > > > > > > > > Child process: > > > > > > > > (gdb) info thread (forked from 21901) > > > > * 1 Thread 0x7f91d5487950 (LWP 21902) 0x00007f91d82ac344 in > > __lll_lock_wait () from /lib64/libpthread.so.0 > > > > (gdb) bt > > > > #0 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 > > > > #1 0x00007f91d82a72d0 in _L_lock_102 () from /lib64/libpthread.so.0 > > > > #2 0x00007f91d82a6bbe in pthread_mutex_lock () from > > /lib64/libpthread.so.0 > > > > #3 0x00007f91d64abe58 in ltt_probe_unregister (desc=0x7f91d66d0ce0) at > > ltt-probes.c:129 > > > > #4 0x00007f91d66e0d10 in __lttng_events_exit__sample_component () at > > /usr/include/lttng/ust-tracepoint-event.h:557 > > > > #5 0x00007f91d66e07cf in __do_global_dtors_aux () from mytrace.so > > > > #6 0x00007f91d66cd664 in global_apps () from /usr/lib/liblttng-ust.so.0 > > > > #7 0x00007f91d5479df0 in ?? () > > > > #8 0x00007f91d66e71dd in _real_fini () from mytrace.so > > > > #9 0x00007f91d66e71d2 in _fini () from mytrace.so > > > > #10 0x00007f91d94f7f54 in ?? () from /lib64/ld-linux-x86-64.so.2 > > > > #11 0x00007f91d7a652ed in exit () from /lib64/libc.so.6 > > > > #12 0x00007f91d64a9207 in wait_for_sessiond (sock_info=0x7f91d66cc640) > > at lttng-ust-comm.c:542 > > > > #13 0x00007f91d64a9545 in ust_listener_thread (arg= > out>) at lttng-ust-comm.c:669 > > > > #14 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 > > > > #15 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 > > > > #16 0x0000000000000000 in ?? () > > > > (gdb) p sessions_mutex > > > > $1 = {__data = {__lock = 2, __count = 0, __owner = 21901, __nusers = 1, > > __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, > > > > __size = "\002\000\000\000\000\000\000\000\215U\000\000\001", '\0' > > , __align = 2} > > > > > > > > What happened seems like this: > > > > > > > > lttng_ust_init > > > > | > > > > |-> ust_listener_thread > > > > | > > > > |-> wait_for_sessiond > > > > | > > > > |-> > > ust_lock > > (1) > > > > |-> > > get_map_shm > > > > | > > | > > > > | > > |-> get_wait_shm > > > > | > > | > > > > | > > |-> fork > > > > | > > parent -> wait > > (2) > > > > | > > child -> exit -> _fini -> __do_global_dtors_aux -> ...... -> > > ltt_probe_unregister -> ust_lock (3) > > > > |-> > > ust_unlock > > (4) > > > > > > > > Deadlock happened at point (1) and (3). Parent waited for child's > > termination and child waited for parent to release the lock. > > > > > > > > Reproduction conditions: > > > > - First time to create share memory > > (/dev/shm/lttng-ust-apps-wait* don't exist) > > > > - Child process got delayed( I'm not quite sure with this, I > > used gdb to hold child process for a while and it happened either) > > > > > > > > In normal case, child process didn't call _fini when it exited so that > > no deadlock happened. > > > > > > > > Is this a known issue? > > Yes, see: > > commit 3b8b68e73ec9b2b3cf550048046d3f7f69050688 > Author: Mathieu Desnoyers > Date: Wed Jun 13 04:26:34 2012 -0400 > > Fix: liblttng-ust-fork deadlock > > * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote: > > * Burton, Michael (mburton at ciena.com) wrote: > > > Mathieu, > > > > > > I think there is a deadlock scenario in UST, which has been > causing my p > > > > Good catch ! > > > > > > > > sessiond is started as root: > > > - creates global sockets ONLY > > > - DOES NOT CREATE shm in $HOME/lttng-ust-wait- > > > > > > application linked against ust is run as root: > > > - in lttng_ust_init constructor > > > - ust_listener_thread (local_apps) > > > - fails to connect to local_apps in $HOME/.lttng (as expected) > > > - prev_connect_failed=1 > > > - ust_unlock() > > > - restart > > > - wait_for_sessiond() > > > --> - ust_lock() > > > | - get_map_shm() > > > | - get_wait_shm() > > > DEADLOCK - shm_open() FAILS (not created by sessiond when > run by root > > > | - fork() (trying to create shared memory itself) > > > | - ust_before_fork() > > > ------------> - ust_lock() > > > > > > > > > You should be able to create this with an empty main, with no > > > tracepoints. As long as sessiond is started as root so > > > $HOME/lttng-ust-wait- is not created. You can also make the > > > lttng-ust constructor (lttng_ust_init) wait forever and then > you'll be > > > able to see the deadlock in gdb without even leaving the > > > lttng_ust_init constructor. > > > > Ah, I see. This deadlock is caused by the interaction between > > [ liblttng-ust-fork ] and liblttng-ust (the fork override is > > performed by [ liblttng-ust-fork ]). > > This can be reproduced easily with the in-tree tests: by removing the > lttng-ust-apps-wait* files belonging to the user in /dev/shm, running > the "tests/fork" test (with ./run) hangs. If we run "hello" first, and > then the fork test, it works fine. > > Fixing this by keeping a nesting counter around the fork() call, so we > return immediately from the pre/post fork handlers if they are > overridden by liblttng-ust-fork. > > Reported-by: Michael Burton > Signed-off-by: Mathieu Desnoyers > Mathieu, It's a little different from the issue of Michael. In my case, the secondary ust_lock is blocked at the destructor of the demo library, which is triggerred by the exit of child process. > #2 0x00007f91d82a6bbe in pthread_mutex_lock () from /lib64/libpthread.so.0 > #3 0x00007f91d64abe58 in ltt_probe_unregister (desc=0x7f91d66d0ce0) at ltt-probes.c:129 We can see ltt_probe_unregister calls ust_lock in the destructor. And here is the setion .dtors of the demo library: objdump --section .dtors -S mytrace.so 0002fc98 <__DTOR_LIST__>: 2fc98: ff ff ff ff 00 00 00 00 40 f0 00 00 d0 f0 00 00 ........ at ....... 0002fca8 <__DTOR_END__>: 2fca8: 00 00 00 00 .... 0000f040 t __lttng_events_exit__lttng_ust 0000f0d0 t __tracepoints__destroy The child process calls _fini when it calls API exit. It gets hung and meanwhile the parent is waiting for its termination. I think the whole life-cycle of the process should be considered. The parent's waiting in critical region is dangerous. Is it possible to refine the critical region with smaller fineness? What do you think? BR -Zheng > > > You should upgrade your lttng-ust to latest 2.0.x. > > Thanks, > > Mathieu > > > > > > > > > > Thanks > > > > -Zheng > > > > > > > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hans.nordeback at ericsson.com Fri Sep 14 02:36:35 2012 From: hans.nordeback at ericsson.com (=?iso-8859-1?Q?Hans_Nordeb=E4ck?=) Date: Fri, 14 Sep 2012 08:36:35 +0200 Subject: [lttng-dev] Problem to get lttng work with a daemon application In-Reply-To: <20120913133809.GA29390@Krystal> References: <50507593.5030206@ericsson.com> <20120912124150.GB26893@Krystal> <1CE40C84E5A3A646A4386DE2A97629A95E724B1A53@ESESSCMS0361.eemea.ericsson.se> <20120912135154.GB28079@Krystal> <1CE40C84E5A3A646A4386DE2A97629A95E724B1ECE@ESESSCMS0361.eemea.ericsson.se> <20120913133809.GA29390@Krystal> Message-ID: <1CE40C84E5A3A646A4386DE2A97629A95E724B205F@ESESSCMS0361.eemea.ericsson.se> Hi Mathieu, the daemon is not closing file descriptors at this point, later it will schedule and daemonize applications, by closing fd's up to SC_OPEN_MAX. An alternative to the getenv solution could be to add two new functions: void lttng_ust_reinit(void) { lttng_ust_cleanup_for_reinit(); lttng_ust_init(); } but the getenv solution seems ok. /Thanks Hans -----Original Message----- From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] Sent: den 13 september 2012 15:38 To: Hans Nordeb?ck Cc: lttng-dev at lists.lttng.org Subject: Re: [lttng-dev] Problem to get lttng work with a daemon application * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > Hi Mathieu, I have installed lttng-ust 2.0.5 and lttng-tools 2.0.4, I > run a gdb session and realized what the problem is. I noticed that > lttng threads are created before main via __attribute__(constructor), > and the problem with the daemon is that the lttng threads "disappears" after "daemonizing" the daemon, causing recvmsg in ustcomm_recv_unix_sock to hang. I removed the __attribute__(constructor) and called > lttng_ust_init explicitly, it works, but I have to search for a more general solution./Thanks Hans Ah! yes! how do you deamonize your daemon ? Do you, for instance, close all file descriptors between 0 and 100 ? This will not behave well with lttng-ust. The following bug entry is keeping track of this issue: http://bugs.lttng.org/issues/253 Indeed, initializing lttng-ust only after the file descriptors has been closed could work. Maybe we could do a work-around for this issue, where we could wrap the constructor within a getenv("LTTNG_UST_MANUAL_INIT") == "1" strcmp check, and, in that case, require that the application call some init API provided by lttng-ust. However, given that we want liblttng-ust to be a dependency that is not strictly required by applications (such as the demo-trace example in tests/demo), we'd need to look up the symbol of the initialization function with dlsym(). Thoughts ? Thanks, Mathieu > > -----Original Message----- > From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] > Sent: den 12 september 2012 15:52 > To: Hans Nordeb?ck > Cc: lttng-dev at lists.lttng.org > Subject: Re: [lttng-dev] Problem to get lttng work with a daemon > application > > * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > > Hi Mathieu, I upgraded to version 2.0.4, but it did not solve the > > problem./Thanks Hans > > Hi Hans, > > Please provide the version numbers you use for both lttng-tools and lttng-ust. The lttng.org website lists the latest lttng-ust as 2.0.5, which leads me to think you might have forgotten to upgrade it. > > Don't forget to restart your test application (just to be sure, rebuild it against the new lttng-ust). Also make sure you kill all lttng-sessiond that might still be active. > > Thanks, > > Mathieu > > > > > -----Original Message----- > > From: Mathieu Desnoyers [mailto:mathieu.desnoyers at efficios.com] > > Sent: den 12 september 2012 14:42 > > To: Hans Nordeb?ck > > Cc: lttng-dev at lists.lttng.org > > Subject: Re: [lttng-dev] Problem to get lttng work with a daemon > > application > > > > * Hans Nordeb?ck (hans.nordeback at ericsson.com) wrote: > > > Hi, I've just started using lttng and run it in Ubuntu 12.04 in VirtualBox. > > > > > > I have run the sample applications without any problem, but I have > > > problems to get a daemon application work. > > > > > > I have added tracepoint support in the same way as for the sample > > > applications and do the following: > > > > > > 1) The lttng-sessiond (version 2.0.1) is started (with > > > > 2.0.1 is old. Please upgrade to the latest versions of the 2.0.x series for both lttng-tools and lttng-ust and try again. > > > > Thanks, > > > > Mathieu > > > > > --verbose--verbose-consumer). > > > 2) I start the daemon application with one tracepoint implemented. > > > 3) I can see that the lttng-sessiond gets called regarding this tracepoint: > > > > > > DEBUG1: App registered with pid:18421 ppid:18419 uid:0 gid:0 > > > sock:18 name:osafamfnd (version 2.0) [in ust_app_register() at > > > ust-app.c:1365] > > > > > > 4) I run, strace -f lttng -v list -u, and can see that it "hangs" > > > in > > > recvmsg: > > > write(2, "DEBUG1: Getting UST tracing even"..., 81DEBUG1: Getting UST > > > tracing events [in list_ust_events() at commands/list.c:253] > > > ) = 81 > > > getuid() = 0 > > > socket(PF_FILE, SOCK_STREAM, 0) = 3 > > > connect(3, {sa_family=AF_FILE, > > > path="/var/run/lttng/client-lttng-sessiond"}, 110) = 0 > > > geteuid() = 0 > > > getegid() = 0 > > > sendmsg(3, {msg_name(0)=NULL, > > > msg_iov(1)=[{"\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ > > > 0\ 0\ 0\0\0\0\0"..., 8784}], msg_controllen=28, {cmsg_len=28, > > > cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS{pid=28878, uid=0, > > > gid=0}}, msg_flags=0}, 0) = > > > 8784 > > > recvmsg(3, > > > > > > 5) the lttng-sessiond outputs only the following and hangs as long > > > as the daemon application is running. > > > DEBUG1: Processing client command 14 [in process_client_msg() at > > > main.c:3309] > > > > > > 6) The only difference between sample app logs and daemon app logs > > > is that the pid and ppid seen at DEBUG1: App registered. In the > > > daemon case in this run it is pid 18421 ppid 18419 but when I > > > print it in the function calling tracepoint it is pid 18430. I > > > don't know if that is related to the problem. Any help on this would be appreciated. > > > > > > /Thanks Hans > > > > > > > > > > > > > > > _______________________________________________ > > > lttng-dev mailing list > > > lttng-dev at lists.lttng.org > > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > > -- > > Mathieu Desnoyers > > Operating System Efficiency R&D Consultant EfficiOS Inc. > > http://www.efficios.com > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant EfficiOS Inc. > http://www.efficios.com -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Fri Sep 14 08:22:18 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 14 Sep 2012 08:22:18 -0400 Subject: [lttng-dev] [RFC] Per-user event ID allocation proposal In-Reply-To: <5051EDE0.3070900@efficios.com> References: <20120912123555.GA26893@Krystal> <5051EDE0.3070900@efficios.com> Message-ID: <20120914122218.GA19648@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > Hi Mathieu, > > This looks good! I have some questions to clarify part of the RFC. > > Mathieu Desnoyers: > > Mathieu Desnoyers September 11, 2012 > > > > Per-user event ID allocation proposal > > > > The intent of this shared event ID registry is to allow sharing > > tracing buffers between applications belonging to the same user > > (UID) for UST (user-space) tracing. > > > > A.1) Overview of System-wide, per-ABI (32 and 64-bit), per-user, > > per-session, LTTng-UST event ID allocation: > > > > - Modify LTTng-UST and lttng-tools to keep a system-wide, per-ABI > > (32 and 64-bit), per-user, per-session registry of enabled events > > and their associated numeric IDs. - LTTng-UST will have to register > > its tracepoints to the session daemon, sending the field typing of > > these tracepoints during registration, - Dynamically check that > > field types match upon registration of an event in this global > > registry, refuse registration if the field types do not match, - > > The metadata will be generated by lttng-tools instead of the > > application. > > > > A.2 Per-user Event ID Details: > > > > The event ID registry is shared across all processes for a given > > session/ABI/channel/user (UID). The intent is to forbid one user > > to access tracing data from another user, while keeping the > > system-wide number of buffers small. > > > > The event ID registry is attached to a: - session, - specific ABI > > (32/64-bit), - channel, - user (UID). > > > > lttng-session fill this registry by pulling this information as > > needed from traced processes (a.k.a. applications) to populate the > > registry. This information is needed only when an event is active > > for a created session. Therefore, applications need not to notify > > the sessiond if no session is created. > > > > The rationale for using a "pull" scheme, where the sessiond pulls > > information from applications, in opposition to a "push" scheme, > > where application would initiate commands to push the information, > > is that it minimizes the amount of logic required within > > liblttng-ust, and it does not require liblttng-ust to wait for > > reply from lttng-sessiond, which minimize the impact on the > > application behavior, providing application resilience to > > lttng-sessiond crash. > > > > Updates to this registry are triggered by two distinct scenarios: > > either an "enable-event" command (could also be "start", depending > > on the sessiond design) is being executed, or, while tracing, a > > library is being loaded within the application. > > > > Before we start describing the algorithms that update the registry, > > it is _very_ important to understand that an event enabled with > > "enable-event" can contain a wildcard (e.g.: libc*) and loglevel, > > and therefore is associated to possibly _many_ events in the > > application. > > > > Algo (1) When an "enable-event"/"start" command is executed, the > > sessiond will get, in return for sending an enable-event command to > > the application (which apply to a channel within a session), a > > variable-sized array of enabled events (remember, we can enable a > > wildcard!), along with their name, loglevel, field name, and field > > type. The sessiond proceeds to check that each event does not > > conflict with another event in the registry with the same name, but > > having different field names/types or loglevel. If its field > > names/typing or loglevel differ from a previous event, it prints a > > warnings. If it matches a previous event, it re-uses the same ID as > > the previous event. If no match, it allocates a new event ID. It > > sends a command to the application to let it know the mapping > > between the event name and ID for the channel. When the > > application receives that command, it can finally proceed to attach > > the tracepoint probe to the tracepoint site. > > > The sessiond keeps a per-application/per-channel hash table of > > already enabled events, so it does not provide the same event > > name/id mapping twice for a given channel. > > and per-session ? Yes. > > Of what I understand of this proposal, an event is associated to > per-user/per-session/per-apps/per-channel values. Well, given that channels become per-user, an application will write its data into the channel with same UID as itself. (it might imply some limitations with setuid() in an application, or at least to document those, or that we overload setuid()) The "per-app" part is not quite right. Event IDs are re-used and shared across all applications that belong to the same UID. > > (I have a question at the end about how an event ID should be generated) > > > > > Algo (2) In the case where a library (.so) is being loaded in the > > application while tracing, the update sequence goes as follow: the > > application first checks if there is any session created. It so, it > > sends a NOTIFY_NEW_EVENTS message to the sessiond through the > > communication socket (normally used to send ACK to commands). The > > lttng-sessiond will therefore need to listen (read) to each > > application communication socket, and will also need to dispatch > > NOTIFY_NEW_EVENTS messages each time it expects an ACK reply for a > > command it has sent to the application. > > Taking back the last sentence, can you explain more or clarify the > mechanism here of "dispatching a NOTIFY_NEW_EVENTS" each time an ACK > reply is expected?... Do you mean that each time we are waiting for an > ACK, if we get a NOTIFY instead (which could happen due to a race > between notification and command handling) you will launch a NOTIFY > code path where the session daemon check the events hash table and > check for event(s) to pull from the UST tracer? ... so what about > getting the real ACK after that ? In this scheme, the NOTIFY is entirely asynchronous, and gets no acknowledge from the sessiond to the app. This means that when dispatching the NOTIFY received at the ACK site (due to the race you refer to), we could simply queue this notify within the sessiond so it gets handled after we finished handling the current command (e.g. next time the thread go back to poll fds). > > > When a NOTIFY_NEW_EVENTS is received from an application, the > > sessiond iterates on each session, each channel, redoing Algo (1). > > The per-app/per-channel hash table that remembers already enabled > > events will ensure that we don't end up enabling the same event > > twice. > > > > At application startup, the "registration done" message will only > > be sent once all the commands setting the mapping between event > > name and ID are sent. This ensures tracing is not started until all > > events are enabled (delaying the application for a configurable > > delay). > > > > At library load, a "registration done" will also be sent by the > > sessiond some time after the NOTIFY_NEW_EVENTS has been received -- > > at the end of Algo(1). This means that library load, within > > applications, can be delayed for the same amount of time that apply > > to application start (configurable). > > > > The registry is emptied when the session is destroyed. Event IDs > > are never freed, only re-used for events with the same name, after > > loglevel, field name and field type match check. > > This means that event IDs here should be some kind of a hash using a > combination of values of the event to make sure it's unique on a > per-event/per-channel/per-session basis ? (considering the sessiond > should keep them in a separate registry) I think it would be enough to hash the events by their full name, and then do a compare to check if the fields match. We _want_ the hash table lookup to succeed if we get an event with same name but different fields, but then our detailed check for field mispatch would fail. > > > > > This registry is also used to generate metadata from the sessiond. > > The sessiond will now be responsible for generation of the metadata > > stream. > > > > This implies that the session daemon will need to keep track of the > global memory location of each applications in order to consumer > metadata streams ? Uh ? no. The metadata stream would be _created_ by the sessiond. Applications would not have anything to do with the metadata stream in this scheme. Basically, we need to ensure that all the information required to generate the metadata for a given session/channel is present in the table that contains mapping between numeric event IDs and event name/field names/types/loglevel. Anything still unclear ? Thanks, Mathieu > > Cheers! > David > -----BEGIN PGP SIGNATURE----- > > iQEcBAEBCgAGBQJQUe3dAAoJEELoaioR9I024JUH/14NpMtoMxKR+Y+oNd9AH6TW > Wj23HMJDwfhbRK8T1Mz6oMI/jWkSLVrJxoB3fh3Tbx5dJBwePXrkD+Da5NqV7MMV > PEc3Hqx66YYNh9EcbkYkg/LJfEmc4XwLxvi4x8DA4LIFwG9SDzs0N/i+e6pWs/Dy > blUFq/Kk7t9Ah72DCzjnSqQU+plW8Nr9wuxjpFV7uiXYpMrQsArhtuengtXmv7+7 > R+KfokIccnKXZURTdEPg5aZg1NRc4QnOl8CPjX/rcD64N32EllRIIdoLFjHAxens > aGsv2U19/53J8nvMl93qswKWNyvt59yr3a7uobKnvmSZMMSyTgApZpxqaB9Y41I= > =cN91 > -----END PGP SIGNATURE----- -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From Bernd.Hufmann at ericsson.com Fri Sep 14 08:24:10 2012 From: Bernd.Hufmann at ericsson.com (Bernd Hufmann) Date: Fri, 14 Sep 2012 08:24:10 -0400 Subject: [lttng-dev] Missing tracepoint entries when listing fields in LTTng Tools 2.1 In-Reply-To: <20120912191400.GA31291@Krystal> References: <5050CD26.6020707@ericsson.com> <20120912191400.GA31291@Krystal> Message-ID: <505321EA.1060007@ericsson.com> Hi I executed command "lttng list -u -f" (in LTTng Tools 2.1 RC2) to list all the available UST tracers and their tracepoints/fields. I noticed that some tracepoints are not listed when they don't have any fields. I think this is not correct because the "-f" option should just give more detailed information, but should not remove information. To re-produce, use the hello.cxx test application delivered with LTTng UST. "lttng list -u" shows: PID: 6056 - Name: /home/bernd/git/lttng-ust/tests/hello.cxx/.libs/lt-hello ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint) ust_tests_hello:tptest (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint) "lttng list -u -f shows: PID: 6056 - Name: /home/bernd/git/lttng-ust/tests/hello.cxx/.libs/lt-hello ust_tests_hello:tptest (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint) field: doublefield (float) field: floatfield (float) field: stringfield (string) field: seqfield2 (string) field: seqfield1 (unknown) field: arrfield2 (string) field: arrfield1 (unknown) field: netintfieldhex (integer) field: netintfield (integer) field: longfield (integer) field: intfield2 (integer) field: intfield (integer) Best Regards Bernd -- This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer From jdesfossez at efficios.com Fri Sep 14 11:20:09 2012 From: jdesfossez at efficios.com (Julien Desfossez) Date: Fri, 14 Sep 2012 11:20:09 -0400 Subject: [lttng-dev] [BABELTRACE RFC PATCH] basic index creation and importing Message-ID: <1347636009-12545-1-git-send-email-jdesfossez@efficios.com> This patch provides a proof-of-concept of writing the index and importing it if it exists. The intent is to have the consumer (not babeltrace) write the index on disk while tracing and Babeltrace import it if possible. I added the stream_id field in the packet_index structure, I think it won't be a problem since this field is in the tracer packet_header structure. Like we discussed, we'll make sure to write the fields in network byte order. This index should also be the basis of the live reading of streamed traces. I think with the timestamp_end of the indexes we will have enough information to do so : only read the trace data up to min(indexes.timestamp_end). In the past, we discussed a separate synchronization file in which we would write the max sequence number that can be read for each stream, but I think we can simplify that by just reading this index. Before I start working on the consumer, I'd like your opinion on that. Thanks, Julien Signed-off-by: Julien Desfossez --- formats/ctf/ctf.c | 78 +++++++++++++++++++++++++++++++++++++--- include/babeltrace/ctf/types.h | 2 ++ 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index f1fdba1..c82dd3c 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -1218,6 +1218,39 @@ error: return ret; } +static +int import_stream_packet_index(struct ctf_trace *td, + struct ctf_file_stream *file_stream) +{ + struct ctf_stream_declaration *stream; + struct ctf_stream_pos *pos; + struct packet_index index; + int ret, index_read; + int first_packet = 1; + + pos = &file_stream->pos; + + while ((index_read = read(pos->index_fd, &index, sizeof(struct packet_index)))) { + if (first_packet) { + file_stream->parent.stream_id = index.stream_id; + stream = g_ptr_array_index(td->streams, index.stream_id); + if (!stream) { + fprintf(stderr, "[error] Stream %" PRIu64 " is not declared in metadata.\n", + index.stream_id); + return -EINVAL; + } + file_stream->parent.stream_class = stream; + ret = create_stream_definitions(td, &file_stream->parent); + if (ret) + return ret; + first_packet = 0; + } + /* add index to packet array */ + g_array_append_val(file_stream->pos.packet_cycles_index, index); + } + + return 0; +} static int create_stream_packet_index(struct ctf_trace *td, @@ -1323,6 +1356,7 @@ int create_stream_packet_index(struct ctf_trace *td, field = struct_definition_get_field_from_index(file_stream->parent.trace_packet_header, len_index); stream_id = get_unsigned_int(field); + packet_index.stream_id = stream_id; } } @@ -1441,6 +1475,7 @@ int create_stream_packet_index(struct ctf_trace *td, /* add index to packet array */ g_array_append_val(file_stream->pos.packet_cycles_index, packet_index); + write(pos->index_fd, &packet_index, sizeof(struct packet_index)); pos->mmap_offset += packet_index.packet_size / CHAR_BIT; } @@ -1481,9 +1516,10 @@ int ctf_open_file_stream_read(struct ctf_trace *td, const char *path, int flags, void (*packet_seek)(struct stream_pos *pos, size_t index, int whence)) { - int ret, fd; + int ret, fd, index_fd; struct ctf_file_stream *file_stream; struct stat statbuf; + char *index_name; fd = openat(td->dirfd, path, flags); if (fd < 0) { @@ -1523,9 +1559,40 @@ int ctf_open_file_stream_read(struct ctf_trace *td, const char *path, int flags, * For now, only a single clock per trace is supported. */ file_stream->parent.current_clock = td->single_clock; - ret = create_stream_packet_index(td, file_stream); - if (ret) - goto error_index; + + index_name = malloc((strlen(td->path) + strlen(path)) * sizeof(char) + 5); + if (!index_name) { + fprintf(stderr, "[error] Cannot allocate index filename\n"); + goto error; + } + sprintf(index_name, "%s/idx_%s", td->path, path); + + if (access(index_name, F_OK) != 0) { + index_fd = open(index_name, O_WRONLY|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); + if (index_fd < 0) { + perror("Index file openat()"); + ret = -1; + goto error; + } + file_stream->pos.index_fd = index_fd; + ret = create_stream_packet_index(td, file_stream); + if (ret) + goto error_index; + } else { + index_fd = open(index_name, O_RDONLY); + if (index_fd < 0) { + perror("Index file openat()"); + ret = -1; + goto error; + } + file_stream->pos.index_fd = index_fd; + ret = import_stream_packet_index(td, file_stream); + if (ret) + goto error_index; + } + close(file_stream->pos.index_fd); + free(index_name); + /* Add stream file to stream class */ g_ptr_array_add(file_stream->parent.stream_class->streams, &file_stream->parent); @@ -1607,7 +1674,8 @@ int ctf_open_trace_read(struct ctf_trace *td, /* Ignore hidden files, ., .. and metadata. */ if (!strncmp(diriter->d_name, ".", 1) || !strcmp(diriter->d_name, "..") - || !strcmp(diriter->d_name, "metadata")) + || !strcmp(diriter->d_name, "metadata") + || !strncmp(diriter->d_name, "idx_", 4)) continue; ret = ctf_open_file_stream_read(td, diriter->d_name, flags, packet_seek); diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h index 6a76c6b..ef79711 100644 --- a/include/babeltrace/ctf/types.h +++ b/include/babeltrace/ctf/types.h @@ -43,6 +43,7 @@ struct packet_index { uint64_t timestamp_begin; uint64_t timestamp_end; uint64_t events_discarded; + uint64_t stream_id; size_t events_discarded_len; /* length of the field, in bits */ }; @@ -52,6 +53,7 @@ struct packet_index { struct ctf_stream_pos { struct stream_pos parent; int fd; /* backing file fd. -1 if unset. */ + int index_fd; /* index file fd. -1 if unset. */ GArray *packet_cycles_index; /* contains struct packet_index in cycles */ GArray *packet_real_index; /* contains struct packet_index in ns */ int prot; /* mmap protection */ -- 1.7.10.4 From mathieu.desnoyers at efficios.com Fri Sep 14 11:42:07 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 14 Sep 2012 11:42:07 -0400 Subject: [lttng-dev] [BABELTRACE RFC PATCH] basic index creation and importing In-Reply-To: <1347636009-12545-1-git-send-email-jdesfossez@efficios.com> References: <1347636009-12545-1-git-send-email-jdesfossez@efficios.com> Message-ID: <20120914154206.GA25350@Krystal> * Julien Desfossez (jdesfossez at efficios.com) wrote: > This patch provides a proof-of-concept of writing the index and importing it if > it exists. The intent is to have the consumer (not babeltrace) write the index > on disk while tracing and Babeltrace import it if possible. > > I added the stream_id field in the packet_index structure, I think it won't be > a problem since this field is in the tracer packet_header structure. > > Like we discussed, we'll make sure to write the fields in network byte order. > > This index should also be the basis of the live reading of streamed traces. I > think with the timestamp_end of the indexes we will have enough information to > do so : only read the trace data up to min(indexes.timestamp_end). > > In the past, we discussed a separate synchronization file in which we would > write the max sequence number that can be read for each stream, but I think we > can simplify that by just reading this index. No. The simplification you propose does not take into account streams that do _not_ produce data. This is why the separate sync file is required. Thanks, Mathieu > > Before I start working on the consumer, I'd like your opinion on that. > > Thanks, > > Julien > > Signed-off-by: Julien Desfossez > --- > formats/ctf/ctf.c | 78 +++++++++++++++++++++++++++++++++++++--- > include/babeltrace/ctf/types.h | 2 ++ > 2 files changed, 75 insertions(+), 5 deletions(-) > > diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c > index f1fdba1..c82dd3c 100644 > --- a/formats/ctf/ctf.c > +++ b/formats/ctf/ctf.c > @@ -1218,6 +1218,39 @@ error: > return ret; > } > > +static > +int import_stream_packet_index(struct ctf_trace *td, > + struct ctf_file_stream *file_stream) > +{ > + struct ctf_stream_declaration *stream; > + struct ctf_stream_pos *pos; > + struct packet_index index; > + int ret, index_read; > + int first_packet = 1; > + > + pos = &file_stream->pos; > + > + while ((index_read = read(pos->index_fd, &index, sizeof(struct packet_index)))) { > + if (first_packet) { > + file_stream->parent.stream_id = index.stream_id; > + stream = g_ptr_array_index(td->streams, index.stream_id); > + if (!stream) { > + fprintf(stderr, "[error] Stream %" PRIu64 " is not declared in metadata.\n", > + index.stream_id); > + return -EINVAL; > + } > + file_stream->parent.stream_class = stream; > + ret = create_stream_definitions(td, &file_stream->parent); > + if (ret) > + return ret; > + first_packet = 0; > + } > + /* add index to packet array */ > + g_array_append_val(file_stream->pos.packet_cycles_index, index); > + } > + > + return 0; > +} > > static > int create_stream_packet_index(struct ctf_trace *td, > @@ -1323,6 +1356,7 @@ int create_stream_packet_index(struct ctf_trace *td, > > field = struct_definition_get_field_from_index(file_stream->parent.trace_packet_header, len_index); > stream_id = get_unsigned_int(field); > + packet_index.stream_id = stream_id; > } > } > > @@ -1441,6 +1475,7 @@ int create_stream_packet_index(struct ctf_trace *td, > > /* add index to packet array */ > g_array_append_val(file_stream->pos.packet_cycles_index, packet_index); > + write(pos->index_fd, &packet_index, sizeof(struct packet_index)); > > pos->mmap_offset += packet_index.packet_size / CHAR_BIT; > } > @@ -1481,9 +1516,10 @@ int ctf_open_file_stream_read(struct ctf_trace *td, const char *path, int flags, > void (*packet_seek)(struct stream_pos *pos, size_t index, > int whence)) > { > - int ret, fd; > + int ret, fd, index_fd; > struct ctf_file_stream *file_stream; > struct stat statbuf; > + char *index_name; > > fd = openat(td->dirfd, path, flags); > if (fd < 0) { > @@ -1523,9 +1559,40 @@ int ctf_open_file_stream_read(struct ctf_trace *td, const char *path, int flags, > * For now, only a single clock per trace is supported. > */ > file_stream->parent.current_clock = td->single_clock; > - ret = create_stream_packet_index(td, file_stream); > - if (ret) > - goto error_index; > + > + index_name = malloc((strlen(td->path) + strlen(path)) * sizeof(char) + 5); > + if (!index_name) { > + fprintf(stderr, "[error] Cannot allocate index filename\n"); > + goto error; > + } > + sprintf(index_name, "%s/idx_%s", td->path, path); > + > + if (access(index_name, F_OK) != 0) { > + index_fd = open(index_name, O_WRONLY|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); > + if (index_fd < 0) { > + perror("Index file openat()"); > + ret = -1; > + goto error; > + } > + file_stream->pos.index_fd = index_fd; > + ret = create_stream_packet_index(td, file_stream); > + if (ret) > + goto error_index; > + } else { > + index_fd = open(index_name, O_RDONLY); > + if (index_fd < 0) { > + perror("Index file openat()"); > + ret = -1; > + goto error; > + } > + file_stream->pos.index_fd = index_fd; > + ret = import_stream_packet_index(td, file_stream); > + if (ret) > + goto error_index; > + } > + close(file_stream->pos.index_fd); > + free(index_name); > + > /* Add stream file to stream class */ > g_ptr_array_add(file_stream->parent.stream_class->streams, > &file_stream->parent); > @@ -1607,7 +1674,8 @@ int ctf_open_trace_read(struct ctf_trace *td, > /* Ignore hidden files, ., .. and metadata. */ > if (!strncmp(diriter->d_name, ".", 1) > || !strcmp(diriter->d_name, "..") > - || !strcmp(diriter->d_name, "metadata")) > + || !strcmp(diriter->d_name, "metadata") > + || !strncmp(diriter->d_name, "idx_", 4)) > continue; > ret = ctf_open_file_stream_read(td, diriter->d_name, > flags, packet_seek); > diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h > index 6a76c6b..ef79711 100644 > --- a/include/babeltrace/ctf/types.h > +++ b/include/babeltrace/ctf/types.h > @@ -43,6 +43,7 @@ struct packet_index { > uint64_t timestamp_begin; > uint64_t timestamp_end; > uint64_t events_discarded; > + uint64_t stream_id; > size_t events_discarded_len; /* length of the field, in bits */ > }; > > @@ -52,6 +53,7 @@ struct packet_index { > struct ctf_stream_pos { > struct stream_pos parent; > int fd; /* backing file fd. -1 if unset. */ > + int index_fd; /* index file fd. -1 if unset. */ > GArray *packet_cycles_index; /* contains struct packet_index in cycles */ > GArray *packet_real_index; /* contains struct packet_index in ns */ > int prot; /* mmap protection */ > -- > 1.7.10.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Fri Sep 14 11:58:08 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 14 Sep 2012 11:58:08 -0400 Subject: [lttng-dev] [RFC] Per-user event ID allocation proposal In-Reply-To: <20120914122218.GA19648@Krystal> References: <20120912123555.GA26893@Krystal> <5051EDE0.3070900@efficios.com> <20120914122218.GA19648@Krystal> Message-ID: <50535410.4040104@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Mathieu Desnoyers: > * David Goulet (dgoulet at efficios.com) wrote: Hi Mathieu, > > This looks good! I have some questions to clarify part of the RFC. > > Mathieu Desnoyers: >>>> Mathieu Desnoyers September 11, 2012 >>>> >>>> Per-user event ID allocation proposal >>>> >>>> The intent of this shared event ID registry is to allow >>>> sharing tracing buffers between applications belonging to the >>>> same user (UID) for UST (user-space) tracing. >>>> >>>> A.1) Overview of System-wide, per-ABI (32 and 64-bit), >>>> per-user, per-session, LTTng-UST event ID allocation: >>>> >>>> - Modify LTTng-UST and lttng-tools to keep a system-wide, >>>> per-ABI (32 and 64-bit), per-user, per-session registry of >>>> enabled events and their associated numeric IDs. - LTTng-UST >>>> will have to register its tracepoints to the session daemon, >>>> sending the field typing of these tracepoints during >>>> registration, - Dynamically check that field types match upon >>>> registration of an event in this global registry, refuse >>>> registration if the field types do not match, - The metadata >>>> will be generated by lttng-tools instead of the application. >>>> >>>> A.2 Per-user Event ID Details: >>>> >>>> The event ID registry is shared across all processes for a >>>> given session/ABI/channel/user (UID). The intent is to forbid >>>> one user to access tracing data from another user, while >>>> keeping the system-wide number of buffers small. >>>> >>>> The event ID registry is attached to a: - session, - specific >>>> ABI (32/64-bit), - channel, - user (UID). >>>> >>>> lttng-session fill this registry by pulling this information >>>> as needed from traced processes (a.k.a. applications) to >>>> populate the registry. This information is needed only when >>>> an event is active for a created session. Therefore, >>>> applications need not to notify the sessiond if no session is >>>> created. >>>> >>>> The rationale for using a "pull" scheme, where the sessiond >>>> pulls information from applications, in opposition to a >>>> "push" scheme, where application would initiate commands to >>>> push the information, is that it minimizes the amount of >>>> logic required within liblttng-ust, and it does not require >>>> liblttng-ust to wait for reply from lttng-sessiond, which >>>> minimize the impact on the application behavior, providing >>>> application resilience to lttng-sessiond crash. >>>> >>>> Updates to this registry are triggered by two distinct >>>> scenarios: either an "enable-event" command (could also be >>>> "start", depending on the sessiond design) is being executed, >>>> or, while tracing, a library is being loaded within the >>>> application. >>>> >>>> Before we start describing the algorithms that update the >>>> registry, it is _very_ important to understand that an event >>>> enabled with "enable-event" can contain a wildcard (e.g.: >>>> libc*) and loglevel, and therefore is associated to possibly >>>> _many_ events in the application. >>>> >>>> Algo (1) When an "enable-event"/"start" command is executed, >>>> the sessiond will get, in return for sending an enable-event >>>> command to the application (which apply to a channel within a >>>> session), a variable-sized array of enabled events (remember, >>>> we can enable a wildcard!), along with their name, loglevel, >>>> field name, and field type. The sessiond proceeds to check >>>> that each event does not conflict with another event in the >>>> registry with the same name, but having different field >>>> names/types or loglevel. If its field names/typing or >>>> loglevel differ from a previous event, it prints a warnings. >>>> If it matches a previous event, it re-uses the same ID as the >>>> previous event. If no match, it allocates a new event ID. It >>>> sends a command to the application to let it know the mapping >>>> between the event name and ID for the channel. When the >>>> application receives that command, it can finally proceed to >>>> attach the tracepoint probe to the tracepoint site. > >>>> The sessiond keeps a per-application/per-channel hash table >>>> of already enabled events, so it does not provide the same >>>> event name/id mapping twice for a given channel. > > and per-session ? > >> Yes. > > > Of what I understand of this proposal, an event is associated to > per-user/per-session/per-apps/per-channel values. > >> Well, given that channels become per-user, an application will >> write its data into the channel with same UID as itself. (it >> might imply some limitations with setuid() in an application, or >> at least to document those, or that we overload setuid()) > >> The "per-app" part is not quite right. Event IDs are re-used and >> shared across all applications that belong to the same UID. > > > > (I have a question at the end about how an event ID should be > generated) > >>>> >>>> Algo (2) In the case where a library (.so) is being loaded in >>>> the application while tracing, the update sequence goes as >>>> follow: the application first checks if there is any session >>>> created. It so, it sends a NOTIFY_NEW_EVENTS message to the >>>> sessiond through the communication socket (normally used to >>>> send ACK to commands). The lttng-sessiond will therefore need >>>> to listen (read) to each application communication socket, >>>> and will also need to dispatch NOTIFY_NEW_EVENTS messages >>>> each time it expects an ACK reply for a command it has sent >>>> to the application. > > Taking back the last sentence, can you explain more or clarify the > mechanism here of "dispatching a NOTIFY_NEW_EVENTS" each time an > ACK reply is expected?... Do you mean that each time we are waiting > for an ACK, if we get a NOTIFY instead (which could happen due to a > race between notification and command handling) you will launch a > NOTIFY code path where the session daemon check the events hash > table and check for event(s) to pull from the UST tracer? ... so > what about getting the real ACK after that ? > >> In this scheme, the NOTIFY is entirely asynchronous, and gets no >> acknowledge from the sessiond to the app. This means that when >> dispatching the NOTIFY received at the ACK site (due to the race >> you refer to), we could simply queue this notify within the >> sessiond so it gets handled after we finished handling the >> current command (e.g. next time the thread go back to poll fds). > > >>>> When a NOTIFY_NEW_EVENTS is received from an application, >>>> the sessiond iterates on each session, each channel, redoing >>>> Algo (1). The per-app/per-channel hash table that remembers >>>> already enabled events will ensure that we don't end up >>>> enabling the same event twice. >>>> >>>> At application startup, the "registration done" message will >>>> only be sent once all the commands setting the mapping >>>> between event name and ID are sent. This ensures tracing is >>>> not started until all events are enabled (delaying the >>>> application for a configurable delay). >>>> >>>> At library load, a "registration done" will also be sent by >>>> the sessiond some time after the NOTIFY_NEW_EVENTS has been >>>> received -- at the end of Algo(1). This means that library >>>> load, within applications, can be delayed for the same amount >>>> of time that apply to application start (configurable). >>>> >>>> The registry is emptied when the session is destroyed. Event >>>> IDs are never freed, only re-used for events with the same >>>> name, after loglevel, field name and field type match check. > > This means that event IDs here should be some kind of a hash using > a combination of values of the event to make sure it's unique on a > per-event/per-channel/per-session basis ? (considering the > sessiond should keep them in a separate registry) > >> I think it would be enough to hash the events by their full name, >> and then do a compare to check if the fields match. We _want_ the >> hash table lookup to succeed if we get an event with same name >> but different fields, but then our detailed check for field >> mispatch would fail. > > >>>> >>>> This registry is also used to generate metadata from the >>>> sessiond. The sessiond will now be responsible for generation >>>> of the metadata stream. >>>> > > This implies that the session daemon will need to keep track of > the global memory location of each applications in order to > consumer metadata streams ? > >> Uh ? no. The metadata stream would be _created_ by the sessiond. >> Applications would not have anything to do with the metadata >> stream in this scheme. Basically, we need to ensure that all the >> information required to generate the metadata for a given >> session/channel is present in the table that contains mapping >> between numeric event IDs and event name/field >> names/types/loglevel. Hmmm... the session daemon creates the metadata now... this means you are going to get the full ringbuffer + ctf code inside the lttng-tools tree....!? Any case, I would love having a reason for that since this seems to me an important change. David > >> Anything still unclear ? > >> Thanks, > >> Mathieu > > > Cheers! David > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQU1QQAAoJEELoaioR9I02rfsIAMuPRy0A9bY1A4GFiGy0SnRj D873hzdwqgxdniyr/R1tT7CqvN4oIqo9at6/jJCm7Si6HS5OCeVvII6iGW0HzuU3 Yo9XdzIt75NoiUBgpIccfXqdRLg5bK8IYYJd+CJjrk7xiP7CVJ+XnarShAic82Tm RSWgjKustgSpJtYHlxdlu+bBu3Y0Dbv9G6ClGJeC96yODVvlkXGtEtRln2SQtVE+ zJcZgqJz+GDc4m1I3nwrXsrXSKgLF4hQuwv7lcXMGRw1xf8pXCW21+UXAlckjlqK eAutnIIU3IU7SrZ4m5+I/IixAPxg+uAmPSVdTXpwS6r5StomM1vE94ZICT4tyKk= =mq+J -----END PGP SIGNATURE----- From jdesfossez at efficios.com Fri Sep 14 12:07:24 2012 From: jdesfossez at efficios.com (Julien Desfossez) Date: Fri, 14 Sep 2012 12:07:24 -0400 Subject: [lttng-dev] [BABELTRACE RFC PATCH] basic index creation and importing In-Reply-To: <20120914154206.GA25350@Krystal> References: <1347636009-12545-1-git-send-email-jdesfossez@efficios.com> <20120914154206.GA25350@Krystal> Message-ID: <5053563C.7070600@efficios.com> On 14/09/12 11:42 AM, Mathieu Desnoyers wrote: > * Julien Desfossez (jdesfossez at efficios.com) wrote: >> This patch provides a proof-of-concept of writing the index and importing it if >> it exists. The intent is to have the consumer (not babeltrace) write the index >> on disk while tracing and Babeltrace import it if possible. >> >> I added the stream_id field in the packet_index structure, I think it won't be >> a problem since this field is in the tracer packet_header structure. >> >> Like we discussed, we'll make sure to write the fields in network byte order. >> >> This index should also be the basis of the live reading of streamed traces. I >> think with the timestamp_end of the indexes we will have enough information to >> do so : only read the trace data up to min(indexes.timestamp_end). >> >> In the past, we discussed a separate synchronization file in which we would >> write the max sequence number that can be read for each stream, but I think we >> can simplify that by just reading this index. > > No. The simplification you propose does not take into account streams > that do _not_ produce data. This is why the separate sync file is > required. Ah yes, that's why we had this scheme :-) ! Ok, I'll start working on that. Thanks, Julien > > Thanks, > > Mathieu > >> >> Before I start working on the consumer, I'd like your opinion on that. >> >> Thanks, >> >> Julien >> >> Signed-off-by: Julien Desfossez >> --- >> formats/ctf/ctf.c | 78 +++++++++++++++++++++++++++++++++++++--- >> include/babeltrace/ctf/types.h | 2 ++ >> 2 files changed, 75 insertions(+), 5 deletions(-) >> >> diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c >> index f1fdba1..c82dd3c 100644 >> --- a/formats/ctf/ctf.c >> +++ b/formats/ctf/ctf.c >> @@ -1218,6 +1218,39 @@ error: >> return ret; >> } >> >> +static >> +int import_stream_packet_index(struct ctf_trace *td, >> + struct ctf_file_stream *file_stream) >> +{ >> + struct ctf_stream_declaration *stream; >> + struct ctf_stream_pos *pos; >> + struct packet_index index; >> + int ret, index_read; >> + int first_packet = 1; >> + >> + pos = &file_stream->pos; >> + >> + while ((index_read = read(pos->index_fd, &index, sizeof(struct packet_index)))) { >> + if (first_packet) { >> + file_stream->parent.stream_id = index.stream_id; >> + stream = g_ptr_array_index(td->streams, index.stream_id); >> + if (!stream) { >> + fprintf(stderr, "[error] Stream %" PRIu64 " is not declared in metadata.\n", >> + index.stream_id); >> + return -EINVAL; >> + } >> + file_stream->parent.stream_class = stream; >> + ret = create_stream_definitions(td, &file_stream->parent); >> + if (ret) >> + return ret; >> + first_packet = 0; >> + } >> + /* add index to packet array */ >> + g_array_append_val(file_stream->pos.packet_cycles_index, index); >> + } >> + >> + return 0; >> +} >> >> static >> int create_stream_packet_index(struct ctf_trace *td, >> @@ -1323,6 +1356,7 @@ int create_stream_packet_index(struct ctf_trace *td, >> >> field = struct_definition_get_field_from_index(file_stream->parent.trace_packet_header, len_index); >> stream_id = get_unsigned_int(field); >> + packet_index.stream_id = stream_id; >> } >> } >> >> @@ -1441,6 +1475,7 @@ int create_stream_packet_index(struct ctf_trace *td, >> >> /* add index to packet array */ >> g_array_append_val(file_stream->pos.packet_cycles_index, packet_index); >> + write(pos->index_fd, &packet_index, sizeof(struct packet_index)); >> >> pos->mmap_offset += packet_index.packet_size / CHAR_BIT; >> } >> @@ -1481,9 +1516,10 @@ int ctf_open_file_stream_read(struct ctf_trace *td, const char *path, int flags, >> void (*packet_seek)(struct stream_pos *pos, size_t index, >> int whence)) >> { >> - int ret, fd; >> + int ret, fd, index_fd; >> struct ctf_file_stream *file_stream; >> struct stat statbuf; >> + char *index_name; >> >> fd = openat(td->dirfd, path, flags); >> if (fd < 0) { >> @@ -1523,9 +1559,40 @@ int ctf_open_file_stream_read(struct ctf_trace *td, const char *path, int flags, >> * For now, only a single clock per trace is supported. >> */ >> file_stream->parent.current_clock = td->single_clock; >> - ret = create_stream_packet_index(td, file_stream); >> - if (ret) >> - goto error_index; >> + >> + index_name = malloc((strlen(td->path) + strlen(path)) * sizeof(char) + 5); >> + if (!index_name) { >> + fprintf(stderr, "[error] Cannot allocate index filename\n"); >> + goto error; >> + } >> + sprintf(index_name, "%s/idx_%s", td->path, path); >> + >> + if (access(index_name, F_OK) != 0) { >> + index_fd = open(index_name, O_WRONLY|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); >> + if (index_fd < 0) { >> + perror("Index file openat()"); >> + ret = -1; >> + goto error; >> + } >> + file_stream->pos.index_fd = index_fd; >> + ret = create_stream_packet_index(td, file_stream); >> + if (ret) >> + goto error_index; >> + } else { >> + index_fd = open(index_name, O_RDONLY); >> + if (index_fd < 0) { >> + perror("Index file openat()"); >> + ret = -1; >> + goto error; >> + } >> + file_stream->pos.index_fd = index_fd; >> + ret = import_stream_packet_index(td, file_stream); >> + if (ret) >> + goto error_index; >> + } >> + close(file_stream->pos.index_fd); >> + free(index_name); >> + >> /* Add stream file to stream class */ >> g_ptr_array_add(file_stream->parent.stream_class->streams, >> &file_stream->parent); >> @@ -1607,7 +1674,8 @@ int ctf_open_trace_read(struct ctf_trace *td, >> /* Ignore hidden files, ., .. and metadata. */ >> if (!strncmp(diriter->d_name, ".", 1) >> || !strcmp(diriter->d_name, "..") >> - || !strcmp(diriter->d_name, "metadata")) >> + || !strcmp(diriter->d_name, "metadata") >> + || !strncmp(diriter->d_name, "idx_", 4)) >> continue; >> ret = ctf_open_file_stream_read(td, diriter->d_name, >> flags, packet_seek); >> diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h >> index 6a76c6b..ef79711 100644 >> --- a/include/babeltrace/ctf/types.h >> +++ b/include/babeltrace/ctf/types.h >> @@ -43,6 +43,7 @@ struct packet_index { >> uint64_t timestamp_begin; >> uint64_t timestamp_end; >> uint64_t events_discarded; >> + uint64_t stream_id; >> size_t events_discarded_len; /* length of the field, in bits */ >> }; >> >> @@ -52,6 +53,7 @@ struct packet_index { >> struct ctf_stream_pos { >> struct stream_pos parent; >> int fd; /* backing file fd. -1 if unset. */ >> + int index_fd; /* index file fd. -1 if unset. */ >> GArray *packet_cycles_index; /* contains struct packet_index in cycles */ >> GArray *packet_real_index; /* contains struct packet_index in ns */ >> int prot; /* mmap protection */ >> -- >> 1.7.10.4 >> > From mathieu.desnoyers at efficios.com Fri Sep 14 12:07:40 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 14 Sep 2012 12:07:40 -0400 Subject: [lttng-dev] [RFC] Per-user event ID allocation proposal In-Reply-To: <50535410.4040104@efficios.com> References: <20120912123555.GA26893@Krystal> <5051EDE0.3070900@efficios.com> <20120914122218.GA19648@Krystal> <50535410.4040104@efficios.com> Message-ID: <20120914160740.GD25652@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > > > Mathieu Desnoyers: > > * David Goulet (dgoulet at efficios.com) wrote: Hi Mathieu, > > > > This looks good! I have some questions to clarify part of the RFC. > > > > Mathieu Desnoyers: > >>>> Mathieu Desnoyers September 11, 2012 > >>>> > >>>> Per-user event ID allocation proposal > >>>> > >>>> The intent of this shared event ID registry is to allow > >>>> sharing tracing buffers between applications belonging to the > >>>> same user (UID) for UST (user-space) tracing. > >>>> > >>>> A.1) Overview of System-wide, per-ABI (32 and 64-bit), > >>>> per-user, per-session, LTTng-UST event ID allocation: > >>>> > >>>> - Modify LTTng-UST and lttng-tools to keep a system-wide, > >>>> per-ABI (32 and 64-bit), per-user, per-session registry of > >>>> enabled events and their associated numeric IDs. - LTTng-UST > >>>> will have to register its tracepoints to the session daemon, > >>>> sending the field typing of these tracepoints during > >>>> registration, - Dynamically check that field types match upon > >>>> registration of an event in this global registry, refuse > >>>> registration if the field types do not match, - The metadata > >>>> will be generated by lttng-tools instead of the application. > >>>> > >>>> A.2 Per-user Event ID Details: > >>>> > >>>> The event ID registry is shared across all processes for a > >>>> given session/ABI/channel/user (UID). The intent is to forbid > >>>> one user to access tracing data from another user, while > >>>> keeping the system-wide number of buffers small. > >>>> > >>>> The event ID registry is attached to a: - session, - specific > >>>> ABI (32/64-bit), - channel, - user (UID). > >>>> > >>>> lttng-session fill this registry by pulling this information > >>>> as needed from traced processes (a.k.a. applications) to > >>>> populate the registry. This information is needed only when > >>>> an event is active for a created session. Therefore, > >>>> applications need not to notify the sessiond if no session is > >>>> created. > >>>> > >>>> The rationale for using a "pull" scheme, where the sessiond > >>>> pulls information from applications, in opposition to a > >>>> "push" scheme, where application would initiate commands to > >>>> push the information, is that it minimizes the amount of > >>>> logic required within liblttng-ust, and it does not require > >>>> liblttng-ust to wait for reply from lttng-sessiond, which > >>>> minimize the impact on the application behavior, providing > >>>> application resilience to lttng-sessiond crash. > >>>> > >>>> Updates to this registry are triggered by two distinct > >>>> scenarios: either an "enable-event" command (could also be > >>>> "start", depending on the sessiond design) is being executed, > >>>> or, while tracing, a library is being loaded within the > >>>> application. > >>>> > >>>> Before we start describing the algorithms that update the > >>>> registry, it is _very_ important to understand that an event > >>>> enabled with "enable-event" can contain a wildcard (e.g.: > >>>> libc*) and loglevel, and therefore is associated to possibly > >>>> _many_ events in the application. > >>>> > >>>> Algo (1) When an "enable-event"/"start" command is executed, > >>>> the sessiond will get, in return for sending an enable-event > >>>> command to the application (which apply to a channel within a > >>>> session), a variable-sized array of enabled events (remember, > >>>> we can enable a wildcard!), along with their name, loglevel, > >>>> field name, and field type. The sessiond proceeds to check > >>>> that each event does not conflict with another event in the > >>>> registry with the same name, but having different field > >>>> names/types or loglevel. If its field names/typing or > >>>> loglevel differ from a previous event, it prints a warnings. > >>>> If it matches a previous event, it re-uses the same ID as the > >>>> previous event. If no match, it allocates a new event ID. It > >>>> sends a command to the application to let it know the mapping > >>>> between the event name and ID for the channel. When the > >>>> application receives that command, it can finally proceed to > >>>> attach the tracepoint probe to the tracepoint site. > > > >>>> The sessiond keeps a per-application/per-channel hash table > >>>> of already enabled events, so it does not provide the same > >>>> event name/id mapping twice for a given channel. > > > > and per-session ? > > > >> Yes. > > > > > > Of what I understand of this proposal, an event is associated to > > per-user/per-session/per-apps/per-channel values. > > > >> Well, given that channels become per-user, an application will > >> write its data into the channel with same UID as itself. (it > >> might imply some limitations with setuid() in an application, or > >> at least to document those, or that we overload setuid()) > > > >> The "per-app" part is not quite right. Event IDs are re-used and > >> shared across all applications that belong to the same UID. > > > > > > > > (I have a question at the end about how an event ID should be > > generated) > > > >>>> > >>>> Algo (2) In the case where a library (.so) is being loaded in > >>>> the application while tracing, the update sequence goes as > >>>> follow: the application first checks if there is any session > >>>> created. It so, it sends a NOTIFY_NEW_EVENTS message to the > >>>> sessiond through the communication socket (normally used to > >>>> send ACK to commands). The lttng-sessiond will therefore need > >>>> to listen (read) to each application communication socket, > >>>> and will also need to dispatch NOTIFY_NEW_EVENTS messages > >>>> each time it expects an ACK reply for a command it has sent > >>>> to the application. > > > > Taking back the last sentence, can you explain more or clarify the > > mechanism here of "dispatching a NOTIFY_NEW_EVENTS" each time an > > ACK reply is expected?... Do you mean that each time we are waiting > > for an ACK, if we get a NOTIFY instead (which could happen due to a > > race between notification and command handling) you will launch a > > NOTIFY code path where the session daemon check the events hash > > table and check for event(s) to pull from the UST tracer? ... so > > what about getting the real ACK after that ? > > > >> In this scheme, the NOTIFY is entirely asynchronous, and gets no > >> acknowledge from the sessiond to the app. This means that when > >> dispatching the NOTIFY received at the ACK site (due to the race > >> you refer to), we could simply queue this notify within the > >> sessiond so it gets handled after we finished handling the > >> current command (e.g. next time the thread go back to poll fds). > > > > > >>>> When a NOTIFY_NEW_EVENTS is received from an application, > >>>> the sessiond iterates on each session, each channel, redoing > >>>> Algo (1). The per-app/per-channel hash table that remembers > >>>> already enabled events will ensure that we don't end up > >>>> enabling the same event twice. > >>>> > >>>> At application startup, the "registration done" message will > >>>> only be sent once all the commands setting the mapping > >>>> between event name and ID are sent. This ensures tracing is > >>>> not started until all events are enabled (delaying the > >>>> application for a configurable delay). > >>>> > >>>> At library load, a "registration done" will also be sent by > >>>> the sessiond some time after the NOTIFY_NEW_EVENTS has been > >>>> received -- at the end of Algo(1). This means that library > >>>> load, within applications, can be delayed for the same amount > >>>> of time that apply to application start (configurable). > >>>> > >>>> The registry is emptied when the session is destroyed. Event > >>>> IDs are never freed, only re-used for events with the same > >>>> name, after loglevel, field name and field type match check. > > > > This means that event IDs here should be some kind of a hash using > > a combination of values of the event to make sure it's unique on a > > per-event/per-channel/per-session basis ? (considering the > > sessiond should keep them in a separate registry) > > > >> I think it would be enough to hash the events by their full name, > >> and then do a compare to check if the fields match. We _want_ the > >> hash table lookup to succeed if we get an event with same name > >> but different fields, but then our detailed check for field > >> mispatch would fail. > > > > > >>>> > >>>> This registry is also used to generate metadata from the > >>>> sessiond. The sessiond will now be responsible for generation > >>>> of the metadata stream. > >>>> > > > > This implies that the session daemon will need to keep track of > > the global memory location of each applications in order to > > consumer metadata streams ? > > > >> Uh ? no. The metadata stream would be _created_ by the sessiond. > >> Applications would not have anything to do with the metadata > >> stream in this scheme. Basically, we need to ensure that all the > >> information required to generate the metadata for a given > >> session/channel is present in the table that contains mapping > >> between numeric event IDs and event name/field > >> names/types/loglevel. > > Hmmm... the session daemon creates the metadata now... this means you > are going to get the full ringbuffer + ctf code inside the lttng-tools > tree....!? No. Just move the internal representation of the tracepoint metadata that UST currently has (see ust-events.h) into lttng-tools. Thanks, Mathieu > > Any case, I would love having a reason for that since this seems to me > an important change. > > David > > > > >> Anything still unclear ? > > > >> Thanks, > > > >> Mathieu > > > > > > Cheers! David > > > -----BEGIN PGP SIGNATURE----- > > iQEcBAEBCgAGBQJQU1QQAAoJEELoaioR9I02rfsIAMuPRy0A9bY1A4GFiGy0SnRj > D873hzdwqgxdniyr/R1tT7CqvN4oIqo9at6/jJCm7Si6HS5OCeVvII6iGW0HzuU3 > Yo9XdzIt75NoiUBgpIccfXqdRLg5bK8IYYJd+CJjrk7xiP7CVJ+XnarShAic82Tm > RSWgjKustgSpJtYHlxdlu+bBu3Y0Dbv9G6ClGJeC96yODVvlkXGtEtRln2SQtVE+ > zJcZgqJz+GDc4m1I3nwrXsrXSKgLF4hQuwv7lcXMGRw1xf8pXCW21+UXAlckjlqK > eAutnIIU3IU7SrZ4m5+I/IixAPxg+uAmPSVdTXpwS6r5StomM1vE94ZICT4tyKk= > =mq+J > -----END PGP SIGNATURE----- -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Fri Sep 14 12:09:52 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 14 Sep 2012 12:09:52 -0400 Subject: [lttng-dev] [RFC] Per-user event ID allocation proposal In-Reply-To: <20120914160740.GD25652@Krystal> References: <20120912123555.GA26893@Krystal> <5051EDE0.3070900@efficios.com> <20120914122218.GA19648@Krystal> <50535410.4040104@efficios.com> <20120914160740.GD25652@Krystal> Message-ID: <505356D0.7020906@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Mathieu Desnoyers: > * David Goulet (dgoulet at efficios.com) wrote: > > > Mathieu Desnoyers: >>>> * David Goulet (dgoulet at efficios.com) wrote: Hi Mathieu, >>>> >>>> This looks good! I have some questions to clarify part of the >>>> RFC. >>>> >>>> Mathieu Desnoyers: >>>>>>> Mathieu Desnoyers September 11, 2012 >>>>>>> >>>>>>> Per-user event ID allocation proposal >>>>>>> >>>>>>> The intent of this shared event ID registry is to >>>>>>> allow sharing tracing buffers between applications >>>>>>> belonging to the same user (UID) for UST (user-space) >>>>>>> tracing. >>>>>>> >>>>>>> A.1) Overview of System-wide, per-ABI (32 and 64-bit), >>>>>>> per-user, per-session, LTTng-UST event ID allocation: >>>>>>> >>>>>>> - Modify LTTng-UST and lttng-tools to keep a >>>>>>> system-wide, per-ABI (32 and 64-bit), per-user, >>>>>>> per-session registry of enabled events and their >>>>>>> associated numeric IDs. - LTTng-UST will have to >>>>>>> register its tracepoints to the session daemon, sending >>>>>>> the field typing of these tracepoints during >>>>>>> registration, - Dynamically check that field types >>>>>>> match upon registration of an event in this global >>>>>>> registry, refuse registration if the field types do not >>>>>>> match, - The metadata will be generated by lttng-tools >>>>>>> instead of the application. >>>>>>> >>>>>>> A.2 Per-user Event ID Details: >>>>>>> >>>>>>> The event ID registry is shared across all processes >>>>>>> for a given session/ABI/channel/user (UID). The intent >>>>>>> is to forbid one user to access tracing data from >>>>>>> another user, while keeping the system-wide number of >>>>>>> buffers small. >>>>>>> >>>>>>> The event ID registry is attached to a: - session, - >>>>>>> specific ABI (32/64-bit), - channel, - user (UID). >>>>>>> >>>>>>> lttng-session fill this registry by pulling this >>>>>>> information as needed from traced processes (a.k.a. >>>>>>> applications) to populate the registry. This >>>>>>> information is needed only when an event is active for >>>>>>> a created session. Therefore, applications need not to >>>>>>> notify the sessiond if no session is created. >>>>>>> >>>>>>> The rationale for using a "pull" scheme, where the >>>>>>> sessiond pulls information from applications, in >>>>>>> opposition to a "push" scheme, where application would >>>>>>> initiate commands to push the information, is that it >>>>>>> minimizes the amount of logic required within >>>>>>> liblttng-ust, and it does not require liblttng-ust to >>>>>>> wait for reply from lttng-sessiond, which minimize the >>>>>>> impact on the application behavior, providing >>>>>>> application resilience to lttng-sessiond crash. >>>>>>> >>>>>>> Updates to this registry are triggered by two distinct >>>>>>> scenarios: either an "enable-event" command (could also >>>>>>> be "start", depending on the sessiond design) is being >>>>>>> executed, or, while tracing, a library is being loaded >>>>>>> within the application. >>>>>>> >>>>>>> Before we start describing the algorithms that update >>>>>>> the registry, it is _very_ important to understand that >>>>>>> an event enabled with "enable-event" can contain a >>>>>>> wildcard (e.g.: libc*) and loglevel, and therefore is >>>>>>> associated to possibly _many_ events in the >>>>>>> application. >>>>>>> >>>>>>> Algo (1) When an "enable-event"/"start" command is >>>>>>> executed, the sessiond will get, in return for sending >>>>>>> an enable-event command to the application (which apply >>>>>>> to a channel within a session), a variable-sized array >>>>>>> of enabled events (remember, we can enable a >>>>>>> wildcard!), along with their name, loglevel, field >>>>>>> name, and field type. The sessiond proceeds to check >>>>>>> that each event does not conflict with another event in >>>>>>> the registry with the same name, but having different >>>>>>> field names/types or loglevel. If its field >>>>>>> names/typing or loglevel differ from a previous event, >>>>>>> it prints a warnings. If it matches a previous event, >>>>>>> it re-uses the same ID as the previous event. If no >>>>>>> match, it allocates a new event ID. It sends a command >>>>>>> to the application to let it know the mapping between >>>>>>> the event name and ID for the channel. When the >>>>>>> application receives that command, it can finally >>>>>>> proceed to attach the tracepoint probe to the >>>>>>> tracepoint site. >>>> >>>>>>> The sessiond keeps a per-application/per-channel hash >>>>>>> table of already enabled events, so it does not provide >>>>>>> the same event name/id mapping twice for a given >>>>>>> channel. >>>> >>>> and per-session ? >>>> >>>>> Yes. >>>> >>>> >>>> Of what I understand of this proposal, an event is associated >>>> to per-user/per-session/per-apps/per-channel values. >>>> >>>>> Well, given that channels become per-user, an application >>>>> will write its data into the channel with same UID as >>>>> itself. (it might imply some limitations with setuid() in >>>>> an application, or at least to document those, or that we >>>>> overload setuid()) >>>> >>>>> The "per-app" part is not quite right. Event IDs are >>>>> re-used and shared across all applications that belong to >>>>> the same UID. >>>> >>>> >>>> >>>> (I have a question at the end about how an event ID should >>>> be generated) >>>> >>>>>>> >>>>>>> Algo (2) In the case where a library (.so) is being >>>>>>> loaded in the application while tracing, the update >>>>>>> sequence goes as follow: the application first checks >>>>>>> if there is any session created. It so, it sends a >>>>>>> NOTIFY_NEW_EVENTS message to the sessiond through the >>>>>>> communication socket (normally used to send ACK to >>>>>>> commands). The lttng-sessiond will therefore need to >>>>>>> listen (read) to each application communication >>>>>>> socket, and will also need to dispatch >>>>>>> NOTIFY_NEW_EVENTS messages each time it expects an ACK >>>>>>> reply for a command it has sent to the application. >>>> >>>> Taking back the last sentence, can you explain more or >>>> clarify the mechanism here of "dispatching a >>>> NOTIFY_NEW_EVENTS" each time an ACK reply is expected?... Do >>>> you mean that each time we are waiting for an ACK, if we get >>>> a NOTIFY instead (which could happen due to a race between >>>> notification and command handling) you will launch a NOTIFY >>>> code path where the session daemon check the events hash >>>> table and check for event(s) to pull from the UST tracer? ... >>>> so what about getting the real ACK after that ? >>>> >>>>> In this scheme, the NOTIFY is entirely asynchronous, and >>>>> gets no acknowledge from the sessiond to the app. This >>>>> means that when dispatching the NOTIFY received at the ACK >>>>> site (due to the race you refer to), we could simply queue >>>>> this notify within the sessiond so it gets handled after we >>>>> finished handling the current command (e.g. next time the >>>>> thread go back to poll fds). >>>> >>>> >>>>>>> When a NOTIFY_NEW_EVENTS is received from an >>>>>>> application, the sessiond iterates on each session, >>>>>>> each channel, redoing Algo (1). The per-app/per-channel >>>>>>> hash table that remembers already enabled events will >>>>>>> ensure that we don't end up enabling the same event >>>>>>> twice. >>>>>>> >>>>>>> At application startup, the "registration done" message >>>>>>> will only be sent once all the commands setting the >>>>>>> mapping between event name and ID are sent. This >>>>>>> ensures tracing is not started until all events are >>>>>>> enabled (delaying the application for a configurable >>>>>>> delay). >>>>>>> >>>>>>> At library load, a "registration done" will also be >>>>>>> sent by the sessiond some time after the >>>>>>> NOTIFY_NEW_EVENTS has been received -- at the end of >>>>>>> Algo(1). This means that library load, within >>>>>>> applications, can be delayed for the same amount of >>>>>>> time that apply to application start (configurable). >>>>>>> >>>>>>> The registry is emptied when the session is destroyed. >>>>>>> Event IDs are never freed, only re-used for events with >>>>>>> the same name, after loglevel, field name and field >>>>>>> type match check. >>>> >>>> This means that event IDs here should be some kind of a hash >>>> using a combination of values of the event to make sure it's >>>> unique on a per-event/per-channel/per-session basis ? >>>> (considering the sessiond should keep them in a separate >>>> registry) >>>> >>>>> I think it would be enough to hash the events by their full >>>>> name, and then do a compare to check if the fields match. >>>>> We _want_ the hash table lookup to succeed if we get an >>>>> event with same name but different fields, but then our >>>>> detailed check for field mispatch would fail. >>>> >>>> >>>>>>> >>>>>>> This registry is also used to generate metadata from >>>>>>> the sessiond. The sessiond will now be responsible for >>>>>>> generation of the metadata stream. >>>>>>> >>>> >>>> This implies that the session daemon will need to keep track >>>> of the global memory location of each applications in order >>>> to consumer metadata streams ? >>>> >>>>> Uh ? no. The metadata stream would be _created_ by the >>>>> sessiond. Applications would not have anything to do with >>>>> the metadata stream in this scheme. Basically, we need to >>>>> ensure that all the information required to generate the >>>>> metadata for a given session/channel is present in the >>>>> table that contains mapping between numeric event IDs and >>>>> event name/field names/types/loglevel. > > Hmmm... the session daemon creates the metadata now... this means > you are going to get the full ringbuffer + ctf code inside the > lttng-tools tree....!? > >> No. Just move the internal representation of the tracepoint >> metadata that UST currently has (see ust-events.h) into >> lttng-tools. Right so the session daemon has to pass over the metadata buffer information up to the application in order to write them? Please, if I'm wrong again, maybe just write a paragraph to explain the whole shebang :P Cheers David > >> Thanks, > >> Mathieu > > > Any case, I would love having a reason for that since this seems to > me an important change. > > David > >>>> >>>>> Anything still unclear ? >>>> >>>>> Thanks, >>>> >>>>> Mathieu >>>> >>>> >>>> Cheers! David >>>> > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQU1bNAAoJEELoaioR9I02hYUH/A1ZVDJ36R90xaPUG+BHMTKl NcN9dK4CBg4dRhVD7JI22HXkG4BYL/rFA0b8FDxIamIqAzdinZwacbNvHlIQ3Qi6 4yFbIjRd0oUJXgkPClyAnl+KPHUNI73HFwuqiFx+PWya/3zNdXBvtvAoyVr3XNSu DG8qV0rlWhtqnd5c8waoMiabdmQ9unbv4Lbme1tPnb8y4AAW7Bkur16gplwiHmJQ iVttc1PhQ14cyl6PyxA6KzhLXLP3WbTxE5tGnzZAEPI0rU79cMqVoR1tWP+Ggeee HMjUQmVvPcM3GJ17ufXcCYKwlwBIIHaovShS1uKnaMgaFkuEUoP+yh92Z5lsaU0= =IrHn -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Fri Sep 14 12:13:13 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 14 Sep 2012 12:13:13 -0400 Subject: [lttng-dev] [RFC] Per-user event ID allocation proposal In-Reply-To: <505356D0.7020906@efficios.com> References: <20120912123555.GA26893@Krystal> <5051EDE0.3070900@efficios.com> <20120914122218.GA19648@Krystal> <50535410.4040104@efficios.com> <20120914160740.GD25652@Krystal> <505356D0.7020906@efficios.com> Message-ID: <20120914161313.GA25901@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > > > Mathieu Desnoyers: > > * David Goulet (dgoulet at efficios.com) wrote: > > > > > > Mathieu Desnoyers: > >>>> * David Goulet (dgoulet at efficios.com) wrote: Hi Mathieu, > >>>> > >>>> This looks good! I have some questions to clarify part of the > >>>> RFC. > >>>> > >>>> Mathieu Desnoyers: > >>>>>>> Mathieu Desnoyers September 11, 2012 > >>>>>>> > >>>>>>> Per-user event ID allocation proposal > >>>>>>> > >>>>>>> The intent of this shared event ID registry is to > >>>>>>> allow sharing tracing buffers between applications > >>>>>>> belonging to the same user (UID) for UST (user-space) > >>>>>>> tracing. > >>>>>>> > >>>>>>> A.1) Overview of System-wide, per-ABI (32 and 64-bit), > >>>>>>> per-user, per-session, LTTng-UST event ID allocation: > >>>>>>> > >>>>>>> - Modify LTTng-UST and lttng-tools to keep a > >>>>>>> system-wide, per-ABI (32 and 64-bit), per-user, > >>>>>>> per-session registry of enabled events and their > >>>>>>> associated numeric IDs. - LTTng-UST will have to > >>>>>>> register its tracepoints to the session daemon, sending > >>>>>>> the field typing of these tracepoints during > >>>>>>> registration, - Dynamically check that field types > >>>>>>> match upon registration of an event in this global > >>>>>>> registry, refuse registration if the field types do not > >>>>>>> match, - The metadata will be generated by lttng-tools > >>>>>>> instead of the application. > >>>>>>> > >>>>>>> A.2 Per-user Event ID Details: > >>>>>>> > >>>>>>> The event ID registry is shared across all processes > >>>>>>> for a given session/ABI/channel/user (UID). The intent > >>>>>>> is to forbid one user to access tracing data from > >>>>>>> another user, while keeping the system-wide number of > >>>>>>> buffers small. > >>>>>>> > >>>>>>> The event ID registry is attached to a: - session, - > >>>>>>> specific ABI (32/64-bit), - channel, - user (UID). > >>>>>>> > >>>>>>> lttng-session fill this registry by pulling this > >>>>>>> information as needed from traced processes (a.k.a. > >>>>>>> applications) to populate the registry. This > >>>>>>> information is needed only when an event is active for > >>>>>>> a created session. Therefore, applications need not to > >>>>>>> notify the sessiond if no session is created. > >>>>>>> > >>>>>>> The rationale for using a "pull" scheme, where the > >>>>>>> sessiond pulls information from applications, in > >>>>>>> opposition to a "push" scheme, where application would > >>>>>>> initiate commands to push the information, is that it > >>>>>>> minimizes the amount of logic required within > >>>>>>> liblttng-ust, and it does not require liblttng-ust to > >>>>>>> wait for reply from lttng-sessiond, which minimize the > >>>>>>> impact on the application behavior, providing > >>>>>>> application resilience to lttng-sessiond crash. > >>>>>>> > >>>>>>> Updates to this registry are triggered by two distinct > >>>>>>> scenarios: either an "enable-event" command (could also > >>>>>>> be "start", depending on the sessiond design) is being > >>>>>>> executed, or, while tracing, a library is being loaded > >>>>>>> within the application. > >>>>>>> > >>>>>>> Before we start describing the algorithms that update > >>>>>>> the registry, it is _very_ important to understand that > >>>>>>> an event enabled with "enable-event" can contain a > >>>>>>> wildcard (e.g.: libc*) and loglevel, and therefore is > >>>>>>> associated to possibly _many_ events in the > >>>>>>> application. > >>>>>>> > >>>>>>> Algo (1) When an "enable-event"/"start" command is > >>>>>>> executed, the sessiond will get, in return for sending > >>>>>>> an enable-event command to the application (which apply > >>>>>>> to a channel within a session), a variable-sized array > >>>>>>> of enabled events (remember, we can enable a > >>>>>>> wildcard!), along with their name, loglevel, field > >>>>>>> name, and field type. The sessiond proceeds to check > >>>>>>> that each event does not conflict with another event in > >>>>>>> the registry with the same name, but having different > >>>>>>> field names/types or loglevel. If its field > >>>>>>> names/typing or loglevel differ from a previous event, > >>>>>>> it prints a warnings. If it matches a previous event, > >>>>>>> it re-uses the same ID as the previous event. If no > >>>>>>> match, it allocates a new event ID. It sends a command > >>>>>>> to the application to let it know the mapping between > >>>>>>> the event name and ID for the channel. When the > >>>>>>> application receives that command, it can finally > >>>>>>> proceed to attach the tracepoint probe to the > >>>>>>> tracepoint site. > >>>> > >>>>>>> The sessiond keeps a per-application/per-channel hash > >>>>>>> table of already enabled events, so it does not provide > >>>>>>> the same event name/id mapping twice for a given > >>>>>>> channel. > >>>> > >>>> and per-session ? > >>>> > >>>>> Yes. > >>>> > >>>> > >>>> Of what I understand of this proposal, an event is associated > >>>> to per-user/per-session/per-apps/per-channel values. > >>>> > >>>>> Well, given that channels become per-user, an application > >>>>> will write its data into the channel with same UID as > >>>>> itself. (it might imply some limitations with setuid() in > >>>>> an application, or at least to document those, or that we > >>>>> overload setuid()) > >>>> > >>>>> The "per-app" part is not quite right. Event IDs are > >>>>> re-used and shared across all applications that belong to > >>>>> the same UID. > >>>> > >>>> > >>>> > >>>> (I have a question at the end about how an event ID should > >>>> be generated) > >>>> > >>>>>>> > >>>>>>> Algo (2) In the case where a library (.so) is being > >>>>>>> loaded in the application while tracing, the update > >>>>>>> sequence goes as follow: the application first checks > >>>>>>> if there is any session created. It so, it sends a > >>>>>>> NOTIFY_NEW_EVENTS message to the sessiond through the > >>>>>>> communication socket (normally used to send ACK to > >>>>>>> commands). The lttng-sessiond will therefore need to > >>>>>>> listen (read) to each application communication > >>>>>>> socket, and will also need to dispatch > >>>>>>> NOTIFY_NEW_EVENTS messages each time it expects an ACK > >>>>>>> reply for a command it has sent to the application. > >>>> > >>>> Taking back the last sentence, can you explain more or > >>>> clarify the mechanism here of "dispatching a > >>>> NOTIFY_NEW_EVENTS" each time an ACK reply is expected?... Do > >>>> you mean that each time we are waiting for an ACK, if we get > >>>> a NOTIFY instead (which could happen due to a race between > >>>> notification and command handling) you will launch a NOTIFY > >>>> code path where the session daemon check the events hash > >>>> table and check for event(s) to pull from the UST tracer? ... > >>>> so what about getting the real ACK after that ? > >>>> > >>>>> In this scheme, the NOTIFY is entirely asynchronous, and > >>>>> gets no acknowledge from the sessiond to the app. This > >>>>> means that when dispatching the NOTIFY received at the ACK > >>>>> site (due to the race you refer to), we could simply queue > >>>>> this notify within the sessiond so it gets handled after we > >>>>> finished handling the current command (e.g. next time the > >>>>> thread go back to poll fds). > >>>> > >>>> > >>>>>>> When a NOTIFY_NEW_EVENTS is received from an > >>>>>>> application, the sessiond iterates on each session, > >>>>>>> each channel, redoing Algo (1). The per-app/per-channel > >>>>>>> hash table that remembers already enabled events will > >>>>>>> ensure that we don't end up enabling the same event > >>>>>>> twice. > >>>>>>> > >>>>>>> At application startup, the "registration done" message > >>>>>>> will only be sent once all the commands setting the > >>>>>>> mapping between event name and ID are sent. This > >>>>>>> ensures tracing is not started until all events are > >>>>>>> enabled (delaying the application for a configurable > >>>>>>> delay). > >>>>>>> > >>>>>>> At library load, a "registration done" will also be > >>>>>>> sent by the sessiond some time after the > >>>>>>> NOTIFY_NEW_EVENTS has been received -- at the end of > >>>>>>> Algo(1). This means that library load, within > >>>>>>> applications, can be delayed for the same amount of > >>>>>>> time that apply to application start (configurable). > >>>>>>> > >>>>>>> The registry is emptied when the session is destroyed. > >>>>>>> Event IDs are never freed, only re-used for events with > >>>>>>> the same name, after loglevel, field name and field > >>>>>>> type match check. > >>>> > >>>> This means that event IDs here should be some kind of a hash > >>>> using a combination of values of the event to make sure it's > >>>> unique on a per-event/per-channel/per-session basis ? > >>>> (considering the sessiond should keep them in a separate > >>>> registry) > >>>> > >>>>> I think it would be enough to hash the events by their full > >>>>> name, and then do a compare to check if the fields match. > >>>>> We _want_ the hash table lookup to succeed if we get an > >>>>> event with same name but different fields, but then our > >>>>> detailed check for field mispatch would fail. > >>>> > >>>> > >>>>>>> > >>>>>>> This registry is also used to generate metadata from > >>>>>>> the sessiond. The sessiond will now be responsible for > >>>>>>> generation of the metadata stream. > >>>>>>> > >>>> > >>>> This implies that the session daemon will need to keep track > >>>> of the global memory location of each applications in order > >>>> to consumer metadata streams ? > >>>> > >>>>> Uh ? no. The metadata stream would be _created_ by the > >>>>> sessiond. Applications would not have anything to do with > >>>>> the metadata stream in this scheme. Basically, we need to > >>>>> ensure that all the information required to generate the > >>>>> metadata for a given session/channel is present in the > >>>>> table that contains mapping between numeric event IDs and > >>>>> event name/field names/types/loglevel. > > > > Hmmm... the session daemon creates the metadata now... this means > > you are going to get the full ringbuffer + ctf code inside the > > lttng-tools tree....!? > > > >> No. Just move the internal representation of the tracepoint > >> metadata that UST currently has (see ust-events.h) into > >> lttng-tools. > > Right so the session daemon has to pass over the metadata buffer > information up to the application in order to write them? > > Please, if I'm wrong again, maybe just write a paragraph to explain > the whole shebang :P No. The sessiond keeps the registry about the entire metadata for each channel. The application will _not_ generate the metadata stream. That's the whole change: now the sessiond will generate this metadata stream. The applications would now have nothing to do with that stream: they would simply write into the data buffers shared across all processes of a given user. Not sure if it's still unclear ? Thanks, Mathieu > > Cheers > David > > > > >> Thanks, > > > >> Mathieu > > > > > > Any case, I would love having a reason for that since this seems to > > me an important change. > > > > David > > > >>>> > >>>>> Anything still unclear ? > >>>> > >>>>> Thanks, > >>>> > >>>>> Mathieu > >>>> > >>>> > >>>> Cheers! David > >>>> > > > -----BEGIN PGP SIGNATURE----- > > iQEcBAEBCgAGBQJQU1bNAAoJEELoaioR9I02hYUH/A1ZVDJ36R90xaPUG+BHMTKl > NcN9dK4CBg4dRhVD7JI22HXkG4BYL/rFA0b8FDxIamIqAzdinZwacbNvHlIQ3Qi6 > 4yFbIjRd0oUJXgkPClyAnl+KPHUNI73HFwuqiFx+PWya/3zNdXBvtvAoyVr3XNSu > DG8qV0rlWhtqnd5c8waoMiabdmQ9unbv4Lbme1tPnb8y4AAW7Bkur16gplwiHmJQ > iVttc1PhQ14cyl6PyxA6KzhLXLP3WbTxE5tGnzZAEPI0rU79cMqVoR1tWP+Ggeee > HMjUQmVvPcM3GJ17ufXcCYKwlwBIIHaovShS1uKnaMgaFkuEUoP+yh92Z5lsaU0= > =IrHn > -----END PGP SIGNATURE----- -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Fri Sep 14 12:25:18 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 14 Sep 2012 12:25:18 -0400 Subject: [lttng-dev] [RFC] Per-user event ID allocation proposal In-Reply-To: <20120914161313.GA25901@Krystal> References: <20120912123555.GA26893@Krystal> <5051EDE0.3070900@efficios.com> <20120914122218.GA19648@Krystal> <50535410.4040104@efficios.com> <20120914160740.GD25652@Krystal> <505356D0.7020906@efficios.com> <20120914161313.GA25901@Krystal> Message-ID: <50535A6E.1050408@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Mathieu Desnoyers: > * David Goulet (dgoulet at efficios.com) wrote: > > > Mathieu Desnoyers: >>>> * David Goulet (dgoulet at efficios.com) wrote: >>>> >>>> >>>> Mathieu Desnoyers: >>>>>>> * David Goulet (dgoulet at efficios.com) wrote: Hi >>>>>>> Mathieu, >>>>>>> >>>>>>> This looks good! I have some questions to clarify part >>>>>>> of the RFC. >>>>>>> >>>>>>> Mathieu Desnoyers: >>>>>>>>>> Mathieu Desnoyers September 11, 2012 >>>>>>>>>> >>>>>>>>>> Per-user event ID allocation proposal >>>>>>>>>> >>>>>>>>>> The intent of this shared event ID registry is >>>>>>>>>> to allow sharing tracing buffers between >>>>>>>>>> applications belonging to the same user (UID) for >>>>>>>>>> UST (user-space) tracing. >>>>>>>>>> >>>>>>>>>> A.1) Overview of System-wide, per-ABI (32 and >>>>>>>>>> 64-bit), per-user, per-session, LTTng-UST event >>>>>>>>>> ID allocation: >>>>>>>>>> >>>>>>>>>> - Modify LTTng-UST and lttng-tools to keep a >>>>>>>>>> system-wide, per-ABI (32 and 64-bit), per-user, >>>>>>>>>> per-session registry of enabled events and their >>>>>>>>>> associated numeric IDs. - LTTng-UST will have to >>>>>>>>>> register its tracepoints to the session daemon, >>>>>>>>>> sending the field typing of these tracepoints >>>>>>>>>> during registration, - Dynamically check that >>>>>>>>>> field types match upon registration of an event >>>>>>>>>> in this global registry, refuse registration if >>>>>>>>>> the field types do not match, - The metadata will >>>>>>>>>> be generated by lttng-tools instead of the >>>>>>>>>> application. >>>>>>>>>> >>>>>>>>>> A.2 Per-user Event ID Details: >>>>>>>>>> >>>>>>>>>> The event ID registry is shared across all >>>>>>>>>> processes for a given session/ABI/channel/user >>>>>>>>>> (UID). The intent is to forbid one user to access >>>>>>>>>> tracing data from another user, while keeping the >>>>>>>>>> system-wide number of buffers small. >>>>>>>>>> >>>>>>>>>> The event ID registry is attached to a: - >>>>>>>>>> session, - specific ABI (32/64-bit), - channel, - >>>>>>>>>> user (UID). >>>>>>>>>> >>>>>>>>>> lttng-session fill this registry by pulling this >>>>>>>>>> information as needed from traced processes >>>>>>>>>> (a.k.a. applications) to populate the registry. >>>>>>>>>> This information is needed only when an event is >>>>>>>>>> active for a created session. Therefore, >>>>>>>>>> applications need not to notify the sessiond if >>>>>>>>>> no session is created. >>>>>>>>>> >>>>>>>>>> The rationale for using a "pull" scheme, where >>>>>>>>>> the sessiond pulls information from applications, >>>>>>>>>> in opposition to a "push" scheme, where >>>>>>>>>> application would initiate commands to push the >>>>>>>>>> information, is that it minimizes the amount of >>>>>>>>>> logic required within liblttng-ust, and it does >>>>>>>>>> not require liblttng-ust to wait for reply from >>>>>>>>>> lttng-sessiond, which minimize the impact on the >>>>>>>>>> application behavior, providing application >>>>>>>>>> resilience to lttng-sessiond crash. >>>>>>>>>> >>>>>>>>>> Updates to this registry are triggered by two >>>>>>>>>> distinct scenarios: either an "enable-event" >>>>>>>>>> command (could also be "start", depending on the >>>>>>>>>> sessiond design) is being executed, or, while >>>>>>>>>> tracing, a library is being loaded within the >>>>>>>>>> application. >>>>>>>>>> >>>>>>>>>> Before we start describing the algorithms that >>>>>>>>>> update the registry, it is _very_ important to >>>>>>>>>> understand that an event enabled with >>>>>>>>>> "enable-event" can contain a wildcard (e.g.: >>>>>>>>>> libc*) and loglevel, and therefore is associated >>>>>>>>>> to possibly _many_ events in the application. >>>>>>>>>> >>>>>>>>>> Algo (1) When an "enable-event"/"start" command >>>>>>>>>> is executed, the sessiond will get, in return for >>>>>>>>>> sending an enable-event command to the >>>>>>>>>> application (which apply to a channel within a >>>>>>>>>> session), a variable-sized array of enabled >>>>>>>>>> events (remember, we can enable a wildcard!), >>>>>>>>>> along with their name, loglevel, field name, and >>>>>>>>>> field type. The sessiond proceeds to check that >>>>>>>>>> each event does not conflict with another event >>>>>>>>>> in the registry with the same name, but having >>>>>>>>>> different field names/types or loglevel. If its >>>>>>>>>> field names/typing or loglevel differ from a >>>>>>>>>> previous event, it prints a warnings. If it >>>>>>>>>> matches a previous event, it re-uses the same ID >>>>>>>>>> as the previous event. If no match, it allocates >>>>>>>>>> a new event ID. It sends a command to the >>>>>>>>>> application to let it know the mapping between >>>>>>>>>> the event name and ID for the channel. When the >>>>>>>>>> application receives that command, it can >>>>>>>>>> finally proceed to attach the tracepoint probe to >>>>>>>>>> the tracepoint site. >>>>>>> >>>>>>>>>> The sessiond keeps a per-application/per-channel >>>>>>>>>> hash table of already enabled events, so it does >>>>>>>>>> not provide the same event name/id mapping twice >>>>>>>>>> for a given channel. >>>>>>> >>>>>>> and per-session ? >>>>>>> >>>>>>>> Yes. >>>>>>> >>>>>>> >>>>>>> Of what I understand of this proposal, an event is >>>>>>> associated to per-user/per-session/per-apps/per-channel >>>>>>> values. >>>>>>> >>>>>>>> Well, given that channels become per-user, an >>>>>>>> application will write its data into the channel with >>>>>>>> same UID as itself. (it might imply some limitations >>>>>>>> with setuid() in an application, or at least to >>>>>>>> document those, or that we overload setuid()) >>>>>>> >>>>>>>> The "per-app" part is not quite right. Event IDs are >>>>>>>> re-used and shared across all applications that >>>>>>>> belong to the same UID. >>>>>>> >>>>>>> >>>>>>> >>>>>>> (I have a question at the end about how an event ID >>>>>>> should be generated) >>>>>>> >>>>>>>>>> >>>>>>>>>> Algo (2) In the case where a library (.so) is >>>>>>>>>> being loaded in the application while tracing, >>>>>>>>>> the update sequence goes as follow: the >>>>>>>>>> application first checks if there is any session >>>>>>>>>> created. It so, it sends a NOTIFY_NEW_EVENTS >>>>>>>>>> message to the sessiond through the communication >>>>>>>>>> socket (normally used to send ACK to commands). >>>>>>>>>> The lttng-sessiond will therefore need to listen >>>>>>>>>> (read) to each application communication socket, >>>>>>>>>> and will also need to dispatch NOTIFY_NEW_EVENTS >>>>>>>>>> messages each time it expects an ACK reply for a >>>>>>>>>> command it has sent to the application. >>>>>>> >>>>>>> Taking back the last sentence, can you explain more or >>>>>>> clarify the mechanism here of "dispatching a >>>>>>> NOTIFY_NEW_EVENTS" each time an ACK reply is >>>>>>> expected?... Do you mean that each time we are waiting >>>>>>> for an ACK, if we get a NOTIFY instead (which could >>>>>>> happen due to a race between notification and command >>>>>>> handling) you will launch a NOTIFY code path where the >>>>>>> session daemon check the events hash table and check >>>>>>> for event(s) to pull from the UST tracer? ... so what >>>>>>> about getting the real ACK after that ? >>>>>>> >>>>>>>> In this scheme, the NOTIFY is entirely asynchronous, >>>>>>>> and gets no acknowledge from the sessiond to the app. >>>>>>>> This means that when dispatching the NOTIFY received >>>>>>>> at the ACK site (due to the race you refer to), we >>>>>>>> could simply queue this notify within the sessiond so >>>>>>>> it gets handled after we finished handling the >>>>>>>> current command (e.g. next time the thread go back to >>>>>>>> poll fds). >>>>>>> >>>>>>> >>>>>>>>>> When a NOTIFY_NEW_EVENTS is received from an >>>>>>>>>> application, the sessiond iterates on each >>>>>>>>>> session, each channel, redoing Algo (1). The >>>>>>>>>> per-app/per-channel hash table that remembers >>>>>>>>>> already enabled events will ensure that we don't >>>>>>>>>> end up enabling the same event twice. >>>>>>>>>> >>>>>>>>>> At application startup, the "registration done" >>>>>>>>>> message will only be sent once all the commands >>>>>>>>>> setting the mapping between event name and ID are >>>>>>>>>> sent. This ensures tracing is not started until >>>>>>>>>> all events are enabled (delaying the application >>>>>>>>>> for a configurable delay). >>>>>>>>>> >>>>>>>>>> At library load, a "registration done" will also >>>>>>>>>> be sent by the sessiond some time after the >>>>>>>>>> NOTIFY_NEW_EVENTS has been received -- at the end >>>>>>>>>> of Algo(1). This means that library load, within >>>>>>>>>> applications, can be delayed for the same amount >>>>>>>>>> of time that apply to application start >>>>>>>>>> (configurable). >>>>>>>>>> >>>>>>>>>> The registry is emptied when the session is >>>>>>>>>> destroyed. Event IDs are never freed, only >>>>>>>>>> re-used for events with the same name, after >>>>>>>>>> loglevel, field name and field type match check. >>>>>>> >>>>>>> This means that event IDs here should be some kind of a >>>>>>> hash using a combination of values of the event to make >>>>>>> sure it's unique on a per-event/per-channel/per-session >>>>>>> basis ? (considering the sessiond should keep them in a >>>>>>> separate registry) >>>>>>> >>>>>>>> I think it would be enough to hash the events by >>>>>>>> their full name, and then do a compare to check if >>>>>>>> the fields match. We _want_ the hash table lookup to >>>>>>>> succeed if we get an event with same name but >>>>>>>> different fields, but then our detailed check for >>>>>>>> field mispatch would fail. >>>>>>> >>>>>>> >>>>>>>>>> >>>>>>>>>> This registry is also used to generate metadata >>>>>>>>>> from the sessiond. The sessiond will now be >>>>>>>>>> responsible for generation of the metadata >>>>>>>>>> stream. >>>>>>>>>> >>>>>>> >>>>>>> This implies that the session daemon will need to keep >>>>>>> track of the global memory location of each >>>>>>> applications in order to consumer metadata streams ? >>>>>>> >>>>>>>> Uh ? no. The metadata stream would be _created_ by >>>>>>>> the sessiond. Applications would not have anything to >>>>>>>> do with the metadata stream in this scheme. >>>>>>>> Basically, we need to ensure that all the information >>>>>>>> required to generate the metadata for a given >>>>>>>> session/channel is present in the table that contains >>>>>>>> mapping between numeric event IDs and event >>>>>>>> name/field names/types/loglevel. >>>> >>>> Hmmm... the session daemon creates the metadata now... this >>>> means you are going to get the full ringbuffer + ctf code >>>> inside the lttng-tools tree....!? >>>> >>>>> No. Just move the internal representation of the >>>>> tracepoint metadata that UST currently has (see >>>>> ust-events.h) into lttng-tools. > > Right so the session daemon has to pass over the metadata buffer > information up to the application in order to write them? > > Please, if I'm wrong again, maybe just write a paragraph to > explain the whole shebang :P > >> No. > >> The sessiond keeps the registry about the entire metadata for >> each channel. The application will _not_ generate the metadata >> stream. That's the whole change: now the sessiond will generate >> this metadata stream. The applications would now have nothing to >> do with that stream: they would simply write into the data >> buffers shared across all processes of a given user. > >> Not sure if it's still unclear ? Ok! So, this isn't a small task and we might want to elaborate on that part since we have to decide what resources are needed to do that either on the consumer side or session daemon... new threads?... new dependency... and so on. Thanks! David > >> Thanks, > >> Mathieu > > > Cheers David > >>>> >>>>> Thanks, >>>> >>>>> Mathieu >>>> >>>> >>>> Any case, I would love having a reason for that since this >>>> seems to me an important change. >>>> >>>> David >>>> >>>>>>> >>>>>>>> Anything still unclear ? >>>>>>> >>>>>>>> Thanks, >>>>>>> >>>>>>>> Mathieu >>>>>>> >>>>>>> >>>>>>> Cheers! David >>>>>>> >>>> > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQU1prAAoJEELoaioR9I02PwgH+wXT6VTfYAo4oatZCVYg8PCO NQBhDEa2/JHGfkJ68wlTZ9Yx/xVZvYWkm5CGAL6zX5iYU18t1hRotpekYrtO1e2+ NamJEYprgAKln3e7DUBv98ZPAUKp83Zca5cbJbTtXy4H5ljkx6QqajqRutB+g5zB UZBoi8L7GlnJcII/n4874W0huefY9auF6QuJRR1/bjNkMWip87ohn6E1wz2hkG1O HGymtaeUpo1sURkV5dAAnxZqendxM0QMLkwLeT1wjyED6WKwh/6SoBjfDs0yMlco 1CDKhsWrix7D3rAmKqLQMkzxDaigClfnkucmvUMi6HcVrNepBYHpkzJhZJe2298= =mEj6 -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Fri Sep 14 13:03:52 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 14 Sep 2012 13:03:52 -0400 Subject: [lttng-dev] [RFC] Per-user event ID allocation proposal In-Reply-To: <50535A6E.1050408@efficios.com> References: <20120912123555.GA26893@Krystal> <5051EDE0.3070900@efficios.com> <20120914122218.GA19648@Krystal> <50535410.4040104@efficios.com> <20120914160740.GD25652@Krystal> <505356D0.7020906@efficios.com> <20120914161313.GA25901@Krystal> <50535A6E.1050408@efficios.com> Message-ID: <20120914170352.GA26704@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > > > Mathieu Desnoyers: > > * David Goulet (dgoulet at efficios.com) wrote: > > > > > > Mathieu Desnoyers: > >>>> * David Goulet (dgoulet at efficios.com) wrote: > >>>> > >>>> > >>>> Mathieu Desnoyers: > >>>>>>> * David Goulet (dgoulet at efficios.com) wrote: Hi > >>>>>>> Mathieu, > >>>>>>> > >>>>>>> This looks good! I have some questions to clarify part > >>>>>>> of the RFC. > >>>>>>> > >>>>>>> Mathieu Desnoyers: > >>>>>>>>>> Mathieu Desnoyers September 11, 2012 > >>>>>>>>>> > >>>>>>>>>> Per-user event ID allocation proposal > >>>>>>>>>> > >>>>>>>>>> The intent of this shared event ID registry is > >>>>>>>>>> to allow sharing tracing buffers between > >>>>>>>>>> applications belonging to the same user (UID) for > >>>>>>>>>> UST (user-space) tracing. > >>>>>>>>>> > >>>>>>>>>> A.1) Overview of System-wide, per-ABI (32 and > >>>>>>>>>> 64-bit), per-user, per-session, LTTng-UST event > >>>>>>>>>> ID allocation: > >>>>>>>>>> > >>>>>>>>>> - Modify LTTng-UST and lttng-tools to keep a > >>>>>>>>>> system-wide, per-ABI (32 and 64-bit), per-user, > >>>>>>>>>> per-session registry of enabled events and their > >>>>>>>>>> associated numeric IDs. - LTTng-UST will have to > >>>>>>>>>> register its tracepoints to the session daemon, > >>>>>>>>>> sending the field typing of these tracepoints > >>>>>>>>>> during registration, - Dynamically check that > >>>>>>>>>> field types match upon registration of an event > >>>>>>>>>> in this global registry, refuse registration if > >>>>>>>>>> the field types do not match, - The metadata will > >>>>>>>>>> be generated by lttng-tools instead of the > >>>>>>>>>> application. > >>>>>>>>>> > >>>>>>>>>> A.2 Per-user Event ID Details: > >>>>>>>>>> > >>>>>>>>>> The event ID registry is shared across all > >>>>>>>>>> processes for a given session/ABI/channel/user > >>>>>>>>>> (UID). The intent is to forbid one user to access > >>>>>>>>>> tracing data from another user, while keeping the > >>>>>>>>>> system-wide number of buffers small. > >>>>>>>>>> > >>>>>>>>>> The event ID registry is attached to a: - > >>>>>>>>>> session, - specific ABI (32/64-bit), - channel, - > >>>>>>>>>> user (UID). > >>>>>>>>>> > >>>>>>>>>> lttng-session fill this registry by pulling this > >>>>>>>>>> information as needed from traced processes > >>>>>>>>>> (a.k.a. applications) to populate the registry. > >>>>>>>>>> This information is needed only when an event is > >>>>>>>>>> active for a created session. Therefore, > >>>>>>>>>> applications need not to notify the sessiond if > >>>>>>>>>> no session is created. > >>>>>>>>>> > >>>>>>>>>> The rationale for using a "pull" scheme, where > >>>>>>>>>> the sessiond pulls information from applications, > >>>>>>>>>> in opposition to a "push" scheme, where > >>>>>>>>>> application would initiate commands to push the > >>>>>>>>>> information, is that it minimizes the amount of > >>>>>>>>>> logic required within liblttng-ust, and it does > >>>>>>>>>> not require liblttng-ust to wait for reply from > >>>>>>>>>> lttng-sessiond, which minimize the impact on the > >>>>>>>>>> application behavior, providing application > >>>>>>>>>> resilience to lttng-sessiond crash. > >>>>>>>>>> > >>>>>>>>>> Updates to this registry are triggered by two > >>>>>>>>>> distinct scenarios: either an "enable-event" > >>>>>>>>>> command (could also be "start", depending on the > >>>>>>>>>> sessiond design) is being executed, or, while > >>>>>>>>>> tracing, a library is being loaded within the > >>>>>>>>>> application. > >>>>>>>>>> > >>>>>>>>>> Before we start describing the algorithms that > >>>>>>>>>> update the registry, it is _very_ important to > >>>>>>>>>> understand that an event enabled with > >>>>>>>>>> "enable-event" can contain a wildcard (e.g.: > >>>>>>>>>> libc*) and loglevel, and therefore is associated > >>>>>>>>>> to possibly _many_ events in the application. > >>>>>>>>>> > >>>>>>>>>> Algo (1) When an "enable-event"/"start" command > >>>>>>>>>> is executed, the sessiond will get, in return for > >>>>>>>>>> sending an enable-event command to the > >>>>>>>>>> application (which apply to a channel within a > >>>>>>>>>> session), a variable-sized array of enabled > >>>>>>>>>> events (remember, we can enable a wildcard!), > >>>>>>>>>> along with their name, loglevel, field name, and > >>>>>>>>>> field type. The sessiond proceeds to check that > >>>>>>>>>> each event does not conflict with another event > >>>>>>>>>> in the registry with the same name, but having > >>>>>>>>>> different field names/types or loglevel. If its > >>>>>>>>>> field names/typing or loglevel differ from a > >>>>>>>>>> previous event, it prints a warnings. If it > >>>>>>>>>> matches a previous event, it re-uses the same ID > >>>>>>>>>> as the previous event. If no match, it allocates > >>>>>>>>>> a new event ID. It sends a command to the > >>>>>>>>>> application to let it know the mapping between > >>>>>>>>>> the event name and ID for the channel. When the > >>>>>>>>>> application receives that command, it can > >>>>>>>>>> finally proceed to attach the tracepoint probe to > >>>>>>>>>> the tracepoint site. > >>>>>>> > >>>>>>>>>> The sessiond keeps a per-application/per-channel > >>>>>>>>>> hash table of already enabled events, so it does > >>>>>>>>>> not provide the same event name/id mapping twice > >>>>>>>>>> for a given channel. > >>>>>>> > >>>>>>> and per-session ? > >>>>>>> > >>>>>>>> Yes. > >>>>>>> > >>>>>>> > >>>>>>> Of what I understand of this proposal, an event is > >>>>>>> associated to per-user/per-session/per-apps/per-channel > >>>>>>> values. > >>>>>>> > >>>>>>>> Well, given that channels become per-user, an > >>>>>>>> application will write its data into the channel with > >>>>>>>> same UID as itself. (it might imply some limitations > >>>>>>>> with setuid() in an application, or at least to > >>>>>>>> document those, or that we overload setuid()) > >>>>>>> > >>>>>>>> The "per-app" part is not quite right. Event IDs are > >>>>>>>> re-used and shared across all applications that > >>>>>>>> belong to the same UID. > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> (I have a question at the end about how an event ID > >>>>>>> should be generated) > >>>>>>> > >>>>>>>>>> > >>>>>>>>>> Algo (2) In the case where a library (.so) is > >>>>>>>>>> being loaded in the application while tracing, > >>>>>>>>>> the update sequence goes as follow: the > >>>>>>>>>> application first checks if there is any session > >>>>>>>>>> created. It so, it sends a NOTIFY_NEW_EVENTS > >>>>>>>>>> message to the sessiond through the communication > >>>>>>>>>> socket (normally used to send ACK to commands). > >>>>>>>>>> The lttng-sessiond will therefore need to listen > >>>>>>>>>> (read) to each application communication socket, > >>>>>>>>>> and will also need to dispatch NOTIFY_NEW_EVENTS > >>>>>>>>>> messages each time it expects an ACK reply for a > >>>>>>>>>> command it has sent to the application. > >>>>>>> > >>>>>>> Taking back the last sentence, can you explain more or > >>>>>>> clarify the mechanism here of "dispatching a > >>>>>>> NOTIFY_NEW_EVENTS" each time an ACK reply is > >>>>>>> expected?... Do you mean that each time we are waiting > >>>>>>> for an ACK, if we get a NOTIFY instead (which could > >>>>>>> happen due to a race between notification and command > >>>>>>> handling) you will launch a NOTIFY code path where the > >>>>>>> session daemon check the events hash table and check > >>>>>>> for event(s) to pull from the UST tracer? ... so what > >>>>>>> about getting the real ACK after that ? > >>>>>>> > >>>>>>>> In this scheme, the NOTIFY is entirely asynchronous, > >>>>>>>> and gets no acknowledge from the sessiond to the app. > >>>>>>>> This means that when dispatching the NOTIFY received > >>>>>>>> at the ACK site (due to the race you refer to), we > >>>>>>>> could simply queue this notify within the sessiond so > >>>>>>>> it gets handled after we finished handling the > >>>>>>>> current command (e.g. next time the thread go back to > >>>>>>>> poll fds). > >>>>>>> > >>>>>>> > >>>>>>>>>> When a NOTIFY_NEW_EVENTS is received from an > >>>>>>>>>> application, the sessiond iterates on each > >>>>>>>>>> session, each channel, redoing Algo (1). The > >>>>>>>>>> per-app/per-channel hash table that remembers > >>>>>>>>>> already enabled events will ensure that we don't > >>>>>>>>>> end up enabling the same event twice. > >>>>>>>>>> > >>>>>>>>>> At application startup, the "registration done" > >>>>>>>>>> message will only be sent once all the commands > >>>>>>>>>> setting the mapping between event name and ID are > >>>>>>>>>> sent. This ensures tracing is not started until > >>>>>>>>>> all events are enabled (delaying the application > >>>>>>>>>> for a configurable delay). > >>>>>>>>>> > >>>>>>>>>> At library load, a "registration done" will also > >>>>>>>>>> be sent by the sessiond some time after the > >>>>>>>>>> NOTIFY_NEW_EVENTS has been received -- at the end > >>>>>>>>>> of Algo(1). This means that library load, within > >>>>>>>>>> applications, can be delayed for the same amount > >>>>>>>>>> of time that apply to application start > >>>>>>>>>> (configurable). > >>>>>>>>>> > >>>>>>>>>> The registry is emptied when the session is > >>>>>>>>>> destroyed. Event IDs are never freed, only > >>>>>>>>>> re-used for events with the same name, after > >>>>>>>>>> loglevel, field name and field type match check. > >>>>>>> > >>>>>>> This means that event IDs here should be some kind of a > >>>>>>> hash using a combination of values of the event to make > >>>>>>> sure it's unique on a per-event/per-channel/per-session > >>>>>>> basis ? (considering the sessiond should keep them in a > >>>>>>> separate registry) > >>>>>>> > >>>>>>>> I think it would be enough to hash the events by > >>>>>>>> their full name, and then do a compare to check if > >>>>>>>> the fields match. We _want_ the hash table lookup to > >>>>>>>> succeed if we get an event with same name but > >>>>>>>> different fields, but then our detailed check for > >>>>>>>> field mispatch would fail. > >>>>>>> > >>>>>>> > >>>>>>>>>> > >>>>>>>>>> This registry is also used to generate metadata > >>>>>>>>>> from the sessiond. The sessiond will now be > >>>>>>>>>> responsible for generation of the metadata > >>>>>>>>>> stream. > >>>>>>>>>> > >>>>>>> > >>>>>>> This implies that the session daemon will need to keep > >>>>>>> track of the global memory location of each > >>>>>>> applications in order to consumer metadata streams ? > >>>>>>> > >>>>>>>> Uh ? no. The metadata stream would be _created_ by > >>>>>>>> the sessiond. Applications would not have anything to > >>>>>>>> do with the metadata stream in this scheme. > >>>>>>>> Basically, we need to ensure that all the information > >>>>>>>> required to generate the metadata for a given > >>>>>>>> session/channel is present in the table that contains > >>>>>>>> mapping between numeric event IDs and event > >>>>>>>> name/field names/types/loglevel. > >>>> > >>>> Hmmm... the session daemon creates the metadata now... this > >>>> means you are going to get the full ringbuffer + ctf code > >>>> inside the lttng-tools tree....!? > >>>> > >>>>> No. Just move the internal representation of the > >>>>> tracepoint metadata that UST currently has (see > >>>>> ust-events.h) into lttng-tools. > > > > Right so the session daemon has to pass over the metadata buffer > > information up to the application in order to write them? > > > > Please, if I'm wrong again, maybe just write a paragraph to > > explain the whole shebang :P > > > >> No. > > > >> The sessiond keeps the registry about the entire metadata for > >> each channel. The application will _not_ generate the metadata > >> stream. That's the whole change: now the sessiond will generate > >> this metadata stream. The applications would now have nothing to > >> do with that stream: they would simply write into the data > >> buffers shared across all processes of a given user. > > > >> Not sure if it's still unclear ? > > Ok! So, this isn't a small task and we might want to elaborate on that > part since we have to decide what resources are needed to do that > either on the consumer side or session daemon... new threads?... new > dependency... and so on. Yes, that's right. This is no small task indeed, but it's a task we should focus on with a #1 priority. Thanks, Mathieu > > Thanks! > David > > > > >> Thanks, > > > >> Mathieu > > > > > > Cheers David > > > >>>> > >>>>> Thanks, > >>>> > >>>>> Mathieu > >>>> > >>>> > >>>> Any case, I would love having a reason for that since this > >>>> seems to me an important change. > >>>> > >>>> David > >>>> > >>>>>>> > >>>>>>>> Anything still unclear ? > >>>>>>> > >>>>>>>> Thanks, > >>>>>>> > >>>>>>>> Mathieu > >>>>>>> > >>>>>>> > >>>>>>> Cheers! David > >>>>>>> > >>>> > > > -----BEGIN PGP SIGNATURE----- > > iQEcBAEBCgAGBQJQU1prAAoJEELoaioR9I02PwgH+wXT6VTfYAo4oatZCVYg8PCO > NQBhDEa2/JHGfkJ68wlTZ9Yx/xVZvYWkm5CGAL6zX5iYU18t1hRotpekYrtO1e2+ > NamJEYprgAKln3e7DUBv98ZPAUKp83Zca5cbJbTtXy4H5ljkx6QqajqRutB+g5zB > UZBoi8L7GlnJcII/n4874W0huefY9auF6QuJRR1/bjNkMWip87ohn6E1wz2hkG1O > HGymtaeUpo1sURkV5dAAnxZqendxM0QMLkwLeT1wjyED6WKwh/6SoBjfDs0yMlco > 1CDKhsWrix7D3rAmKqLQMkzxDaigClfnkucmvUMi6HcVrNepBYHpkzJhZJe2298= > =mEj6 > -----END PGP SIGNATURE----- -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From christian.babeux at efficios.com Fri Sep 14 15:00:29 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Fri, 14 Sep 2012 15:00:29 -0400 Subject: [lttng-dev] [PATCH RFC v3 lttng-tools] Testpoint mechanism In-Reply-To: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1347649230-21489-1-git-send-email-christian.babeux@efficios.com> Hi, Here a few style and a define fix to the original testpoints patch. Changelog v3: - Use _GNU_SOURCE instead of __USE_GNU define. __USE_GNU is resetted by any headers that include features.h. This can cause erratic behavior depending on the order of headers inclusion. - Style fixes. Changelog v2: - Moved dlsym call to a separate function in testpoint.c. This is to avoid to have to define __USE_GNU in the testpoint header and possibly contaminate others with this define. - Use caa_likely/unlikely instead of defining likely/unlikely. - Style and comments fixes. Christian Babeux (1): New testpoint mechanism to instrument LTTng binaries for testing purpose configure.ac | 1 + src/common/Makefile.am | 2 +- src/common/testpoint/Makefile.am | 6 ++++ src/common/testpoint/testpoint.c | 64 ++++++++++++++++++++++++++++++++++ src/common/testpoint/testpoint.h | 74 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 src/common/testpoint/Makefile.am create mode 100644 src/common/testpoint/testpoint.c create mode 100644 src/common/testpoint/testpoint.h -- 1.7.11.4 From christian.babeux at efficios.com Fri Sep 14 15:00:30 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Fri, 14 Sep 2012 15:00:30 -0400 Subject: [lttng-dev] [PATCH RFC v3 lttng-tools] New testpoint mechanism to instrument LTTng binaries for testing purpose In-Reply-To: <1347649230-21489-1-git-send-email-christian.babeux@efficios.com> References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> <1347649230-21489-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1347649230-21489-2-git-send-email-christian.babeux@efficios.com> This commit introduce two new macros: TESTPOINT_DECL(name) and testpoint(name). Here a quick example that show how to use the testpoint mechanism: file: main.c /* Testpoint declaration */ TESTPOINT_DECL(interesting_function) void interesting_function(void) { testpoint(interesting_function); /* Some processing that can fail */ ... } int main(int argc, char *argv[]) { interesting_function(); ... printf("End"); } file: testpoint.c void __testpoint_interesting_function(void) { printf("In testpoint of interesting function!"); } Compile: gcc -o test main.c gcc -fPIC -shared -o testpoint.so testpoint.c Run: > ./test End > export LTTNG_TESTPOINT_ENABLE=1 > LD_PRELOAD=testpoint.so ./test In testpoint of interesting function! End > export LTTNG_TESTPOINT_ENABLE=0 > LD_PRELOAD=testpoint.so ./test End The testpoint mechanism is triggered via the preloading of a shared object containing the appropriate testpoint symbols and by setting the LTTNG_TESTPOINT_ENABLE environment variable. The check on this environment variable is done on the application startup with the help of a constructor (lttng_testpoint_check) which toggle a global state variable indicating whether or not the testpoints should be activated. When enabled, the testpoint() macro calls an underlying wrapper specific to the testpoint and simply try to lookup the testpoint symbol via a dlsym() call. When disabled, the testpoint() call will only incur an additionnal test per testpoint on a global variable. This performance 'hit' should be acceptable for production use. The testpoint mechanism should be *always on*. It can be explicitly disabled via CFLAGS="-DNTESTPOINT" in a way similar to NDEBUG and assert(). Signed-off-by: Christian Babeux --- configure.ac | 1 + src/common/Makefile.am | 2 +- src/common/testpoint/Makefile.am | 6 ++++ src/common/testpoint/testpoint.c | 64 ++++++++++++++++++++++++++++++++++ src/common/testpoint/testpoint.h | 74 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 src/common/testpoint/Makefile.am create mode 100644 src/common/testpoint/testpoint.c create mode 100644 src/common/testpoint/testpoint.h diff --git a/configure.ac b/configure.ac index 7687280..8e61115 100644 --- a/configure.ac +++ b/configure.ac @@ -275,6 +275,7 @@ AC_CONFIG_FILES([ src/common/sessiond-comm/Makefile src/common/compat/Makefile src/common/relayd/Makefile + src/common/testpoint/Makefile src/lib/Makefile src/lib/lttng-ctl/Makefile src/lib/lttng-ctl/filter/Makefile diff --git a/src/common/Makefile.am b/src/common/Makefile.am index ca48153..889b04e 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer +SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer testpoint AM_CFLAGS = -fno-strict-aliasing diff --git a/src/common/testpoint/Makefile.am b/src/common/testpoint/Makefile.am new file mode 100644 index 0000000..7d3df16 --- /dev/null +++ b/src/common/testpoint/Makefile.am @@ -0,0 +1,6 @@ +AM_CPPFLAGS = + +noinst_LTLIBRARIES = libtestpoint.la + +libtestpoint_la_SOURCES = testpoint.h testpoint.c +libtestpoint_la_LIBADD = -ldl diff --git a/src/common/testpoint/testpoint.c b/src/common/testpoint/testpoint.c new file mode 100644 index 0000000..3d01a03 --- /dev/null +++ b/src/common/testpoint/testpoint.c @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2012 - Christian Babeux + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef NTESTPOINT + +#define _GNU_SOURCE /* for RTLD_DEFAULT GNU extension */ + +#include /* for dlsym */ +#include /* for getenv */ +#include /* for strncmp */ + +#include "testpoint.h" + +/* Environment variable used to enable the testpoints facilities. */ +static const char *lttng_testpoint_env_var = "LTTNG_TESTPOINT_ENABLE"; + +/* Testpoint toggle flag */ +int lttng_testpoint_activated; + +/* + * Toggle the support for testpoints on the application startup. + */ +static void __attribute__((constructor)) lttng_testpoint_check(void) +{ + char *testpoint_env_val = NULL; + + testpoint_env_val = getenv(lttng_testpoint_env_var); + if (testpoint_env_val != NULL + && (strncmp(testpoint_env_val, "1", 1) == 0)) { + lttng_testpoint_activated = 1; + } +} + +/* + * Lookup a symbol by name. + * + * Return the address where the symbol is loaded + * or NULL if the symbol was not found. + */ +void *lttng_testpoint_lookup(const char *name) +{ + if (!name) { + return NULL; + } + + return dlsym(RTLD_DEFAULT, name); +} + +#endif /* NTESTPOINT */ + diff --git a/src/common/testpoint/testpoint.h b/src/common/testpoint/testpoint.h new file mode 100644 index 0000000..2925b0a --- /dev/null +++ b/src/common/testpoint/testpoint.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2012 - Christian Babeux + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef NTESTPOINT + +#define testpoint(name) +#define TESTPOINT_DECL(name) + +#else /* NTESTPOINT */ + +#include /* for caa_likely/unlikely */ + +extern int lttng_testpoint_activated; + +void *lttng_testpoint_lookup(const char *name); + +/* + * Testpoint is only active if the global + * lttng_testpoint_activated flag is set. + */ +#define testpoint(name) \ + do { \ + if (caa_unlikely(lttng_testpoint_activated)) { \ + __testpoint_##name##_wrapper(); \ + } \ + } while (0) + +/* + * One wrapper per testpoint is generated. This is to keep track + * of the symbol lookup status and the corresponding function + * pointer, if any. + */ +#define _TESTPOINT_DECL(_name) \ + static inline void __testpoint_##_name##_wrapper(void) \ + { \ + static void (*tp)(void); \ + static int found; \ + const char *tp_name = "__testpoint_" #_name; \ + \ + if (tp) { \ + tp(); \ + } else { \ + if (!found) { \ + tp = lttng_testpoint_lookup(tp_name); \ + if (tp) { \ + found = 1; \ + tp(); \ + } else { \ + found = -1; \ + } \ + } \ + } \ + } + +/* Testpoint declaration */ +#define TESTPOINT_DECL(name) \ + _TESTPOINT_DECL(name) + +#endif /* NTESTPOINT */ + -- 1.7.11.4 From mathieu.desnoyers at efficios.com Fri Sep 14 15:06:31 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 14 Sep 2012 15:06:31 -0400 Subject: [lttng-dev] [PATCH RFC v3 lttng-tools] New testpoint mechanism to instrument LTTng binaries for testing purpose In-Reply-To: <1347649230-21489-2-git-send-email-christian.babeux@efficios.com> References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> <1347649230-21489-1-git-send-email-christian.babeux@efficios.com> <1347649230-21489-2-git-send-email-christian.babeux@efficios.com> Message-ID: <20120914190631.GA28097@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > This commit introduce two new macros: TESTPOINT_DECL(name) and > testpoint(name). > > Here a quick example that show how to use the testpoint mechanism: > > file: main.c > > /* Testpoint declaration */ > TESTPOINT_DECL(interesting_function) > > void interesting_function(void) > { > testpoint(interesting_function); > /* Some processing that can fail */ > ... > } > > int main(int argc, char *argv[]) > { > interesting_function(); > ... > printf("End"); > } > > file: testpoint.c > void __testpoint_interesting_function(void) > { > printf("In testpoint of interesting function!"); > } > > Compile: > gcc -o test main.c > gcc -fPIC -shared -o testpoint.so testpoint.c > > Run: > > ./test > End > > export LTTNG_TESTPOINT_ENABLE=1 > > LD_PRELOAD=testpoint.so ./test > In testpoint of interesting function! > End > > export LTTNG_TESTPOINT_ENABLE=0 > > LD_PRELOAD=testpoint.so ./test > End > > The testpoint mechanism is triggered via the preloading of a shared > object containing the appropriate testpoint symbols and by setting the > LTTNG_TESTPOINT_ENABLE environment variable. > > The check on this environment variable is done on the application startup > with the help of a constructor (lttng_testpoint_check) which toggle a global > state variable indicating whether or not the testpoints should be activated. > > When enabled, the testpoint() macro calls an underlying wrapper specific to > the testpoint and simply try to lookup the testpoint symbol via a dlsym() > call. > > When disabled, the testpoint() call will only incur an additionnal test > per testpoint on a global variable. This performance 'hit' should be > acceptable for production use. > > The testpoint mechanism should be *always on*. It can be explicitly > disabled via CFLAGS="-DNTESTPOINT" in a way similar to NDEBUG and assert(). > > Signed-off-by: Christian Babeux Acked-by: Mathieu Desnoyers Thanks! Mathieu > --- > configure.ac | 1 + > src/common/Makefile.am | 2 +- > src/common/testpoint/Makefile.am | 6 ++++ > src/common/testpoint/testpoint.c | 64 ++++++++++++++++++++++++++++++++++ > src/common/testpoint/testpoint.h | 74 ++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 146 insertions(+), 1 deletion(-) > create mode 100644 src/common/testpoint/Makefile.am > create mode 100644 src/common/testpoint/testpoint.c > create mode 100644 src/common/testpoint/testpoint.h > > diff --git a/configure.ac b/configure.ac > index 7687280..8e61115 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -275,6 +275,7 @@ AC_CONFIG_FILES([ > src/common/sessiond-comm/Makefile > src/common/compat/Makefile > src/common/relayd/Makefile > + src/common/testpoint/Makefile > src/lib/Makefile > src/lib/lttng-ctl/Makefile > src/lib/lttng-ctl/filter/Makefile > diff --git a/src/common/Makefile.am b/src/common/Makefile.am > index ca48153..889b04e 100644 > --- a/src/common/Makefile.am > +++ b/src/common/Makefile.am > @@ -1,6 +1,6 @@ > AM_CPPFLAGS = > > -SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer > +SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd kernel-consumer ust-consumer testpoint > > AM_CFLAGS = -fno-strict-aliasing > > diff --git a/src/common/testpoint/Makefile.am b/src/common/testpoint/Makefile.am > new file mode 100644 > index 0000000..7d3df16 > --- /dev/null > +++ b/src/common/testpoint/Makefile.am > @@ -0,0 +1,6 @@ > +AM_CPPFLAGS = > + > +noinst_LTLIBRARIES = libtestpoint.la > + > +libtestpoint_la_SOURCES = testpoint.h testpoint.c > +libtestpoint_la_LIBADD = -ldl > diff --git a/src/common/testpoint/testpoint.c b/src/common/testpoint/testpoint.c > new file mode 100644 > index 0000000..3d01a03 > --- /dev/null > +++ b/src/common/testpoint/testpoint.c > @@ -0,0 +1,64 @@ > +/* > + * Copyright (C) 2012 - Christian Babeux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License, version 2 only, > + * as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + * > + * You should have received a copy of the GNU General Public License along > + * with this program; if not, write to the Free Software Foundation, Inc., > + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + */ > + > +#ifndef NTESTPOINT > + > +#define _GNU_SOURCE /* for RTLD_DEFAULT GNU extension */ > + > +#include /* for dlsym */ > +#include /* for getenv */ > +#include /* for strncmp */ > + > +#include "testpoint.h" > + > +/* Environment variable used to enable the testpoints facilities. */ > +static const char *lttng_testpoint_env_var = "LTTNG_TESTPOINT_ENABLE"; > + > +/* Testpoint toggle flag */ > +int lttng_testpoint_activated; > + > +/* > + * Toggle the support for testpoints on the application startup. > + */ > +static void __attribute__((constructor)) lttng_testpoint_check(void) > +{ > + char *testpoint_env_val = NULL; > + > + testpoint_env_val = getenv(lttng_testpoint_env_var); > + if (testpoint_env_val != NULL > + && (strncmp(testpoint_env_val, "1", 1) == 0)) { > + lttng_testpoint_activated = 1; > + } > +} > + > +/* > + * Lookup a symbol by name. > + * > + * Return the address where the symbol is loaded > + * or NULL if the symbol was not found. > + */ > +void *lttng_testpoint_lookup(const char *name) > +{ > + if (!name) { > + return NULL; > + } > + > + return dlsym(RTLD_DEFAULT, name); > +} > + > +#endif /* NTESTPOINT */ > + > diff --git a/src/common/testpoint/testpoint.h b/src/common/testpoint/testpoint.h > new file mode 100644 > index 0000000..2925b0a > --- /dev/null > +++ b/src/common/testpoint/testpoint.h > @@ -0,0 +1,74 @@ > +/* > + * Copyright (C) 2012 - Christian Babeux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License, version 2 only, > + * as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + * > + * You should have received a copy of the GNU General Public License along > + * with this program; if not, write to the Free Software Foundation, Inc., > + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + */ > + > +#ifdef NTESTPOINT > + > +#define testpoint(name) > +#define TESTPOINT_DECL(name) > + > +#else /* NTESTPOINT */ > + > +#include /* for caa_likely/unlikely */ > + > +extern int lttng_testpoint_activated; > + > +void *lttng_testpoint_lookup(const char *name); > + > +/* > + * Testpoint is only active if the global > + * lttng_testpoint_activated flag is set. > + */ > +#define testpoint(name) \ > + do { \ > + if (caa_unlikely(lttng_testpoint_activated)) { \ > + __testpoint_##name##_wrapper(); \ > + } \ > + } while (0) > + > +/* > + * One wrapper per testpoint is generated. This is to keep track > + * of the symbol lookup status and the corresponding function > + * pointer, if any. > + */ > +#define _TESTPOINT_DECL(_name) \ > + static inline void __testpoint_##_name##_wrapper(void) \ > + { \ > + static void (*tp)(void); \ > + static int found; \ > + const char *tp_name = "__testpoint_" #_name; \ > + \ > + if (tp) { \ > + tp(); \ > + } else { \ > + if (!found) { \ > + tp = lttng_testpoint_lookup(tp_name); \ > + if (tp) { \ > + found = 1; \ > + tp(); \ > + } else { \ > + found = -1; \ > + } \ > + } \ > + } \ > + } > + > +/* Testpoint declaration */ > +#define TESTPOINT_DECL(name) \ > + _TESTPOINT_DECL(name) > + > +#endif /* NTESTPOINT */ > + > -- > 1.7.11.4 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From Bernd.Hufmann at ericsson.com Mon Sep 17 08:26:07 2012 From: Bernd.Hufmann at ericsson.com (Bernd Hufmann) Date: Mon, 17 Sep 2012 08:26:07 -0400 Subject: [lttng-dev] Missing tracepoint entries when listing fields in LTTng Tools 2.1 In-Reply-To: <505321EA.1060007@ericsson.com> References: <5050CD26.6020707@ericsson.com> <20120912191400.GA31291@Krystal> <505321EA.1060007@ericsson.com> Message-ID: <505716DF.60505@ericsson.com> Hello I wondering if the described problem below will be fixed for the release of 2.1? I think the behaviour is not correct and should be corrected in the release. Any comments? Best Regards Bernd On 09/14/2012 08:24 AM, Bernd Hufmann wrote: > Hi > > I executed command "lttng list -u -f" (in LTTng Tools 2.1 RC2) to list > all the available UST tracers and their tracepoints/fields. I noticed > that some tracepoints are not listed when they don't have any fields. I > think this is not correct because the "-f" option should just give more > detailed information, but should not remove information. > > To re-produce, use the hello.cxx test application delivered with LTTng UST. > "lttng list -u" shows: > PID: 6056 - Name: /home/bernd/git/lttng-ust/tests/hello.cxx/.libs/lt-hello > ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_LINE > (13)) (type: tracepoint) > ust_tests_hello:tptest (loglevel: TRACE_DEBUG_LINE (13)) (type: > tracepoint) > > "lttng list -u -f shows: > PID: 6056 - Name: /home/bernd/git/lttng-ust/tests/hello.cxx/.libs/lt-hello > ust_tests_hello:tptest (loglevel: TRACE_DEBUG_LINE (13)) (type: > tracepoint) > field: doublefield (float) > field: floatfield (float) > field: stringfield (string) > field: seqfield2 (string) > field: seqfield1 (unknown) > field: arrfield2 (string) > field: arrfield1 (unknown) > field: netintfieldhex (integer) > field: netintfield (integer) > field: longfield (integer) > field: intfield2 (integer) > field: intfield (integer) > > Best Regards > Bernd > > -- This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer From Ansgar.RADERMACHER at cea.fr Mon Sep 17 08:37:43 2012 From: Ansgar.RADERMACHER at cea.fr (RADERMACHER Ansgar 206501) Date: Mon, 17 Sep 2012 12:37:43 +0000 Subject: [lttng-dev] Userspace tracing, TP declaration via C++ Message-ID: <386C5D4D5C53C24CBC2C60CAAFD2136A170E5A3E@EXDAG0-B1.intra.cea.fr> Hello, I'd like to use LTTng in the context of C++ projects. Unless I missed something, the trace provider iitself is always a "c" file, in the examples called tp.c (I use the 2.0.5. of the LTTng tools, linux kernel 3.1.10 and gcc/g++ 4.6.2). If I use a C++ file instead, e.g. by renaming the tp.c to tp.cpp, the compilation fails, since the two enumerations alloc and sync are defined within the scope of the lttng_ust_lib_ring_buffer_config structure and thus their literals are not found (there are additional problems, if I try to define these two enumerations on top level). Using a c file instead of a C++ is a bit problemaitc, since I am currently integrating LTTng into the Papyrus code generation and I do not like mixing the C and C++ code generation (although possible). Is there a know work-around or upcoming solution to declare a tracepoint and compile it with g++ ? Best regards Ansgar -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Mon Sep 17 09:01:47 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 17 Sep 2012 09:01:47 -0400 Subject: [lttng-dev] Userspace tracing, TP declaration via C++ In-Reply-To: <386C5D4D5C53C24CBC2C60CAAFD2136A170E5A3E@EXDAG0-B1.intra.cea.fr> References: <386C5D4D5C53C24CBC2C60CAAFD2136A170E5A3E@EXDAG0-B1.intra.cea.fr> Message-ID: <20120917130147.GB4256@Krystal> * RADERMACHER Ansgar 206501 (Ansgar.RADERMACHER at cea.fr) wrote: > Hello, > > I'd like to use LTTng in the context of C++ projects. Unless I missed something, the trace provider iitself is always a "c" file, in the examples called tp.c (I use the 2.0.5. of the LTTng tools, linux kernel 3.1.10 and gcc/g++ 4.6.2). > > If I use a C++ file instead, e.g. by renaming the tp.c to tp.cpp, the compilation fails, since the two enumerations alloc and sync are defined within the scope of the lttng_ust_lib_ring_buffer_config structure and thus their literals are not found (there are additional problems, if I try to define these two enumerations on top level). > > Using a c file instead of a C++ is a bit problemaitc, since I am currently integrating LTTng into the Papyrus code generation and I do not like mixing the C and C++ code generation (although possible). > > Is there a know work-around or upcoming solution to declare a tracepoint and compile it with g++ ? Not at this point. The probe needs to be compiled with gcc. Please file a feature request on bugs.lttng.org. Thanks, Mathieu > > Best regards > > Ansgar > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Mon Sep 17 09:33:24 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 17 Sep 2012 09:33:24 -0400 Subject: [lttng-dev] Deaklock in liblttng-ust In-Reply-To: <5052AC26.5050904@emc.com> References: <6539770C71C3814BB0BFC2DBEBD1050801062B20@CORPUSMX30B.corp.emc.com> <20120913113739.GA27777@Krystal> <5052AC26.5050904@emc.com> Message-ID: <20120917133324.GC4256@Krystal> * changz (zheng.chang at emc.com) wrote: > On 9/13/2012 19:37 PM, Mathieu Desnoyers wrote: >> Re: [lttng-dev] Deaklock in liblttng-ust >> >> * Chang, Zheng (Zheng.Chang at emc.com) wrote: >> > Hi, >> > >> > >> > >> > I built a trace.so as a wrapper of lttng-ust, which predefines some >> > events and APIs based on lttng-ust. >> > >> > And here is demo application linked to this share library. >> > >> > >> > >> > Sometimes the demo hung at launch time. I did test with the demo and >> > easy-ust of lttng-ust on both IA32 and X64 and got the same result. >> > >> > Lttng-ust version is 2.02. >> > >> > >> > >> > I collect some debuging info with gdb here: >> > >> > >> > >> > Parent process: >> > >> > >> > >> > gdb) thread 3 (constructor of liblttng-ust.so) >> > >> > [Switching to thread 3 (Thread 0x7f91d5487950 (LWP 21901))]#0 >> > 0x00007f91d82ad400 in wait () from /lib64/libpthread.so.0 >> > >> > (gdb) bt >> > >> > #0 0x00007f91d82ad400 in wait () from /lib64/libpthread.so.0 >> > >> > #1 0x00007f91d64a8c4b in wait_for_sessiond (sock_info=0x7f91d66cc640) >> > at lttng-ust-comm.c:481 >> > >> > #2 0x00007f91d64a9545 in ust_listener_thread (arg=> > out>) at lttng-ust-comm.c:669 >> > >> > #3 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 >> > >> > #4 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 >> > >> > >> > >> > (gdb) thread 5 (constructor of demo) >> > >> > [Switching to thread 5 (Thread 0x7f91d690e950 (LWP 21899))]#0 >> > 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 >> > >> > (gdb) bt >> > >> > #0 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 >> > >> > #1 0x00007f91d82a72d0 in _L_lock_102 () from /lib64/libpthread.so.0 >> > >> > #2 0x00007f91d82a6bbe in pthread_mutex_lock () from >> > /lib64/libpthread.so.0 >> > >> > #3 0x00007f91d64abf8b in ltt_probe_register (desc=0x7f91d66d0ce0) at >> > ltt-probes.c:77 >> > >> > #4 0x00007f91d66e0cfb in __lttng_events_init__sample_component () at >> > /usr/include/lttng/ust-tracepoint-event.h:550 >> > >> > #5 0x00007f91d66e71b6 in __do_global_ctors_aux () from mytrace.so >> > >> > #6 0x00007f91d66e03c3 in _init () from mytrace.so >> > >> > #7 0x00007f91d66df3d4 in ?? () from mytrace.so >> > >> > #8 0x00007f91d94f78d8 in ?? () from /lib64/ld-linux-x86-64.so.2 >> > >> > #9 0x00007f91d94f7a07 in ?? () from /lib64/ld-linux-x86-64.so.2 >> > >> > #10 0x00007f91d94fbbde in ?? () from /lib64/ld-linux-x86-64.so.2 >> > >> > #11 0x00007f91d94f7566 in ?? () from /lib64/ld-linux-x86-64.so.2 >> > >> > #12 0x00007f91d94fb38b in ?? () from /lib64/ld-linux-x86-64.so.2 >> > >> > #13 0x00007f91d84bbf9b in ?? () from /lib64/libdl.so.2 >> > >> > #14 0x00007f91d94f7566 in ?? () from /lib64/ld-linux-x86-64.so.2 >> > >> > #15 0x00007f91d84bc34c in ?? () from /lib64/libdl.so.2 >> > >> > #16 0x00007f91d84bbf01 in dlopen () from /lib64/libdl.so.2 >> > >> > .............................................. >> > >> > #24 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 >> > >> > #25 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 >> > >> > >> > >> > (gdb) p sessions_mutex >> > >> > $4 = {__data = {__lock = 2, __count = 0, __owner = 21901, __nusers = 1, >> > __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, >> > >> > __size = "\002\000\000\000\000\000\000\000\215U\000\000\001", '\0' >> > , __align = 2} >> > >> > >> > >> > Child process: >> > >> > >> > >> > (gdb) info thread (forked from 21901) >> > >> > * 1 Thread 0x7f91d5487950 (LWP 21902) 0x00007f91d82ac344 in >> > __lll_lock_wait () from /lib64/libpthread.so.0 >> > >> > (gdb) bt >> > >> > #0 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 >> > >> > #1 0x00007f91d82a72d0 in _L_lock_102 () from /lib64/libpthread.so.0 >> > >> > #2 0x00007f91d82a6bbe in pthread_mutex_lock () from >> > /lib64/libpthread.so.0 >> > >> > #3 0x00007f91d64abe58 in ltt_probe_unregister (desc=0x7f91d66d0ce0) at >> > ltt-probes.c:129 >> > >> > #4 0x00007f91d66e0d10 in __lttng_events_exit__sample_component () at >> > /usr/include/lttng/ust-tracepoint-event.h:557 >> > >> > #5 0x00007f91d66e07cf in __do_global_dtors_aux () from mytrace.so >> > >> > #6 0x00007f91d66cd664 in global_apps () from /usr/lib/liblttng-ust.so.0 >> > >> > #7 0x00007f91d5479df0 in ?? () >> > >> > #8 0x00007f91d66e71dd in _real_fini () from mytrace.so >> > >> > #9 0x00007f91d66e71d2 in _fini () from mytrace.so >> > >> > #10 0x00007f91d94f7f54 in ?? () from /lib64/ld-linux-x86-64.so.2 >> > >> > #11 0x00007f91d7a652ed in exit () from /lib64/libc.so.6 >> > >> > #12 0x00007f91d64a9207 in wait_for_sessiond (sock_info=0x7f91d66cc640) >> > at lttng-ust-comm.c:542 >> > >> > #13 0x00007f91d64a9545 in ust_listener_thread (arg=> > out>) at lttng-ust-comm.c:669 >> > >> > #14 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 >> > >> > #15 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 >> > >> > #16 0x0000000000000000 in ?? () >> > >> > (gdb) p sessions_mutex >> > >> > $1 = {__data = {__lock = 2, __count = 0, __owner = 21901, __nusers = 1, >> > __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, >> > >> > __size = "\002\000\000\000\000\000\000\000\215U\000\000\001", '\0' >> > , __align = 2} >> > >> > >> > >> > What happened seems like this: >> > >> > >> > >> > lttng_ust_init >> > >> > | >> > >> > |-> ust_listener_thread >> > >> > | >> > >> > |-> wait_for_sessiond >> > >> > | >> > >> > |-> >> > ust_lock >> > (1) >> > >> > |-> >> > get_map_shm >> > >> > | >> > | >> > >> > | >> > |-> get_wait_shm >> > >> > | >> > | >> > >> > | >> > |-> fork >> > >> > | >> > parent -> wait >> > (2) >> > >> > | >> > child -> exit -> _fini -> __do_global_dtors_aux -> ...... -> >> > ltt_probe_unregister -> ust_lock (3) >> > >> > |-> >> > ust_unlock >> > (4) >> > >> > >> > >> > Deadlock happened at point (1) and (3). Parent waited for child's >> > termination and child waited for parent to release the lock. >> > >> > >> > >> > Reproduction conditions: >> > >> > - First time to create share memory >> > (/dev/shm/lttng-ust-apps-wait* don't exist) >> > >> > - Child process got delayed( I'm not quite sure with this, I >> > used gdb to hold child process for a while and it happened either) >> > >> > >> > >> > In normal case, child process didn't call _fini when it exited so that >> > no deadlock happened. >> > >> > >> > >> > Is this a known issue? >> >> Yes, see: >> >> commit 3b8b68e73ec9b2b3cf550048046d3f7f69050688 >> Author: Mathieu Desnoyers >> Date: Wed Jun 13 04:26:34 2012 -0400 >> >> Fix: liblttng-ust-fork deadlock >> >> * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote: >> > * Burton, Michael (mburton at ciena.com) wrote: >> > > Mathieu, >> > > >> > > I think there is a deadlock scenario in UST, which has been >> causing my p >> > >> > Good catch ! >> > >> > > >> > > sessiond is started as root: >> > > - creates global sockets ONLY >> > > - DOES NOT CREATE shm in $HOME/lttng-ust-wait- >> > > >> > > application linked against ust is run as root: >> > > - in lttng_ust_init constructor >> > > - ust_listener_thread (local_apps) >> > > - fails to connect to local_apps in $HOME/.lttng (as expected) >> > > - prev_connect_failed=1 >> > > - ust_unlock() >> > > - restart >> > > - wait_for_sessiond() >> > > --> - ust_lock() >> > > | - get_map_shm() >> > > | - get_wait_shm() >> > > DEADLOCK - shm_open() FAILS (not created by sessiond when >> run by root >> > > | - fork() (trying to create shared memory itself) >> > > | - ust_before_fork() >> > > ------------> - ust_lock() >> > > >> > > >> > > You should be able to create this with an empty main, with no >> > > tracepoints. As long as sessiond is started as root so >> > > $HOME/lttng-ust-wait- is not created. You can also make the >> > > lttng-ust constructor (lttng_ust_init) wait forever and then >> you'll be >> > > able to see the deadlock in gdb without even leaving the >> > > lttng_ust_init constructor. >> > >> > Ah, I see. This deadlock is caused by the interaction between >> > [ liblttng-ust-fork ] and liblttng-ust (the fork override is >> > performed by [ liblttng-ust-fork ]). >> >> This can be reproduced easily with the in-tree tests: by removing the >> lttng-ust-apps-wait* files belonging to the user in /dev/shm, running >> the "tests/fork" test (with ./run) hangs. If we run "hello" first, and >> then the fork test, it works fine. >> >> Fixing this by keeping a nesting counter around the fork() call, so we >> return immediately from the pre/post fork handlers if they are >> overridden by liblttng-ust-fork. >> >> Reported-by: Michael Burton >> Signed-off-by: Mathieu Desnoyers >> > Mathieu, > > It's a little different from the issue of Michael. > In my case, the secondary ust_lock is blocked at the destructor of the > demo library, which is triggerred by the exit of child process. > > > #2 0x00007f91d82a6bbe in pthread_mutex_lock () from > /lib64/libpthread.so.0 > > #3 0x00007f91d64abe58 in ltt_probe_unregister > (desc=0x7f91d66d0ce0) at ltt-probes.c:129 > > We can see ltt_probe_unregister calls ust_lock in the destructor. > And here is the setion .dtors of the demo library: > > objdump --section .dtors -S mytrace.so > 0002fc98 <__DTOR_LIST__>: > 2fc98: ff ff ff ff 00 00 00 00 40 f0 00 00 d0 f0 00 00 > ........ at ....... > 0002fca8 <__DTOR_END__>: > 2fca8: 00 00 00 00 .... > 0000f040 t __lttng_events_exit__lttng_ust called by this vector> > 0000f0d0 t __tracepoints__destroy > > The child process calls _fini when it calls API exit. It gets hung and > meanwhile the parent is waiting for its termination. > I think the whole life-cycle of the process should be considered. The > parent's waiting in critical region is dangerous. > Is it possible to refine the critical region with smaller fineness? > > What do you think? Hrm, yes you're right. I'm looking into it. The main issue is that get_wait_shm() bypass the fork() wrapper (with lttng_ust_nest_count), which is responsible for holding the UST mutex across fork(). Therefore, when exiting the context of the child process, we execute the destructor, which try to grab the UST mutex, which might be in pretty much any state. Given that we don't want this process to try to register to lttng-sessiond (because this is internal to lttng-ust), we might want to let it skip the destructor execution. This would actually be the easiest way out. Does the follow patch fix the issue for you ? diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index be64acd..596fd7d 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -616,9 +616,9 @@ int get_wait_shm(struct sock_info *sock_info, size_t mmap_size) ret = ftruncate(wait_shm_fd, mmap_size); if (ret) { PERROR("ftruncate"); - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); } - exit(EXIT_SUCCESS); + _exit(EXIT_SUCCESS); } /* * For local shm, we need to have rw access to accept -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Mon Sep 17 10:14:55 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 17 Sep 2012 10:14:55 -0400 Subject: [lttng-dev] Missing tracepoint entries when listing fields in LTTng Tools 2.1 In-Reply-To: <505716DF.60505@ericsson.com> References: <5050CD26.6020707@ericsson.com> <20120912191400.GA31291@Krystal> <505321EA.1060007@ericsson.com> <505716DF.60505@ericsson.com> Message-ID: <20120917141455.GA8071@Krystal> * Bernd Hufmann (Bernd.Hufmann at ericsson.com) wrote: > Hello > > I wondering if the described problem below will be fixed for the release > of 2.1? I think the behaviour is not correct and should be corrected in > the release. > Any comments? Fixed by commit: commit 26329f266af91824651fe32df3003c45c71985b8 Author: Mathieu Desnoyers Date: Mon Sep 17 10:11:09 2012 -0400 Fix: add events with 0 field to field list Signed-off-by: Mathieu Desnoyers It will be in 2.1. Thanks, Mathieu > > Best Regards > Bernd > > On 09/14/2012 08:24 AM, Bernd Hufmann wrote: >> Hi >> >> I executed command "lttng list -u -f" (in LTTng Tools 2.1 RC2) to list >> all the available UST tracers and their tracepoints/fields. I noticed >> that some tracepoints are not listed when they don't have any fields. I >> think this is not correct because the "-f" option should just give more >> detailed information, but should not remove information. >> >> To re-produce, use the hello.cxx test application delivered with LTTng UST. >> "lttng list -u" shows: >> PID: 6056 - Name: /home/bernd/git/lttng-ust/tests/hello.cxx/.libs/lt-hello >> ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_LINE >> (13)) (type: tracepoint) >> ust_tests_hello:tptest (loglevel: TRACE_DEBUG_LINE (13)) (type: >> tracepoint) >> >> "lttng list -u -f shows: >> PID: 6056 - Name: /home/bernd/git/lttng-ust/tests/hello.cxx/.libs/lt-hello >> ust_tests_hello:tptest (loglevel: TRACE_DEBUG_LINE (13)) (type: >> tracepoint) >> field: doublefield (float) >> field: floatfield (float) >> field: stringfield (string) >> field: seqfield2 (string) >> field: seqfield1 (unknown) >> field: arrfield2 (string) >> field: arrfield1 (unknown) >> field: netintfieldhex (integer) >> field: netintfield (integer) >> field: longfield (integer) >> field: intfield2 (integer) >> field: intfield (integer) >> >> Best Regards >> Bernd >> >> > > > -- > This Communication is Confidential. We only send and receive email on > the basis of the terms set out at www.ericsson.com/email_disclaimer > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Mon Sep 17 10:51:49 2012 From: dgoulet at efficios.com (David Goulet) Date: Mon, 17 Sep 2012 10:51:49 -0400 Subject: [lttng-dev] [PATCH RFC v3 lttng-tools] New testpoint mechanism to instrument LTTng binaries for testing purpose In-Reply-To: <1347649230-21489-2-git-send-email-christian.babeux@efficios.com> References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> <1347649230-21489-1-git-send-email-christian.babeux@efficios.com> <1347649230-21489-2-git-send-email-christian.babeux@efficios.com> Message-ID: <50573905.9070106@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hoy, This looks good. However, I can _not_ merge it upstream for now. I will at least need a testpoint library example in the git tree to test it and make sure it does not break releases. Cheers! David Christian Babeux: > This commit introduce two new macros: TESTPOINT_DECL(name) and > testpoint(name). > > Here a quick example that show how to use the testpoint mechanism: > > file: main.c > > /* Testpoint declaration */ TESTPOINT_DECL(interesting_function) > > void interesting_function(void) { testpoint(interesting_function); > /* Some processing that can fail */ ... } > > int main(int argc, char *argv[]) { interesting_function(); ... > printf("End"); } > > file: testpoint.c void __testpoint_interesting_function(void) { > printf("In testpoint of interesting function!"); } > > Compile: gcc -o test main.c gcc -fPIC -shared -o testpoint.so > testpoint.c > > Run: >> ./test > End >> export LTTNG_TESTPOINT_ENABLE=1 LD_PRELOAD=testpoint.so ./test > In testpoint of interesting function! End >> export LTTNG_TESTPOINT_ENABLE=0 LD_PRELOAD=testpoint.so ./test > End > > The testpoint mechanism is triggered via the preloading of a > shared object containing the appropriate testpoint symbols and by > setting the LTTNG_TESTPOINT_ENABLE environment variable. > > The check on this environment variable is done on the application > startup with the help of a constructor (lttng_testpoint_check) > which toggle a global state variable indicating whether or not the > testpoints should be activated. > > When enabled, the testpoint() macro calls an underlying wrapper > specific to the testpoint and simply try to lookup the testpoint > symbol via a dlsym() call. > > When disabled, the testpoint() call will only incur an additionnal > test per testpoint on a global variable. This performance 'hit' > should be acceptable for production use. > > The testpoint mechanism should be *always on*. It can be > explicitly disabled via CFLAGS="-DNTESTPOINT" in a way similar to > NDEBUG and assert(). > > Signed-off-by: Christian Babeux > --- configure.ac | 1 + src/common/Makefile.am > | 2 +- src/common/testpoint/Makefile.am | 6 ++++ > src/common/testpoint/testpoint.c | 64 > ++++++++++++++++++++++++++++++++++ src/common/testpoint/testpoint.h > | 74 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 146 > insertions(+), 1 deletion(-) create mode 100644 > src/common/testpoint/Makefile.am create mode 100644 > src/common/testpoint/testpoint.c create mode 100644 > src/common/testpoint/testpoint.h > > diff --git a/configure.ac b/configure.ac index 7687280..8e61115 > 100644 --- a/configure.ac +++ b/configure.ac @@ -275,6 +275,7 @@ > AC_CONFIG_FILES([ src/common/sessiond-comm/Makefile > src/common/compat/Makefile src/common/relayd/Makefile + > src/common/testpoint/Makefile src/lib/Makefile > src/lib/lttng-ctl/Makefile src/lib/lttng-ctl/filter/Makefile diff > --git a/src/common/Makefile.am b/src/common/Makefile.am index > ca48153..889b04e 100644 --- a/src/common/Makefile.am +++ > b/src/common/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = > > -SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd > kernel-consumer ust-consumer +SUBDIRS = compat hashtable kernel-ctl > sessiond-comm relayd kernel-consumer ust-consumer testpoint > > AM_CFLAGS = -fno-strict-aliasing > > diff --git a/src/common/testpoint/Makefile.am > b/src/common/testpoint/Makefile.am new file mode 100644 index > 0000000..7d3df16 --- /dev/null +++ > b/src/common/testpoint/Makefile.am @@ -0,0 +1,6 @@ +AM_CPPFLAGS = > + +noinst_LTLIBRARIES = libtestpoint.la + +libtestpoint_la_SOURCES > = testpoint.h testpoint.c +libtestpoint_la_LIBADD = -ldl diff --git > a/src/common/testpoint/testpoint.c > b/src/common/testpoint/testpoint.c new file mode 100644 index > 0000000..3d01a03 --- /dev/null +++ > b/src/common/testpoint/testpoint.c @@ -0,0 +1,64 @@ +/* + * > Copyright (C) 2012 - Christian Babeux > + * + * This program is free > software; you can redistribute it and/or modify + * it under the > terms of the GNU General Public License, version 2 only, + * as > published by the Free Software Foundation. + * + * This program is > distributed in the hope that it will be useful, but WITHOUT + * ANY > WARRANTY; without even the implied warranty of MERCHANTABILITY or + > * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public > License for + * more details. + * + * You should have received a > copy of the GNU General Public License along + * with this program; > if not, write to the Free Software Foundation, Inc., + * 51 > Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + > +#ifndef NTESTPOINT + +#define _GNU_SOURCE /* for RTLD_DEFAULT GNU > extension */ + +#include /* for dlsym */ +#include > /* for getenv */ +#include /* for strncmp > */ + +#include "testpoint.h" + +/* Environment variable used to > enable the testpoints facilities. */ +static const char > *lttng_testpoint_env_var = "LTTNG_TESTPOINT_ENABLE"; + +/* > Testpoint toggle flag */ +int lttng_testpoint_activated; + +/* + * > Toggle the support for testpoints on the application startup. + */ > +static void __attribute__((constructor)) > lttng_testpoint_check(void) +{ + char *testpoint_env_val = NULL; + > + testpoint_env_val = getenv(lttng_testpoint_env_var); + if > (testpoint_env_val != NULL + && (strncmp(testpoint_env_val, > "1", 1) == 0)) { + lttng_testpoint_activated = 1; + } +} + +/* + * > Lookup a symbol by name. + * + * Return the address where the > symbol is loaded + * or NULL if the symbol was not found. + */ > +void *lttng_testpoint_lookup(const char *name) +{ + if (!name) { + > return NULL; + } + + return dlsym(RTLD_DEFAULT, name); +} + +#endif > /* NTESTPOINT */ + diff --git a/src/common/testpoint/testpoint.h > b/src/common/testpoint/testpoint.h new file mode 100644 index > 0000000..2925b0a --- /dev/null +++ > b/src/common/testpoint/testpoint.h @@ -0,0 +1,74 @@ +/* + * > Copyright (C) 2012 - Christian Babeux > + * + * This program is free > software; you can redistribute it and/or modify + * it under the > terms of the GNU General Public License, version 2 only, + * as > published by the Free Software Foundation. + * + * This program is > distributed in the hope that it will be useful, but WITHOUT + * ANY > WARRANTY; without even the implied warranty of MERCHANTABILITY or + > * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public > License for + * more details. + * + * You should have received a > copy of the GNU General Public License along + * with this program; > if not, write to the Free Software Foundation, Inc., + * 51 > Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + > +#ifdef NTESTPOINT + +#define testpoint(name) +#define > TESTPOINT_DECL(name) + +#else /* NTESTPOINT */ + +#include > /* for caa_likely/unlikely */ + +extern int > lttng_testpoint_activated; + +void *lttng_testpoint_lookup(const > char *name); + +/* + * Testpoint is only active if the global + * > lttng_testpoint_activated flag is set. + */ +#define > testpoint(name) \ + do { \ + if > (caa_unlikely(lttng_testpoint_activated)) { \ + > __testpoint_##name##_wrapper(); \ + } \ + } while (0) + +/* > + * One wrapper per testpoint is generated. This is to keep track + > * of the symbol lookup status and the corresponding function + * > pointer, if any. + */ +#define _TESTPOINT_DECL(_name) \ + > static inline void __testpoint_##_name##_wrapper(void) \ + { > \ + static void (*tp)(void); \ + static int found; \ + > const char *tp_name = "__testpoint_" #_name; \ + \ + if > (tp) { \ + tp(); \ + } else { \ + if (!found) { > \ + tp = lttng_testpoint_lookup(tp_name); \ + if (tp) { \ > + found = 1; \ + tp(); \ + } else { \ + > found = -1; \ + } \ + } \ + } \ + } + +/* > Testpoint declaration */ +#define TESTPOINT_DECL(name) \ + > _TESTPOINT_DECL(name) + +#endif /* NTESTPOINT */ + -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQVzkBAAoJEELoaioR9I02oW8IAKePOQ5iMOVARGniB6xLtWeD 6yEc5dh+sh8kjR/Vl+of9Qi0GC/4nLzQeDes15UJgeMGK/aMl30PDtlUO0JHdYAO HZoZpOi+TrX++4n0D7nU92XBAL6trDcMDzh+Dk+YMdVTgJiKcmZd0zXwD7wg8P5y AaQ6ZhlKelNe/p5T2TZKTO4Vk5Pkz4tm2DiH62wkOUEhjk1OK5j2jYArKWHefoh1 lAyLHqYbq5jYH/i+c8XUsGBRlb7pvc+3fcFV26AFIxt1A9oZ33k1geHY9VDQ5vVc fyovQjtR+OQmLFW4ifXsVb7RVSJCEosjlYnjK0LkyKEyb7DwjALwxArPNYy5i1E= =42G8 -----END PGP SIGNATURE----- From Bernd.Hufmann at ericsson.com Mon Sep 17 10:59:19 2012 From: Bernd.Hufmann at ericsson.com (Bernd Hufmann) Date: Mon, 17 Sep 2012 10:59:19 -0400 Subject: [lttng-dev] Missing tracepoint entries when listing fields in LTTng Tools 2.1 In-Reply-To: <20120917141455.GA8071@Krystal> References: <5050CD26.6020707@ericsson.com> <20120912191400.GA31291@Krystal> <505321EA.1060007@ericsson.com> <505716DF.60505@ericsson.com> <20120917141455.GA8071@Krystal> Message-ID: <50573AC7.4040304@ericsson.com> Hi Mathieu thanks for the quick fix. I tried it and it works as expected. BR, Bernd On 09/17/2012 10:14 AM, Mathieu Desnoyers wrote: > * Bernd Hufmann (Bernd.Hufmann at ericsson.com) wrote: >> Hello >> >> I wondering if the described problem below will be fixed for the release >> of 2.1? I think the behaviour is not correct and should be corrected in >> the release. >> Any comments? > Fixed by commit: > > commit 26329f266af91824651fe32df3003c45c71985b8 > Author: Mathieu Desnoyers > Date: Mon Sep 17 10:11:09 2012 -0400 > > Fix: add events with 0 field to field list > > Signed-off-by: Mathieu Desnoyers > > It will be in 2.1. > > Thanks, > > Mathieu > > >> Best Regards >> Bernd >> >> On 09/14/2012 08:24 AM, Bernd Hufmann wrote: >>> Hi >>> >>> I executed command "lttng list -u -f" (in LTTng Tools 2.1 RC2) to list >>> all the available UST tracers and their tracepoints/fields. I noticed >>> that some tracepoints are not listed when they don't have any fields. I >>> think this is not correct because the "-f" option should just give more >>> detailed information, but should not remove information. >>> >>> To re-produce, use the hello.cxx test application delivered with LTTng UST. >>> "lttng list -u" shows: >>> PID: 6056 - Name: /home/bernd/git/lttng-ust/tests/hello.cxx/.libs/lt-hello >>> ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_LINE >>> (13)) (type: tracepoint) >>> ust_tests_hello:tptest (loglevel: TRACE_DEBUG_LINE (13)) (type: >>> tracepoint) >>> >>> "lttng list -u -f shows: >>> PID: 6056 - Name: /home/bernd/git/lttng-ust/tests/hello.cxx/.libs/lt-hello >>> ust_tests_hello:tptest (loglevel: TRACE_DEBUG_LINE (13)) (type: >>> tracepoint) >>> field: doublefield (float) >>> field: floatfield (float) >>> field: stringfield (string) >>> field: seqfield2 (string) >>> field: seqfield1 (unknown) >>> field: arrfield2 (string) >>> field: arrfield1 (unknown) >>> field: netintfieldhex (integer) >>> field: netintfield (integer) >>> field: longfield (integer) >>> field: intfield2 (integer) >>> field: intfield (integer) >>> >>> Best Regards >>> Bernd >>> >>> >> >> -- >> This Communication is Confidential. We only send and receive email on >> the basis of the terms set out at www.ericsson.com/email_disclaimer >> >> _______________________________________________ >> lttng-dev mailing list >> lttng-dev at lists.lttng.org >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer From mathieu.desnoyers at efficios.com Mon Sep 17 11:25:29 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 17 Sep 2012 11:25:29 -0400 Subject: [lttng-dev] [PATCH RFC v3 lttng-tools] New testpoint mechanism to instrument LTTng binaries for testing purpose In-Reply-To: <50573905.9070106@efficios.com> References: <1347396978-4661-1-git-send-email-christian.babeux@efficios.com> <1347649230-21489-1-git-send-email-christian.babeux@efficios.com> <1347649230-21489-2-git-send-email-christian.babeux@efficios.com> <50573905.9070106@efficios.com> Message-ID: <20120917152529.GB8071@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > Hoy, > > This looks good. However, I can _not_ merge it upstream for now. I > will at least need a testpoint library example in the git tree to test > it and make sure it does not break releases. good point! We need at least one example user. > > Cheers! > David > > Christian Babeux: > > This commit introduce two new macros: TESTPOINT_DECL(name) and > > testpoint(name). > > > > Here a quick example that show how to use the testpoint mechanism: > > > > file: main.c > > > > /* Testpoint declaration */ TESTPOINT_DECL(interesting_function) > > > > void interesting_function(void) { testpoint(interesting_function); > > /* Some processing that can fail */ ... } > > > > int main(int argc, char *argv[]) { interesting_function(); ... > > printf("End"); } > > > > file: testpoint.c void __testpoint_interesting_function(void) { > > printf("In testpoint of interesting function!"); } > > > > Compile: gcc -o test main.c gcc -fPIC -shared -o testpoint.so > > testpoint.c > > > > Run: > >> ./test > > End > >> export LTTNG_TESTPOINT_ENABLE=1 LD_PRELOAD=testpoint.so ./test > > In testpoint of interesting function! End > >> export LTTNG_TESTPOINT_ENABLE=0 LD_PRELOAD=testpoint.so ./test > > End > > > > The testpoint mechanism is triggered via the preloading of a > > shared object containing the appropriate testpoint symbols and by > > setting the LTTNG_TESTPOINT_ENABLE environment variable. > > > > The check on this environment variable is done on the application > > startup with the help of a constructor (lttng_testpoint_check) > > which toggle a global state variable indicating whether or not the > > testpoints should be activated. > > > > When enabled, the testpoint() macro calls an underlying wrapper > > specific to the testpoint and simply try to lookup the testpoint > > symbol via a dlsym() call. > > > > When disabled, the testpoint() call will only incur an additionnal > > test per testpoint on a global variable. This performance 'hit' > > should be acceptable for production use. > > > > The testpoint mechanism should be *always on*. It can be > > explicitly disabled via CFLAGS="-DNTESTPOINT" in a way similar to > > NDEBUG and assert(). > > > > Signed-off-by: Christian Babeux > > --- configure.ac | 1 + src/common/Makefile.am > > | 2 +- src/common/testpoint/Makefile.am | 6 ++++ > > src/common/testpoint/testpoint.c | 64 > > ++++++++++++++++++++++++++++++++++ src/common/testpoint/testpoint.h > > | 74 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 146 > > insertions(+), 1 deletion(-) create mode 100644 > > src/common/testpoint/Makefile.am create mode 100644 > > src/common/testpoint/testpoint.c create mode 100644 > > src/common/testpoint/testpoint.h > > > > diff --git a/configure.ac b/configure.ac index 7687280..8e61115 > > 100644 --- a/configure.ac +++ b/configure.ac @@ -275,6 +275,7 @@ > > AC_CONFIG_FILES([ src/common/sessiond-comm/Makefile > > src/common/compat/Makefile src/common/relayd/Makefile + > > src/common/testpoint/Makefile src/lib/Makefile > > src/lib/lttng-ctl/Makefile src/lib/lttng-ctl/filter/Makefile diff > > --git a/src/common/Makefile.am b/src/common/Makefile.am index > > ca48153..889b04e 100644 --- a/src/common/Makefile.am +++ > > b/src/common/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = > > > > -SUBDIRS = compat hashtable kernel-ctl sessiond-comm relayd > > kernel-consumer ust-consumer +SUBDIRS = compat hashtable kernel-ctl > > sessiond-comm relayd kernel-consumer ust-consumer testpoint > > > > AM_CFLAGS = -fno-strict-aliasing > > > > diff --git a/src/common/testpoint/Makefile.am > > b/src/common/testpoint/Makefile.am new file mode 100644 index > > 0000000..7d3df16 --- /dev/null +++ > > b/src/common/testpoint/Makefile.am @@ -0,0 +1,6 @@ +AM_CPPFLAGS = > > + +noinst_LTLIBRARIES = libtestpoint.la + +libtestpoint_la_SOURCES > > = testpoint.h testpoint.c +libtestpoint_la_LIBADD = -ldl diff --git > > a/src/common/testpoint/testpoint.c > > b/src/common/testpoint/testpoint.c new file mode 100644 index > > 0000000..3d01a03 --- /dev/null +++ > > b/src/common/testpoint/testpoint.c @@ -0,0 +1,64 @@ +/* + * > > Copyright (C) 2012 - Christian Babeux > > + * + * This program is free > > software; you can redistribute it and/or modify + * it under the > > terms of the GNU General Public License, version 2 only, + * as > > published by the Free Software Foundation. + * + * This program is > > distributed in the hope that it will be useful, but WITHOUT + * ANY > > WARRANTY; without even the implied warranty of MERCHANTABILITY or + > > * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public > > License for + * more details. + * + * You should have received a > > copy of the GNU General Public License along + * with this program; > > if not, write to the Free Software Foundation, Inc., + * 51 > > Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + > > +#ifndef NTESTPOINT + +#define _GNU_SOURCE /* for RTLD_DEFAULT GNU > > extension */ + +#include /* for dlsym */ +#include > > /* for getenv */ +#include /* for strncmp > > */ + +#include "testpoint.h" + +/* Environment variable used to > > enable the testpoints facilities. */ +static const char > > *lttng_testpoint_env_var = "LTTNG_TESTPOINT_ENABLE"; + +/* > > Testpoint toggle flag */ +int lttng_testpoint_activated; + +/* + * > > Toggle the support for testpoints on the application startup. + */ > > +static void __attribute__((constructor)) > > lttng_testpoint_check(void) +{ + char *testpoint_env_val = NULL; + > > + testpoint_env_val = getenv(lttng_testpoint_env_var); + if > > (testpoint_env_val != NULL + && (strncmp(testpoint_env_val, > > "1", 1) == 0)) { + lttng_testpoint_activated = 1; + } +} + +/* + * > > Lookup a symbol by name. + * + * Return the address where the > > symbol is loaded + * or NULL if the symbol was not found. + */ > > +void *lttng_testpoint_lookup(const char *name) +{ + if (!name) { + > > return NULL; + } + + return dlsym(RTLD_DEFAULT, name); +} + +#endif > > /* NTESTPOINT */ + diff --git a/src/common/testpoint/testpoint.h > > b/src/common/testpoint/testpoint.h new file mode 100644 index > > 0000000..2925b0a --- /dev/null +++ > > b/src/common/testpoint/testpoint.h @@ -0,0 +1,74 @@ +/* + * > > Copyright (C) 2012 - Christian Babeux > > + * + * This program is free > > software; you can redistribute it and/or modify + * it under the > > terms of the GNU General Public License, version 2 only, + * as > > published by the Free Software Foundation. + * + * This program is > > distributed in the hope that it will be useful, but WITHOUT + * ANY > > WARRANTY; without even the implied warranty of MERCHANTABILITY or + > > * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public > > License for + * more details. + * + * You should have received a > > copy of the GNU General Public License along + * with this program; > > if not, write to the Free Software Foundation, Inc., + * 51 > > Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + > > +#ifdef NTESTPOINT + +#define testpoint(name) +#define > > TESTPOINT_DECL(name) + +#else /* NTESTPOINT */ + +#include > > /* for caa_likely/unlikely */ + +extern int > > lttng_testpoint_activated; + +void *lttng_testpoint_lookup(const > > char *name); + +/* + * Testpoint is only active if the global + * > > lttng_testpoint_activated flag is set. + */ +#define > > testpoint(name) \ + do { \ + if > > (caa_unlikely(lttng_testpoint_activated)) { \ + > > __testpoint_##name##_wrapper(); \ + } \ + } while (0) + +/* > > + * One wrapper per testpoint is generated. This is to keep track + > > * of the symbol lookup status and the corresponding function + * > > pointer, if any. + */ +#define _TESTPOINT_DECL(_name) \ + > > static inline void __testpoint_##_name##_wrapper(void) \ + { > > \ + static void (*tp)(void); \ + static int found; \ + > > const char *tp_name = "__testpoint_" #_name; \ + \ + if > > (tp) { \ + tp(); \ + } else { \ + if (!found) { > > \ + tp = lttng_testpoint_lookup(tp_name); \ + if (tp) { \ > > + found = 1; \ + tp(); \ + } else { \ + > > found = -1; \ + } \ + } \ + } \ + } + +/* > > Testpoint declaration */ +#define TESTPOINT_DECL(name) \ + > > _TESTPOINT_DECL(name) + +#endif /* NTESTPOINT */ + > -----BEGIN PGP SIGNATURE----- > > iQEcBAEBCgAGBQJQVzkBAAoJEELoaioR9I02oW8IAKePOQ5iMOVARGniB6xLtWeD > 6yEc5dh+sh8kjR/Vl+of9Qi0GC/4nLzQeDes15UJgeMGK/aMl30PDtlUO0JHdYAO > HZoZpOi+TrX++4n0D7nU92XBAL6trDcMDzh+Dk+YMdVTgJiKcmZd0zXwD7wg8P5y > AaQ6ZhlKelNe/p5T2TZKTO4Vk5Pkz4tm2DiH62wkOUEhjk1OK5j2jYArKWHefoh1 > lAyLHqYbq5jYH/i+c8XUsGBRlb7pvc+3fcFV26AFIxt1A9oZ33k1geHY9VDQ5vVc > fyovQjtR+OQmLFW4ifXsVb7RVSJCEosjlYnjK0LkyKEyb7DwjALwxArPNYy5i1E= > =42G8 > -----END PGP SIGNATURE----- > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Mon Sep 17 12:04:10 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 17 Sep 2012 12:04:10 -0400 Subject: [lttng-dev] Deaklock in liblttng-ust In-Reply-To: <20120917133324.GC4256@Krystal> References: <6539770C71C3814BB0BFC2DBEBD1050801062B20@CORPUSMX30B.corp.emc.com> <20120913113739.GA27777@Krystal> <5052AC26.5050904@emc.com> <20120917133324.GC4256@Krystal> Message-ID: <20120917160409.GA14133@Krystal> * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote: > * changz (zheng.chang at emc.com) wrote: > > On 9/13/2012 19:37 PM, Mathieu Desnoyers wrote: > >> Re: [lttng-dev] Deaklock in liblttng-ust > >> > >> * Chang, Zheng (Zheng.Chang at emc.com) wrote: > >> > Hi, > >> > > >> > > >> > > >> > I built a trace.so as a wrapper of lttng-ust, which predefines some > >> > events and APIs based on lttng-ust. > >> > > >> > And here is demo application linked to this share library. > >> > > >> > > >> > > >> > Sometimes the demo hung at launch time. I did test with the demo and > >> > easy-ust of lttng-ust on both IA32 and X64 and got the same result. > >> > > >> > Lttng-ust version is 2.02. > >> > > >> > > >> > > >> > I collect some debuging info with gdb here: > >> > > >> > > >> > > >> > Parent process: > >> > > >> > > >> > > >> > gdb) thread 3 (constructor of liblttng-ust.so) > >> > > >> > [Switching to thread 3 (Thread 0x7f91d5487950 (LWP 21901))]#0 > >> > 0x00007f91d82ad400 in wait () from /lib64/libpthread.so.0 > >> > > >> > (gdb) bt > >> > > >> > #0 0x00007f91d82ad400 in wait () from /lib64/libpthread.so.0 > >> > > >> > #1 0x00007f91d64a8c4b in wait_for_sessiond (sock_info=0x7f91d66cc640) > >> > at lttng-ust-comm.c:481 > >> > > >> > #2 0x00007f91d64a9545 in ust_listener_thread (arg= >> > out>) at lttng-ust-comm.c:669 > >> > > >> > #3 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 > >> > > >> > #4 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 > >> > > >> > > >> > > >> > (gdb) thread 5 (constructor of demo) > >> > > >> > [Switching to thread 5 (Thread 0x7f91d690e950 (LWP 21899))]#0 > >> > 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 > >> > > >> > (gdb) bt > >> > > >> > #0 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 > >> > > >> > #1 0x00007f91d82a72d0 in _L_lock_102 () from /lib64/libpthread.so.0 > >> > > >> > #2 0x00007f91d82a6bbe in pthread_mutex_lock () from > >> > /lib64/libpthread.so.0 > >> > > >> > #3 0x00007f91d64abf8b in ltt_probe_register (desc=0x7f91d66d0ce0) at > >> > ltt-probes.c:77 > >> > > >> > #4 0x00007f91d66e0cfb in __lttng_events_init__sample_component () at > >> > /usr/include/lttng/ust-tracepoint-event.h:550 > >> > > >> > #5 0x00007f91d66e71b6 in __do_global_ctors_aux () from mytrace.so > >> > > >> > #6 0x00007f91d66e03c3 in _init () from mytrace.so > >> > > >> > #7 0x00007f91d66df3d4 in ?? () from mytrace.so > >> > > >> > #8 0x00007f91d94f78d8 in ?? () from /lib64/ld-linux-x86-64.so.2 > >> > > >> > #9 0x00007f91d94f7a07 in ?? () from /lib64/ld-linux-x86-64.so.2 > >> > > >> > #10 0x00007f91d94fbbde in ?? () from /lib64/ld-linux-x86-64.so.2 > >> > > >> > #11 0x00007f91d94f7566 in ?? () from /lib64/ld-linux-x86-64.so.2 > >> > > >> > #12 0x00007f91d94fb38b in ?? () from /lib64/ld-linux-x86-64.so.2 > >> > > >> > #13 0x00007f91d84bbf9b in ?? () from /lib64/libdl.so.2 > >> > > >> > #14 0x00007f91d94f7566 in ?? () from /lib64/ld-linux-x86-64.so.2 > >> > > >> > #15 0x00007f91d84bc34c in ?? () from /lib64/libdl.so.2 > >> > > >> > #16 0x00007f91d84bbf01 in dlopen () from /lib64/libdl.so.2 > >> > > >> > .............................................. > >> > > >> > #24 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 > >> > > >> > #25 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 > >> > > >> > > >> > > >> > (gdb) p sessions_mutex > >> > > >> > $4 = {__data = {__lock = 2, __count = 0, __owner = 21901, __nusers = 1, > >> > __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, > >> > > >> > __size = "\002\000\000\000\000\000\000\000\215U\000\000\001", '\0' > >> > , __align = 2} > >> > > >> > > >> > > >> > Child process: > >> > > >> > > >> > > >> > (gdb) info thread (forked from 21901) > >> > > >> > * 1 Thread 0x7f91d5487950 (LWP 21902) 0x00007f91d82ac344 in > >> > __lll_lock_wait () from /lib64/libpthread.so.0 > >> > > >> > (gdb) bt > >> > > >> > #0 0x00007f91d82ac344 in __lll_lock_wait () from /lib64/libpthread.so.0 > >> > > >> > #1 0x00007f91d82a72d0 in _L_lock_102 () from /lib64/libpthread.so.0 > >> > > >> > #2 0x00007f91d82a6bbe in pthread_mutex_lock () from > >> > /lib64/libpthread.so.0 > >> > > >> > #3 0x00007f91d64abe58 in ltt_probe_unregister (desc=0x7f91d66d0ce0) at > >> > ltt-probes.c:129 > >> > > >> > #4 0x00007f91d66e0d10 in __lttng_events_exit__sample_component () at > >> > /usr/include/lttng/ust-tracepoint-event.h:557 > >> > > >> > #5 0x00007f91d66e07cf in __do_global_dtors_aux () from mytrace.so > >> > > >> > #6 0x00007f91d66cd664 in global_apps () from /usr/lib/liblttng-ust.so.0 > >> > > >> > #7 0x00007f91d5479df0 in ?? () > >> > > >> > #8 0x00007f91d66e71dd in _real_fini () from mytrace.so > >> > > >> > #9 0x00007f91d66e71d2 in _fini () from mytrace.so > >> > > >> > #10 0x00007f91d94f7f54 in ?? () from /lib64/ld-linux-x86-64.so.2 > >> > > >> > #11 0x00007f91d7a652ed in exit () from /lib64/libc.so.6 > >> > > >> > #12 0x00007f91d64a9207 in wait_for_sessiond (sock_info=0x7f91d66cc640) > >> > at lttng-ust-comm.c:542 > >> > > >> > #13 0x00007f91d64a9545 in ust_listener_thread (arg= >> > out>) at lttng-ust-comm.c:669 > >> > > >> > #14 0x00007f91d82a5650 in start_thread () from /lib64/libpthread.so.0 > >> > > >> > #15 0x00007f91d7b0315d in clone () from /lib64/libc.so.6 > >> > > >> > #16 0x0000000000000000 in ?? () > >> > > >> > (gdb) p sessions_mutex > >> > > >> > $1 = {__data = {__lock = 2, __count = 0, __owner = 21901, __nusers = 1, > >> > __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, > >> > > >> > __size = "\002\000\000\000\000\000\000\000\215U\000\000\001", '\0' > >> > , __align = 2} > >> > > >> > > >> > > >> > What happened seems like this: > >> > > >> > > >> > > >> > lttng_ust_init > >> > > >> > | > >> > > >> > |-> ust_listener_thread > >> > > >> > | > >> > > >> > |-> wait_for_sessiond > >> > > >> > | > >> > > >> > |-> > >> > ust_lock > >> > (1) > >> > > >> > |-> > >> > get_map_shm > >> > > >> > | > >> > | > >> > > >> > | > >> > |-> get_wait_shm > >> > > >> > | > >> > | > >> > > >> > | > >> > |-> fork > >> > > >> > | > >> > parent -> wait > >> > (2) > >> > > >> > | > >> > child -> exit -> _fini -> __do_global_dtors_aux -> ...... -> > >> > ltt_probe_unregister -> ust_lock (3) > >> > > >> > |-> > >> > ust_unlock > >> > (4) > >> > > >> > > >> > > >> > Deadlock happened at point (1) and (3). Parent waited for child's > >> > termination and child waited for parent to release the lock. > >> > > >> > > >> > > >> > Reproduction conditions: > >> > > >> > - First time to create share memory > >> > (/dev/shm/lttng-ust-apps-wait* don't exist) > >> > > >> > - Child process got delayed( I'm not quite sure with this, I > >> > used gdb to hold child process for a while and it happened either) > >> > > >> > > >> > > >> > In normal case, child process didn't call _fini when it exited so that > >> > no deadlock happened. > >> > > >> > > >> > > >> > Is this a known issue? > >> > >> Yes, see: > >> > >> commit 3b8b68e73ec9b2b3cf550048046d3f7f69050688 > >> Author: Mathieu Desnoyers > >> Date: Wed Jun 13 04:26:34 2012 -0400 > >> > >> Fix: liblttng-ust-fork deadlock > >> > >> * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote: > >> > * Burton, Michael (mburton at ciena.com) wrote: > >> > > Mathieu, > >> > > > >> > > I think there is a deadlock scenario in UST, which has been > >> causing my p > >> > > >> > Good catch ! > >> > > >> > > > >> > > sessiond is started as root: > >> > > - creates global sockets ONLY > >> > > - DOES NOT CREATE shm in $HOME/lttng-ust-wait- > >> > > > >> > > application linked against ust is run as root: > >> > > - in lttng_ust_init constructor > >> > > - ust_listener_thread (local_apps) > >> > > - fails to connect to local_apps in $HOME/.lttng (as expected) > >> > > - prev_connect_failed=1 > >> > > - ust_unlock() > >> > > - restart > >> > > - wait_for_sessiond() > >> > > --> - ust_lock() > >> > > | - get_map_shm() > >> > > | - get_wait_shm() > >> > > DEADLOCK - shm_open() FAILS (not created by sessiond when > >> run by root > >> > > | - fork() (trying to create shared memory itself) > >> > > | - ust_before_fork() > >> > > ------------> - ust_lock() > >> > > > >> > > > >> > > You should be able to create this with an empty main, with no > >> > > tracepoints. As long as sessiond is started as root so > >> > > $HOME/lttng-ust-wait- is not created. You can also make the > >> > > lttng-ust constructor (lttng_ust_init) wait forever and then > >> you'll be > >> > > able to see the deadlock in gdb without even leaving the > >> > > lttng_ust_init constructor. > >> > > >> > Ah, I see. This deadlock is caused by the interaction between > >> > [ liblttng-ust-fork ] and liblttng-ust (the fork override is > >> > performed by [ liblttng-ust-fork ]). > >> > >> This can be reproduced easily with the in-tree tests: by removing the > >> lttng-ust-apps-wait* files belonging to the user in /dev/shm, running > >> the "tests/fork" test (with ./run) hangs. If we run "hello" first, and > >> then the fork test, it works fine. > >> > >> Fixing this by keeping a nesting counter around the fork() call, so we > >> return immediately from the pre/post fork handlers if they are > >> overridden by liblttng-ust-fork. > >> > >> Reported-by: Michael Burton > >> Signed-off-by: Mathieu Desnoyers > >> > > Mathieu, > > > > It's a little different from the issue of Michael. > > In my case, the secondary ust_lock is blocked at the destructor of the > > demo library, which is triggerred by the exit of child process. > > > > > #2 0x00007f91d82a6bbe in pthread_mutex_lock () from > > /lib64/libpthread.so.0 > > > #3 0x00007f91d64abe58 in ltt_probe_unregister > > (desc=0x7f91d66d0ce0) at ltt-probes.c:129 > > > > We can see ltt_probe_unregister calls ust_lock in the destructor. > > And here is the setion .dtors of the demo library: > > > > objdump --section .dtors -S mytrace.so > > 0002fc98 <__DTOR_LIST__>: > > 2fc98: ff ff ff ff 00 00 00 00 40 f0 00 00 d0 f0 00 00 > > ........ at ....... > > 0002fca8 <__DTOR_END__>: > > 2fca8: 00 00 00 00 .... > > 0000f040 t __lttng_events_exit__lttng_ust > called by this vector> > > 0000f0d0 t __tracepoints__destroy > > > > The child process calls _fini when it calls API exit. It gets hung and > > meanwhile the parent is waiting for its termination. > > I think the whole life-cycle of the process should be considered. The > > parent's waiting in critical region is dangerous. > > Is it possible to refine the critical region with smaller fineness? > > > > What do you think? > > Hrm, yes you're right. I'm looking into it. > > The main issue is that get_wait_shm() bypass the fork() wrapper (with > lttng_ust_nest_count), which is responsible for holding the UST mutex > across fork(). Therefore, when exiting the context of the child process, > we execute the destructor, which try to grab the UST mutex, which might > be in pretty much any state. > > Given that we don't want this process to try to register to > lttng-sessiond (because this is internal to lttng-ust), we might want to > let it skip the destructor execution. This would actually be the easiest > way out. > > Does the follow patch fix the issue for you ? > > diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c > index be64acd..596fd7d 100644 > --- a/liblttng-ust/lttng-ust-comm.c > +++ b/liblttng-ust/lttng-ust-comm.c > @@ -616,9 +616,9 @@ int get_wait_shm(struct sock_info *sock_info, size_t mmap_size) > ret = ftruncate(wait_shm_fd, mmap_size); > if (ret) { > PERROR("ftruncate"); > - exit(EXIT_FAILURE); > + _exit(EXIT_FAILURE); > } > - exit(EXIT_SUCCESS); > + _exit(EXIT_SUCCESS); > } > /* > * For local shm, we need to have rw access to accept FYI, I'm pushing this commit into master, and will backport to stable-2.0. commit b0c1425d1dbdd356172125a2dde4af4602a17326 Author: Mathieu Desnoyers Date: Mon Sep 17 12:01:14 2012 -0400 Fix: get_wait_shm() ust mutex deadlock The main issue is that get_wait_shm() bypass the fork() wrapper (with lttng_ust_nest_count), which is responsible for holding the UST mutex across fork(). Therefore, when exiting the context of the child process, we execute the destructor, which try to grab the UST mutex, which might be in pretty much any state. Given that we don't want this process to try to register to lttng-sessiond (because this is internal to lttng-ust), we might want to let it skip the destructor execution. This would actually be the easiest way out. Reported-by: changz Signed-off-by: Mathieu Desnoyers > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From christian.babeux at efficios.com Mon Sep 17 17:32:03 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Mon, 17 Sep 2012 17:32:03 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: Mismatch of field name between latest lttng-ust abi and lttng-tools Message-ID: <1347917523-9848-1-git-send-email-christian.babeux@efficios.com> The "written" field of the lttng_event_field and lttng_ust_field_iter structures has been renamed to "nowrite" in the upstream version of lttng-ust. Signed-off-by: Christian Babeux --- include/lttng/lttng.h | 2 +- src/bin/lttng-sessiond/lttng-ust-abi.h | 2 +- src/bin/lttng-sessiond/ust-app.c | 2 +- src/bin/lttng/commands/list.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index d066728..f92ccb6 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -261,7 +261,7 @@ struct lttng_event_field { enum lttng_event_field_type type; char padding[LTTNG_EVENT_FIELD_PADDING]; struct lttng_event event; - int written; + int nowrite; }; /* diff --git a/src/bin/lttng-sessiond/lttng-ust-abi.h b/src/bin/lttng-sessiond/lttng-ust-abi.h index 91639a7..c9be4bd 100644 --- a/src/bin/lttng-sessiond/lttng-ust-abi.h +++ b/src/bin/lttng-sessiond/lttng-ust-abi.h @@ -105,7 +105,7 @@ struct lttng_ust_field_iter { char field_name[LTTNG_UST_SYM_NAME_LEN]; enum lttng_ust_field_type type; int loglevel; /* event loglevel */ - int written; + int nowrite; char padding[LTTNG_UST_FIELD_ITER_PADDING]; }; diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 81b1f41..3202cd4 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -1667,7 +1667,7 @@ int ust_app_list_event_fields(struct lttng_event_field **fields) memcpy(tmp[count].field_name, uiter.field_name, LTTNG_UST_SYM_NAME_LEN); tmp[count].type = uiter.type; - tmp[count].written = uiter.written; + tmp[count].nowrite = uiter.nowrite; memcpy(tmp[count].event.name, uiter.event_name, LTTNG_UST_SYM_NAME_LEN); tmp[count].event.loglevel = uiter.loglevel; diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index eced2b7..0467cc6 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -281,7 +281,7 @@ static void print_event_field(struct lttng_event_field *field) return; } MSG("%sfield: %s (%s)%s", indent8, field->field_name, - field_type(field), field->written ? "" : " [no write]"); + field_type(field), field->nowrite ? "" : " [no write]"); } /* -- 1.7.12 From dgoulet at efficios.com Mon Sep 17 17:36:53 2012 From: dgoulet at efficios.com (David Goulet) Date: Mon, 17 Sep 2012 17:36:53 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: Mismatch of field name between latest lttng-ust abi and lttng-tools In-Reply-To: <1347917523-9848-1-git-send-email-christian.babeux@efficios.com> References: <1347917523-9848-1-git-send-email-christian.babeux@efficios.com> Message-ID: <505797F5.4010206@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Merged! Thanks! David Christian Babeux: > The "written" field of the lttng_event_field and > lttng_ust_field_iter structures has been renamed to "nowrite" in > the upstream version of lttng-ust. > > Signed-off-by: Christian Babeux > --- include/lttng/lttng.h | 2 +- > src/bin/lttng-sessiond/lttng-ust-abi.h | 2 +- > src/bin/lttng-sessiond/ust-app.c | 2 +- > src/bin/lttng/commands/list.c | 2 +- 4 files changed, 4 > insertions(+), 4 deletions(-) > > diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index > d066728..f92ccb6 100644 --- a/include/lttng/lttng.h +++ > b/include/lttng/lttng.h @@ -261,7 +261,7 @@ struct > lttng_event_field { enum lttng_event_field_type type; char > padding[LTTNG_EVENT_FIELD_PADDING]; struct lttng_event event; - int > written; + int nowrite; }; > > /* diff --git a/src/bin/lttng-sessiond/lttng-ust-abi.h > b/src/bin/lttng-sessiond/lttng-ust-abi.h index 91639a7..c9be4bd > 100644 --- a/src/bin/lttng-sessiond/lttng-ust-abi.h +++ > b/src/bin/lttng-sessiond/lttng-ust-abi.h @@ -105,7 +105,7 @@ struct > lttng_ust_field_iter { char field_name[LTTNG_UST_SYM_NAME_LEN]; > enum lttng_ust_field_type type; int loglevel; /* event loglevel > */ - int written; + int nowrite; char > padding[LTTNG_UST_FIELD_ITER_PADDING]; }; > > diff --git a/src/bin/lttng-sessiond/ust-app.c > b/src/bin/lttng-sessiond/ust-app.c index 81b1f41..3202cd4 100644 > --- a/src/bin/lttng-sessiond/ust-app.c +++ > b/src/bin/lttng-sessiond/ust-app.c @@ -1667,7 +1667,7 @@ int > ust_app_list_event_fields(struct lttng_event_field **fields) > > memcpy(tmp[count].field_name, uiter.field_name, > LTTNG_UST_SYM_NAME_LEN); tmp[count].type = uiter.type; - > tmp[count].written = uiter.written; + tmp[count].nowrite = > uiter.nowrite; > > memcpy(tmp[count].event.name, uiter.event_name, > LTTNG_UST_SYM_NAME_LEN); tmp[count].event.loglevel = > uiter.loglevel; diff --git a/src/bin/lttng/commands/list.c > b/src/bin/lttng/commands/list.c index eced2b7..0467cc6 100644 --- > a/src/bin/lttng/commands/list.c +++ > b/src/bin/lttng/commands/list.c @@ -281,7 +281,7 @@ static void > print_event_field(struct lttng_event_field *field) return; } > MSG("%sfield: %s (%s)%s", indent8, field->field_name, - > field_type(field), field->written ? "" : " [no write]"); + > field_type(field), field->nowrite ? "" : " [no write]"); } > > /* -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQV5fsAAoJEELoaioR9I02wi4H/j5LXn7GnA4X32/d18RVjLqK M64WEz4R1htj3lPC0pM04eCffUQ+qv416aGpFhWwZ9z/4bt0C8xUh1h2zMs046y/ cbjsS5OMWXdPBWcjiBC8kzzLIBC61on0qCT7jYQk3k0NkoJ6YG+w3OOYhxwlMAfR Cxpwbd6iPizJ1d5dOy5GomXr3WqDYwxmIvHsjLoP4TLgdIxwP/9XG/1yYUzSafZP RisgbHMy91IsTMDrYKr7LwoSI4HoiHLqqGPnblHfhFjyzm1rtQfKxQcPa487Mn1S SZOjfaOyUSQg4TyR7CHvuQGmYJihRkIqquphWYf64Ry2glsp8EycfWMxJSHXEWQ= =hrT3 -----END PGP SIGNATURE----- From zheng.chang at emc.com Mon Sep 17 23:57:34 2012 From: zheng.chang at emc.com (changz) Date: Tue, 18 Sep 2012 11:57:34 +0800 Subject: [lttng-dev] Deaklock in liblttng-ust In-Reply-To: <20120917133324.GC4256@Krystal> References: <6539770C71C3814BB0BFC2DBEBD1050801062B20@CORPUSMX30B.corp.emc.com> <20120913113739.GA27777@Krystal> <5052AC26.5050904@emc.com> <20120917133324.GC4256@Krystal> Message-ID: <5057F12E.2090209@emc.com> On 9/17/2012 21:33 PM, Mathieu Desnoyers wrote: > * changz (zheng.chang at emc.com) wrote: >> ...... >> >> The child process calls _fini when it calls API exit. It gets hung and >> meanwhile the parent is waiting for its termination. >> I think the whole life-cycle of the process should be considered. The >> parent's waiting in critical region is dangerous. >> Is it possible to refine the critical region with smaller fineness? >> >> What do you think? > Hrm, yes you're right. I'm looking into it. > > The main issue is that get_wait_shm() bypass the fork() wrapper (with > lttng_ust_nest_count), which is responsible for holding the UST mutex > across fork(). Therefore, when exiting the context of the child process, > we execute the destructor, which try to grab the UST mutex, which might > be in pretty much any state. > > Given that we don't want this process to try to register to > lttng-sessiond (because this is internal to lttng-ust), we might want to > let it skip the destructor execution. This would actually be the easiest > way out. > > Does the follow patch fix the issue for you ? > > diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c > index be64acd..596fd7d 100644 > --- a/liblttng-ust/lttng-ust-comm.c > +++ b/liblttng-ust/lttng-ust-comm.c > @@ -616,9 +616,9 @@ int get_wait_shm(struct sock_info *sock_info, size_t mmap_size) > ret = ftruncate(wait_shm_fd, mmap_size); > if (ret) { > PERROR("ftruncate"); > - exit(EXIT_FAILURE); > + _exit(EXIT_FAILURE); > } > - exit(EXIT_SUCCESS); > + _exit(EXIT_SUCCESS); > } > /* > * For local shm, we need to have rw access to accept Yes, it works. Just a reminder, here arefour callings of exit in child's path in my git repository. Thanks & BR -Zheng -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Tue Sep 18 00:54:49 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 18 Sep 2012 00:54:49 -0400 Subject: [lttng-dev] Deaklock in liblttng-ust In-Reply-To: <5057F12E.2090209@emc.com> References: <6539770C71C3814BB0BFC2DBEBD1050801062B20@CORPUSMX30B.corp.emc.com> <20120913113739.GA27777@Krystal> <5052AC26.5050904@emc.com> <20120917133324.GC4256@Krystal> <5057F12E.2090209@emc.com> Message-ID: <20120918045449.GA16820@Krystal> * changz (zheng.chang at emc.com) wrote: > On 9/17/2012 21:33 PM, Mathieu Desnoyers wrote: >> * changz (zheng.chang at emc.com) wrote: >>> ...... >>> >>> The child process calls _fini when it calls API exit. It gets hung and >>> meanwhile the parent is waiting for its termination. >>> I think the whole life-cycle of the process should be considered. The >>> parent's waiting in critical region is dangerous. >>> Is it possible to refine the critical region with smaller fineness? >>> >>> What do you think? >> Hrm, yes you're right. I'm looking into it. >> >> The main issue is that get_wait_shm() bypass the fork() wrapper (with >> lttng_ust_nest_count), which is responsible for holding the UST mutex >> across fork(). Therefore, when exiting the context of the child process, >> we execute the destructor, which try to grab the UST mutex, which might >> be in pretty much any state. >> >> Given that we don't want this process to try to register to >> lttng-sessiond (because this is internal to lttng-ust), we might want to >> let it skip the destructor execution. This would actually be the easiest >> way out. >> >> Does the follow patch fix the issue for you ? >> >> diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c >> index be64acd..596fd7d 100644 >> --- a/liblttng-ust/lttng-ust-comm.c >> +++ b/liblttng-ust/lttng-ust-comm.c >> @@ -616,9 +616,9 @@ int get_wait_shm(struct sock_info *sock_info, size_t mmap_size) >> ret = ftruncate(wait_shm_fd, mmap_size); >> if (ret) { >> PERROR("ftruncate"); >> - exit(EXIT_FAILURE); >> + _exit(EXIT_FAILURE); >> } >> - exit(EXIT_SUCCESS); >> + _exit(EXIT_SUCCESS); >> } >> /* >> * For local shm, we need to have rw access to accept > Yes, it works. > Just a reminder, here arefour callings of exit in child's path in my git > repository. Indeed! Thanks for the reminder! Here is the fix: commit 5d3bc5ed74a4c9f557a75d7de82ed7056adb812e Author: Mathieu Desnoyers Date: Tue Sep 18 00:52:10 2012 -0400 Fix: get_wait_shm() ust mutex deadlock (add 2 missing exit calls) Reported-by: changz Signed-off-by: Mathieu Desnoyers backported to stable-2.0. -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From gerlando.falauto at keymile.com Tue Sep 18 04:59:45 2012 From: gerlando.falauto at keymile.com (Gerlando Falauto) Date: Tue, 18 Sep 2012 10:59:45 +0200 Subject: [lttng-dev] [lttng-tools PATCH] Add new thread in consumer for metadata handling In-Reply-To: <1347389351-19792-1-git-send-email-dgoulet@efficios.com> References: <1347389351-19792-1-git-send-email-dgoulet@efficios.com> Message-ID: <50583801.4030205@keymile.com> Hi David, On 09/11/2012 08:49 PM, David Goulet wrote: > To prioritize the consumption of the metadata, this patch introduce a > new thread in the consumer which exclusively handles metadata in order > to separate them from the trace data. [...] > + /* Check the metadata pipe for incoming metadata. */ > + if (pollfd == ctx->consumer_metadata_pipe[0]) { > + if (revents& (LPOLLERR | LPOLLHUP | LPOLLNVAL)) { > + DBG("Metadata thread pipe hung up"); > + /* > + * Remove the pipe from the poll set and continue the loop Since we don't HAVE_EPOLL, we get: consumer.c: In function 'lttng_consumer_thread_poll_metadata': consumer.c:1700:42: error: 'LPOLLNVAL' undeclared (first use in this function) consumer.c:1700:42: note: each undeclared identifier is reported only once for each function it appears in For some reason, compat/poll.h defines: LPOLLERR = POLLERR, LPOLLHUP = POLLHUP | POLLNVAL, /* Close on exec feature does not exist for poll(2) */ LTTNG_CLOEXEC = 0xdead, Whereas with HAVE_EPOLL we have: LPOLLHUP = EPOLLHUP, LPOLLNVAL = EPOLLHUP, LPOLLRDHUP = EPOLLRDHUP, I would patch this myself but I'm a bit confused by the above... Thanks! Gerlando From dgoulet at efficios.com Tue Sep 18 11:22:33 2012 From: dgoulet at efficios.com (David Goulet) Date: Tue, 18 Sep 2012 11:22:33 -0400 Subject: [lttng-dev] [lttng-tools PATCH] Add new thread in consumer for metadata handling In-Reply-To: <50583801.4030205@keymile.com> References: <1347389351-19792-1-git-send-email-dgoulet@efficios.com> <50583801.4030205@keymile.com> Message-ID: <505891B9.8040809@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi Gerlando, I've fix this upstream: commit 4adabd6161a6decfcd21108b45df6959c34de74c Author: David Goulet Date: Tue Sep 18 11:13:33 2012 -0400 Fix: Remove LPOLLNVAL from consumer metadata revents Without epoll(7), this value does not exist in the compat layer. For now, this poll error is set within the LPOLLHUP in the poll(2) compat header and POLLNVAL of epoll is set to POLLHUP so we basically don't need it at all if we simply use the LPOLLHUP code. Signed-off-by: David Goulet Thanks for reporting! David Gerlando Falauto: > Hi David, > > On 09/11/2012 08:49 PM, David Goulet wrote: >> To prioritize the consumption of the metadata, this patch >> introduce a new thread in the consumer which exclusively handles >> metadata in order to separate them from the trace data. > [...] >> + /* Check the metadata pipe for incoming metadata. */ >> + if (pollfd == ctx->consumer_metadata_pipe[0]) { + if >> (revents& (LPOLLERR | LPOLLHUP | LPOLLNVAL)) { + DBG("Metadata >> thread pipe hung up"); + /* + * Remove the >> pipe from the poll set and continue the loop > > Since we don't HAVE_EPOLL, we get: > > consumer.c: In function 'lttng_consumer_thread_poll_metadata': > consumer.c:1700:42: error: 'LPOLLNVAL' undeclared (first use in > this function) consumer.c:1700:42: note: each undeclared > identifier is reported only once for each function it appears in > > For some reason, compat/poll.h defines: LPOLLERR = POLLERR, > LPOLLHUP = POLLHUP | POLLNVAL, /* Close on exec feature does not > exist for poll(2) */ LTTNG_CLOEXEC = 0xdead, > > Whereas with HAVE_EPOLL we have: LPOLLHUP = EPOLLHUP, LPOLLNVAL = > EPOLLHUP, LPOLLRDHUP = EPOLLRDHUP, > > I would patch this myself but I'm a bit confused by the above... > > Thanks! Gerlando -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQWJG1AAoJEELoaioR9I02rq8IAIB9fk+gOPK5wCat4ASe2Q69 vr9kcUktlNt9QKdWxHd8p9bOQe4oHtMEK9hk/CwTUuEFb4dygbWi1PkxiVFj/OZR RECc+EmuMBx1GWnYFfBKlRLTlcANGipC4co4CcKpe4m4ja12M9OmfJBfa6VHh1m3 gVPPlZ5Sa/lWYijK1dIf6RkqIiOu4daIsU+orxLr3F4buxnVnvs1WJVoI/SLb8AO hAu5XDacJW6i3XMKnY6qSCBL8XwJH9YRPZxahV6Xw94yKaAPtNjwkYUzav9ow6O1 IlGQ8F93vvk7nDf2AaqPSvYQBJw9zl/5MLjltA4pnlZkoLBhcUTji/VFCeP4Bo8= =dO2o -----END PGP SIGNATURE----- From Fredrik_Oestman at mentor.com Wed Sep 19 06:52:58 2012 From: Fredrik_Oestman at mentor.com (Oestman, Fredrik) Date: Wed, 19 Sep 2012 10:52:58 +0000 Subject: [lttng-dev] Clock correlation Message-ID: <524C960C5DFC794E82BE548D825F05CF5BC6C751@EU-MBX-01.mgc.mentorg.com> Hi, We have a problem with kernel and ust traces not correlating in time when the option --clock-raw is used. We have used babeltrace 1.0.0-rc1. I have noticed that version 1.0.0-rc5 doesn't have this option at all anymore. Why not? Did anything change in the way timestamps and/or time offsets are generated in later versions of the kernel and/or user-space tracers? The traces were made with lttng-modules 2.0.3 and lttng-ust 2.0.5. Cheers, Fredrik ?stman http://go.mentor.com/sourceryanalyzer/ From mathieu.desnoyers at efficios.com Wed Sep 19 10:11:31 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Wed, 19 Sep 2012 10:11:31 -0400 Subject: [lttng-dev] Clock correlation In-Reply-To: <524C960C5DFC794E82BE548D825F05CF5BC6C751@EU-MBX-01.mgc.mentorg.com> References: <524C960C5DFC794E82BE548D825F05CF5BC6C751@EU-MBX-01.mgc.mentorg.com> Message-ID: <20120919141131.GC16643@Krystal> * Oestman, Fredrik (Fredrik_Oestman at mentor.com) wrote: > Hi, > > > We have a problem with kernel and ust traces not correlating in time > when the option --clock-raw is used. We have used babeltrace > 1.0.0-rc1. See commit: commit 03798a93f959f6c694fe98f5647481947607c604 Author: Julien Desfossez Date: Fri Aug 3 14:55:00 2012 -0400 Get rid of clock-raw and use real clock The clock-raw does not make much sense except internally, using this clock for seeks and with the public API is more complicated than necessary. This patch replaces the clock-raw by a clock-cycles (does not scale the timestamp with the frequency) and make sure all the calls that manipulate timestamps use the timestamp in nanoseconds with the offset applied. That way the user of the API don't need to bother with the "raw" timestamp which won't be convenient when dealing with multiple traces taken in different timezones. Traces output before and after this patch are exactly the same and multiple API calls have been tested with real timestamps and everything seems to work fine. Signed-off-by: Julien Desfossez Signed-off-by: Mathieu Desnoyers which got into rc5. This quickly phased-out the --clock-raw option, but introduced a --clock-cycles that prints timestamps in cycles. > I have noticed that version 1.0.0-rc5 doesn't have this > option at all anymore. Why not? The main reason for this change is the issue you noticed about lack of time correlation when using the raw time. So instead of changing the behavior of "--clock-raw", we decided to remove it, and provide a similar feature (--clock-cycles) that does not impact timestamp correlation. > Did anything change in the way > timestamps and/or time offsets are generated in later versions of the > kernel and/or user-space tracers? The traces were made with > lttng-modules 2.0.3 and lttng-ust 2.0.5. No changes were made to the way timestamps are generated, other than small fixes (please refer to changelogs for details). This change is internal to babeltrace, about the way it handle trace merge by timestamps. Thanks, Mathieu > > > Cheers, > > Fredrik ?stman > > http://go.mentor.com/sourceryanalyzer/ > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From wade_farnsworth at mentor.com Wed Sep 19 15:48:56 2012 From: wade_farnsworth at mentor.com (Wade Farnsworth) Date: Wed, 19 Sep 2012 12:48:56 -0700 Subject: [lttng-dev] [PATCH] ring_buffer_frontend.c: include lttng-tracer-core.h Message-ID: <505A21A8.4080900@mentor.com> In lib/ringbuffer/ring_buffer_frontend.c, RING_BUFFER_ALIGN is undefined, leading to no alignment offset being recorded after the call to config->cb.record_header_size() in lib_ring_buffer_try_reserve_slow(). However, lttng-ring-buffer-client.h does define RING_BUFFER_ALIGN, so the alignment offset will be produced when the packet header is written in lttng_write_event_header(). This discrepancy may be observed on architectures that don't set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, such as ARM, with a babeltrace error such as: babeltrace: ../../include/babeltrace/ctf/types.h:206: ctf_pos_get_event: Assertion `pos->offset <= pos->content_size' failed. Aborted indicating that the actual content size differs from the calculated one due to the difference in alignment. Including the appropriate header file in ring_buffer_frontend.c solves the problem. Signed-off-by: Wade Farnsworth --- lib/ringbuffer/ring_buffer_frontend.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c index dc0357f..a04333a 100644 --- a/lib/ringbuffer/ring_buffer_frontend.c +++ b/lib/ringbuffer/ring_buffer_frontend.c @@ -55,6 +55,7 @@ #include #include +#include "../../lttng-tracer-core.h" #include "../../wrapper/ringbuffer/config.h" #include "../../wrapper/ringbuffer/backend.h" #include "../../wrapper/ringbuffer/frontend.h" -- 1.7.0.4 From Bernd.Hufmann at ericsson.com Thu Sep 20 07:35:27 2012 From: Bernd.Hufmann at ericsson.com (Bernd Hufmann) Date: Thu, 20 Sep 2012 07:35:27 -0400 Subject: [lttng-dev] Segmentation fault in LTTng Tools 2.1 Message-ID: <505AFF7F.2020002@ericsson.com> Hello I get a Segmentation Fault for the following command: lttng -vvv create -C tcp://192.168.56.1 -D tcp://192.168.56.1 mySession The core dump gives the following stack back trace: Core was generated by `lttng -vvv create -C tcp://192.168.56.1 -D tcp://192.168.56.1 mySession'. Program terminated with signal 11, Segmentation fault. #0 _lttng_create_session_ext (name=, url=0x0, datetime=0xbfa417dc "20120919-194400") at lttng-ctl.c:1546 1546 if (uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) { LTTng Tools version: v2.1.0-rc3 I attached the core dump file: Could someone please look into this error? Thanks Bernd -- This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer -------------- next part -------------- A non-text attachment was scrubbed... Name: core.zip Type: application/zip Size: 31777 bytes Desc: not available URL: From mathieu.desnoyers at efficios.com Thu Sep 20 09:54:16 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 20 Sep 2012 09:54:16 -0400 Subject: [lttng-dev] [PATCH] ring_buffer_frontend.c: include lttng-tracer-core.h In-Reply-To: <505A21A8.4080900@mentor.com> References: <505A21A8.4080900@mentor.com> Message-ID: <20120920135416.GB11608@Krystal> * Wade Farnsworth (wade_farnsworth at mentor.com) wrote: > In lib/ringbuffer/ring_buffer_frontend.c, RING_BUFFER_ALIGN is undefined, > leading to no alignment offset being recorded after the call to > config->cb.record_header_size() in lib_ring_buffer_try_reserve_slow(). > > However, lttng-ring-buffer-client.h does define RING_BUFFER_ALIGN, so > the alignment offset will be produced when the packet header is written > in lttng_write_event_header(). > > This discrepancy may be observed on architectures that don't set > CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, such as ARM, with a babeltrace > error such as: > > babeltrace: ../../include/babeltrace/ctf/types.h:206: ctf_pos_get_event: > Assertion `pos->offset <= pos->content_size' failed. > Aborted > > indicating that the actual content size differs from the calculated one > due to the difference in alignment. Including the appropriate header > file in ring_buffer_frontend.c solves the problem. Good catch! Merged into master and stable-2.0 branches. Thanks! Mathieu > > Signed-off-by: Wade Farnsworth > --- > lib/ringbuffer/ring_buffer_frontend.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c > index dc0357f..a04333a 100644 > --- a/lib/ringbuffer/ring_buffer_frontend.c > +++ b/lib/ringbuffer/ring_buffer_frontend.c > @@ -55,6 +55,7 @@ > #include > #include > > +#include "../../lttng-tracer-core.h" > #include "../../wrapper/ringbuffer/config.h" > #include "../../wrapper/ringbuffer/backend.h" > #include "../../wrapper/ringbuffer/frontend.h" > -- > 1.7.0.4 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From christian.babeux at efficios.com Thu Sep 20 18:05:17 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 20 Sep 2012 18:05:17 -0400 Subject: [lttng-dev] [PATCH lttng-tools 1/4] Tests: Add a check for color support when printing status Message-ID: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> When printing the status of test is OK or FAIL, check if stdout is attached to a terminal device. This way the output is not cluttered with useless escape characters. Some use cases where we don't want colors: $ ./sometest | less $ ./sometest > a.log Signed-off-by: Christian Babeux --- tests/utils.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/utils.h b/tests/utils.h index 7650865..34c8bd6 100644 --- a/tests/utils.h +++ b/tests/utils.h @@ -16,10 +16,28 @@ */ #include +#include #define BRIGHT 1 #define GREEN 32 #define RED 31 -#define PRINT_OK() printf("%c[%d;%dmOK%c[%dm\n", 0x1B, BRIGHT, GREEN, 0x1B, 0); -#define PRINT_FAIL() printf("%c[%d;%dmFAIL%c[%dm\n", 0x1B, BRIGHT, RED, 0x1B, 0); +#define PRINT_OK() \ +do { \ + /* Check for color support */ \ + if (isatty(fileno(stdout))) { \ + printf("%c[%d;%dmOK%c[%dm\n", 0x1B, BRIGHT, GREEN, 0x1B, 0); \ + } else { \ + printf("OK\n"); \ + } \ +} while (0) + +#define PRINT_FAIL() \ +do { \ + /* Check for color support */ \ + if (isatty(fileno(stdout))) { \ + printf("%c[%d;%dmFAIL%c[%dm\n", 0x1B, BRIGHT, RED, 0x1B, 0); \ + } else { \ + printf("FAIL\n"); \ + } \ +} while (0) -- 1.7.12 From christian.babeux at efficios.com Thu Sep 20 18:05:18 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 20 Sep 2012 18:05:18 -0400 Subject: [lttng-dev] [PATCH lttng-tools 2/4] Tests: Add helper functions for printing status and test banner In-Reply-To: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1348178720-24610-2-git-send-email-christian.babeux@efficios.com> Add three new printing functions: print_ok: Print the OK status with optional color support. print_fail: Print the FAIL status with optional color support. print_test_banner: Print a test banner of the test description. e.g.: sometest.sh: TEST_DESC="A really useful test" [...] source $TESTDIR/utils.sh print_test_banner [...] print_ok print_fail [...] $ ./sometest.sh ---------------------- A really useful test ---------------------- OK FAIL Signed-off-by: Christian Babeux --- tests/utils.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/utils.sh b/tests/utils.sh index 42b18e3..2670de3 100644 --- a/tests/utils.sh +++ b/tests/utils.sh @@ -25,6 +25,39 @@ KERNEL_MAJOR_VERSION=2 KERNEL_MINOR_VERSION=6 KERNEL_PATCHLEVEL_VERSION=27 +function print_ok () +{ + # Check if we are a terminal + if [ -t 1 ]; then + echo -e "\e[1;32mOK\e[0m" + else + echo -e "OK" + fi +} + +function print_fail () +{ + # Check if we are a terminal + if [ -t 1 ]; then + echo -e "\e[1;31mFAIL\e[0m" + else + echo -e "FAIL" + fi +} + +function print_test_banner () +{ + # Rely on the global TEST_DESC to be set + if [ -n "$TEST_DESC" ]; then + count=$((${#TEST_DESC}+2)) + str=$(printf "%${count}s"); + echo -e "\n" + echo -e ${str// /-} + echo -e " $TEST_DESC " + echo -e ${str// /-} + fi +} + function validate_kernel_version () { kern_version=($(uname -r | awk -F. '{ printf("%d.%d.%d\n",$1,$2,$3); }' | tr '.' '\n')) -- 1.7.12 From christian.babeux at efficios.com Thu Sep 20 18:05:19 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 20 Sep 2012 18:05:19 -0400 Subject: [lttng-dev] [PATCH lttng-tools 3/4] Tests: Cleanup redundant code and use printing helper functions In-Reply-To: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1348178720-24610-3-git-send-email-christian.babeux@efficios.com> Signed-off-by: Christian Babeux --- tests/kernel/run-kernel-tests.sh | 7 +++-- tests/tools/streaming/run-kernel | 13 ++++---- tests/tools/streaming/run-ust | 5 ++-- tests/tools/streaming/uri_switch | 6 ++-- tests/ust/before-after/run | 14 ++++----- tests/ust/high-throughput/run | 9 +++--- tests/ust/low-throughput/run | 9 +++--- tests/ust/multi-session/run | 13 ++++---- tests/ust/nprocesses/run | 7 ++--- tests/ust/nprocesses/ust-nprocesses | 7 +++-- tests/ust/run-ust-global-tests.sh | 6 ++-- tests/utils.sh | 60 +++++++++++++++++++------------------ 12 files changed, 76 insertions(+), 80 deletions(-) diff --git a/tests/kernel/run-kernel-tests.sh b/tests/kernel/run-kernel-tests.sh index f872be5..358bf92 100755 --- a/tests/kernel/run-kernel-tests.sh +++ b/tests/kernel/run-kernel-tests.sh @@ -46,9 +46,10 @@ function check_lttng_modules () fi } -echo -e "\n---------------------" -echo -e "Testing Kernel tracer" -echo -e "---------------------" + +TEST_DESC="Testing Kernel tracer" + +print_test_banner # Detect lttng-modules installed check_lttng_modules diff --git a/tests/tools/streaming/run-kernel b/tests/tools/streaming/run-kernel index 73a99de..fb05c71 100755 --- a/tests/tools/streaming/run-kernel +++ b/tests/tools/streaming/run-kernel @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="Streaming - Kernel tracing" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -25,9 +26,7 @@ TRACE_PATH=$(mktemp -d) source $TESTDIR/utils.sh -echo -e "\n---------------------------" -echo -e " Streaming - Kernel tracing " -echo -e "----------------------------" +print_test_banner if [ "$(id -u)" != "0" ]; then echo "This test must be running as root. Aborting" @@ -50,10 +49,10 @@ function lttng_create_session # Create session with default path $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -63,10 +62,10 @@ function lttng_enable_consumer_localhost # Create session with default path $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-consumer -k net://localhost >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } diff --git a/tests/tools/streaming/run-ust b/tests/tools/streaming/run-ust index 0149918..4fd2f74 100755 --- a/tests/tools/streaming/run-ust +++ b/tests/tools/streaming/run-ust @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="Streaming - User space tracing" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -26,9 +27,7 @@ TRACE_PATH=$(mktemp -d) source $TESTDIR/utils.sh -echo -e "\n-------------------------------" -echo -e " Streaming - User space tracing " -echo -e "--------------------------------" +print_test_banner if [ ! -x "$CURDIR/$BIN_NAME" ]; then echo -e "No UST nevents binary detected. Passing." diff --git a/tests/tools/streaming/uri_switch b/tests/tools/streaming/uri_switch index a6b1582..6081417 100755 --- a/tests/tools/streaming/uri_switch +++ b/tests/tools/streaming/uri_switch @@ -15,6 +15,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="Streaming - URI switching" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -27,10 +28,7 @@ TRACE_PATH=$(mktemp -d) source $TESTDIR/utils.sh -echo -e "\n" -echo -e "---------------------------" -echo -e " Streaming - URI switching " -echo -e "---------------------------" +print_test_banner if [ ! -x "$CURDIR/$BIN_NAME" ]; then echo -e "No UST nevents binary detected. Skipping." diff --git a/tests/ust/before-after/run b/tests/ust/before-after/run index 9b16528..db6584b 100755 --- a/tests/ust/before-after/run +++ b/tests/ust/before-after/run @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Start tracing before and after execution" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -23,9 +24,7 @@ EVENT_NAME="ust_gen_nevents:tptest" source $TESTDIR/utils.sh -echo -e "\n----------------------------------------------------" -echo -e "UST tracer - Star tracing before and after execution" -echo -e "----------------------------------------------------" +print_test_banner if [ ! -x "$CURDIR/gen-nevents" ]; then echo -e "No UST nevents binary detected. Passing." @@ -44,7 +43,8 @@ test_before_apps() { # Start test echo -n "Starting application... " ./$CURDIR/gen-nevents $NR_ITER - echo -e "Ended \e[1;32mOK\e[0m" + echo -e "Ended " + print_ok stop_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME @@ -58,7 +58,7 @@ test_after_apps() { echo -n "Starting application... " ./$CURDIR/gen-nevents 100 & - echo -e "\e[1;32mOK\e[0m" + print_ok # BEFORE application is spawned create_lttng_session $SESSION_NAME $TRACE_PATH @@ -74,11 +74,11 @@ test_after_apps() { out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l) if [ $out -eq 0 ]; then echo -n "No event found. Suppose to have at least one... " - echo -e "\e[1;31mFAILED\e[0m" + print_fail out=1 else echo -n "Found $out event(s). Coherent... " - echo -e "\e[1;32mOK\e[0m" + print_ok out=0 fi diff --git a/tests/ust/high-throughput/run b/tests/ust/high-throughput/run index de3111d..a6aef3d 100755 --- a/tests/ust/high-throughput/run +++ b/tests/ust/high-throughput/run @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Testing high events throughput" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -24,9 +25,7 @@ EVENT_NAME="tp:tptest" source $TESTDIR/utils.sh -echo -e "\n-------------------------------------------" -echo -e "UST tracer - Testing high events throughput" -echo -e "-------------------------------------------" +print_test_banner if [ ! -x "$CURDIR/$BIN_NAME" ]; then echo -e "No UST nevents binary detected. Passing." @@ -81,11 +80,11 @@ let wanted=$NR_ITER*1000000 if [ $wanted -ne $total ]; then echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... " - echo -e "\e[1;31mFAILED\e[0m" + print_fail out=1 else echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... " - echo -e "\e[1;32mOK\e[0m" + print_ok out=0 fi diff --git a/tests/ust/low-throughput/run b/tests/ust/low-throughput/run index 3f2d1b7..038eff2 100755 --- a/tests/ust/low-throughput/run +++ b/tests/ust/low-throughput/run @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Testing low events throughput" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -23,9 +24,7 @@ EVENT_NAME="tp:slow" source $TESTDIR/utils.sh -echo -e "\n-------------------------------------------" -echo -e "UST tracer - Testing low events throughput" -echo -e "-------------------------------------------" +print_test_banner if [ ! -x "$CURDIR/$BIN_NAME" ]; then echo -e "No UST nevents binary detected. Passing." @@ -92,9 +91,9 @@ done if [ $out -eq 0 ]; then echo -n "Trace is coherent... " - echo -e "\e[1;32mOK\e[0m" + print_ok else - echo -e "\e[1;31mFAILED\e[0m" + print_fail fi rm -rf $TRACE_PATH diff --git a/tests/ust/multi-session/run b/tests/ust/multi-session/run index f6dab7c..f740b57 100755 --- a/tests/ust/multi-session/run +++ b/tests/ust/multi-session/run @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Multi-session" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -23,9 +24,7 @@ EVENT_NAME="ust_gen_nevents:tptest" source $TESTDIR/utils.sh -echo -e "\n--------------------------" -echo -e "UST tracer - Multi-session" -echo -e "--------------------------" +print_test_banner if [ ! -x "$CURDIR/gen-nevents" ]; then echo -e "No UST nevents binary detected. Passing." @@ -46,7 +45,7 @@ test_multi_session() { echo -n "Starting application generating $NR_ITER events... " ./$CURDIR/gen-nevents $NR_ITER & - echo -e "\e[1;32mOK\e[0m" + print_ok # At least hit one event echo -n "Waiting for events to record " @@ -54,7 +53,7 @@ test_multi_session() { echo -n "." sleep 0.1 done - echo -e "\e[1;32m OK\e[0m" + print_ok for i in `seq 0 3`; do stop_tracing "$SESSION_NAME-$i" @@ -62,11 +61,11 @@ test_multi_session() { out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l) if [ $out -ne $NR_ITER ]; then echo -n "No event found. Suppose to have at least one... " - echo -e "\e[1;31mFAILED\e[0m" + print_fail out=1 else echo -n "Found $out event(s) for $SESSION_NAME-$i. Coherent... " - echo -e "\e[1;32mOK\e[0m" + print_ok out=0 fi done diff --git a/tests/ust/nprocesses/run b/tests/ust/nprocesses/run index 7513fe1..b284fbc 100755 --- a/tests/ust/nprocesses/run +++ b/tests/ust/nprocesses/run @@ -14,17 +14,16 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +NR_ITER=100 +TEST_DESC="UST tracer - Generate $NR_ITER process" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. -NR_ITER=100 TEST_BIN_NAME="gen-events-time" source $TESTDIR/utils.sh -echo -e "\n-------------------------------------" -echo -e "UST tracer - Generate $NR_ITER process" -echo -e "---------------------------------------" +print_test_banner if [ ! -x "$CURDIR/$TEST_BIN_NAME" ]; then echo -e "No UST $TEST_BIN_NAME binary detected. Passing." diff --git a/tests/ust/nprocesses/ust-nprocesses b/tests/ust/nprocesses/ust-nprocesses index eab6d39..7355057 100755 --- a/tests/ust/nprocesses/ust-nprocesses +++ b/tests/ust/nprocesses/ust-nprocesses @@ -41,9 +41,10 @@ sleep 3 listing=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list -u) reg_app_count=$(echo -n $listing | sed "s/$TEST_BIN_NAME/$TEST_BIN_NAME\n/g" | grep "$TEST_BIN_NAME" | wc -l) if [ "$reg_app_count" -ne "$NR_ITER" ]; then - echo -e "$reg_app_count apps listed. Expected $NR_ITER \e[1;31mFAILED\e[0m" + echo -e "$reg_app_count apps listed. Expected $NR_ITER " + print_fail else - echo -e "\e[1;32mOK\e[0m" + print_ok fi TRACE_PATH=$(mktemp -d) @@ -64,5 +65,5 @@ rm -rf $TRACE_PATH echo -e -n "Killing all spawned applications..." killall -q $TEST_BIN_NAME >/dev/null 2>&1 & -echo -e "\e[1;32mOK\e[0m" +print_ok exit 0 diff --git a/tests/ust/run-ust-global-tests.sh b/tests/ust/run-ust-global-tests.sh index 969e217..67239c2 100755 --- a/tests/ust/run-ust-global-tests.sh +++ b/tests/ust/run-ust-global-tests.sh @@ -35,9 +35,9 @@ function start_tests () rm -rf $tmpdir } -echo -e "\n-------------------------------------------" -echo -e "UST tracer - Global domain (LTTNG_DOMAIN_UST)" -echo -e "---------------------------------------------" +TEST_DESC="UST tracer - Global domain (LTTNG_DOMAIN_UST)" + +print_test_banner start_tests diff --git a/tests/utils.sh b/tests/utils.sh index 2670de3..70b6607 100644 --- a/tests/utils.sh +++ b/tests/utils.sh @@ -99,10 +99,10 @@ function spawn_sessiond () $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --daemonize --quiet --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" #$DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --verbose-consumer >>/tmp/sessiond.log 2>&1 & if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi fi @@ -122,10 +122,10 @@ function lttng_enable_kernel_event echo -n "Enabling kernel event $event_name for session $sess_name" $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event $event_name -s $sess_name -k >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -141,13 +141,13 @@ function lttng_start_relayd $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >/dev/null 2>&1 & #$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt -vvv >>/tmp/relayd.log 2>&1 & if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -158,7 +158,7 @@ function lttng_stop_relayd echo -e -n "Killing lttng-relayd (pid: $PID_RELAYD)... " kill $PID_RELAYD >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else out=1 @@ -166,7 +166,7 @@ function lttng_stop_relayd out=$(pidof lt-$RELAYD_BIN) sleep 0.5 done - echo -e "\e[1;32mOK\e[0m" + print_ok return 0 fi } @@ -205,7 +205,7 @@ function stop_sessiond () echo -e -n "Killing session daemon... " kill $PID_SESSIOND >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else out=1 @@ -213,7 +213,7 @@ function stop_sessiond () out=$(pidof lt-$SESSIOND_BIN) sleep 0.5 done - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -225,10 +225,10 @@ function create_lttng_session () echo -n "Creating lttng session $sess_name in $trace_path " $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -240,10 +240,10 @@ function enable_lttng_channel() echo -n "Enabling lttng channel $channel_name for session $sess_name" $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel $channel_name -s $sess_name >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -255,10 +255,10 @@ function disable_lttng_channel() echo -n "Disabling lttng channel $channel_name for session $sess_name" $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-channel $channel_name -s $sess_name >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -270,10 +270,10 @@ function enable_ust_lttng_event () echo -n "Enabling lttng event $event_name for session $sess_name " $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event $event_name -s $sess_name -u >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -284,10 +284,10 @@ function start_tracing () echo -n "Start lttng tracing for session $sess_name " $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $sess_name >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -298,10 +298,10 @@ function stop_tracing () echo -n "Stop lttng tracing for session $sess_name " $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $sess_name >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -312,10 +312,10 @@ function destroy_lttng_session () echo -n "Destroy lttng session $sess_name " $TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $sess_name >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -335,10 +335,12 @@ function trace_matches () count=$($BABELTRACE_BIN $trace_path | grep $event_name | wc -l) if [ "$count" -ne "$nr_iter" ]; then - echo -e "$count found in trace \e[1;31mFAILED\e[0m" + echo -e "$count found in trace " + print_fail return 1 else - echo -e "Trace is coherent \e[1;32mOK\e[0m" + echo -e "Trace is coherent " + print_ok return 0 fi } @@ -357,10 +359,10 @@ function validate_trace echo -n "Validating trace for event $event_name... " traced=$($BABELTRACE_BIN $trace_path 2>/dev/null | grep $event_name | wc -l) if [ $traced -eq 0 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok return 0 fi } -- 1.7.12 From christian.babeux at efficios.com Thu Sep 20 18:05:20 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 20 Sep 2012 18:05:20 -0400 Subject: [lttng-dev] [PATCH lttng-tools 4/4] Tests: Rename helper functions to have consistent names In-Reply-To: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1348178720-24610-4-git-send-email-christian.babeux@efficios.com> Most of the helper functions had inconsistent naming. Suggested naming convention for helper functions: _ or _lttng_ List of modified helper functions: lttng_start_relayd -> start_lttng_relayd lttng_stop_relayd -> stop_lttng_relayd start_sessiond -> start_lttng_sessiond stop_sessiond -> stop_lttng_sessiond start_tracing -> start_lttng_tracing stop_tracing -> stop_lttng_tracing Signed-off-by: Christian Babeux --- tests/kernel/run-kernel-tests.sh | 6 +++--- tests/tools/streaming/run-kernel | 16 ++++++++-------- tests/tools/streaming/run-ust | 16 ++++++++-------- tests/tools/streaming/uri_switch | 24 ++++++++++++------------ tests/ust/before-after/run | 16 ++++++++-------- tests/ust/high-throughput/run | 8 ++++---- tests/ust/low-throughput/run | 8 ++++---- tests/ust/multi-session/run | 10 +++++----- tests/ust/nprocesses/run | 4 ++-- tests/ust/nprocesses/ust-nprocesses | 4 ++-- tests/ust/run-ust-global-tests.sh | 6 +++--- tests/utils.sh | 12 ++++++------ 12 files changed, 65 insertions(+), 65 deletions(-) diff --git a/tests/kernel/run-kernel-tests.sh b/tests/kernel/run-kernel-tests.sh index 358bf92..c3a9078 100755 --- a/tests/kernel/run-kernel-tests.sh +++ b/tests/kernel/run-kernel-tests.sh @@ -19,16 +19,16 @@ function start_tests () continue fi - start_sessiond + start_lttng_sessiond ./$bin $tmpdir # Test must return 0 to pass. if [ $? -ne 0 ]; then exit_code=1 - stop_sessiond + stop_lttng_sessiond break fi - stop_sessiond + stop_lttng_sessiond done # Cleaning up diff --git a/tests/tools/streaming/run-kernel b/tests/tools/streaming/run-kernel index fb05c71..f02d1dc 100755 --- a/tests/tools/streaming/run-kernel +++ b/tests/tools/streaming/run-kernel @@ -75,10 +75,10 @@ function test_kernel_before_start () lttng_create_session lttng_enable_consumer_localhost lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME # Give a second sleep 1 - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME } @@ -89,16 +89,16 @@ function test_kernel_after_start () echo -e "\n=== Testing kernel streaming with event enable AFTER start\n" lttng_create_session lttng_enable_consumer_localhost - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME # Give a second sleep 1 - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME } -start_sessiond -lttng_start_relayd "-o $TRACE_PATH" +start_lttng_sessiond +start_lttng_relayd "-o $TRACE_PATH" tests=( test_kernel_before_start ) @@ -118,8 +118,8 @@ do done echo "" -stop_sessiond -lttng_stop_relayd +stop_lttng_sessiond +stop_lttng_relayd exit $out diff --git a/tests/tools/streaming/run-ust b/tests/tools/streaming/run-ust index 4fd2f74..7aea4f6 100755 --- a/tests/tools/streaming/run-ust +++ b/tests/tools/streaming/run-ust @@ -68,10 +68,10 @@ function test_ust_before_start () # Run 5 times with a 1 second delay ./$CURDIR/$BIN_NAME 5 1000000 >/dev/null 2>&1 & - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME wait_apps - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME } @@ -81,18 +81,18 @@ function test_ust_after_start () lttng_create_session lttng_enable_consumer enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME # Run 5 times with a 1 second delay ./$CURDIR/$BIN_NAME 5 1000000 >/dev/null 2>&1 & wait_apps - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME } -start_sessiond -lttng_start_relayd "-o $TRACE_PATH" +start_lttng_sessiond +start_lttng_relayd "-o $TRACE_PATH" tests=( test_ust_before_start test_ust_after_start ) @@ -112,7 +112,7 @@ do done echo "" -stop_sessiond -lttng_stop_relayd +stop_lttng_sessiond +stop_lttng_relayd exit $out diff --git a/tests/tools/streaming/uri_switch b/tests/tools/streaming/uri_switch index 6081417..762a2e7 100755 --- a/tests/tools/streaming/uri_switch +++ b/tests/tools/streaming/uri_switch @@ -94,10 +94,10 @@ function test_uri_switch_localhost_folder done enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME run_apps wait_apps - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$RAND @@ -135,10 +135,10 @@ function test_uri_switch_file_network lttng_create_session $FILE_URI lttng_enable_consumer "$NETWORK_URI/$NET_PATH" enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME run_apps wait_apps - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$NET_PATH @@ -179,10 +179,10 @@ IPVER=$1 lttng_create_session $NETWORK_URI lttng_enable_consumer "$FILE_URI/$FILE_PATH" enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME run_apps wait_apps - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME validate_trace $EVENT_NAME $TMP_PATH/$FILE_PATH @@ -196,22 +196,22 @@ IPVER=$1 } -start_sessiond +start_lttng_sessiond echo "" echo "=== Testing with IPv4" -lttng_start_relayd "-o $TRACE_PATH" +start_lttng_relayd "-o $TRACE_PATH" test_uri_switch_localhost_folder "IPv4" test_uri_switch_file_network "IPv4" test_uri_switch_network_file "IPv4" -lttng_stop_relayd +stop_lttng_relayd echo "" echo "=== Testing with IPv6" -lttng_start_relayd "-o $TRACE_PATH -C tcp6://localhost:5342 -D tcp6://localhost:5343" +start_lttng_relayd "-o $TRACE_PATH -C tcp6://localhost:5342 -D tcp6://localhost:5343" test_uri_switch_localhost_folder "IPv6" test_uri_switch_file_network "IPv6" test_uri_switch_network_file "IPv6" -lttng_stop_relayd +stop_lttng_relayd -stop_sessiond +stop_lttng_sessiond diff --git a/tests/ust/before-after/run b/tests/ust/before-after/run index db6584b..4711b58 100755 --- a/tests/ust/before-after/run +++ b/tests/ust/before-after/run @@ -39,13 +39,13 @@ test_before_apps() { # BEFORE application is spawned create_lttng_session $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME # Start test echo -n "Starting application... " ./$CURDIR/gen-nevents $NR_ITER echo -e "Ended " print_ok - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH @@ -63,12 +63,12 @@ test_after_apps() { # BEFORE application is spawned create_lttng_session $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME # At least hit one event sleep 2 - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l) @@ -87,7 +87,7 @@ test_after_apps() { # MUST set TESTDIR before calling those functions -start_sessiond +start_lttng_sessiond echo "" echo "=== Start application BEFORE tracing was started ===" @@ -97,7 +97,7 @@ TRACE_PATH=$(mktemp -d) test_before_apps out=$? if [ $out -ne 0 ]; then - stop_sessiond + stop_lttng_sessiond exit $out fi @@ -111,10 +111,10 @@ TRACE_PATH=$(mktemp -d) test_after_apps out=$? if [ $out -ne 0 ]; then - stop_sessiond + stop_lttng_sessiond exit $out fi -stop_sessiond +stop_lttng_sessiond rm -rf $TRACE_PATH diff --git a/tests/ust/high-throughput/run b/tests/ust/high-throughput/run index a6aef3d..7bf9995 100755 --- a/tests/ust/high-throughput/run +++ b/tests/ust/high-throughput/run @@ -36,12 +36,12 @@ TRACE_PATH=$(mktemp -d) # MUST set TESTDIR before calling those functions -start_sessiond +start_lttng_sessiond create_lttng_session $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME -start_tracing $SESSION_NAME +start_lttng_tracing $SESSION_NAME for i in `seq 1 $NR_ITER`; do ./$CURDIR/$BIN_NAME & >/dev/null 2>&1 @@ -54,10 +54,10 @@ while [ -n "$(pidof $BIN_NAME)" ]; do done echo "" -stop_tracing $SESSION_NAME +stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME -stop_sessiond +stop_lttng_sessiond # Validate test diff --git a/tests/ust/low-throughput/run b/tests/ust/low-throughput/run index 038eff2..0e70dad 100755 --- a/tests/ust/low-throughput/run +++ b/tests/ust/low-throughput/run @@ -35,20 +35,20 @@ TRACE_PATH=$(mktemp -d) # MUST set TESTDIR before calling those functions -start_sessiond +start_lttng_sessiond create_lttng_session $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME -start_tracing $SESSION_NAME +start_lttng_tracing $SESSION_NAME # This is going to take 20 minutes ./$CURDIR/$BIN_NAME >/dev/null 2>&1 -stop_tracing $SESSION_NAME +stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME -stop_sessiond +stop_lttng_sessiond # Validate test diff --git a/tests/ust/multi-session/run b/tests/ust/multi-session/run index f740b57..7d45f4a 100755 --- a/tests/ust/multi-session/run +++ b/tests/ust/multi-session/run @@ -40,7 +40,7 @@ test_multi_session() { for i in `seq 0 3`; do create_lttng_session "$SESSION_NAME-$i" "$TRACE_PATH/$i" enable_ust_lttng_event "$SESSION_NAME-$i" "$EVENT_NAME$i" - start_tracing "$SESSION_NAME-$i" + start_lttng_tracing "$SESSION_NAME-$i" done echo -n "Starting application generating $NR_ITER events... " @@ -56,7 +56,7 @@ test_multi_session() { print_ok for i in `seq 0 3`; do - stop_tracing "$SESSION_NAME-$i" + stop_lttng_tracing "$SESSION_NAME-$i" destroy_lttng_session "$SESSION_NAME-$i" out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l) if [ $out -ne $NR_ITER ]; then @@ -75,17 +75,17 @@ test_multi_session() { # MUST set TESTDIR before calling those functions -start_sessiond +start_lttng_sessiond TRACE_PATH=$(mktemp -d) test_multi_session out=$? if [ $out -ne 0 ]; then - stop_sessiond + stop_lttng_sessiond exit $out fi -stop_sessiond +stop_lttng_sessiond rm -rf "$TRACE_PATH" diff --git a/tests/ust/nprocesses/run b/tests/ust/nprocesses/run index b284fbc..838798a 100755 --- a/tests/ust/nprocesses/run +++ b/tests/ust/nprocesses/run @@ -32,10 +32,10 @@ fi # MUST set TESTDIR before calling those functions -start_sessiond +start_lttng_sessiond ./$CURDIR/ust-nprocesses $NR_ITER -stop_sessiond +stop_lttng_sessiond exit 0 diff --git a/tests/ust/nprocesses/ust-nprocesses b/tests/ust/nprocesses/ust-nprocesses index 7355057..90c0c2e 100755 --- a/tests/ust/nprocesses/ust-nprocesses +++ b/tests/ust/nprocesses/ust-nprocesses @@ -52,13 +52,13 @@ TRACE_PATH=$(mktemp -d) create_lttng_session $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME -start_tracing $SESSION_NAME +start_lttng_tracing $SESSION_NAME echo "Sleeping $TEST_WAIT_SEC seconds for tracing to start everywhere" echo "Warning: this arbitrary time can make the test fail on slower system" sleep $TEST_WAIT_SEC -stop_tracing $SESSION_NAME +stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME rm -rf $TRACE_PATH diff --git a/tests/ust/run-ust-global-tests.sh b/tests/ust/run-ust-global-tests.sh index 67239c2..875641a 100755 --- a/tests/ust/run-ust-global-tests.sh +++ b/tests/ust/run-ust-global-tests.sh @@ -19,16 +19,16 @@ function start_tests () continue fi - start_sessiond + start_lttng_sessiond ./$bin $tmpdir # Test must return 0 to pass. if [ $? -ne 0 ]; then exit_code=1 - stop_sessiond + stop_lttng_sessiond break fi - stop_sessiond + stop_lttng_sessiond done # Cleaning up diff --git a/tests/utils.sh b/tests/utils.sh index 70b6607..4b2eeec 100644 --- a/tests/utils.sh +++ b/tests/utils.sh @@ -129,7 +129,7 @@ function lttng_enable_kernel_event fi } -function lttng_start_relayd +function start_lttng_relayd { local opt="$1" @@ -151,7 +151,7 @@ function lttng_start_relayd fi } -function lttng_stop_relayd +function stop_lttng_relayd { PID_RELAYD=`pidof lt-$RELAYD_BIN` @@ -171,7 +171,7 @@ function lttng_stop_relayd fi } -function start_sessiond() +function start_lttng_sessiond() { if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then # Env variable requested no session daemon @@ -193,7 +193,7 @@ function start_sessiond() sleep 2 } -function stop_sessiond () +function stop_lttng_sessiond () { if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then # Env variable requested no session daemon @@ -277,7 +277,7 @@ function enable_ust_lttng_event () fi } -function start_tracing () +function start_lttng_tracing () { sess_name=$1 @@ -291,7 +291,7 @@ function start_tracing () fi } -function stop_tracing () +function stop_lttng_tracing () { sess_name=$1 -- 1.7.12 From mathieu.desnoyers at efficios.com Thu Sep 20 22:16:39 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 20 Sep 2012 22:16:39 -0400 Subject: [lttng-dev] [PATCH lttng-tools 1/4] Tests: Add a check for color support when printing status In-Reply-To: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> Message-ID: <20120921021639.GB22861@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > When printing the status of test is OK or FAIL, check if stdout is > attached to a terminal device. This way the output is not cluttered > with useless escape characters. Some use cases where we don't want > colors: > > $ ./sometest | less > > $ ./sometest > a.log > > Signed-off-by: Christian Babeux > --- > tests/utils.h | 22 ++++++++++++++++++++-- > 1 file changed, 20 insertions(+), 2 deletions(-) > > diff --git a/tests/utils.h b/tests/utils.h > index 7650865..34c8bd6 100644 > --- a/tests/utils.h > +++ b/tests/utils.h > @@ -16,10 +16,28 @@ > */ > > #include > +#include > > #define BRIGHT 1 > #define GREEN 32 > #define RED 31 > > -#define PRINT_OK() printf("%c[%d;%dmOK%c[%dm\n", 0x1B, BRIGHT, GREEN, 0x1B, 0); > -#define PRINT_FAIL() printf("%c[%d;%dmFAIL%c[%dm\n", 0x1B, BRIGHT, RED, 0x1B, 0); > +#define PRINT_OK() \ > +do { \ > + /* Check for color support */ \ > + if (isatty(fileno(stdout))) { \ I'm 100% ok with this approach, just a small optimisation to consider: change fileno(stdout) for STDOUT_FILENO , as defined by unistd.h. (same below) Thanks! Mathieu > + printf("%c[%d;%dmOK%c[%dm\n", 0x1B, BRIGHT, GREEN, 0x1B, 0); \ > + } else { \ > + printf("OK\n"); \ > + } \ > +} while (0) > + > +#define PRINT_FAIL() \ > +do { \ > + /* Check for color support */ \ > + if (isatty(fileno(stdout))) { \ > + printf("%c[%d;%dmFAIL%c[%dm\n", 0x1B, BRIGHT, RED, 0x1B, 0); \ > + } else { \ > + printf("FAIL\n"); \ > + } \ > +} while (0) > -- > 1.7.12 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 20 22:20:14 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 20 Sep 2012 22:20:14 -0400 Subject: [lttng-dev] [PATCH lttng-tools 2/4] Tests: Add helper functions for printing status and test banner In-Reply-To: <1348178720-24610-2-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> <1348178720-24610-2-git-send-email-christian.babeux@efficios.com> Message-ID: <20120921022014.GD22861@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > Add three new printing functions: > > print_ok: Print the OK status with optional color support. > print_fail: Print the FAIL status with optional color support. > print_test_banner: Print a test banner of the test description. > > e.g.: > sometest.sh: > TEST_DESC="A really useful test" > [...] > source $TESTDIR/utils.sh > print_test_banner > [...] > print_ok > print_fail > [...] > > $ ./sometest.sh > ---------------------- > A really useful test > ---------------------- > OK > FAIL > > Signed-off-by: Christian Babeux Looks good to me! Acked-by: Mathieu Desnoyers > --- > tests/utils.sh | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/tests/utils.sh b/tests/utils.sh > index 42b18e3..2670de3 100644 > --- a/tests/utils.sh > +++ b/tests/utils.sh > @@ -25,6 +25,39 @@ KERNEL_MAJOR_VERSION=2 > KERNEL_MINOR_VERSION=6 > KERNEL_PATCHLEVEL_VERSION=27 > > +function print_ok () > +{ > + # Check if we are a terminal > + if [ -t 1 ]; then > + echo -e "\e[1;32mOK\e[0m" > + else > + echo -e "OK" > + fi > +} > + > +function print_fail () > +{ > + # Check if we are a terminal > + if [ -t 1 ]; then > + echo -e "\e[1;31mFAIL\e[0m" > + else > + echo -e "FAIL" > + fi > +} > + > +function print_test_banner () > +{ > + # Rely on the global TEST_DESC to be set > + if [ -n "$TEST_DESC" ]; then > + count=$((${#TEST_DESC}+2)) > + str=$(printf "%${count}s"); > + echo -e "\n" > + echo -e ${str// /-} > + echo -e " $TEST_DESC " > + echo -e ${str// /-} > + fi > +} > + > function validate_kernel_version () > { > kern_version=($(uname -r | awk -F. '{ printf("%d.%d.%d\n",$1,$2,$3); }' | tr '.' '\n')) > -- > 1.7.12 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 20 22:21:06 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 20 Sep 2012 22:21:06 -0400 Subject: [lttng-dev] [PATCH lttng-tools 4/4] Tests: Rename helper functions to have consistent names In-Reply-To: <1348178720-24610-4-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> <1348178720-24610-4-git-send-email-christian.babeux@efficios.com> Message-ID: <20120921022106.GE22861@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > Most of the helper functions had inconsistent naming. > > Suggested naming convention for helper functions: > > _ > or > _lttng_ > > List of modified helper functions: > > lttng_start_relayd -> start_lttng_relayd > lttng_stop_relayd -> stop_lttng_relayd > > start_sessiond -> start_lttng_sessiond > stop_sessiond -> stop_lttng_sessiond > > start_tracing -> start_lttng_tracing > stop_tracing -> stop_lttng_tracing > > Signed-off-by: Christian Babeux Nice cleanup ! Acked-by: Mathieu Desnoyers > --- > tests/kernel/run-kernel-tests.sh | 6 +++--- > tests/tools/streaming/run-kernel | 16 ++++++++-------- > tests/tools/streaming/run-ust | 16 ++++++++-------- > tests/tools/streaming/uri_switch | 24 ++++++++++++------------ > tests/ust/before-after/run | 16 ++++++++-------- > tests/ust/high-throughput/run | 8 ++++---- > tests/ust/low-throughput/run | 8 ++++---- > tests/ust/multi-session/run | 10 +++++----- > tests/ust/nprocesses/run | 4 ++-- > tests/ust/nprocesses/ust-nprocesses | 4 ++-- > tests/ust/run-ust-global-tests.sh | 6 +++--- > tests/utils.sh | 12 ++++++------ > 12 files changed, 65 insertions(+), 65 deletions(-) > > diff --git a/tests/kernel/run-kernel-tests.sh b/tests/kernel/run-kernel-tests.sh > index 358bf92..c3a9078 100755 > --- a/tests/kernel/run-kernel-tests.sh > +++ b/tests/kernel/run-kernel-tests.sh > @@ -19,16 +19,16 @@ function start_tests () > continue > fi > > - start_sessiond > + start_lttng_sessiond > > ./$bin $tmpdir > # Test must return 0 to pass. > if [ $? -ne 0 ]; then > exit_code=1 > - stop_sessiond > + stop_lttng_sessiond > break > fi > - stop_sessiond > + stop_lttng_sessiond > done > > # Cleaning up > diff --git a/tests/tools/streaming/run-kernel b/tests/tools/streaming/run-kernel > index fb05c71..f02d1dc 100755 > --- a/tests/tools/streaming/run-kernel > +++ b/tests/tools/streaming/run-kernel > @@ -75,10 +75,10 @@ function test_kernel_before_start () > lttng_create_session > lttng_enable_consumer_localhost > lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME > - start_tracing $SESSION_NAME > + start_lttng_tracing $SESSION_NAME > # Give a second > sleep 1 > - stop_tracing $SESSION_NAME > + stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > } > > @@ -89,16 +89,16 @@ function test_kernel_after_start () > echo -e "\n=== Testing kernel streaming with event enable AFTER start\n" > lttng_create_session > lttng_enable_consumer_localhost > - start_tracing $SESSION_NAME > + start_lttng_tracing $SESSION_NAME > lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME > # Give a second > sleep 1 > - stop_tracing $SESSION_NAME > + stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > } > > -start_sessiond > -lttng_start_relayd "-o $TRACE_PATH" > +start_lttng_sessiond > +start_lttng_relayd "-o $TRACE_PATH" > > tests=( test_kernel_before_start ) > > @@ -118,8 +118,8 @@ do > done > > echo "" > -stop_sessiond > -lttng_stop_relayd > +stop_lttng_sessiond > +stop_lttng_relayd > > > exit $out > diff --git a/tests/tools/streaming/run-ust b/tests/tools/streaming/run-ust > index 4fd2f74..7aea4f6 100755 > --- a/tests/tools/streaming/run-ust > +++ b/tests/tools/streaming/run-ust > @@ -68,10 +68,10 @@ function test_ust_before_start () > # Run 5 times with a 1 second delay > ./$CURDIR/$BIN_NAME 5 1000000 >/dev/null 2>&1 & > > - start_tracing $SESSION_NAME > + start_lttng_tracing $SESSION_NAME > > wait_apps > - stop_tracing $SESSION_NAME > + stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > } > > @@ -81,18 +81,18 @@ function test_ust_after_start () > lttng_create_session > lttng_enable_consumer > enable_ust_lttng_event $SESSION_NAME $EVENT_NAME > - start_tracing $SESSION_NAME > + start_lttng_tracing $SESSION_NAME > > # Run 5 times with a 1 second delay > ./$CURDIR/$BIN_NAME 5 1000000 >/dev/null 2>&1 & > > wait_apps > - stop_tracing $SESSION_NAME > + stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > } > > -start_sessiond > -lttng_start_relayd "-o $TRACE_PATH" > +start_lttng_sessiond > +start_lttng_relayd "-o $TRACE_PATH" > > tests=( test_ust_before_start test_ust_after_start ) > > @@ -112,7 +112,7 @@ do > done > > echo "" > -stop_sessiond > -lttng_stop_relayd > +stop_lttng_sessiond > +stop_lttng_relayd > > exit $out > diff --git a/tests/tools/streaming/uri_switch b/tests/tools/streaming/uri_switch > index 6081417..762a2e7 100755 > --- a/tests/tools/streaming/uri_switch > +++ b/tests/tools/streaming/uri_switch > @@ -94,10 +94,10 @@ function test_uri_switch_localhost_folder > done > > enable_ust_lttng_event $SESSION_NAME $EVENT_NAME > - start_tracing $SESSION_NAME > + start_lttng_tracing $SESSION_NAME > run_apps > wait_apps > - stop_tracing $SESSION_NAME > + stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$RAND > > @@ -135,10 +135,10 @@ function test_uri_switch_file_network > lttng_create_session $FILE_URI > lttng_enable_consumer "$NETWORK_URI/$NET_PATH" > enable_ust_lttng_event $SESSION_NAME $EVENT_NAME > - start_tracing $SESSION_NAME > + start_lttng_tracing $SESSION_NAME > run_apps > wait_apps > - stop_tracing $SESSION_NAME > + stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$NET_PATH > > @@ -179,10 +179,10 @@ IPVER=$1 > lttng_create_session $NETWORK_URI > lttng_enable_consumer "$FILE_URI/$FILE_PATH" > enable_ust_lttng_event $SESSION_NAME $EVENT_NAME > - start_tracing $SESSION_NAME > + start_lttng_tracing $SESSION_NAME > run_apps > wait_apps > - stop_tracing $SESSION_NAME > + stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > validate_trace $EVENT_NAME $TMP_PATH/$FILE_PATH > > @@ -196,22 +196,22 @@ IPVER=$1 > } > > > -start_sessiond > +start_lttng_sessiond > > echo "" > echo "=== Testing with IPv4" > -lttng_start_relayd "-o $TRACE_PATH" > +start_lttng_relayd "-o $TRACE_PATH" > test_uri_switch_localhost_folder "IPv4" > test_uri_switch_file_network "IPv4" > test_uri_switch_network_file "IPv4" > -lttng_stop_relayd > +stop_lttng_relayd > > echo "" > echo "=== Testing with IPv6" > -lttng_start_relayd "-o $TRACE_PATH -C tcp6://localhost:5342 -D tcp6://localhost:5343" > +start_lttng_relayd "-o $TRACE_PATH -C tcp6://localhost:5342 -D tcp6://localhost:5343" > test_uri_switch_localhost_folder "IPv6" > test_uri_switch_file_network "IPv6" > test_uri_switch_network_file "IPv6" > -lttng_stop_relayd > +stop_lttng_relayd > > -stop_sessiond > +stop_lttng_sessiond > diff --git a/tests/ust/before-after/run b/tests/ust/before-after/run > index db6584b..4711b58 100755 > --- a/tests/ust/before-after/run > +++ b/tests/ust/before-after/run > @@ -39,13 +39,13 @@ test_before_apps() { > # BEFORE application is spawned > create_lttng_session $SESSION_NAME $TRACE_PATH > enable_ust_lttng_event $SESSION_NAME $EVENT_NAME > - start_tracing $SESSION_NAME > + start_lttng_tracing $SESSION_NAME > # Start test > echo -n "Starting application... " > ./$CURDIR/gen-nevents $NR_ITER > echo -e "Ended " > print_ok > - stop_tracing $SESSION_NAME > + stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > > trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH > @@ -63,12 +63,12 @@ test_after_apps() { > # BEFORE application is spawned > create_lttng_session $SESSION_NAME $TRACE_PATH > enable_ust_lttng_event $SESSION_NAME $EVENT_NAME > - start_tracing $SESSION_NAME > + start_lttng_tracing $SESSION_NAME > > # At least hit one event > sleep 2 > > - stop_tracing $SESSION_NAME > + stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > > out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l) > @@ -87,7 +87,7 @@ test_after_apps() { > > # MUST set TESTDIR before calling those functions > > -start_sessiond > +start_lttng_sessiond > > echo "" > echo "=== Start application BEFORE tracing was started ===" > @@ -97,7 +97,7 @@ TRACE_PATH=$(mktemp -d) > test_before_apps > out=$? > if [ $out -ne 0 ]; then > - stop_sessiond > + stop_lttng_sessiond > exit $out > fi > > @@ -111,10 +111,10 @@ TRACE_PATH=$(mktemp -d) > test_after_apps > out=$? > if [ $out -ne 0 ]; then > - stop_sessiond > + stop_lttng_sessiond > exit $out > fi > > -stop_sessiond > +stop_lttng_sessiond > > rm -rf $TRACE_PATH > diff --git a/tests/ust/high-throughput/run b/tests/ust/high-throughput/run > index a6aef3d..7bf9995 100755 > --- a/tests/ust/high-throughput/run > +++ b/tests/ust/high-throughput/run > @@ -36,12 +36,12 @@ TRACE_PATH=$(mktemp -d) > > # MUST set TESTDIR before calling those functions > > -start_sessiond > +start_lttng_sessiond > > create_lttng_session $SESSION_NAME $TRACE_PATH > > enable_ust_lttng_event $SESSION_NAME $EVENT_NAME > -start_tracing $SESSION_NAME > +start_lttng_tracing $SESSION_NAME > > for i in `seq 1 $NR_ITER`; do > ./$CURDIR/$BIN_NAME & >/dev/null 2>&1 > @@ -54,10 +54,10 @@ while [ -n "$(pidof $BIN_NAME)" ]; do > done > echo "" > > -stop_tracing $SESSION_NAME > +stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > > -stop_sessiond > +stop_lttng_sessiond > > # Validate test > > diff --git a/tests/ust/low-throughput/run b/tests/ust/low-throughput/run > index 038eff2..0e70dad 100755 > --- a/tests/ust/low-throughput/run > +++ b/tests/ust/low-throughput/run > @@ -35,20 +35,20 @@ TRACE_PATH=$(mktemp -d) > > # MUST set TESTDIR before calling those functions > > -start_sessiond > +start_lttng_sessiond > > create_lttng_session $SESSION_NAME $TRACE_PATH > > enable_ust_lttng_event $SESSION_NAME $EVENT_NAME > -start_tracing $SESSION_NAME > +start_lttng_tracing $SESSION_NAME > > # This is going to take 20 minutes > ./$CURDIR/$BIN_NAME >/dev/null 2>&1 > > -stop_tracing $SESSION_NAME > +stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > > -stop_sessiond > +stop_lttng_sessiond > > # Validate test > > diff --git a/tests/ust/multi-session/run b/tests/ust/multi-session/run > index f740b57..7d45f4a 100755 > --- a/tests/ust/multi-session/run > +++ b/tests/ust/multi-session/run > @@ -40,7 +40,7 @@ test_multi_session() { > for i in `seq 0 3`; do > create_lttng_session "$SESSION_NAME-$i" "$TRACE_PATH/$i" > enable_ust_lttng_event "$SESSION_NAME-$i" "$EVENT_NAME$i" > - start_tracing "$SESSION_NAME-$i" > + start_lttng_tracing "$SESSION_NAME-$i" > done > > echo -n "Starting application generating $NR_ITER events... " > @@ -56,7 +56,7 @@ test_multi_session() { > print_ok > > for i in `seq 0 3`; do > - stop_tracing "$SESSION_NAME-$i" > + stop_lttng_tracing "$SESSION_NAME-$i" > destroy_lttng_session "$SESSION_NAME-$i" > out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l) > if [ $out -ne $NR_ITER ]; then > @@ -75,17 +75,17 @@ test_multi_session() { > > # MUST set TESTDIR before calling those functions > > -start_sessiond > +start_lttng_sessiond > > TRACE_PATH=$(mktemp -d) > > test_multi_session > out=$? > if [ $out -ne 0 ]; then > - stop_sessiond > + stop_lttng_sessiond > exit $out > fi > > -stop_sessiond > +stop_lttng_sessiond > > rm -rf "$TRACE_PATH" > diff --git a/tests/ust/nprocesses/run b/tests/ust/nprocesses/run > index b284fbc..838798a 100755 > --- a/tests/ust/nprocesses/run > +++ b/tests/ust/nprocesses/run > @@ -32,10 +32,10 @@ fi > > # MUST set TESTDIR before calling those functions > > -start_sessiond > +start_lttng_sessiond > > ./$CURDIR/ust-nprocesses $NR_ITER > > -stop_sessiond > +stop_lttng_sessiond > > exit 0 > diff --git a/tests/ust/nprocesses/ust-nprocesses b/tests/ust/nprocesses/ust-nprocesses > index 7355057..90c0c2e 100755 > --- a/tests/ust/nprocesses/ust-nprocesses > +++ b/tests/ust/nprocesses/ust-nprocesses > @@ -52,13 +52,13 @@ TRACE_PATH=$(mktemp -d) > create_lttng_session $SESSION_NAME $TRACE_PATH > > enable_ust_lttng_event $SESSION_NAME $EVENT_NAME > -start_tracing $SESSION_NAME > +start_lttng_tracing $SESSION_NAME > > echo "Sleeping $TEST_WAIT_SEC seconds for tracing to start everywhere" > echo "Warning: this arbitrary time can make the test fail on slower system" > sleep $TEST_WAIT_SEC > > -stop_tracing $SESSION_NAME > +stop_lttng_tracing $SESSION_NAME > destroy_lttng_session $SESSION_NAME > > rm -rf $TRACE_PATH > diff --git a/tests/ust/run-ust-global-tests.sh b/tests/ust/run-ust-global-tests.sh > index 67239c2..875641a 100755 > --- a/tests/ust/run-ust-global-tests.sh > +++ b/tests/ust/run-ust-global-tests.sh > @@ -19,16 +19,16 @@ function start_tests () > continue > fi > > - start_sessiond > + start_lttng_sessiond > > ./$bin $tmpdir > # Test must return 0 to pass. > if [ $? -ne 0 ]; then > exit_code=1 > - stop_sessiond > + stop_lttng_sessiond > break > fi > - stop_sessiond > + stop_lttng_sessiond > done > > # Cleaning up > diff --git a/tests/utils.sh b/tests/utils.sh > index 70b6607..4b2eeec 100644 > --- a/tests/utils.sh > +++ b/tests/utils.sh > @@ -129,7 +129,7 @@ function lttng_enable_kernel_event > fi > } > > -function lttng_start_relayd > +function start_lttng_relayd > { > local opt="$1" > > @@ -151,7 +151,7 @@ function lttng_start_relayd > fi > } > > -function lttng_stop_relayd > +function stop_lttng_relayd > { > PID_RELAYD=`pidof lt-$RELAYD_BIN` > > @@ -171,7 +171,7 @@ function lttng_stop_relayd > fi > } > > -function start_sessiond() > +function start_lttng_sessiond() > { > if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then > # Env variable requested no session daemon > @@ -193,7 +193,7 @@ function start_sessiond() > sleep 2 > } > > -function stop_sessiond () > +function stop_lttng_sessiond () > { > if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then > # Env variable requested no session daemon > @@ -277,7 +277,7 @@ function enable_ust_lttng_event () > fi > } > > -function start_tracing () > +function start_lttng_tracing () > { > sess_name=$1 > > @@ -291,7 +291,7 @@ function start_tracing () > fi > } > > -function stop_tracing () > +function stop_lttng_tracing () > { > sess_name=$1 > > -- > 1.7.12 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 20 22:23:28 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 20 Sep 2012 22:23:28 -0400 Subject: [lttng-dev] [PATCH lttng-tools 2/4] Tests: Add helper functions for printing status and test banner In-Reply-To: <20120921022014.GD22861@Krystal> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> <1348178720-24610-2-git-send-email-christian.babeux@efficios.com> <20120921022014.GD22861@Krystal> Message-ID: <20120921022328.GF22861@Krystal> * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote: > * Christian Babeux (christian.babeux at efficios.com) wrote: > > Add three new printing functions: > > > > print_ok: Print the OK status with optional color support. > > print_fail: Print the FAIL status with optional color support. > > print_test_banner: Print a test banner of the test description. > > > > e.g.: > > sometest.sh: > > TEST_DESC="A really useful test" > > [...] > > source $TESTDIR/utils.sh > > print_test_banner oh, wait... could print_test_banner take the string (or variable) to print as parameter ? e.g. print_test_banner($TEST_DESC) So some typical use-cases could simply pass the banner string as parameter.. ? Thanks, Mathieu > > [...] > > print_ok > > print_fail > > [...] > > > > $ ./sometest.sh > > ---------------------- > > A really useful test > > ---------------------- > > OK > > FAIL > > > > Signed-off-by: Christian Babeux > > Looks good to me! > > Acked-by: Mathieu Desnoyers > > > --- > > tests/utils.sh | 33 +++++++++++++++++++++++++++++++++ > > 1 file changed, 33 insertions(+) > > > > diff --git a/tests/utils.sh b/tests/utils.sh > > index 42b18e3..2670de3 100644 > > --- a/tests/utils.sh > > +++ b/tests/utils.sh > > @@ -25,6 +25,39 @@ KERNEL_MAJOR_VERSION=2 > > KERNEL_MINOR_VERSION=6 > > KERNEL_PATCHLEVEL_VERSION=27 > > > > +function print_ok () > > +{ > > + # Check if we are a terminal > > + if [ -t 1 ]; then > > + echo -e "\e[1;32mOK\e[0m" > > + else > > + echo -e "OK" > > + fi > > +} > > + > > +function print_fail () > > +{ > > + # Check if we are a terminal > > + if [ -t 1 ]; then > > + echo -e "\e[1;31mFAIL\e[0m" > > + else > > + echo -e "FAIL" > > + fi > > +} > > + > > +function print_test_banner () > > +{ > > + # Rely on the global TEST_DESC to be set > > + if [ -n "$TEST_DESC" ]; then > > + count=$((${#TEST_DESC}+2)) > > + str=$(printf "%${count}s"); > > + echo -e "\n" > > + echo -e ${str// /-} > > + echo -e " $TEST_DESC " > > + echo -e ${str// /-} > > + fi > > +} > > + > > function validate_kernel_version () > > { > > kern_version=($(uname -r | awk -F. '{ printf("%d.%d.%d\n",$1,$2,$3); }' | tr '.' '\n')) > > -- > > 1.7.12 > > > > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Fri Sep 21 10:32:34 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 21 Sep 2012 10:32:34 -0400 Subject: [lttng-dev] Segmentation fault in LTTng Tools 2.1 In-Reply-To: <505AFF7F.2020002@ericsson.com> References: <505AFF7F.2020002@ericsson.com> Message-ID: <505C7A82.9040709@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi Bernd, Confirmed! I've created a bug: https://bugs.lttng.org/issues/350 Thanks for reporting it! David Bernd Hufmann: > Hello > > I get a Segmentation Fault for the following command: lttng -vvv > create -C tcp://192.168.56.1 -D tcp://192.168.56.1 mySession > > The core dump gives the following stack back trace: > > Core was generated by `lttng -vvv create -C tcp://192.168.56.1 -D > tcp://192.168.56.1 mySession'. Program terminated with signal 11, > Segmentation fault. #0 _lttng_create_session_ext (name= out>, url=0x0, datetime=0xbfa417dc "20120919-194400") at > lttng-ctl.c:1546 1546 if (uris[0].dtype != LTTNG_DST_PATH > && strlen(uris[0].subdir) == 0) { > > LTTng Tools version: v2.1.0-rc3 > > I attached the core dump file: > > Could someone please look into this error? > > Thanks Bernd > > > > This body part will be downloaded on demand. -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQXHp/AAoJEELoaioR9I02f8QH/jq949pzhET+IM375drR52IO gasGkwsT+gsLQTfWGjhJ9qXHjuoBJlLn3ouuEAH1dZFSetUAjDoLyZEmE6L2nVMD s7B01joR7wM5LeNrjDalrL20kzhtPINEoiun+3Rneo+KJj8tQF/3Tb3RrTqlo+nz hlFSAJU5XRdTVSJsUgxErCLqKrizbDcqCVdnezUfP4aoSEssgdh0gNHg3ATH7T35 bSPwBzVzBYATP9N729RkscGv9iE/Lcu7XmG8TyCPQU84s4d4X3EOAik3FgNOAU54 zHGCLRDtIwV16l96ZcFjTwMvPZH3MdE8Ft7rPRYK6luO47dIc2Gy4zsabPGbydg= =TIlu -----END PGP SIGNATURE----- From dgoulet at efficios.com Fri Sep 21 10:42:13 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 21 Sep 2012 10:42:13 -0400 Subject: [lttng-dev] Bug324 patch Message-ID: <505C7CC5.3030501@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 For the mutt users not getting the attachments :P :D https://bugs.lttng.org/attachments/51/pthread_cond_patch.diff -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQXHzFAAoJEELoaioR9I02sZYH/A/fc04tZnUCDGOYsOmY8E+g JRoxCXdnR43FOUL6xjpsla9eLxUtPRMdN1gRanrnCfboBFAJpTG8Wvb6zhmhsXZa OoqdcqfRnDcDunb7sjcqG7HCBxK15qhon08QXNGrgz1XwqZK1so+39h+3LbcHumD uF9P02eprfONOhyD2PxBYRhn0dIQ/VEoBntel+Jvm0dZjQ6xWErLJATa/XojuteH ZbMkXJITshu6d00lhMn8cHdAZObhSuqUgxhIfcsAoG4E8ZkaSNCOFuv96jyrQTdp BXCQfZb9UAvyOETb9z8MFDFQnvOxeXepea0B5RDiImupnx7R6+QDEQcuPvx0eHo= =ECat -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Fri Sep 21 10:59:00 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 21 Sep 2012 10:59:00 -0400 Subject: [lttng-dev] Bug324 patch In-Reply-To: <505C7CC5.3030501@efficios.com> References: <505C7CC5.3030501@efficios.com> Message-ID: <20120921145859.GA29319@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > For the mutt users not getting the attachments :P :D > > https://bugs.lttng.org/attachments/51/pthread_cond_patch.diff You forgot to take associated cond_mutex around pthread_cond_signal calls. Otherwise it looks OK. Thanks, Mathieu > -----BEGIN PGP SIGNATURE----- > > iQEcBAEBCgAGBQJQXHzFAAoJEELoaioR9I02sZYH/A/fc04tZnUCDGOYsOmY8E+g > JRoxCXdnR43FOUL6xjpsla9eLxUtPRMdN1gRanrnCfboBFAJpTG8Wvb6zhmhsXZa > OoqdcqfRnDcDunb7sjcqG7HCBxK15qhon08QXNGrgz1XwqZK1so+39h+3LbcHumD > uF9P02eprfONOhyD2PxBYRhn0dIQ/VEoBntel+Jvm0dZjQ6xWErLJATa/XojuteH > ZbMkXJITshu6d00lhMn8cHdAZObhSuqUgxhIfcsAoG4E8ZkaSNCOFuv96jyrQTdp > BXCQfZb9UAvyOETb9z8MFDFQnvOxeXepea0B5RDiImupnx7R6+QDEQcuPvx0eHo= > =ECat > -----END PGP SIGNATURE----- -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Fri Sep 21 12:28:29 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 21 Sep 2012 12:28:29 -0400 Subject: [lttng-dev] [lttng-tools PATCH] Fix: Change sempahore to pthread conditions Message-ID: <1348244909-13184-1-git-send-email-dgoulet@efficios.com> Fixes #324 Signed-off-by: David Goulet --- src/bin/lttng-sessiond/consumer.h | 8 ++- src/bin/lttng-sessiond/main.c | 116 +++++++++++++++++++++++++++++-------- 2 files changed, 96 insertions(+), 28 deletions(-) diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h index 1337f32..a5437d8 100644 --- a/src/bin/lttng-sessiond/consumer.h +++ b/src/bin/lttng-sessiond/consumer.h @@ -18,8 +18,6 @@ #ifndef _CONSUMER_H #define _CONSUMER_H -#include - #include #include #include @@ -54,7 +52,11 @@ struct consumer_data { enum lttng_consumer_type type; pthread_t thread; /* Worker thread interacting with the consumer */ - sem_t sem; + + /* Conditions used by the consumer thread to indicate readiness. */ + pthread_cond_t cond; + pthread_condattr_t condattr; + pthread_mutex_t cond_mutex; /* Mutex to control consumerd pid assignation */ pthread_mutex_t pid_mutex; diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 730ac65..df817c1 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -90,6 +89,8 @@ static struct consumer_data kconsumer_data = { .cmd_sock = -1, .pid_mutex = PTHREAD_MUTEX_INITIALIZER, .lock = PTHREAD_MUTEX_INITIALIZER, + .cond = PTHREAD_COND_INITIALIZER, + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, }; static struct consumer_data ustconsumer64_data = { .type = LTTNG_CONSUMER64_UST, @@ -99,6 +100,8 @@ static struct consumer_data ustconsumer64_data = { .cmd_sock = -1, .pid_mutex = PTHREAD_MUTEX_INITIALIZER, .lock = PTHREAD_MUTEX_INITIALIZER, + .cond = PTHREAD_COND_INITIALIZER, + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, }; static struct consumer_data ustconsumer32_data = { .type = LTTNG_CONSUMER32_UST, @@ -108,6 +111,8 @@ static struct consumer_data ustconsumer32_data = { .cmd_sock = -1, .pid_mutex = PTHREAD_MUTEX_INITIALIZER, .lock = PTHREAD_MUTEX_INITIALIZER, + .cond = PTHREAD_COND_INITIALIZER, + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, }; /* Shared between threads */ @@ -213,6 +218,17 @@ enum consumerd_state { static enum consumerd_state ust_consumerd_state; static enum consumerd_state kernel_consumerd_state; +/* + * This is a flag condition indicating that the consumer thread is ready and + * connected to the lttng-consumerd daemon. + * + * A value of 0 indicates that the thread is NOT ready. A value of 1 means that + * the thread consumer did connect successfully to the lttng-consumerd daemon. + * A negative value means that there is been an error and the thread as likely + * quit. + */ +static int consumer_thread_is_ready; + /* Used for the health monitoring of the session daemon. See health.h */ struct health_state health_thread_cmd; struct health_state health_thread_app_manage; @@ -789,6 +805,16 @@ error_poll_create: } /* + * Signal pthread condition of the consumer data that the thread. + */ +static void signal_consumer_condition(struct consumer_data *data) +{ + pthread_mutex_lock(&data->cond_mutex); + pthread_cond_signal(&data->cond); + pthread_mutex_unlock(&data->cond_mutex); +} + +/* * This thread manage the consumer error sent back to the session daemon. */ static void *thread_manage_consumer(void *data) @@ -801,6 +827,9 @@ static void *thread_manage_consumer(void *data) DBG("[thread] Manage consumer started"); + /* Make sure we set the readiness flag to 0 because we are NOT ready */ + consumer_thread_is_ready = 0; + health_code_update(&consumer_data->health); ret = lttcomm_listen_unix_sock(consumer_data->err_sock); @@ -886,13 +915,16 @@ restart: consumer_data->cmd_sock = lttcomm_connect_unix_sock(consumer_data->cmd_unix_sock_path); if (consumer_data->cmd_sock < 0) { - sem_post(&consumer_data->sem); + /* On error, signal condition and quit. */ + consumer_thread_is_ready = -1; + signal_consumer_condition(consumer_data); PERROR("consumer connect"); goto error; } - /* Signal condition to tell that the kconsumerd is ready */ - sem_post(&consumer_data->sem); - DBG("consumer command socket ready"); + /* Signal condition to tell that the consumerd is ready */ + consumer_thread_is_ready = 1; + signal_consumer_condition(consumer_data); + DBG("Consumer command socket ready"); } else { ERR("consumer error when waiting for SOCK_READY : %s", lttcomm_get_readable_code(-code)); @@ -1446,16 +1478,33 @@ error_create_poll: */ static int spawn_consumer_thread(struct consumer_data *consumer_data) { - int ret; + int ret, clock_ret; struct timespec timeout; - timeout.tv_sec = DEFAULT_SEM_WAIT_TIMEOUT; - timeout.tv_nsec = 0; + /* Setup pthread condition */ + ret = pthread_condattr_init(&consumer_data->condattr); + if (ret != 0) { + errno = ret; + PERROR("pthread_condattr_init consumer data"); + goto error; + } - /* Setup semaphore */ - ret = sem_init(&consumer_data->sem, 0, 0); - if (ret < 0) { - PERROR("sem_init consumer semaphore"); + /* + * Set the monotonic clock in order to make sure we DO NOT jump in time + * between the clock_gettime() call and the timedwait call. See bug #324 + * for a more details and how we noticed it. + */ + ret = pthread_condattr_setclock(&consumer_data->condattr, CLOCK_MONOTONIC); + if (ret != 0) { + errno = ret; + PERROR("pthread_condattr_setclock consumer data"); + goto error; + } + + ret = pthread_cond_init(&consumer_data->cond, &consumer_data->condattr); + if (ret != 0) { + errno = ret; + PERROR("pthread_cond_init consumer data"); goto error; } @@ -1467,31 +1516,48 @@ static int spawn_consumer_thread(struct consumer_data *consumer_data) goto error; } + /* We are about to wait on a pthread condition */ + pthread_mutex_lock(&consumer_data->cond_mutex); + /* Get time for sem_timedwait absolute timeout */ - ret = clock_gettime(CLOCK_REALTIME, &timeout); - if (ret < 0) { - PERROR("clock_gettime spawn consumer"); - /* Infinite wait for the kconsumerd thread to be ready */ - ret = sem_wait(&consumer_data->sem); - } else { - /* Normal timeout if the gettime was successful */ - timeout.tv_sec += DEFAULT_SEM_WAIT_TIMEOUT; - ret = sem_timedwait(&consumer_data->sem, &timeout); + clock_ret = clock_gettime(CLOCK_MONOTONIC, &timeout); + while (!consumer_thread_is_ready) { + if (clock_ret < 0) { + PERROR("clock_gettime spawn consumer"); + /* Infinite wait for the consumerd thread to be ready */ + ret = pthread_cond_wait(&consumer_data->cond, + &consumer_data->cond_mutex); + } else { + /* Normal timeout if the gettime was successful */ + timeout.tv_sec += DEFAULT_SEM_WAIT_TIMEOUT; + ret = pthread_cond_timedwait(&consumer_data->cond, + &consumer_data->cond_mutex, &timeout); + } } - if (ret < 0) { - if (errno == ETIMEDOUT) { + /* + * Reset back the flag so we could respawn a consumer thread at some point + * and avoid skipping the above readiness wait period. + */ + consumer_thread_is_ready = 0; + + pthread_mutex_unlock(&consumer_data->cond_mutex); + + if (ret != 0) { + errno = ret; + if (ret == ETIMEDOUT) { /* * Call has timed out so we kill the kconsumerd_thread and return * an error. */ - ERR("The consumer thread was never ready. Killing it"); + ERR("Condition timed out. The consumer thread was never ready." + " Killing it"); ret = pthread_cancel(consumer_data->thread); if (ret < 0) { PERROR("pthread_cancel consumer thread"); } } else { - PERROR("semaphore wait failed consumer thread"); + PERROR("pthread_cond_wait failed consumer thread"); } goto error; } -- 1.7.10.4 From dgoulet at efficios.com Fri Sep 21 12:30:47 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 21 Sep 2012 12:30:47 -0400 Subject: [lttng-dev] [PATCH lttng-tools 2/4] Tests: Add helper functions for printing status and test banner In-Reply-To: <20120921022328.GF22861@Krystal> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> <1348178720-24610-2-git-send-email-christian.babeux@efficios.com> <20120921022014.GD22861@Krystal> <20120921022328.GF22861@Krystal> Message-ID: <505C9637.4050507@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Agreed on the string param to test_banner() David Mathieu Desnoyers: > * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote: >> * Christian Babeux (christian.babeux at efficios.com) wrote: >>> Add three new printing functions: >>> >>> print_ok: Print the OK status with optional color support. >>> print_fail: Print the FAIL status with optional color support. >>> print_test_banner: Print a test banner of the test >>> description. >>> >>> e.g.: sometest.sh: TEST_DESC="A really useful test" [...] >>> source $TESTDIR/utils.sh print_test_banner > > oh, wait... > > could print_test_banner take the string (or variable) to print as > parameter ? e.g. > > print_test_banner($TEST_DESC) > > So some typical use-cases could simply pass the banner string as > parameter.. ? > > Thanks, > > Mathieu > >>> [...] print_ok print_fail [...] >>> >>> $ ./sometest.sh ---------------------- A really useful test >>> ---------------------- OK FAIL >>> >>> Signed-off-by: Christian Babeux >>> >> >> Looks good to me! >> >> Acked-by: Mathieu Desnoyers >> >>> --- tests/utils.sh | 33 +++++++++++++++++++++++++++++++++ 1 >>> file changed, 33 insertions(+) >>> >>> diff --git a/tests/utils.sh b/tests/utils.sh index >>> 42b18e3..2670de3 100644 --- a/tests/utils.sh +++ >>> b/tests/utils.sh @@ -25,6 +25,39 @@ KERNEL_MAJOR_VERSION=2 >>> KERNEL_MINOR_VERSION=6 KERNEL_PATCHLEVEL_VERSION=27 >>> >>> +function print_ok () +{ + # Check if we are a terminal + if [ >>> -t 1 ]; then + echo -e "\e[1;32mOK\e[0m" + else + echo -e >>> "OK" + fi +} + +function print_fail () +{ + # Check if we are a >>> terminal + if [ -t 1 ]; then + echo -e "\e[1;31mFAIL\e[0m" + >>> else + echo -e "FAIL" + fi +} + +function print_test_banner >>> () +{ + # Rely on the global TEST_DESC to be set + if [ -n >>> "$TEST_DESC" ]; then + count=$((${#TEST_DESC}+2)) + >>> str=$(printf "%${count}s"); + echo -e "\n" + echo -e ${str// >>> /-} + echo -e " $TEST_DESC " + echo -e ${str// /-} + fi +} + >>> function validate_kernel_version () { kern_version=($(uname -r >>> | awk -F. '{ printf("%d.%d.%d\n",$1,$2,$3); }' | tr '.' '\n')) >>> -- 1.7.12 >>> >>> >>> _______________________________________________ lttng-dev >>> mailing list lttng-dev at lists.lttng.org >>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev >> >> -- Mathieu Desnoyers Operating System Efficiency R&D Consultant >> EfficiOS Inc. http://www.efficios.com >> >> _______________________________________________ lttng-dev mailing >> list lttng-dev at lists.lttng.org >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQXJY3AAoJEELoaioR9I02bFAH/0pstQvLB2x0HvJtPQKut9SV /dZsjHii/aTo+IjqVjLynXb85kZ1hTUuozX1GsUKw+zc6OOHji1Mr5dmFewRkNZD igJxj5zL1LpVEI1gLgjqs6Slfe05jAr1ggQkPiyjzSE2kFp8307LRwtkwEqnJYvr JOS2LQ4Ga6NU+LDtsDTowoLC/76IRbAFvooCM4xbaN9u9ypDPj8QvIRagAiFFl4j SqsH8Y+tpI4262Z/3Veg1Ty7iBl5BG0HgcJjWnC9avjAKuMKx6AlY5+MqX9ksJ+T Kh7uMUcGhjrsyO2SY4AofeERJwQPcLOFmOLWKk0vUzywfgVJewbLVEZieILAVfs= =n7Le -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Fri Sep 21 12:45:37 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 21 Sep 2012 12:45:37 -0400 Subject: [lttng-dev] [lttng-tools PATCH] Fix: Change sempahore to pthread conditions In-Reply-To: <1348244909-13184-1-git-send-email-dgoulet@efficios.com> References: <1348244909-13184-1-git-send-email-dgoulet@efficios.com> Message-ID: <20120921164537.GA30791@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > Fixes #324 > > Signed-off-by: David Goulet > --- > src/bin/lttng-sessiond/consumer.h | 8 ++- > src/bin/lttng-sessiond/main.c | 116 +++++++++++++++++++++++++++++-------- > 2 files changed, 96 insertions(+), 28 deletions(-) > > diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h > index 1337f32..a5437d8 100644 > --- a/src/bin/lttng-sessiond/consumer.h > +++ b/src/bin/lttng-sessiond/consumer.h > @@ -18,8 +18,6 @@ > #ifndef _CONSUMER_H > #define _CONSUMER_H > > -#include > - > #include > #include > #include > @@ -54,7 +52,11 @@ struct consumer_data { > enum lttng_consumer_type type; > > pthread_t thread; /* Worker thread interacting with the consumer */ > - sem_t sem; > + > + /* Conditions used by the consumer thread to indicate readiness. */ > + pthread_cond_t cond; > + pthread_condattr_t condattr; > + pthread_mutex_t cond_mutex; > > /* Mutex to control consumerd pid assignation */ > pthread_mutex_t pid_mutex; > diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c > index 730ac65..df817c1 100644 > --- a/src/bin/lttng-sessiond/main.c > +++ b/src/bin/lttng-sessiond/main.c > @@ -21,7 +21,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -90,6 +89,8 @@ static struct consumer_data kconsumer_data = { > .cmd_sock = -1, > .pid_mutex = PTHREAD_MUTEX_INITIALIZER, > .lock = PTHREAD_MUTEX_INITIALIZER, > + .cond = PTHREAD_COND_INITIALIZER, > + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, > }; > static struct consumer_data ustconsumer64_data = { > .type = LTTNG_CONSUMER64_UST, > @@ -99,6 +100,8 @@ static struct consumer_data ustconsumer64_data = { > .cmd_sock = -1, > .pid_mutex = PTHREAD_MUTEX_INITIALIZER, > .lock = PTHREAD_MUTEX_INITIALIZER, > + .cond = PTHREAD_COND_INITIALIZER, > + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, > }; > static struct consumer_data ustconsumer32_data = { > .type = LTTNG_CONSUMER32_UST, > @@ -108,6 +111,8 @@ static struct consumer_data ustconsumer32_data = { > .cmd_sock = -1, > .pid_mutex = PTHREAD_MUTEX_INITIALIZER, > .lock = PTHREAD_MUTEX_INITIALIZER, > + .cond = PTHREAD_COND_INITIALIZER, > + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, > }; > > /* Shared between threads */ > @@ -213,6 +218,17 @@ enum consumerd_state { > static enum consumerd_state ust_consumerd_state; > static enum consumerd_state kernel_consumerd_state; > > +/* > + * This is a flag condition indicating that the consumer thread is ready and > + * connected to the lttng-consumerd daemon. > + * > + * A value of 0 indicates that the thread is NOT ready. A value of 1 means that > + * the thread consumer did connect successfully to the lttng-consumerd daemon. > + * A negative value means that there is been an error and the thread as likely > + * quit. > + */ > +static int consumer_thread_is_ready; This flag should go with each "cond" above, within struct consumer_data. Sharing this flag across all conditions does not make much sense. > + > /* Used for the health monitoring of the session daemon. See health.h */ > struct health_state health_thread_cmd; > struct health_state health_thread_app_manage; > @@ -789,6 +805,16 @@ error_poll_create: > } > > /* > + * Signal pthread condition of the consumer data that the thread. > + */ > +static void signal_consumer_condition(struct consumer_data *data) > +{ > + pthread_mutex_lock(&data->cond_mutex); you should test the condition before sending the signal. > + pthread_cond_signal(&data->cond); > + pthread_mutex_unlock(&data->cond_mutex); > +} > + > +/* > * This thread manage the consumer error sent back to the session daemon. > */ > static void *thread_manage_consumer(void *data) > @@ -801,6 +827,9 @@ static void *thread_manage_consumer(void *data) > > DBG("[thread] Manage consumer started"); > > + /* Make sure we set the readiness flag to 0 because we are NOT ready */ > + consumer_thread_is_ready = 0; no, this should always be updated with cond mutex held, or initialized before you spawn the consumer thread. I recommend you set it to 0 before you spawn the thread_manage_consumer thread, within spawn_consumer_thread. > + > health_code_update(&consumer_data->health); > > ret = lttcomm_listen_unix_sock(consumer_data->err_sock); > @@ -886,13 +915,16 @@ restart: > consumer_data->cmd_sock = > lttcomm_connect_unix_sock(consumer_data->cmd_unix_sock_path); > if (consumer_data->cmd_sock < 0) { > - sem_post(&consumer_data->sem); > + /* On error, signal condition and quit. */ > + consumer_thread_is_ready = -1; no. you need to hold mutex across setting condition and signalling. > + signal_consumer_condition(consumer_data); > PERROR("consumer connect"); > goto error; > } > - /* Signal condition to tell that the kconsumerd is ready */ > - sem_post(&consumer_data->sem); > - DBG("consumer command socket ready"); > + /* Signal condition to tell that the consumerd is ready */ > + consumer_thread_is_ready = 1; same here. > + signal_consumer_condition(consumer_data); > + DBG("Consumer command socket ready"); > } else { > ERR("consumer error when waiting for SOCK_READY : %s", > lttcomm_get_readable_code(-code)); > @@ -1446,16 +1478,33 @@ error_create_poll: > */ > static int spawn_consumer_thread(struct consumer_data *consumer_data) > { > - int ret; > + int ret, clock_ret; > struct timespec timeout; > > - timeout.tv_sec = DEFAULT_SEM_WAIT_TIMEOUT; > - timeout.tv_nsec = 0; > + /* Setup pthread condition */ > + ret = pthread_condattr_init(&consumer_data->condattr); > + if (ret != 0) { > + errno = ret; > + PERROR("pthread_condattr_init consumer data"); > + goto error; > + } > > - /* Setup semaphore */ > - ret = sem_init(&consumer_data->sem, 0, 0); > - if (ret < 0) { > - PERROR("sem_init consumer semaphore"); > + /* > + * Set the monotonic clock in order to make sure we DO NOT jump in time > + * between the clock_gettime() call and the timedwait call. See bug #324 > + * for a more details and how we noticed it. > + */ > + ret = pthread_condattr_setclock(&consumer_data->condattr, CLOCK_MONOTONIC); > + if (ret != 0) { > + errno = ret; > + PERROR("pthread_condattr_setclock consumer data"); > + goto error; > + } > + > + ret = pthread_cond_init(&consumer_data->cond, &consumer_data->condattr); > + if (ret != 0) { > + errno = ret; > + PERROR("pthread_cond_init consumer data"); > goto error; > } > > @@ -1467,31 +1516,48 @@ static int spawn_consumer_thread(struct consumer_data *consumer_data) > goto error; > } > > + /* We are about to wait on a pthread condition */ > + pthread_mutex_lock(&consumer_data->cond_mutex); > + > /* Get time for sem_timedwait absolute timeout */ > - ret = clock_gettime(CLOCK_REALTIME, &timeout); > - if (ret < 0) { > - PERROR("clock_gettime spawn consumer"); > - /* Infinite wait for the kconsumerd thread to be ready */ > - ret = sem_wait(&consumer_data->sem); > - } else { > - /* Normal timeout if the gettime was successful */ > - timeout.tv_sec += DEFAULT_SEM_WAIT_TIMEOUT; > - ret = sem_timedwait(&consumer_data->sem, &timeout); > + clock_ret = clock_gettime(CLOCK_MONOTONIC, &timeout); > + while (!consumer_thread_is_ready) { ret = 0; while (!consumer_thread_is_ready && ret != ETIMEDOUT) { ... > + if (clock_ret < 0) { > + PERROR("clock_gettime spawn consumer"); > + /* Infinite wait for the consumerd thread to be ready */ > + ret = pthread_cond_wait(&consumer_data->cond, > + &consumer_data->cond_mutex); > + } else { > + /* Normal timeout if the gettime was successful */ > + timeout.tv_sec += DEFAULT_SEM_WAIT_TIMEOUT; no, if you return due to EINTR, and loop, this increment is incorrect. > + ret = pthread_cond_timedwait(&consumer_data->cond, > + &consumer_data->cond_mutex, &timeout); > + } > } > > - if (ret < 0) { > - if (errno == ETIMEDOUT) { > + /* > + * Reset back the flag so we could respawn a consumer thread at some point > + * and avoid skipping the above readiness wait period. > + */ > + consumer_thread_is_ready = 0; no, if we set to 0 in spawn_consumer_thread before creating the thread, we will be OK. No need to clear it here. Thanks, Mathieu > + > + pthread_mutex_unlock(&consumer_data->cond_mutex); > + > + if (ret != 0) { > + errno = ret; > + if (ret == ETIMEDOUT) { > /* > * Call has timed out so we kill the kconsumerd_thread and return > * an error. > */ > - ERR("The consumer thread was never ready. Killing it"); > + ERR("Condition timed out. The consumer thread was never ready." > + " Killing it"); > ret = pthread_cancel(consumer_data->thread); > if (ret < 0) { > PERROR("pthread_cancel consumer thread"); > } > } else { > - PERROR("semaphore wait failed consumer thread"); > + PERROR("pthread_cond_wait failed consumer thread"); > } > goto error; > } > -- > 1.7.10.4 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Sun Sep 23 21:45:27 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Sun, 23 Sep 2012 21:45:27 -0400 Subject: [lttng-dev] [RFC PATCH] wfcqueue: implement concurrency-efficient queue Message-ID: <20120924014527.GA15865@Krystal> This new API simplify the wfqueue implementation, and brings a 2.3x to 2.6x performance boost due to the ability to eliminate false-sharing between enqueue and dequeue. This work is derived from the patch from Lai Jiangshan submitted as "urcu: new wfqueue implementation" (http://lists.lttng.org/pipermail/lttng-dev/2012-August/018379.html) Its changelog: > Some guys would be surprised by this fact: > There are already TWO implementations of wfqueue in urcu. > > The first one is in urcu/static/wfqueue.h: > 1) enqueue: exchange the tail and then update previous->next > 2) dequeue: wait for first node's next pointer and them shift, a dummy node > is introduced to avoid the queue->tail become NULL when shift. > > The second one shares some code with the first one, and the left code > are spreading in urcu-call-rcu-impl.h: > 1) enqueue: share with the first one > 2) no dequeue operation: and no shift, so it don't need dummy node, > Although the dummy node is queued when initialization, but it is removed > after the first dequeue_all operation in call_rcu_thread(). > call_rcu_data_free() forgets to handle the dummy node if it is not removed. > 3)dequeue_all: record the old head and tail, and queue->head become the special > tail node.(atomic record the tail and change the tail). > > The second implementation's code are spreading, bad for review, and it is not > tested by tests/test_urcu_wfq. > > So we need a better implementation avoid the dummy node dancing and can service > both generic wfqueue APIs and dequeue_all API for call rcu. > > The new implementation: > 1) enqueue: share with the first one/original implementation. > 2) dequeue: shift when node count >= 2, cmpxchg when node count = 1. > no dummy node, save memory. > 3) dequeue_all: simply set queue->head.next to NULL, xchg the tail > and return the old head.next. > > More implementation details are in the code. > tests/test_urcu_wfq will be update in future for testing new APIs. The patch proposed by Lai brings a very interesting simplification to the single-node handling (which is kept here), and moves all queue handling code away from call_rcu implementation, back into the wfqueue code. This has the benefit to allow testing enhancements. I modified it so the API does not expose implementation details to the user (e.g. ___cds_wfq_node_sync_next). I added a "splice" operation and a for loop iterator which should allow wfqueue users to use the list very efficiently both from LGPL/GPL code and from non-LGPL-compatible code. I also changed the API so the queue head and tail are now two separate structures: it allows the queue user to place these as they like, either on different cache lines (to eliminate false-sharing), or close one to another (on same cache-line) in case a queue is spliced onto the stack and not concurrently accessed. Benchmarks performed on Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz (dual-core, with hyperthreading) Benchmark invoked: for a in $(seq 1 10); do ./test_urcu_wfq 1 1 10 -a 0 -a 2; done (using cpu number 0 and 2, which should correspond to two cores of my Intel 2-core/hyperthread processor) Before patch: testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 97274297 nr_dequeues 80745742 successful enqueues 97274297 successful dequeues 80745321 end_dequeues 16528976 nr_ops 178020039 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 92300568 nr_dequeues 75019529 successful enqueues 92300568 successful dequeues 74973237 end_dequeues 17327331 nr_ops 167320097 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 93516443 nr_dequeues 75846726 successful enqueues 93516443 successful dequeues 75826578 end_dequeues 17689865 nr_ops 169363169 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 94160362 nr_dequeues 77967638 successful enqueues 94160362 successful dequeues 77967638 end_dequeues 16192724 nr_ops 172128000 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 97491956 nr_dequeues 81001191 successful enqueues 97491956 successful dequeues 81000247 end_dequeues 16491709 nr_ops 178493147 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 94101298 nr_dequeues 75650510 successful enqueues 94101298 successful dequeues 75649318 end_dequeues 18451980 nr_ops 169751808 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 94742803 nr_dequeues 75402105 successful enqueues 94742803 successful dequeues 75341859 end_dequeues 19400944 nr_ops 170144908 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 92198835 nr_dequeues 75037877 successful enqueues 92198835 successful dequeues 75027605 end_dequeues 17171230 nr_ops 167236712 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 94159560 nr_dequeues 77895972 successful enqueues 94159560 successful dequeues 77858442 end_dequeues 16301118 nr_ops 172055532 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 96059399 nr_dequeues 80115442 successful enqueues 96059399 successful dequeues 80066843 end_dequeues 15992556 nr_ops 176174841 After patch: testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 221229322 nr_dequeues 210645491 successful enqueues 221229322 successful dequeues 210645088 end_dequeues 10584234 nr_ops 431874813 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 219803943 nr_dequeues 210377337 successful enqueues 219803943 successful dequeues 210368680 end_dequeues 9435263 nr_ops 430181280 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 237006358 nr_dequeues 237035340 successful enqueues 237006358 successful dequeues 236997050 end_dequeues 9308 nr_ops 474041698 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 235822443 nr_dequeues 235815942 successful enqueues 235822443 successful dequeues 235814020 end_dequeues 8423 nr_ops 471638385 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 235825567 nr_dequeues 235811803 successful enqueues 235825567 successful dequeues 235810526 end_dequeues 15041 nr_ops 471637370 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 221974953 nr_dequeues 210938190 successful enqueues 221974953 successful dequeues 210938190 end_dequeues 11036763 nr_ops 432913143 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 237994492 nr_dequeues 237938119 successful enqueues 237994492 successful dequeues 237930648 end_dequeues 63844 nr_ops 475932611 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 220634365 nr_dequeues 210491382 successful enqueues 220634365 successful dequeues 210490995 end_dequeues 10143370 nr_ops 431125747 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 237388065 nr_dequeues 237401251 successful enqueues 237388065 successful dequeues 237380295 end_dequeues 7770 nr_ops 474789316 testdur 10 nr_enqueuers 1 wdelay 0 nr_dequeuers 1 rdur 0 nr_enqueues 221201436 nr_dequeues 210831162 successful enqueues 221201436 successful dequeues 210831162 end_dequeues 10370274 nr_ops 432032598 Summary: Both enqueue and dequeue speed increase: around 2.3x speedup for enqueue, and around 2.6x for dequeue. We can verify that: successful enqueues - successful dequeues = end_dequeues For all runs (ensures correctness: no lost node). CC: Lai Jiangshan CC: Paul McKenney Signed-off-by: Mathieu Desnoyers --- diff --git a/Makefile.am b/Makefile.am index 2396fcf..ffdca9a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,7 +16,7 @@ nobase_dist_include_HEADERS = urcu/compiler.h urcu/hlist.h urcu/list.h \ urcu/uatomic/generic.h urcu/arch/generic.h urcu/wfstack.h \ urcu/wfqueue.h urcu/rculfstack.h urcu/rculfqueue.h \ urcu/ref.h urcu/cds.h urcu/urcu_ref.h urcu/urcu-futex.h \ - urcu/uatomic_arch.h urcu/rculfhash.h \ + urcu/uatomic_arch.h urcu/rculfhash.h urcu/wfcqueue.h \ $(top_srcdir)/urcu/map/*.h \ $(top_srcdir)/urcu/static/*.h \ urcu/tls-compat.h @@ -53,7 +53,7 @@ lib_LTLIBRARIES = liburcu-common.la \ # liburcu-common contains wait-free queues (needed by call_rcu) as well # as futex fallbacks. # -liburcu_common_la_SOURCES = wfqueue.c wfstack.c $(COMPAT) +liburcu_common_la_SOURCES = wfqueue.c wfcqueue.c wfstack.c $(COMPAT) liburcu_la_SOURCES = urcu.c urcu-pointer.c $(COMPAT) liburcu_la_LIBADD = liburcu-common.la diff --git a/urcu/static/wfcqueue.h b/urcu/static/wfcqueue.h new file mode 100644 index 0000000..a989984 --- /dev/null +++ b/urcu/static/wfcqueue.h @@ -0,0 +1,380 @@ +#ifndef _URCU_WFCQUEUE_STATIC_H +#define _URCU_WFCQUEUE_STATIC_H + +/* + * wfcqueue-static.h + * + * Userspace RCU library - Concurrent Queue with Wait-Free Enqueue/Blocking Dequeue + * + * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See wfcqueue.h for linking + * dynamically with the userspace rcu library. + * + * Copyright 2010-2012 - Mathieu Desnoyers + * Copyright 2011-2012 - Lai Jiangshan + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Concurrent queue with wait-free enqueue/blocking dequeue. + * + * Inspired from half-wait-free/half-blocking queue implementation done by + * Paul E. McKenney. + * + * Mutual exclusion of __cds_wfcq_* API + * + * Unless otherwise stated, the caller must ensure mutual exclusion of + * queue update operations "dequeue" and "splice" (for source queue). + * Queue read operations "first" and "next" need to be protected against + * concurrent "dequeue" and "splice" (for source queue) by the caller. + * "enqueue", "splice" (for destination queue), and "empty" are the only + * operations that can be used without any mutual exclusion. + * Mutual exclusion can be ensured by holding cds_wfcq_dequeue_lock(). + * + * For convenience, cds_wfcq_dequeue_blocking() and + * cds_wfcq_splice_blocking() hold the dequeue lock. + */ + +#define WFCQ_ADAPT_ATTEMPTS 10 /* Retry if being set */ +#define WFCQ_WAIT 10 /* Wait 10 ms if being set */ + +/* + * cds_wfcq_node_init: initialize wait-free queue node. + */ +static inline void _cds_wfcq_node_init(struct cds_wfcq_node *node) +{ + node->next = NULL; +} + +/* + * cds_wfcq_init: initialize wait-free queue. + */ +static inline void _cds_wfcq_init(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + int ret; + + /* Set queue head and tail */ + _cds_wfcq_node_init(&head->node); + tail->p = &head->node; + ret = pthread_mutex_init(&head->lock, NULL); + assert(!ret); +} + +/* + * cds_wfcq_empty: return whether wait-free queue is empty. + * + * No memory barrier is issued. No mutual exclusion is required. + */ +static inline bool _cds_wfcq_empty(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + /* + * Queue is empty if no node is pointed by head->node.next nor + * tail->p. Even though the tail->p check is sufficient to find + * out of the queue is empty, we first check head->node.next as a + * common case to ensure that dequeuers do not frequently access + * enqueuer's tail->p cache line. + */ + return CMM_LOAD_SHARED(head->node.next) == NULL + && CMM_LOAD_SHARED(tail->p) == &head->node; +} + +static inline void _cds_wfcq_dequeue_lock(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + int ret; + + ret = pthread_mutex_lock(&head->lock); + assert(!ret); +} + +static inline void _cds_wfcq_dequeue_unlock(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + int ret; + + ret = pthread_mutex_unlock(&head->lock); + assert(!ret); +} + +static inline void ___cds_wfcq_append(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail, + struct cds_wfcq_node *new_head, + struct cds_wfcq_node *new_tail) +{ + struct cds_wfcq_node *old_tail; + + /* + * Implicit memory barrier before uatomic_xchg() orders earlier + * stores to data structure containing node and setting + * node->next to NULL before publication. + */ + old_tail = uatomic_xchg(&tail->p, new_tail); + + /* + * Implicit memory barrier after uatomic_xchg() orders store to + * q->tail before store to old_tail->next. + * + * At this point, dequeuers see a NULL tail->p->next, which + * indicates that the queue is being appended to. The following + * store will append "node" to the queue from a dequeuer + * perspective. + */ + CMM_STORE_SHARED(old_tail->next, new_head); +} + +/* + * cds_wfcq_enqueue: enqueue a node into a wait-free queue. + * + * Issues a full memory barrier before enqueue. No mutual exclusion is + * required. + */ +static inline void _cds_wfcq_enqueue(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail, + struct cds_wfcq_node *new_tail) +{ + ___cds_wfcq_append(head, tail, new_tail, new_tail); +} + +/* + * Waiting for enqueuer to complete enqueue and return the next node. + */ +static inline struct cds_wfcq_node * +___cds_wfcq_node_sync_next(struct cds_wfcq_node *node) +{ + struct cds_wfcq_node *next; + int attempt = 0; + + /* + * Adaptative busy-looping waiting for enqueuer to complete enqueue. + */ + while ((next = CMM_LOAD_SHARED(node->next)) == NULL) { + if (++attempt >= WFCQ_ADAPT_ATTEMPTS) { + poll(NULL, 0, WFCQ_WAIT); /* Wait for 10ms */ + attempt = 0; + } else { + caa_cpu_relax(); + } + } + + return next; +} + +/* + * __cds_wfcq_first_blocking: get first node of a queue, without dequeuing. + * + * Content written into the node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * Should be called with cds_wfcq_dequeue_lock() held. + */ +static inline struct cds_wfcq_node * +___cds_wfcq_first_blocking(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + struct cds_wfcq_node *node; + + if (_cds_wfcq_empty(head, tail)) + return NULL; + node = ___cds_wfcq_node_sync_next(&head->node); + /* Load head->node.next before loading node's content */ + cmm_smp_read_barrier_depends(); + return node; +} + +/* + * __cds_wfcq_next_blocking: get next node of a queue, without dequeuing. + * + * Content written into the node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * Should be called with cds_wfcq_dequeue_lock() held. + */ +static inline struct cds_wfcq_node * +___cds_wfcq_next_blocking(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail, + struct cds_wfcq_node *node) +{ + struct cds_wfcq_node *next; + + /* + * Even though the following tail->p check is sufficient to find + * out if we reached the end of the queue, we first check + * node->next as a common case to ensure that iteration on nodes + * do not frequently access enqueuer's tail->p cache line. + */ + if ((next = CMM_LOAD_SHARED(node->next)) == NULL) { + /* Load node->next before tail->p */ + cmm_smp_rmb(); + if (CMM_LOAD_SHARED(tail->p) == node) + return NULL; + next = ___cds_wfcq_node_sync_next(node); + } + /* Load node->next before loading next's content */ + cmm_smp_read_barrier_depends(); + return next; +} + +/* + * __cds_wfcq_dequeue_blocking: dequeue a node from the queue. + * + * No need to go on a waitqueue here, as there is no possible state in which the + * list could cause dequeue to busy-loop needlessly while waiting for another + * thread to be scheduled. The queue appears empty until tail->next is set by + * enqueue. + * + * Content written into the node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * It is valid to reuse and free a dequeued node immediately. + * Should be called with cds_wfcq_dequeue_lock() held. + */ +static inline struct cds_wfcq_node * +___cds_wfcq_dequeue_blocking(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + struct cds_wfcq_node *node, *next; + + if (_cds_wfcq_empty(head, tail)) + return NULL; + + node = ___cds_wfcq_node_sync_next(&head->node); + + if ((next = CMM_LOAD_SHARED(node->next)) == NULL) { + /* + * @node is probably the only node in the queue. + * Try to move the tail to &q->head. + * q->head.next is set to NULL here, and stays + * NULL if the cmpxchg succeeds. Should the + * cmpxchg fail due to a concurrent enqueue, the + * q->head.next will be set to the next node. + * The implicit memory barrier before + * uatomic_cmpxchg() orders load node->next + * before loading q->tail. + * The implicit memory barrier before uatomic_cmpxchg + * orders load q->head.next before loading node's + * content. + */ + _cds_wfcq_node_init(&head->node); + if (uatomic_cmpxchg(&tail->p, node, &head->node) == node) + return node; + next = ___cds_wfcq_node_sync_next(node); + } + + /* + * Move queue head forward. + */ + head->node.next = next; + + /* Load q->head.next before loading node's content */ + cmm_smp_read_barrier_depends(); + return node; +} + +/* + * __cds_wfcq_splice_blocking: enqueue all src_q nodes at the end of dest_q. + * + * Dequeue all nodes from src_q. + * dest_q must be already initialized. + * Should be called with cds_wfcq_dequeue_lock() held on src_q. + */ +static inline void +___cds_wfcq_splice_blocking( + struct cds_wfcq_head *dest_q_head, + struct cds_wfcq_tail *dest_q_tail, + struct cds_wfcq_head *src_q_head, + struct cds_wfcq_tail *src_q_tail) +{ + struct cds_wfcq_node *head, *tail; + + if (_cds_wfcq_empty(src_q_head, src_q_tail)) + return; + + head = ___cds_wfcq_node_sync_next(&src_q_head->node); + _cds_wfcq_node_init(&src_q_head->node); + + /* + * Memory barrier implied before uatomic_xchg() orders store to + * src_q->head before store to src_q->tail. This is required by + * concurrent enqueue on src_q, which exchanges the tail before + * updating the previous tail's next pointer. + */ + tail = uatomic_xchg(&src_q_tail->p, &src_q_head->node); + + /* + * Append the spliced content of src_q into dest_q. Does not + * require mutual exclusion on dest_q (wait-free). + */ + ___cds_wfcq_append(dest_q_head, dest_q_tail, head, tail); +} + +/* + * cds_wfcq_dequeue_blocking: dequeue a node from a wait-free queue. + * + * Content written into the node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * Mutual exlusion with (and only with) cds_wfcq_splice_blocking is + * ensured. + * It is valid to reuse and free a dequeued node immediately. + */ +static inline struct cds_wfcq_node * +_cds_wfcq_dequeue_blocking(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + struct cds_wfcq_node *retval; + + _cds_wfcq_dequeue_lock(head, tail); + retval = ___cds_wfcq_dequeue_blocking(head, tail); + _cds_wfcq_dequeue_unlock(head, tail); + return retval; +} + +/* + * cds_wfcq_splice_blocking: enqueue all src_q nodes at the end of dest_q. + * + * Dequeue all nodes from src_q. + * dest_q must be already initialized. + * Content written into the node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * Mutual exlusion with (and only with) cds_wfcq_dequeue_blocking is + * ensured. + */ +static inline void +_cds_wfcq_splice_blocking( + struct cds_wfcq_head *dest_q_head, + struct cds_wfcq_tail *dest_q_tail, + struct cds_wfcq_head *src_q_head, + struct cds_wfcq_tail *src_q_tail) +{ + _cds_wfcq_dequeue_lock(src_q_head, src_q_tail); + ___cds_wfcq_splice_blocking(dest_q_head, dest_q_tail, + src_q_head, src_q_tail); + _cds_wfcq_dequeue_unlock(src_q_head, src_q_tail); +} + +#ifdef __cplusplus +} +#endif + +#endif /* _URCU_WFCQUEUE_STATIC_H */ diff --git a/urcu/wfcqueue.h b/urcu/wfcqueue.h new file mode 100644 index 0000000..9270484 --- /dev/null +++ b/urcu/wfcqueue.h @@ -0,0 +1,255 @@ +#ifndef _URCU_WFCQUEUE_H +#define _URCU_WFCQUEUE_H + +/* + * wfcqueue.h + * + * Userspace RCU library - Concurrent Queue with Wait-Free Enqueue/Blocking Dequeue + * + * Copyright 2010-2012 - Mathieu Desnoyers + * Copyright 2011-2012 - Lai Jiangshan + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Concurrent queue with wait-free enqueue/blocking dequeue. + * + * Inspired from half-wait-free/half-blocking queue implementation done by + * Paul E. McKenney. + */ + +struct cds_wfcq_node { + struct cds_wfcq_node *next; +}; + +/* + * Do not put head and tail on the same cache-line if concurrent + * enqueue/dequeue are expected from many CPUs. This eliminates + * false-sharing between enqueue and dequeue. + */ +struct cds_wfcq_head { + struct cds_wfcq_node node; + pthread_mutex_t lock; +}; + +struct cds_wfcq_tail { + struct cds_wfcq_node *p; +}; + +#ifdef _LGPL_SOURCE + +#include + +#define cds_wfcq_node_init _cds_wfcq_node_init +#define cds_wfcq_init _cds_wfcq_init +#define cds_wfcq_empty _cds_wfcq_empty +#define cds_wfcq_enqueue _cds_wfcq_enqueue + +/* Dequeue locking */ +#define cds_wfcq_dequeue_lock _cds_wfcq_dequeue_lock +#define cds_wfcq_dequeue_unlock _cds_wfcq_dequeue_unlock + +/* Locking performed within cds_wfcq calls. */ +#define cds_wfcq_dequeue_blocking _cds_wfcq_dequeue_blocking +#define cds_wfcq_splice_blocking _cds_wfcq_splice_blocking +#define cds_wfcq_first_blocking _cds_wfcq_first_blocking +#define cds_wfcq_next_blocking _cds_wfcq_next_blocking + +/* Locking ensured by caller by holding cds_wfcq_dequeue_lock() */ +#define __cds_wfcq_dequeue_blocking ___cds_wfcq_dequeue_blocking +#define __cds_wfcq_splice_blocking ___cds_wfcq_splice_blocking +#define __cds_wfcq_first_blocking ___cds_wfcq_first_blocking +#define __cds_wfcq_next_blocking ___cds_wfcq_next_blocking + +#else /* !_LGPL_SOURCE */ + +/* + * Mutual exclusion of cds_wfcq_* / __cds_wfcq_* API + * + * Unless otherwise stated, the caller must ensure mutual exclusion of + * queue update operations "dequeue" and "splice" (for source queue). + * Queue read operations "first" and "next" need to be protected against + * concurrent "dequeue" and "splice" (for source queue) by the caller. + * "enqueue", "splice" (for destination queue), and "empty" are the only + * operations that can be used without any mutual exclusion. + * Mutual exclusion can be ensured by holding cds_wfcq_dequeue_lock(). + * + * For convenience, cds_wfcq_dequeue_blocking() and + * cds_wfcq_splice_blocking() hold the dequeue lock. + */ + +/* + * cds_wfcq_node_init: initialize wait-free queue node. + */ +extern void cds_wfcq_node_init(struct cds_wfcq_node *node); + +/* + * cds_wfcq_init: initialize wait-free queue. + */ +extern void cds_wfcq_init(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail); + +/* + * cds_wfcq_empty: return whether wait-free queue is empty. + * + * No memory barrier is issued. No mutual exclusion is required. + */ +extern bool cds_wfcq_empty(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail); + +/* + * cds_wfcq_dequeue_lock: take the dequeue mutual exclusion lock. + */ +extern void cds_wfcq_dequeue_lock(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail); + +/* + * cds_wfcq_dequeue_unlock: release the dequeue mutual exclusion lock. + */ +extern void cds_wfcq_dequeue_unlock(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail); + +/* + * cds_wfcq_enqueue: enqueue a node into a wait-free queue. + * + * Issues a full memory barrier before enqueue. No mutual exclusion is + * required. + */ +extern void cds_wfcq_enqueue(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail, + struct cds_wfcq_node *node); + +/* + * cds_wfcq_dequeue_blocking: dequeue a node from a wait-free queue. + * + * Content written into the node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * It is valid to reuse and free a dequeued node immediately. + * Mutual exlusion with dequeuers is ensured internally. + */ +extern struct cds_wfcq_node *cds_wfcq_dequeue_blocking( + struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail); + +/* + * cds_wfcq_splice_blocking: enqueue all src_q nodes at the end of dest_q. + * + * Dequeue all nodes from src_q. + * dest_q must be already initialized. + * Content written into the node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * Mutual exlusion with dequeuers is ensured internally. + */ +extern void cds_wfcq_splice_blocking( + struct cds_wfcq_head *dest_q_head, + struct cds_wfcq_tail *dest_q_tail, + struct cds_wfcq_head *src_q_head, + struct cds_wfcq_tail *src_q_tail); + +/* + * __cds_wfcq_dequeue_blocking: + * + * Content written into the node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * It is valid to reuse and free a dequeued node immediately. + * Should be called with cds_wfcq_dequeue_lock() held. + */ +extern struct cds_wfcq_node *__cds_wfcq_dequeue_blocking( + struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail); + +/* + * __cds_wfcq_splice_blocking: enqueue all src_q nodes at the end of dest_q. + * + * Dequeue all nodes from src_q. + * dest_q must be already initialized. + * Content written into the node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * Should be called with cds_wfcq_dequeue_lock() held. + */ +extern void __cds_wfcq_splice_blocking( + struct cds_wfcq_head *dest_q_head, + struct cds_wfcq_tail *dest_q_tail, + struct cds_wfcq_head *src_q_head, + struct cds_wfcq_tail *src_q_tail); + +/* + * __cds_wfcq_first_blocking: get first node of a queue, without dequeuing. + * + * Content written into the node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * Should be called with cds_wfcq_dequeue_lock() held. + */ +extern struct cds_wfcq_node *__cds_wfcq_first_blocking( + struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail); + +/* + * __cds_wfcq_next_blocking: get next node of a queue, without dequeuing. + * + * Content written into the node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * Should be called with cds_wfcq_dequeue_lock() held. + */ +extern struct cds_wfcq_node *__cds_wfcq_next_blocking( + struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail, + struct cds_wfcq_node *node); + +#endif /* !_LGPL_SOURCE */ + +/* + * __cds_wfcq_for_each_blocking: Iterate over all nodes in a queue, + * without dequeuing them. + * + * Content written into each node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * Should be called with cds_wfcq_dequeue_lock() held. + */ +#define __cds_wfcq_for_each_blocking(head, tail, node) \ + for (node = __cds_wfcq_first_blocking(head, tail); \ + node != NULL; \ + node = __cds_wfcq_next_blocking(head, tail, node)) + +/* + * __cds_wfcq_for_each_blocking_safe: Iterate over all nodes in a queue, + * without dequeuing them. Safe against deletion. + * + * Content written into each node before enqueue is guaranteed to be + * consistent, but no other memory ordering is ensured. + * Should be called with cds_wfcq_dequeue_lock() held. + */ +#define __cds_wfcq_for_each_blocking_safe(head, tail, node, n) \ + for (node = __cds_wfcq_first_blocking(head, tail), \ + n = (node ? __cds_wfcq_next_blocking(head, tail, node) : NULL); \ + node != NULL; \ + node = n, n = (node ? __cds_wfcq_next_blocking(head, tail, node) : NULL)) + +#ifdef __cplusplus +} +#endif + +#endif /* _URCU_WFCQUEUE_H */ diff --git a/wfcqueue.c b/wfcqueue.c new file mode 100644 index 0000000..1fa27ac --- /dev/null +++ b/wfcqueue.c @@ -0,0 +1,116 @@ +/* + * wfcqueue.c + * + * Userspace RCU library - Concurrent queue with Wait-Free Enqueue/Blocking Dequeue + * + * Copyright 2010-2012 - Mathieu Desnoyers + * Copyright 2011-2012 - Lai Jiangshan + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */ +#include "urcu/wfcqueue.h" +#include "urcu/static/wfcqueue.h" + +/* + * library wrappers to be used by non-LGPL compatible source code. + */ + +void cds_wfcq_node_init(struct cds_wfcq_node *node) +{ + _cds_wfcq_node_init(node); +} + +void cds_wfcq_init(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + _cds_wfcq_init(head, tail); +} + +bool cds_wfcq_empty(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) + +{ + return _cds_wfcq_empty(head, tail); +} + +void cds_wfcq_enqueue(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail, + struct cds_wfcq_node *node) +{ + _cds_wfcq_enqueue(head, tail, node); +} + +void cds_wfcq_dequeue_lock(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + cds_wfcq_dequeue_lock(head, tail); +} + +void cds_wfcq_dequeue_unlock(struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + cds_wfcq_dequeue_unlock(head, tail); +} + +struct cds_wfcq_node *cds_wfcq_dequeue_blocking( + struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + return _cds_wfcq_dequeue_blocking(head, tail); +} + +void cds_wfcq_splice_blocking( + struct cds_wfcq_head *dest_q_head, + struct cds_wfcq_tail *dest_q_tail, + struct cds_wfcq_head *src_q_head, + struct cds_wfcq_tail *src_q_tail) +{ + _cds_wfcq_splice_blocking(dest_q_head, dest_q_tail, + src_q_head, src_q_tail); +} + +struct cds_wfcq_node *__cds_wfcq_dequeue_blocking( + struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + return ___cds_wfcq_dequeue_blocking(head, tail); +} + +void __cds_wfcq_splice_blocking( + struct cds_wfcq_head *dest_q_head, + struct cds_wfcq_tail *dest_q_tail, + struct cds_wfcq_head *src_q_head, + struct cds_wfcq_tail *src_q_tail) +{ + ___cds_wfcq_splice_blocking(dest_q_head, dest_q_tail, + src_q_head, src_q_tail); +} + +struct cds_wfcq_node *__cds_wfcq_first_blocking( + struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail) +{ + return ___cds_wfcq_first_blocking(head, tail); +} + +struct cds_wfcq_node *__cds_wfcq_next_blocking( + struct cds_wfcq_head *head, + struct cds_wfcq_tail *tail, + struct cds_wfcq_node *node) +{ + return ___cds_wfcq_next_blocking(head, tail, node); +} -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From meher.146 at gmail.com Mon Sep 24 06:16:13 2012 From: meher.146 at gmail.com (meher chaitanya) Date: Mon, 24 Sep 2012 15:46:13 +0530 Subject: [lttng-dev] unable to detect library format (unsupported architecture (armv7l) Message-ID: root at lttng:/home/ltt/lttng-ust-2.0.4# ./configure checking build system type... armv7l-unknown-linux-gnueabi checking host system type... armv7l-unknown-linux-gnueabi checking target system type... armv7l-unknown-linux-gnueabi checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking for a sed that does not truncate output... /bin/sed checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking dependency style of g++... gcc3 checking whether make sets $(MAKE)... (cached) yes checking how to print strings... printf checking for a sed that does not truncate output... (cached) /bin/sed checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for fgrep... /bin/grep -F checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B checking the name lister (/usr/bin/nm -B) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 1572864 checking whether the shell understands some XSI constructs... yes checking whether the shell understands "+="... yes checking how to convert armv7l-unknown-linux-gnueabi file names to armv7l-unknown-linux-gnueabi format... func_convert_file_noop checking how to convert armv7l-unknown-linux-gnueabi file names to toolchain format... func_convert_file_noop checking for /usr/bin/ld option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -B output from gcc object... ok checking for sysroot... no checking for mt... mt checking if mt is a manifest tool... no checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC -DPIC checking if gcc PIC flag -fPIC -DPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking how to run the C++ preprocessor... g++ -E checking for ld used by g++... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes checking for g++ option to produce PIC... -fPIC -DPIC checking if g++ PIC flag -fPIC -DPIC works... yes checking if g++ static flag -static works... yes checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... (cached) GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking for dlopen in -ldl... yes checking for pthread_create in -lpthread... yes checking for uuid_generate in -luuid... yes checking for inline... inline checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking for gettimeofday... yes checking for munmap... yes checking for socket... yes checking for strerror... yes checking for strtol... yes checking for sched_getcpu... yes checking for sysconf... yes checking for makeinfo... yes checking urcu-bp.h usability... yes checking urcu-bp.h presence... yes checking for urcu-bp.h... yes checking caa_likely()... yes checking for synchronize_rcu_bp in -lurcu-bp... yes checking for call_rcu_bp in -lurcu-bp... yes checking library format for the host system... configure: error: unable to detect library format (unsupported architecture (armv7l)?) In the configure.ac file i had made an entry for arm7l but even then i am seeing this error . I am doing this on my target machine . can anyone help me with this?? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Mon Sep 24 07:33:33 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 24 Sep 2012 07:33:33 -0400 Subject: [lttng-dev] unable to detect library format (unsupported architecture (armv7l) In-Reply-To: References: Message-ID: <20120924113333.GA26574@Krystal> * meher chaitanya (meher.146 at gmail.com) wrote: > root at lttng:/home/ltt/lttng-ust-2.0.4# ./configure > checking build system type... armv7l-unknown-linux-gnueabi > checking host system type... armv7l-unknown-linux-gnueabi > checking target system type... armv7l-unknown-linux-gnueabi > checking for a BSD-compatible install... /usr/bin/install -c > checking whether build environment is sane... yes > checking for a thread-safe mkdir -p... /bin/mkdir -p > checking for gawk... no > checking for mawk... mawk > checking whether make sets $(MAKE)... yes > checking whether make supports nested variables... yes > checking for a sed that does not truncate output... /bin/sed > checking for gcc... gcc > checking whether the C compiler works... yes > checking for C compiler default output file name... a.out > checking for suffix of executables... > checking whether we are cross compiling... no > checking for suffix of object files... o > checking whether we are using the GNU C compiler... yes > checking whether gcc accepts -g... yes > checking for gcc option to accept ISO C89... none needed > checking for style of include used by make... GNU > checking dependency style of gcc... gcc3 > checking for g++... g++ > checking whether we are using the GNU C++ compiler... yes > checking whether g++ accepts -g... yes > checking dependency style of g++... gcc3 > checking whether make sets $(MAKE)... (cached) yes > checking how to print strings... printf > checking for a sed that does not truncate output... (cached) /bin/sed > checking for grep that handles long lines and -e... /bin/grep > checking for egrep... /bin/grep -E > checking for fgrep... /bin/grep -F > checking for ld used by gcc... /usr/bin/ld > checking if the linker (/usr/bin/ld) is GNU ld... yes > checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B > checking the name lister (/usr/bin/nm -B) interface... BSD nm > checking whether ln -s works... yes > checking the maximum length of command line arguments... 1572864 > checking whether the shell understands some XSI constructs... yes > checking whether the shell understands "+="... yes > checking how to convert armv7l-unknown-linux-gnueabi file names to > armv7l-unknown-linux-gnueabi format... func_convert_file_noop > checking how to convert armv7l-unknown-linux-gnueabi file names to > toolchain format... func_convert_file_noop > checking for /usr/bin/ld option to reload object files... -r > checking for objdump... objdump > checking how to recognize dependent libraries... pass_all > checking for dlltool... no > checking how to associate runtime and link libraries... printf %s\n > checking for ar... ar > checking for archiver @FILE support... @ > checking for strip... strip > checking for ranlib... ranlib > checking command to parse /usr/bin/nm -B output from gcc object... ok > checking for sysroot... no > checking for mt... mt > checking if mt is a manifest tool... no > checking how to run the C preprocessor... gcc -E > checking for ANSI C header files... yes > checking for sys/types.h... yes > checking for sys/stat.h... yes > checking for stdlib.h... yes > checking for string.h... yes > checking for memory.h... yes > checking for strings.h... yes > checking for inttypes.h... yes > checking for stdint.h... yes > checking for unistd.h... yes > checking for dlfcn.h... yes > checking for objdir... .libs > checking if gcc supports -fno-rtti -fno-exceptions... no > checking for gcc option to produce PIC... -fPIC -DPIC > checking if gcc PIC flag -fPIC -DPIC works... yes > checking if gcc static flag -static works... yes > checking if gcc supports -c -o file.o... yes > checking if gcc supports -c -o file.o... (cached) yes > checking whether the gcc linker (/usr/bin/ld) supports shared libraries... > yes > checking whether -lc should be explicitly linked in... no > checking dynamic linker characteristics... GNU/Linux ld.so > checking how to hardcode library paths into programs... immediate > checking whether stripping libraries is possible... yes > checking if libtool supports shared libraries... yes > checking whether to build shared libraries... yes > checking whether to build static libraries... yes > checking how to run the C++ preprocessor... g++ -E > checking for ld used by g++... /usr/bin/ld > checking if the linker (/usr/bin/ld) is GNU ld... yes > checking whether the g++ linker (/usr/bin/ld) supports shared libraries... > yes > checking for g++ option to produce PIC... -fPIC -DPIC > checking if g++ PIC flag -fPIC -DPIC works... yes > checking if g++ static flag -static works... yes > checking if g++ supports -c -o file.o... yes > checking if g++ supports -c -o file.o... (cached) yes > checking whether the g++ linker (/usr/bin/ld) supports shared libraries... > yes > checking dynamic linker characteristics... (cached) GNU/Linux ld.so > checking how to hardcode library paths into programs... immediate > checking for dlopen in -ldl... yes > checking for pthread_create in -lpthread... yes > checking for uuid_generate in -luuid... yes > checking for inline... inline > checking for stdlib.h... (cached) yes > checking for GNU libc compatible malloc... yes > checking for gettimeofday... yes > checking for munmap... yes > checking for socket... yes > checking for strerror... yes > checking for strtol... yes > checking for sched_getcpu... yes > checking for sysconf... yes > checking for makeinfo... yes > checking urcu-bp.h usability... yes > checking urcu-bp.h presence... yes > checking for urcu-bp.h... yes > checking caa_likely()... yes > checking for synchronize_rcu_bp in -lurcu-bp... yes > checking for call_rcu_bp in -lurcu-bp... yes > checking library format for the host system... configure: error: unable to > detect library format (unsupported architecture (armv7l)?) > > > In the configure.ac file i had made an entry for arm7l but even then i am > seeing this error . I am doing this on my target machine . can anyone help > me with this?? There is a fix for cross-compiling in lttng-ust 2.0.5. Please upgrade. Refer to the Changelog for details, Thanks, Mathieu > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From meher.146 at gmail.com Mon Sep 24 07:55:06 2012 From: meher.146 at gmail.com (meher chaitanya) Date: Mon, 24 Sep 2012 17:25:06 +0530 Subject: [lttng-dev] unable to detect library format (unsupported architecture (armv7l) In-Reply-To: <20120924113333.GA26574@Krystal> References: <20120924113333.GA26574@Krystal> Message-ID: I got the same issue in lttng-ust 2.0.5 . I added the line armv7l) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;; in configure.ac file . Even then i am able to see this issue. On Mon, Sep 24, 2012 at 5:03 PM, Mathieu Desnoyers < mathieu.desnoyers at efficios.com> wrote: > * meher chaitanya (meher.146 at gmail.com) wrote: > > root at lttng:/home/ltt/lttng-ust-2.0.4# ./configure > > checking build system type... armv7l-unknown-linux-gnueabi > > checking host system type... armv7l-unknown-linux-gnueabi > > checking target system type... armv7l-unknown-linux-gnueabi > > checking for a BSD-compatible install... /usr/bin/install -c > > checking whether build environment is sane... yes > > checking for a thread-safe mkdir -p... /bin/mkdir -p > > checking for gawk... no > > checking for mawk... mawk > > checking whether make sets $(MAKE)... yes > > checking whether make supports nested variables... yes > > checking for a sed that does not truncate output... /bin/sed > > checking for gcc... gcc > > checking whether the C compiler works... yes > > checking for C compiler default output file name... a.out > > checking for suffix of executables... > > checking whether we are cross compiling... no > > checking for suffix of object files... o > > checking whether we are using the GNU C compiler... yes > > checking whether gcc accepts -g... yes > > checking for gcc option to accept ISO C89... none needed > > checking for style of include used by make... GNU > > checking dependency style of gcc... gcc3 > > checking for g++... g++ > > checking whether we are using the GNU C++ compiler... yes > > checking whether g++ accepts -g... yes > > checking dependency style of g++... gcc3 > > checking whether make sets $(MAKE)... (cached) yes > > checking how to print strings... printf > > checking for a sed that does not truncate output... (cached) /bin/sed > > checking for grep that handles long lines and -e... /bin/grep > > checking for egrep... /bin/grep -E > > checking for fgrep... /bin/grep -F > > checking for ld used by gcc... /usr/bin/ld > > checking if the linker (/usr/bin/ld) is GNU ld... yes > > checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B > > checking the name lister (/usr/bin/nm -B) interface... BSD nm > > checking whether ln -s works... yes > > checking the maximum length of command line arguments... 1572864 > > checking whether the shell understands some XSI constructs... yes > > checking whether the shell understands "+="... yes > > checking how to convert armv7l-unknown-linux-gnueabi file names to > > armv7l-unknown-linux-gnueabi format... func_convert_file_noop > > checking how to convert armv7l-unknown-linux-gnueabi file names to > > toolchain format... func_convert_file_noop > > checking for /usr/bin/ld option to reload object files... -r > > checking for objdump... objdump > > checking how to recognize dependent libraries... pass_all > > checking for dlltool... no > > checking how to associate runtime and link libraries... printf %s\n > > checking for ar... ar > > checking for archiver @FILE support... @ > > checking for strip... strip > > checking for ranlib... ranlib > > checking command to parse /usr/bin/nm -B output from gcc object... ok > > checking for sysroot... no > > checking for mt... mt > > checking if mt is a manifest tool... no > > checking how to run the C preprocessor... gcc -E > > checking for ANSI C header files... yes > > checking for sys/types.h... yes > > checking for sys/stat.h... yes > > checking for stdlib.h... yes > > checking for string.h... yes > > checking for memory.h... yes > > checking for strings.h... yes > > checking for inttypes.h... yes > > checking for stdint.h... yes > > checking for unistd.h... yes > > checking for dlfcn.h... yes > > checking for objdir... .libs > > checking if gcc supports -fno-rtti -fno-exceptions... no > > checking for gcc option to produce PIC... -fPIC -DPIC > > checking if gcc PIC flag -fPIC -DPIC works... yes > > checking if gcc static flag -static works... yes > > checking if gcc supports -c -o file.o... yes > > checking if gcc supports -c -o file.o... (cached) yes > > checking whether the gcc linker (/usr/bin/ld) supports shared > libraries... > > yes > > checking whether -lc should be explicitly linked in... no > > checking dynamic linker characteristics... GNU/Linux ld.so > > checking how to hardcode library paths into programs... immediate > > checking whether stripping libraries is possible... yes > > checking if libtool supports shared libraries... yes > > checking whether to build shared libraries... yes > > checking whether to build static libraries... yes > > checking how to run the C++ preprocessor... g++ -E > > checking for ld used by g++... /usr/bin/ld > > checking if the linker (/usr/bin/ld) is GNU ld... yes > > checking whether the g++ linker (/usr/bin/ld) supports shared > libraries... > > yes > > checking for g++ option to produce PIC... -fPIC -DPIC > > checking if g++ PIC flag -fPIC -DPIC works... yes > > checking if g++ static flag -static works... yes > > checking if g++ supports -c -o file.o... yes > > checking if g++ supports -c -o file.o... (cached) yes > > checking whether the g++ linker (/usr/bin/ld) supports shared > libraries... > > yes > > checking dynamic linker characteristics... (cached) GNU/Linux ld.so > > checking how to hardcode library paths into programs... immediate > > checking for dlopen in -ldl... yes > > checking for pthread_create in -lpthread... yes > > checking for uuid_generate in -luuid... yes > > checking for inline... inline > > checking for stdlib.h... (cached) yes > > checking for GNU libc compatible malloc... yes > > checking for gettimeofday... yes > > checking for munmap... yes > > checking for socket... yes > > checking for strerror... yes > > checking for strtol... yes > > checking for sched_getcpu... yes > > checking for sysconf... yes > > checking for makeinfo... yes > > checking urcu-bp.h usability... yes > > checking urcu-bp.h presence... yes > > checking for urcu-bp.h... yes > > checking caa_likely()... yes > > checking for synchronize_rcu_bp in -lurcu-bp... yes > > checking for call_rcu_bp in -lurcu-bp... yes > > checking library format for the host system... configure: error: unable > to > > detect library format (unsupported architecture (armv7l)?) > > > > > > In the configure.ac file i had made an entry for arm7l but even then i > am > > seeing this error . I am doing this on my target machine . can anyone > help > > me with this?? > > There is a fix for cross-compiling in lttng-ust 2.0.5. Please upgrade. > Refer to the Changelog for details, > > Thanks, > > Mathieu > > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > -- > Mathieu Desnoyers > Operating System Efficiency R&D Consultant > EfficiOS Inc. > http://www.efficios.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgoulet at efficios.com Mon Sep 24 11:33:47 2012 From: dgoulet at efficios.com (David Goulet) Date: Mon, 24 Sep 2012 11:33:47 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: Change sempahore to pthread conditions Message-ID: <1348500827-8921-1-git-send-email-dgoulet@efficios.com> Fixes #324 Signed-off-by: David Goulet --- src/bin/lttng-sessiond/consumer.h | 21 +++++- src/bin/lttng-sessiond/main.c | 127 ++++++++++++++++++++++++++++--------- 2 files changed, 116 insertions(+), 32 deletions(-) diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h index 1337f32..6639bd8 100644 --- a/src/bin/lttng-sessiond/consumer.h +++ b/src/bin/lttng-sessiond/consumer.h @@ -18,8 +18,6 @@ #ifndef _CONSUMER_H #define _CONSUMER_H -#include - #include #include #include @@ -54,7 +52,24 @@ struct consumer_data { enum lttng_consumer_type type; pthread_t thread; /* Worker thread interacting with the consumer */ - sem_t sem; + + /* Conditions used by the consumer thread to indicate readiness. */ + pthread_cond_t cond; + pthread_condattr_t condattr; + pthread_mutex_t cond_mutex; + + /* + * This is a flag condition indicating that the consumer thread is ready + * and connected to the lttng-consumerd daemon. This flag MUST only be + * updated by locking the condition mutex above or before spawning a + * consumer thread. + * + * A value of 0 means that the thread is NOT ready. A value of 1 means that + * the thread consumer did connect successfully to the lttng-consumerd + * daemon. A negative value indicates that there is been an error and the + * thread as likely quit. + */ + int consumer_thread_is_ready; /* Mutex to control consumerd pid assignation */ pthread_mutex_t pid_mutex; diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 730ac65..2fb8700 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -81,7 +80,10 @@ static int is_root; /* Set to 1 if the daemon is running as root */ static pid_t ppid; /* Parent PID for --sig-parent option */ static char *rundir; -/* Consumer daemon specific control data */ +/* + * Consumer daemon specific control data. Every value not initialized here is + * set to 0 by the static definition. + */ static struct consumer_data kconsumer_data = { .type = LTTNG_CONSUMER_KERNEL, .err_unix_sock_path = DEFAULT_KCONSUMERD_ERR_SOCK_PATH, @@ -90,6 +92,8 @@ static struct consumer_data kconsumer_data = { .cmd_sock = -1, .pid_mutex = PTHREAD_MUTEX_INITIALIZER, .lock = PTHREAD_MUTEX_INITIALIZER, + .cond = PTHREAD_COND_INITIALIZER, + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, }; static struct consumer_data ustconsumer64_data = { .type = LTTNG_CONSUMER64_UST, @@ -99,6 +103,8 @@ static struct consumer_data ustconsumer64_data = { .cmd_sock = -1, .pid_mutex = PTHREAD_MUTEX_INITIALIZER, .lock = PTHREAD_MUTEX_INITIALIZER, + .cond = PTHREAD_COND_INITIALIZER, + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, }; static struct consumer_data ustconsumer32_data = { .type = LTTNG_CONSUMER32_UST, @@ -108,6 +114,8 @@ static struct consumer_data ustconsumer32_data = { .cmd_sock = -1, .pid_mutex = PTHREAD_MUTEX_INITIALIZER, .lock = PTHREAD_MUTEX_INITIALIZER, + .cond = PTHREAD_COND_INITIALIZER, + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, }; /* Shared between threads */ @@ -789,6 +797,20 @@ error_poll_create: } /* + * Signal pthread condition of the consumer data that the thread. + */ +static void signal_consumer_condition(struct consumer_data *data, int state) +{ + pthread_mutex_lock(&data->cond_mutex); + + /* Indicates that the thread is ready for action! */ + data->consumer_thread_is_ready = state; + (void) pthread_cond_signal(&data->cond); + + pthread_mutex_unlock(&data->cond_mutex); +} + +/* * This thread manage the consumer error sent back to the session daemon. */ static void *thread_manage_consumer(void *data) @@ -886,13 +908,13 @@ restart: consumer_data->cmd_sock = lttcomm_connect_unix_sock(consumer_data->cmd_unix_sock_path); if (consumer_data->cmd_sock < 0) { - sem_post(&consumer_data->sem); + /* On error, signal condition and quit. */ + signal_consumer_condition(consumer_data, -1); PERROR("consumer connect"); goto error; } - /* Signal condition to tell that the kconsumerd is ready */ - sem_post(&consumer_data->sem); - DBG("consumer command socket ready"); + signal_consumer_condition(consumer_data, 1); + DBG("Consumer command socket ready"); } else { ERR("consumer error when waiting for SOCK_READY : %s", lttcomm_get_readable_code(-code)); @@ -1446,59 +1468,106 @@ error_create_poll: */ static int spawn_consumer_thread(struct consumer_data *consumer_data) { - int ret; + int ret, clock_ret; struct timespec timeout; - timeout.tv_sec = DEFAULT_SEM_WAIT_TIMEOUT; - timeout.tv_nsec = 0; + /* Make sure we set the readiness flag to 0 because we are NOT ready */ + consumer_data->consumer_thread_is_ready = 0; - /* Setup semaphore */ - ret = sem_init(&consumer_data->sem, 0, 0); - if (ret < 0) { - PERROR("sem_init consumer semaphore"); + /* Setup pthread condition */ + ret = pthread_condattr_init(&consumer_data->condattr); + if (ret != 0) { + errno = ret; + PERROR("pthread_condattr_init consumer data"); + goto error; + } + + /* + * Set the monotonic clock in order to make sure we DO NOT jump in time + * between the clock_gettime() call and the timedwait call. See bug #324 + * for a more details and how we noticed it. + */ + ret = pthread_condattr_setclock(&consumer_data->condattr, CLOCK_MONOTONIC); + if (ret != 0) { + errno = ret; + PERROR("pthread_condattr_setclock consumer data"); goto error; } - ret = pthread_create(&consumer_data->thread, NULL, - thread_manage_consumer, consumer_data); + ret = pthread_cond_init(&consumer_data->cond, &consumer_data->condattr); + if (ret != 0) { + errno = ret; + PERROR("pthread_cond_init consumer data"); + goto error; + } + + ret = pthread_create(&consumer_data->thread, NULL, thread_manage_consumer, + consumer_data); if (ret != 0) { PERROR("pthread_create consumer"); ret = -1; goto error; } + /* We are about to wait on a pthread condition */ + pthread_mutex_lock(&consumer_data->cond_mutex); + /* Get time for sem_timedwait absolute timeout */ - ret = clock_gettime(CLOCK_REALTIME, &timeout); - if (ret < 0) { - PERROR("clock_gettime spawn consumer"); - /* Infinite wait for the kconsumerd thread to be ready */ - ret = sem_wait(&consumer_data->sem); - } else { - /* Normal timeout if the gettime was successful */ - timeout.tv_sec += DEFAULT_SEM_WAIT_TIMEOUT; - ret = sem_timedwait(&consumer_data->sem, &timeout); + clock_ret = clock_gettime(CLOCK_MONOTONIC, &timeout); + /* + * Set the timeout for the condition timed wait even if the clock gettime + * call fails since we might loop on that call and we want to avoid to + * incremente the timeout too many times. + */ + timeout.tv_sec += DEFAULT_SEM_WAIT_TIMEOUT; + + /* Make sure that ret is never set to ETIMEDOUT before reaching the loop */ + ret = 0; + + /* + * Loop until the condition is reached or when a timeout is reached. Note + * that the pthread_cond_timedwait(P) man page specifies that EINTR can NOT + * be returned but the pthread_cond(3), from the glibc-doc, says that it is + * possible. This loop does not take any chances and works with both of + * them. + */ + while (!consumer_data->consumer_thread_is_ready && ret != ETIMEDOUT) { + if (clock_ret < 0) { + PERROR("clock_gettime spawn consumer"); + /* Infinite wait for the consumerd thread to be ready */ + ret = pthread_cond_wait(&consumer_data->cond, + &consumer_data->cond_mutex); + } else { + ret = pthread_cond_timedwait(&consumer_data->cond, + &consumer_data->cond_mutex, &timeout); + } } - if (ret < 0) { - if (errno == ETIMEDOUT) { + /* Release the pthread condition */ + pthread_mutex_unlock(&consumer_data->cond_mutex); + + if (ret != 0) { + errno = ret; + if (ret == ETIMEDOUT) { /* * Call has timed out so we kill the kconsumerd_thread and return * an error. */ - ERR("The consumer thread was never ready. Killing it"); + ERR("Condition timed out. The consumer thread was never ready." + " Killing it"); ret = pthread_cancel(consumer_data->thread); if (ret < 0) { PERROR("pthread_cancel consumer thread"); } } else { - PERROR("semaphore wait failed consumer thread"); + PERROR("pthread_cond_wait failed consumer thread"); } goto error; } pthread_mutex_lock(&consumer_data->pid_mutex); if (consumer_data->pid == 0) { - ERR("Kconsumerd did not start"); + ERR("Consumerd did not start"); pthread_mutex_unlock(&consumer_data->pid_mutex); goto error; } -- 1.7.10.4 From christian.babeux at efficios.com Mon Sep 24 12:11:43 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Mon, 24 Sep 2012 12:11:43 -0400 Subject: [lttng-dev] [PATCH v2 lttng-tools 0/4] Tests cleanup In-Reply-To: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1348503107-3830-1-git-send-email-christian.babeux@efficios.com> Hi all, Here a brief changelog for the tests cleanup patches. v2 Changelog: 1/4: Use STDOUT_FILENO define instead of fileno(stdout). 2/4: print_test_banner now accept a string parameter instead of relying on the global TEST_DESC. 3/4: print_test_banner now requires a string argument. Pass TEST_DESC string. 4/4: No changes Thanks, Christian Babeux (4): Tests: Add a check for color support when printing status Tests: Add helper functions for printing status and test banner Tests: Cleanup redundant code and use printing helper functions Tests: Rename helper functions to have consistent names tests/kernel/run-kernel-tests.sh | 13 ++--- tests/tools/streaming/run-kernel | 29 +++++----- tests/tools/streaming/run-ust | 21 ++++---- tests/tools/streaming/uri_switch | 30 +++++------ tests/ust/before-after/run | 30 +++++------ tests/ust/high-throughput/run | 17 +++--- tests/ust/low-throughput/run | 17 +++--- tests/ust/multi-session/run | 23 ++++---- tests/ust/nprocesses/run | 11 ++-- tests/ust/nprocesses/ust-nprocesses | 11 ++-- tests/ust/run-ust-global-tests.sh | 12 ++--- tests/utils.h | 22 +++++++- tests/utils.sh | 104 ++++++++++++++++++++++++------------ 13 files changed, 193 insertions(+), 147 deletions(-) -- 1.7.12 From christian.babeux at efficios.com Mon Sep 24 12:11:44 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Mon, 24 Sep 2012 12:11:44 -0400 Subject: [lttng-dev] [PATCH v2 lttng-tools 1/4] Tests: Add a check for color support when printing status In-Reply-To: <1348503107-3830-1-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> <1348503107-3830-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1348503107-3830-2-git-send-email-christian.babeux@efficios.com> When printing the status of test is OK or FAIL, check if stdout is attached to a terminal device. This way the output is not cluttered with useless escape characters. Some use cases where we don't want colors: $ ./sometest | less $ ./sometest > a.log Signed-off-by: Christian Babeux --- tests/utils.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/utils.h b/tests/utils.h index 7650865..94891c0 100644 --- a/tests/utils.h +++ b/tests/utils.h @@ -16,10 +16,28 @@ */ #include +#include #define BRIGHT 1 #define GREEN 32 #define RED 31 -#define PRINT_OK() printf("%c[%d;%dmOK%c[%dm\n", 0x1B, BRIGHT, GREEN, 0x1B, 0); -#define PRINT_FAIL() printf("%c[%d;%dmFAIL%c[%dm\n", 0x1B, BRIGHT, RED, 0x1B, 0); +#define PRINT_OK() \ +do { \ + /* Check for color support */ \ + if (isatty(STDOUT_FILENO)) { \ + printf("%c[%d;%dmOK%c[%dm\n", 0x1B, BRIGHT, GREEN, 0x1B, 0); \ + } else { \ + printf("OK\n"); \ + } \ +} while (0) + +#define PRINT_FAIL() \ +do { \ + /* Check for color support */ \ + if (isatty(STDOUT_FILENO)) { \ + printf("%c[%d;%dmFAIL%c[%dm\n", 0x1B, BRIGHT, RED, 0x1B, 0); \ + } else { \ + printf("FAIL\n"); \ + } \ +} while (0) -- 1.7.12 From christian.babeux at efficios.com Mon Sep 24 12:11:45 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Mon, 24 Sep 2012 12:11:45 -0400 Subject: [lttng-dev] [PATCH v2 lttng-tools 2/4] Tests: Add helper functions for printing status and test banner In-Reply-To: <1348503107-3830-1-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> <1348503107-3830-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1348503107-3830-3-git-send-email-christian.babeux@efficios.com> Add three new printing functions: print_ok: Print the OK status with optional color support. print_fail: Print the FAIL status with optional color support. print_test_banner: Print a test banner of the test description. e.g.: sometest.sh: TEST_DESC="A really useful test" [...] source $TESTDIR/utils.sh print_test_banner [...] print_ok print_fail [...] $ ./sometest.sh ---------------------- A really useful test ---------------------- OK FAIL Signed-off-by: Christian Babeux --- tests/utils.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/utils.sh b/tests/utils.sh index 42b18e3..8fcb0da 100644 --- a/tests/utils.sh +++ b/tests/utils.sh @@ -25,6 +25,38 @@ KERNEL_MAJOR_VERSION=2 KERNEL_MINOR_VERSION=6 KERNEL_PATCHLEVEL_VERSION=27 +function print_ok () +{ + # Check if we are a terminal + if [ -t 1 ]; then + echo -e "\e[1;32mOK\e[0m" + else + echo -e "OK" + fi +} + +function print_fail () +{ + # Check if we are a terminal + if [ -t 1 ]; then + echo -e "\e[1;31mFAIL\e[0m" + else + echo -e "FAIL" + fi +} + +function print_test_banner () +{ + desc="$1" + + count=$((${#desc}+2)) + str=$(printf "%${count}s"); + echo -e "\n" + echo -e ${str// /-} + echo -e " $desc " + echo -e ${str// /-} +} + function validate_kernel_version () { kern_version=($(uname -r | awk -F. '{ printf("%d.%d.%d\n",$1,$2,$3); }' | tr '.' '\n')) -- 1.7.12 From christian.babeux at efficios.com Mon Sep 24 12:11:46 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Mon, 24 Sep 2012 12:11:46 -0400 Subject: [lttng-dev] [PATCH v2 lttng-tools 3/4] Tests: Cleanup redundant code and use printing helper functions In-Reply-To: <1348503107-3830-1-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> <1348503107-3830-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1348503107-3830-4-git-send-email-christian.babeux@efficios.com> Signed-off-by: Christian Babeux --- tests/kernel/run-kernel-tests.sh | 7 +++-- tests/tools/streaming/run-kernel | 13 ++++---- tests/tools/streaming/run-ust | 5 ++-- tests/tools/streaming/uri_switch | 6 ++-- tests/ust/before-after/run | 14 ++++----- tests/ust/high-throughput/run | 9 +++--- tests/ust/low-throughput/run | 9 +++--- tests/ust/multi-session/run | 13 ++++---- tests/ust/nprocesses/run | 7 ++--- tests/ust/nprocesses/ust-nprocesses | 7 +++-- tests/ust/run-ust-global-tests.sh | 6 ++-- tests/utils.sh | 60 +++++++++++++++++++------------------ 12 files changed, 76 insertions(+), 80 deletions(-) diff --git a/tests/kernel/run-kernel-tests.sh b/tests/kernel/run-kernel-tests.sh index f872be5..f89cd7b 100755 --- a/tests/kernel/run-kernel-tests.sh +++ b/tests/kernel/run-kernel-tests.sh @@ -46,9 +46,10 @@ function check_lttng_modules () fi } -echo -e "\n---------------------" -echo -e "Testing Kernel tracer" -echo -e "---------------------" + +TEST_DESC="Testing Kernel tracer" + +print_test_banner "$TEST_DESC" # Detect lttng-modules installed check_lttng_modules diff --git a/tests/tools/streaming/run-kernel b/tests/tools/streaming/run-kernel index 73a99de..b87be13 100755 --- a/tests/tools/streaming/run-kernel +++ b/tests/tools/streaming/run-kernel @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="Streaming - Kernel tracing" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -25,9 +26,7 @@ TRACE_PATH=$(mktemp -d) source $TESTDIR/utils.sh -echo -e "\n---------------------------" -echo -e " Streaming - Kernel tracing " -echo -e "----------------------------" +print_test_banner "$TEST_DESC" if [ "$(id -u)" != "0" ]; then echo "This test must be running as root. Aborting" @@ -50,10 +49,10 @@ function lttng_create_session # Create session with default path $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -63,10 +62,10 @@ function lttng_enable_consumer_localhost # Create session with default path $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-consumer -k net://localhost >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } diff --git a/tests/tools/streaming/run-ust b/tests/tools/streaming/run-ust index 0149918..1c415cc 100755 --- a/tests/tools/streaming/run-ust +++ b/tests/tools/streaming/run-ust @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="Streaming - User space tracing" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -26,9 +27,7 @@ TRACE_PATH=$(mktemp -d) source $TESTDIR/utils.sh -echo -e "\n-------------------------------" -echo -e " Streaming - User space tracing " -echo -e "--------------------------------" +print_test_banner "$TEST_DESC" if [ ! -x "$CURDIR/$BIN_NAME" ]; then echo -e "No UST nevents binary detected. Passing." diff --git a/tests/tools/streaming/uri_switch b/tests/tools/streaming/uri_switch index a6b1582..cb0979e 100755 --- a/tests/tools/streaming/uri_switch +++ b/tests/tools/streaming/uri_switch @@ -15,6 +15,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="Streaming - URI switching" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -27,10 +28,7 @@ TRACE_PATH=$(mktemp -d) source $TESTDIR/utils.sh -echo -e "\n" -echo -e "---------------------------" -echo -e " Streaming - URI switching " -echo -e "---------------------------" +print_test_banner "$TEST_DESC" if [ ! -x "$CURDIR/$BIN_NAME" ]; then echo -e "No UST nevents binary detected. Skipping." diff --git a/tests/ust/before-after/run b/tests/ust/before-after/run index 9b16528..56046b4 100755 --- a/tests/ust/before-after/run +++ b/tests/ust/before-after/run @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Start tracing before and after execution" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -23,9 +24,7 @@ EVENT_NAME="ust_gen_nevents:tptest" source $TESTDIR/utils.sh -echo -e "\n----------------------------------------------------" -echo -e "UST tracer - Star tracing before and after execution" -echo -e "----------------------------------------------------" +print_test_banner "$TEST_DESC" if [ ! -x "$CURDIR/gen-nevents" ]; then echo -e "No UST nevents binary detected. Passing." @@ -44,7 +43,8 @@ test_before_apps() { # Start test echo -n "Starting application... " ./$CURDIR/gen-nevents $NR_ITER - echo -e "Ended \e[1;32mOK\e[0m" + echo -e "Ended " + print_ok stop_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME @@ -58,7 +58,7 @@ test_after_apps() { echo -n "Starting application... " ./$CURDIR/gen-nevents 100 & - echo -e "\e[1;32mOK\e[0m" + print_ok # BEFORE application is spawned create_lttng_session $SESSION_NAME $TRACE_PATH @@ -74,11 +74,11 @@ test_after_apps() { out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l) if [ $out -eq 0 ]; then echo -n "No event found. Suppose to have at least one... " - echo -e "\e[1;31mFAILED\e[0m" + print_fail out=1 else echo -n "Found $out event(s). Coherent... " - echo -e "\e[1;32mOK\e[0m" + print_ok out=0 fi diff --git a/tests/ust/high-throughput/run b/tests/ust/high-throughput/run index de3111d..f86a17a 100755 --- a/tests/ust/high-throughput/run +++ b/tests/ust/high-throughput/run @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Testing high events throughput" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -24,9 +25,7 @@ EVENT_NAME="tp:tptest" source $TESTDIR/utils.sh -echo -e "\n-------------------------------------------" -echo -e "UST tracer - Testing high events throughput" -echo -e "-------------------------------------------" +print_test_banner "$TEST_DESC" if [ ! -x "$CURDIR/$BIN_NAME" ]; then echo -e "No UST nevents binary detected. Passing." @@ -81,11 +80,11 @@ let wanted=$NR_ITER*1000000 if [ $wanted -ne $total ]; then echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... " - echo -e "\e[1;31mFAILED\e[0m" + print_fail out=1 else echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... " - echo -e "\e[1;32mOK\e[0m" + print_ok out=0 fi diff --git a/tests/ust/low-throughput/run b/tests/ust/low-throughput/run index 3f2d1b7..219a641 100755 --- a/tests/ust/low-throughput/run +++ b/tests/ust/low-throughput/run @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Testing low events throughput" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -23,9 +24,7 @@ EVENT_NAME="tp:slow" source $TESTDIR/utils.sh -echo -e "\n-------------------------------------------" -echo -e "UST tracer - Testing low events throughput" -echo -e "-------------------------------------------" +print_test_banner "$TEST_DESC" if [ ! -x "$CURDIR/$BIN_NAME" ]; then echo -e "No UST nevents binary detected. Passing." @@ -92,9 +91,9 @@ done if [ $out -eq 0 ]; then echo -n "Trace is coherent... " - echo -e "\e[1;32mOK\e[0m" + print_ok else - echo -e "\e[1;31mFAILED\e[0m" + print_fail fi rm -rf $TRACE_PATH diff --git a/tests/ust/multi-session/run b/tests/ust/multi-session/run index f6dab7c..ce3d12b 100755 --- a/tests/ust/multi-session/run +++ b/tests/ust/multi-session/run @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="UST tracer - Multi-session" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. @@ -23,9 +24,7 @@ EVENT_NAME="ust_gen_nevents:tptest" source $TESTDIR/utils.sh -echo -e "\n--------------------------" -echo -e "UST tracer - Multi-session" -echo -e "--------------------------" +print_test_banner "$TEST_DESC" if [ ! -x "$CURDIR/gen-nevents" ]; then echo -e "No UST nevents binary detected. Passing." @@ -46,7 +45,7 @@ test_multi_session() { echo -n "Starting application generating $NR_ITER events... " ./$CURDIR/gen-nevents $NR_ITER & - echo -e "\e[1;32mOK\e[0m" + print_ok # At least hit one event echo -n "Waiting for events to record " @@ -54,7 +53,7 @@ test_multi_session() { echo -n "." sleep 0.1 done - echo -e "\e[1;32m OK\e[0m" + print_ok for i in `seq 0 3`; do stop_tracing "$SESSION_NAME-$i" @@ -62,11 +61,11 @@ test_multi_session() { out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l) if [ $out -ne $NR_ITER ]; then echo -n "No event found. Suppose to have at least one... " - echo -e "\e[1;31mFAILED\e[0m" + print_fail out=1 else echo -n "Found $out event(s) for $SESSION_NAME-$i. Coherent... " - echo -e "\e[1;32mOK\e[0m" + print_ok out=0 fi done diff --git a/tests/ust/nprocesses/run b/tests/ust/nprocesses/run index 7513fe1..25ca413 100755 --- a/tests/ust/nprocesses/run +++ b/tests/ust/nprocesses/run @@ -14,17 +14,16 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +NR_ITER=100 +TEST_DESC="UST tracer - Generate $NR_ITER process" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. -NR_ITER=100 TEST_BIN_NAME="gen-events-time" source $TESTDIR/utils.sh -echo -e "\n-------------------------------------" -echo -e "UST tracer - Generate $NR_ITER process" -echo -e "---------------------------------------" +print_test_banner "$TEST_DESC" if [ ! -x "$CURDIR/$TEST_BIN_NAME" ]; then echo -e "No UST $TEST_BIN_NAME binary detected. Passing." diff --git a/tests/ust/nprocesses/ust-nprocesses b/tests/ust/nprocesses/ust-nprocesses index eab6d39..7355057 100755 --- a/tests/ust/nprocesses/ust-nprocesses +++ b/tests/ust/nprocesses/ust-nprocesses @@ -41,9 +41,10 @@ sleep 3 listing=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list -u) reg_app_count=$(echo -n $listing | sed "s/$TEST_BIN_NAME/$TEST_BIN_NAME\n/g" | grep "$TEST_BIN_NAME" | wc -l) if [ "$reg_app_count" -ne "$NR_ITER" ]; then - echo -e "$reg_app_count apps listed. Expected $NR_ITER \e[1;31mFAILED\e[0m" + echo -e "$reg_app_count apps listed. Expected $NR_ITER " + print_fail else - echo -e "\e[1;32mOK\e[0m" + print_ok fi TRACE_PATH=$(mktemp -d) @@ -64,5 +65,5 @@ rm -rf $TRACE_PATH echo -e -n "Killing all spawned applications..." killall -q $TEST_BIN_NAME >/dev/null 2>&1 & -echo -e "\e[1;32mOK\e[0m" +print_ok exit 0 diff --git a/tests/ust/run-ust-global-tests.sh b/tests/ust/run-ust-global-tests.sh index 969e217..57c5170 100755 --- a/tests/ust/run-ust-global-tests.sh +++ b/tests/ust/run-ust-global-tests.sh @@ -35,9 +35,9 @@ function start_tests () rm -rf $tmpdir } -echo -e "\n-------------------------------------------" -echo -e "UST tracer - Global domain (LTTNG_DOMAIN_UST)" -echo -e "---------------------------------------------" +TEST_DESC="UST tracer - Global domain (LTTNG_DOMAIN_UST)" + +print_test_banner "$TEST_DESC" start_tests diff --git a/tests/utils.sh b/tests/utils.sh index 8fcb0da..281ca35 100644 --- a/tests/utils.sh +++ b/tests/utils.sh @@ -98,10 +98,10 @@ function spawn_sessiond () $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --daemonize --quiet --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" #$DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --verbose-consumer >>/tmp/sessiond.log 2>&1 & if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi fi @@ -121,10 +121,10 @@ function lttng_enable_kernel_event echo -n "Enabling kernel event $event_name for session $sess_name" $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event $event_name -s $sess_name -k >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -140,13 +140,13 @@ function lttng_start_relayd $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >/dev/null 2>&1 & #$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt -vvv >>/tmp/relayd.log 2>&1 & if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -157,7 +157,7 @@ function lttng_stop_relayd echo -e -n "Killing lttng-relayd (pid: $PID_RELAYD)... " kill $PID_RELAYD >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else out=1 @@ -165,7 +165,7 @@ function lttng_stop_relayd out=$(pidof lt-$RELAYD_BIN) sleep 0.5 done - echo -e "\e[1;32mOK\e[0m" + print_ok return 0 fi } @@ -204,7 +204,7 @@ function stop_sessiond () echo -e -n "Killing session daemon... " kill $PID_SESSIOND >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else out=1 @@ -212,7 +212,7 @@ function stop_sessiond () out=$(pidof lt-$SESSIOND_BIN) sleep 0.5 done - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -224,10 +224,10 @@ function create_lttng_session () echo -n "Creating lttng session $sess_name in $trace_path " $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -239,10 +239,10 @@ function enable_lttng_channel() echo -n "Enabling lttng channel $channel_name for session $sess_name" $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel $channel_name -s $sess_name >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -254,10 +254,10 @@ function disable_lttng_channel() echo -n "Disabling lttng channel $channel_name for session $sess_name" $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-channel $channel_name -s $sess_name >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -269,10 +269,10 @@ function enable_ust_lttng_event () echo -n "Enabling lttng event $event_name for session $sess_name " $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event $event_name -s $sess_name -u >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -283,10 +283,10 @@ function start_tracing () echo -n "Start lttng tracing for session $sess_name " $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $sess_name >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -297,10 +297,10 @@ function stop_tracing () echo -n "Stop lttng tracing for session $sess_name " $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $sess_name >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -311,10 +311,10 @@ function destroy_lttng_session () echo -n "Destroy lttng session $sess_name " $TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $sess_name >/dev/null 2>&1 if [ $? -eq 1 ]; then - echo -e '\e[1;31mFAILED\e[0m' + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok fi } @@ -334,10 +334,12 @@ function trace_matches () count=$($BABELTRACE_BIN $trace_path | grep $event_name | wc -l) if [ "$count" -ne "$nr_iter" ]; then - echo -e "$count found in trace \e[1;31mFAILED\e[0m" + echo -e "$count found in trace " + print_fail return 1 else - echo -e "Trace is coherent \e[1;32mOK\e[0m" + echo -e "Trace is coherent " + print_ok return 0 fi } @@ -356,10 +358,10 @@ function validate_trace echo -n "Validating trace for event $event_name... " traced=$($BABELTRACE_BIN $trace_path 2>/dev/null | grep $event_name | wc -l) if [ $traced -eq 0 ]; then - echo -e "\e[1;31mFAILED\e[0m" + print_fail return 1 else - echo -e "\e[1;32mOK\e[0m" + print_ok return 0 fi } -- 1.7.12 From christian.babeux at efficios.com Mon Sep 24 12:11:47 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Mon, 24 Sep 2012 12:11:47 -0400 Subject: [lttng-dev] [PATCH v2 lttng-tools 4/4] Tests: Rename helper functions to have consistent names In-Reply-To: <1348503107-3830-1-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> <1348503107-3830-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1348503107-3830-5-git-send-email-christian.babeux@efficios.com> Most of the helper functions had inconsistent naming. Suggested naming convention for helper functions: _ or _lttng_ List of modified helper functions: lttng_start_relayd -> start_lttng_relayd lttng_stop_relayd -> stop_lttng_relayd start_sessiond -> start_lttng_sessiond stop_sessiond -> stop_lttng_sessiond start_tracing -> start_lttng_tracing stop_tracing -> stop_lttng_tracing Signed-off-by: Christian Babeux --- tests/kernel/run-kernel-tests.sh | 6 +++--- tests/tools/streaming/run-kernel | 16 ++++++++-------- tests/tools/streaming/run-ust | 16 ++++++++-------- tests/tools/streaming/uri_switch | 24 ++++++++++++------------ tests/ust/before-after/run | 16 ++++++++-------- tests/ust/high-throughput/run | 8 ++++---- tests/ust/low-throughput/run | 8 ++++---- tests/ust/multi-session/run | 10 +++++----- tests/ust/nprocesses/run | 4 ++-- tests/ust/nprocesses/ust-nprocesses | 4 ++-- tests/ust/run-ust-global-tests.sh | 6 +++--- tests/utils.sh | 12 ++++++------ 12 files changed, 65 insertions(+), 65 deletions(-) diff --git a/tests/kernel/run-kernel-tests.sh b/tests/kernel/run-kernel-tests.sh index f89cd7b..6948e1f 100755 --- a/tests/kernel/run-kernel-tests.sh +++ b/tests/kernel/run-kernel-tests.sh @@ -19,16 +19,16 @@ function start_tests () continue fi - start_sessiond + start_lttng_sessiond ./$bin $tmpdir # Test must return 0 to pass. if [ $? -ne 0 ]; then exit_code=1 - stop_sessiond + stop_lttng_sessiond break fi - stop_sessiond + stop_lttng_sessiond done # Cleaning up diff --git a/tests/tools/streaming/run-kernel b/tests/tools/streaming/run-kernel index b87be13..b64f233 100755 --- a/tests/tools/streaming/run-kernel +++ b/tests/tools/streaming/run-kernel @@ -75,10 +75,10 @@ function test_kernel_before_start () lttng_create_session lttng_enable_consumer_localhost lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME # Give a second sleep 1 - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME } @@ -89,16 +89,16 @@ function test_kernel_after_start () echo -e "\n=== Testing kernel streaming with event enable AFTER start\n" lttng_create_session lttng_enable_consumer_localhost - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME # Give a second sleep 1 - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME } -start_sessiond -lttng_start_relayd "-o $TRACE_PATH" +start_lttng_sessiond +start_lttng_relayd "-o $TRACE_PATH" tests=( test_kernel_before_start ) @@ -118,8 +118,8 @@ do done echo "" -stop_sessiond -lttng_stop_relayd +stop_lttng_sessiond +stop_lttng_relayd exit $out diff --git a/tests/tools/streaming/run-ust b/tests/tools/streaming/run-ust index 1c415cc..277807f 100755 --- a/tests/tools/streaming/run-ust +++ b/tests/tools/streaming/run-ust @@ -68,10 +68,10 @@ function test_ust_before_start () # Run 5 times with a 1 second delay ./$CURDIR/$BIN_NAME 5 1000000 >/dev/null 2>&1 & - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME wait_apps - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME } @@ -81,18 +81,18 @@ function test_ust_after_start () lttng_create_session lttng_enable_consumer enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME # Run 5 times with a 1 second delay ./$CURDIR/$BIN_NAME 5 1000000 >/dev/null 2>&1 & wait_apps - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME } -start_sessiond -lttng_start_relayd "-o $TRACE_PATH" +start_lttng_sessiond +start_lttng_relayd "-o $TRACE_PATH" tests=( test_ust_before_start test_ust_after_start ) @@ -112,7 +112,7 @@ do done echo "" -stop_sessiond -lttng_stop_relayd +stop_lttng_sessiond +stop_lttng_relayd exit $out diff --git a/tests/tools/streaming/uri_switch b/tests/tools/streaming/uri_switch index cb0979e..4eb4359 100755 --- a/tests/tools/streaming/uri_switch +++ b/tests/tools/streaming/uri_switch @@ -94,10 +94,10 @@ function test_uri_switch_localhost_folder done enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME run_apps wait_apps - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$RAND @@ -135,10 +135,10 @@ function test_uri_switch_file_network lttng_create_session $FILE_URI lttng_enable_consumer "$NETWORK_URI/$NET_PATH" enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME run_apps wait_apps - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$NET_PATH @@ -179,10 +179,10 @@ IPVER=$1 lttng_create_session $NETWORK_URI lttng_enable_consumer "$FILE_URI/$FILE_PATH" enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME run_apps wait_apps - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME validate_trace $EVENT_NAME $TMP_PATH/$FILE_PATH @@ -196,22 +196,22 @@ IPVER=$1 } -start_sessiond +start_lttng_sessiond echo "" echo "=== Testing with IPv4" -lttng_start_relayd "-o $TRACE_PATH" +start_lttng_relayd "-o $TRACE_PATH" test_uri_switch_localhost_folder "IPv4" test_uri_switch_file_network "IPv4" test_uri_switch_network_file "IPv4" -lttng_stop_relayd +stop_lttng_relayd echo "" echo "=== Testing with IPv6" -lttng_start_relayd "-o $TRACE_PATH -C tcp6://localhost:5342 -D tcp6://localhost:5343" +start_lttng_relayd "-o $TRACE_PATH -C tcp6://localhost:5342 -D tcp6://localhost:5343" test_uri_switch_localhost_folder "IPv6" test_uri_switch_file_network "IPv6" test_uri_switch_network_file "IPv6" -lttng_stop_relayd +stop_lttng_relayd -stop_sessiond +stop_lttng_sessiond diff --git a/tests/ust/before-after/run b/tests/ust/before-after/run index 56046b4..48bfee3 100755 --- a/tests/ust/before-after/run +++ b/tests/ust/before-after/run @@ -39,13 +39,13 @@ test_before_apps() { # BEFORE application is spawned create_lttng_session $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME # Start test echo -n "Starting application... " ./$CURDIR/gen-nevents $NR_ITER echo -e "Ended " print_ok - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH @@ -63,12 +63,12 @@ test_after_apps() { # BEFORE application is spawned create_lttng_session $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME - start_tracing $SESSION_NAME + start_lttng_tracing $SESSION_NAME # At least hit one event sleep 2 - stop_tracing $SESSION_NAME + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l) @@ -87,7 +87,7 @@ test_after_apps() { # MUST set TESTDIR before calling those functions -start_sessiond +start_lttng_sessiond echo "" echo "=== Start application BEFORE tracing was started ===" @@ -97,7 +97,7 @@ TRACE_PATH=$(mktemp -d) test_before_apps out=$? if [ $out -ne 0 ]; then - stop_sessiond + stop_lttng_sessiond exit $out fi @@ -111,10 +111,10 @@ TRACE_PATH=$(mktemp -d) test_after_apps out=$? if [ $out -ne 0 ]; then - stop_sessiond + stop_lttng_sessiond exit $out fi -stop_sessiond +stop_lttng_sessiond rm -rf $TRACE_PATH diff --git a/tests/ust/high-throughput/run b/tests/ust/high-throughput/run index f86a17a..dff5fdd 100755 --- a/tests/ust/high-throughput/run +++ b/tests/ust/high-throughput/run @@ -36,12 +36,12 @@ TRACE_PATH=$(mktemp -d) # MUST set TESTDIR before calling those functions -start_sessiond +start_lttng_sessiond create_lttng_session $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME -start_tracing $SESSION_NAME +start_lttng_tracing $SESSION_NAME for i in `seq 1 $NR_ITER`; do ./$CURDIR/$BIN_NAME & >/dev/null 2>&1 @@ -54,10 +54,10 @@ while [ -n "$(pidof $BIN_NAME)" ]; do done echo "" -stop_tracing $SESSION_NAME +stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME -stop_sessiond +stop_lttng_sessiond # Validate test diff --git a/tests/ust/low-throughput/run b/tests/ust/low-throughput/run index 219a641..26e0749 100755 --- a/tests/ust/low-throughput/run +++ b/tests/ust/low-throughput/run @@ -35,20 +35,20 @@ TRACE_PATH=$(mktemp -d) # MUST set TESTDIR before calling those functions -start_sessiond +start_lttng_sessiond create_lttng_session $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME -start_tracing $SESSION_NAME +start_lttng_tracing $SESSION_NAME # This is going to take 20 minutes ./$CURDIR/$BIN_NAME >/dev/null 2>&1 -stop_tracing $SESSION_NAME +stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME -stop_sessiond +stop_lttng_sessiond # Validate test diff --git a/tests/ust/multi-session/run b/tests/ust/multi-session/run index ce3d12b..7242fd9 100755 --- a/tests/ust/multi-session/run +++ b/tests/ust/multi-session/run @@ -40,7 +40,7 @@ test_multi_session() { for i in `seq 0 3`; do create_lttng_session "$SESSION_NAME-$i" "$TRACE_PATH/$i" enable_ust_lttng_event "$SESSION_NAME-$i" "$EVENT_NAME$i" - start_tracing "$SESSION_NAME-$i" + start_lttng_tracing "$SESSION_NAME-$i" done echo -n "Starting application generating $NR_ITER events... " @@ -56,7 +56,7 @@ test_multi_session() { print_ok for i in `seq 0 3`; do - stop_tracing "$SESSION_NAME-$i" + stop_lttng_tracing "$SESSION_NAME-$i" destroy_lttng_session "$SESSION_NAME-$i" out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l) if [ $out -ne $NR_ITER ]; then @@ -75,17 +75,17 @@ test_multi_session() { # MUST set TESTDIR before calling those functions -start_sessiond +start_lttng_sessiond TRACE_PATH=$(mktemp -d) test_multi_session out=$? if [ $out -ne 0 ]; then - stop_sessiond + stop_lttng_sessiond exit $out fi -stop_sessiond +stop_lttng_sessiond rm -rf "$TRACE_PATH" diff --git a/tests/ust/nprocesses/run b/tests/ust/nprocesses/run index 25ca413..f492ed7 100755 --- a/tests/ust/nprocesses/run +++ b/tests/ust/nprocesses/run @@ -32,10 +32,10 @@ fi # MUST set TESTDIR before calling those functions -start_sessiond +start_lttng_sessiond ./$CURDIR/ust-nprocesses $NR_ITER -stop_sessiond +stop_lttng_sessiond exit 0 diff --git a/tests/ust/nprocesses/ust-nprocesses b/tests/ust/nprocesses/ust-nprocesses index 7355057..90c0c2e 100755 --- a/tests/ust/nprocesses/ust-nprocesses +++ b/tests/ust/nprocesses/ust-nprocesses @@ -52,13 +52,13 @@ TRACE_PATH=$(mktemp -d) create_lttng_session $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME -start_tracing $SESSION_NAME +start_lttng_tracing $SESSION_NAME echo "Sleeping $TEST_WAIT_SEC seconds for tracing to start everywhere" echo "Warning: this arbitrary time can make the test fail on slower system" sleep $TEST_WAIT_SEC -stop_tracing $SESSION_NAME +stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME rm -rf $TRACE_PATH diff --git a/tests/ust/run-ust-global-tests.sh b/tests/ust/run-ust-global-tests.sh index 57c5170..e1a54ad 100755 --- a/tests/ust/run-ust-global-tests.sh +++ b/tests/ust/run-ust-global-tests.sh @@ -19,16 +19,16 @@ function start_tests () continue fi - start_sessiond + start_lttng_sessiond ./$bin $tmpdir # Test must return 0 to pass. if [ $? -ne 0 ]; then exit_code=1 - stop_sessiond + stop_lttng_sessiond break fi - stop_sessiond + stop_lttng_sessiond done # Cleaning up diff --git a/tests/utils.sh b/tests/utils.sh index 281ca35..bb2fee7 100644 --- a/tests/utils.sh +++ b/tests/utils.sh @@ -128,7 +128,7 @@ function lttng_enable_kernel_event fi } -function lttng_start_relayd +function start_lttng_relayd { local opt="$1" @@ -150,7 +150,7 @@ function lttng_start_relayd fi } -function lttng_stop_relayd +function stop_lttng_relayd { PID_RELAYD=`pidof lt-$RELAYD_BIN` @@ -170,7 +170,7 @@ function lttng_stop_relayd fi } -function start_sessiond() +function start_lttng_sessiond() { if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then # Env variable requested no session daemon @@ -192,7 +192,7 @@ function start_sessiond() sleep 2 } -function stop_sessiond () +function stop_lttng_sessiond () { if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then # Env variable requested no session daemon @@ -276,7 +276,7 @@ function enable_ust_lttng_event () fi } -function start_tracing () +function start_lttng_tracing () { sess_name=$1 @@ -290,7 +290,7 @@ function start_tracing () fi } -function stop_tracing () +function stop_lttng_tracing () { sess_name=$1 -- 1.7.12 From meher.146 at gmail.com Mon Sep 24 12:31:55 2012 From: meher.146 at gmail.com (meher chaitanya) Date: Mon, 24 Sep 2012 22:01:55 +0530 Subject: [lttng-dev] unable to detect library format (unsupported architecture (armv7l) In-Reply-To: References: Message-ID: 1) I am using NFS file system and i am directly trying to set up the lttng tool on my target ( its 3.1 kernel ) ( NO CROSS COMPILING : downloading it on target and trying to set up ) a) downloaded and extracted the files b) userspace-rcu was successfully installed , configured and compiled using make and make install c) But for Lttng-ust i am getting the error " checking library format for the host system... configure: error: unable to detect library format (unsupported architecture (armv7l)? " I tried to change the configure.ac file to make a new entry for armv7l . but even then this issue reproduces. can you help me with this as i am new to LTTNG and this is very much needed for my project . Thanks in advance. Thanks & Regards On Mon, Sep 24, 2012 at 3:46 PM, meher chaitanya wrote: > root at lttng:/home/ltt/lttng-ust-2.0.4# ./configure > checking build system type... armv7l-unknown-linux-gnueabi > checking host system type... armv7l-unknown-linux-gnueabi > checking target system type... armv7l-unknown-linux-gnueabi > checking for a BSD-compatible install... /usr/bin/install -c > checking whether build environment is sane... yes > checking for a thread-safe mkdir -p... /bin/mkdir -p > checking for gawk... no > checking for mawk... mawk > checking whether make sets $(MAKE)... yes > checking whether make supports nested variables... yes > checking for a sed that does not truncate output... /bin/sed > checking for gcc... gcc > checking whether the C compiler works... yes > checking for C compiler default output file name... a.out > checking for suffix of executables... > checking whether we are cross compiling... no > checking for suffix of object files... o > checking whether we are using the GNU C compiler... yes > checking whether gcc accepts -g... yes > checking for gcc option to accept ISO C89... none needed > checking for style of include used by make... GNU > checking dependency style of gcc... gcc3 > checking for g++... g++ > checking whether we are using the GNU C++ compiler... yes > checking whether g++ accepts -g... yes > checking dependency style of g++... gcc3 > checking whether make sets $(MAKE)... (cached) yes > checking how to print strings... printf > checking for a sed that does not truncate output... (cached) /bin/sed > checking for grep that handles long lines and -e... /bin/grep > checking for egrep... /bin/grep -E > checking for fgrep... /bin/grep -F > checking for ld used by gcc... /usr/bin/ld > checking if the linker (/usr/bin/ld) is GNU ld... yes > checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B > checking the name lister (/usr/bin/nm -B) interface... BSD nm > checking whether ln -s works... yes > checking the maximum length of command line arguments... 1572864 > checking whether the shell understands some XSI constructs... yes > checking whether the shell understands "+="... yes > checking how to convert armv7l-unknown-linux-gnueabi file names to > armv7l-unknown-linux-gnueabi format... func_convert_file_noop > checking how to convert armv7l-unknown-linux-gnueabi file names to > toolchain format... func_convert_file_noop > checking for /usr/bin/ld option to reload object files... -r > checking for objdump... objdump > checking how to recognize dependent libraries... pass_all > checking for dlltool... no > checking how to associate runtime and link libraries... printf %s\n > checking for ar... ar > checking for archiver @FILE support... @ > checking for strip... strip > checking for ranlib... ranlib > checking command to parse /usr/bin/nm -B output from gcc object... ok > checking for sysroot... no > checking for mt... mt > checking if mt is a manifest tool... no > checking how to run the C preprocessor... gcc -E > checking for ANSI C header files... yes > checking for sys/types.h... yes > checking for sys/stat.h... yes > checking for stdlib.h... yes > checking for string.h... yes > checking for memory.h... yes > checking for strings.h... yes > checking for inttypes.h... yes > checking for stdint.h... yes > checking for unistd.h... yes > checking for dlfcn.h... yes > checking for objdir... .libs > checking if gcc supports -fno-rtti -fno-exceptions... no > checking for gcc option to produce PIC... -fPIC -DPIC > checking if gcc PIC flag -fPIC -DPIC works... yes > checking if gcc static flag -static works... yes > checking if gcc supports -c -o file.o... yes > checking if gcc supports -c -o file.o... (cached) yes > checking whether the gcc linker (/usr/bin/ld) supports shared libraries... > yes > checking whether -lc should be explicitly linked in... no > checking dynamic linker characteristics... GNU/Linux ld.so > checking how to hardcode library paths into programs... immediate > checking whether stripping libraries is possible... yes > checking if libtool supports shared libraries... yes > checking whether to build shared libraries... yes > checking whether to build static libraries... yes > checking how to run the C++ preprocessor... g++ -E > checking for ld used by g++... /usr/bin/ld > checking if the linker (/usr/bin/ld) is GNU ld... yes > checking whether the g++ linker (/usr/bin/ld) supports shared libraries... > yes > checking for g++ option to produce PIC... -fPIC -DPIC > checking if g++ PIC flag -fPIC -DPIC works... yes > checking if g++ static flag -static works... yes > checking if g++ supports -c -o file.o... yes > checking if g++ supports -c -o file.o... (cached) yes > checking whether the g++ linker (/usr/bin/ld) supports shared libraries... > yes > checking dynamic linker characteristics... (cached) GNU/Linux ld.so > checking how to hardcode library paths into programs... immediate > checking for dlopen in -ldl... yes > checking for pthread_create in -lpthread... yes > checking for uuid_generate in -luuid... yes > checking for inline... inline > checking for stdlib.h... (cached) yes > checking for GNU libc compatible malloc... yes > checking for gettimeofday... yes > checking for munmap... yes > checking for socket... yes > checking for strerror... yes > checking for strtol... yes > checking for sched_getcpu... yes > checking for sysconf... yes > checking for makeinfo... yes > checking urcu-bp.h usability... yes > checking urcu-bp.h presence... yes > checking for urcu-bp.h... yes > checking caa_likely()... yes > checking for synchronize_rcu_bp in -lurcu-bp... yes > checking for call_rcu_bp in -lurcu-bp... yes > checking library format for the host system... configure: error: unable to > detect library format (unsupported architecture (armv7l)?) > > > In the configure.ac file i had made an entry for arm7l but even then i am > seeing this error . I am doing this on my target machine . can anyone help > me with this?? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian.babeux at efficios.com Mon Sep 24 12:54:17 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Mon, 24 Sep 2012 12:54:17 -0400 Subject: [lttng-dev] unable to detect library format (unsupported architecture (armv7l) In-Reply-To: References: Message-ID: Hi Meher, The change that you applied to your lttng-ust configure.ac should look like this: diff --git a/configure.ac b/configure.ac index ea73243..efb16d4 100644 --- a/configure.ac +++ b/configure.ac @@ -209,6 +209,7 @@ changequote([,])dnl s390) LIBFORMAT="elf32-s390"; NO_UNALIGNED_ACCESS=1 ;; s390x) LIBFORMAT="elf64-s390"; NO_UNALIGNED_ACCESS=1 ;; armv5) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;; + armv7l) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;; arm) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;; mips*) LIBFORMAT=""; NO_UNALIGNED_ACCESS=1;; *) AC_MSG_ERROR([unable to detect library format (unsupported architecture ($host_cpu)?)]) ;; Make sure after making this change that you run the autoreconf command like this: autoreconf -i -v And then rerun ./configure with your platform specific flags. The configure test should now pass without problem :). Thanks, Christian On Mon, Sep 24, 2012 at 12:31 PM, meher chaitanya wrote: > 1) I am using NFS file system and i am directly trying to set up the lttng > tool on my target ( its 3.1 kernel ) ( NO CROSS COMPILING : downloading it > on target and trying to set up ) > a) downloaded and extracted the files > b) userspace-rcu was successfully installed , > configured and compiled using make and make install > c) But for Lttng-ust i am getting the error " > checking library format for the host system... configure: error: unable to > > > detect library format (unsupported architecture (armv7l)? " > I tried to change the configure.ac file to make a > new entry for armv7l . but even then this issue reproduces. > > can you help me with this as i am new to LTTNG and this is very much needed > for my project . Thanks in advance. > > > Thanks & Regards > > On Mon, Sep 24, 2012 at 3:46 PM, meher chaitanya > wrote: >> >> root at lttng:/home/ltt/lttng-ust-2.0.4# ./configure >> checking build system type... armv7l-unknown-linux-gnueabi >> checking host system type... armv7l-unknown-linux-gnueabi >> checking target system type... armv7l-unknown-linux-gnueabi >> checking for a BSD-compatible install... /usr/bin/install -c >> checking whether build environment is sane... yes >> checking for a thread-safe mkdir -p... /bin/mkdir -p >> checking for gawk... no >> checking for mawk... mawk >> checking whether make sets $(MAKE)... yes >> checking whether make supports nested variables... yes >> checking for a sed that does not truncate output... /bin/sed >> checking for gcc... gcc >> checking whether the C compiler works... yes >> checking for C compiler default output file name... a.out >> checking for suffix of executables... >> checking whether we are cross compiling... no >> checking for suffix of object files... o >> checking whether we are using the GNU C compiler... yes >> checking whether gcc accepts -g... yes >> checking for gcc option to accept ISO C89... none needed >> checking for style of include used by make... GNU >> checking dependency style of gcc... gcc3 >> checking for g++... g++ >> checking whether we are using the GNU C++ compiler... yes >> checking whether g++ accepts -g... yes >> checking dependency style of g++... gcc3 >> checking whether make sets $(MAKE)... (cached) yes >> checking how to print strings... printf >> checking for a sed that does not truncate output... (cached) /bin/sed >> checking for grep that handles long lines and -e... /bin/grep >> checking for egrep... /bin/grep -E >> checking for fgrep... /bin/grep -F >> checking for ld used by gcc... /usr/bin/ld >> checking if the linker (/usr/bin/ld) is GNU ld... yes >> checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B >> checking the name lister (/usr/bin/nm -B) interface... BSD nm >> checking whether ln -s works... yes >> checking the maximum length of command line arguments... 1572864 >> checking whether the shell understands some XSI constructs... yes >> checking whether the shell understands "+="... yes >> checking how to convert armv7l-unknown-linux-gnueabi file names to >> armv7l-unknown-linux-gnueabi format... func_convert_file_noop >> checking how to convert armv7l-unknown-linux-gnueabi file names to >> toolchain format... func_convert_file_noop >> checking for /usr/bin/ld option to reload object files... -r >> checking for objdump... objdump >> checking how to recognize dependent libraries... pass_all >> checking for dlltool... no >> checking how to associate runtime and link libraries... printf %s\n >> checking for ar... ar >> checking for archiver @FILE support... @ >> checking for strip... strip >> checking for ranlib... ranlib >> checking command to parse /usr/bin/nm -B output from gcc object... ok >> checking for sysroot... no >> checking for mt... mt >> checking if mt is a manifest tool... no >> checking how to run the C preprocessor... gcc -E >> checking for ANSI C header files... yes >> checking for sys/types.h... yes >> checking for sys/stat.h... yes >> checking for stdlib.h... yes >> checking for string.h... yes >> checking for memory.h... yes >> checking for strings.h... yes >> checking for inttypes.h... yes >> checking for stdint.h... yes >> checking for unistd.h... yes >> checking for dlfcn.h... yes >> checking for objdir... .libs >> checking if gcc supports -fno-rtti -fno-exceptions... no >> checking for gcc option to produce PIC... -fPIC -DPIC >> checking if gcc PIC flag -fPIC -DPIC works... yes >> checking if gcc static flag -static works... yes >> checking if gcc supports -c -o file.o... yes >> checking if gcc supports -c -o file.o... (cached) yes >> checking whether the gcc linker (/usr/bin/ld) supports shared libraries... >> yes >> checking whether -lc should be explicitly linked in... no >> checking dynamic linker characteristics... GNU/Linux ld.so >> checking how to hardcode library paths into programs... immediate >> checking whether stripping libraries is possible... yes >> checking if libtool supports shared libraries... yes >> checking whether to build shared libraries... yes >> checking whether to build static libraries... yes >> checking how to run the C++ preprocessor... g++ -E >> checking for ld used by g++... /usr/bin/ld >> checking if the linker (/usr/bin/ld) is GNU ld... yes >> checking whether the g++ linker (/usr/bin/ld) supports shared libraries... >> yes >> checking for g++ option to produce PIC... -fPIC -DPIC >> checking if g++ PIC flag -fPIC -DPIC works... yes >> checking if g++ static flag -static works... yes >> checking if g++ supports -c -o file.o... yes >> checking if g++ supports -c -o file.o... (cached) yes >> checking whether the g++ linker (/usr/bin/ld) supports shared libraries... >> yes >> checking dynamic linker characteristics... (cached) GNU/Linux ld.so >> checking how to hardcode library paths into programs... immediate >> checking for dlopen in -ldl... yes >> checking for pthread_create in -lpthread... yes >> checking for uuid_generate in -luuid... yes >> checking for inline... inline >> checking for stdlib.h... (cached) yes >> checking for GNU libc compatible malloc... yes >> checking for gettimeofday... yes >> checking for munmap... yes >> checking for socket... yes >> checking for strerror... yes >> checking for strtol... yes >> checking for sched_getcpu... yes >> checking for sysconf... yes >> checking for makeinfo... yes >> checking urcu-bp.h usability... yes >> checking urcu-bp.h presence... yes >> checking for urcu-bp.h... yes >> checking caa_likely()... yes >> checking for synchronize_rcu_bp in -lurcu-bp... yes >> checking for call_rcu_bp in -lurcu-bp... yes >> checking library format for the host system... configure: error: unable to >> detect library format (unsupported architecture (armv7l)?) >> >> >> In the configure.ac file i had made an entry for arm7l but even then i am >> seeing this error . I am doing this on my target machine . can anyone help >> me with this?? >> > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > From meher.146 at gmail.com Mon Sep 24 14:36:02 2012 From: meher.146 at gmail.com (meher chaitanya) Date: Tue, 25 Sep 2012 00:06:02 +0530 Subject: [lttng-dev] unable to detect library format (unsupported architecture (armv7l) In-Reply-To: References: Message-ID: > > Hi I followed the way you specified ./configure ran successfully . But > when i am trying to do the make its reporting the following errors > Making all in hello make[3]: Entering directory `/home/nvidia/ltt/lttng-ust-2.0.4/tests/hello' make[3]: Warning: File `.deps/tp.Po' has modification time 1.6e+04 s in the future CC tp.o CCLD hello ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `shm_object_table_append' ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `align_shm' ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `shm_object_table_create' ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `_get_num_possible_cpus' ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `zalloc_shm' ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `__num_possible_cpus' ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `shm_object_table_append_shadow' ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to `shm_object_table_destroy' collect2: ld returned 1 exit status make[3]: *** [hello] Error 1 make[3]: Leaving directory `/home/nvidia/ltt/lttng-ust-2.0.4/tests/hello' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/nvidia/ltt/lttng-ust-2.0.4/tests' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/nvidia/ltt/lttng-ust-2.0.4' make: *** [all] Error 2 can you kindly help me with this error. Thanks & Regards Meher Chaitanya > The change that you applied to your lttng-ust configure.ac should look > like this: > > diff --git a/configure.ac b/configure.ac > index ea73243..efb16d4 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -209,6 +209,7 @@ changequote([,])dnl > s390) LIBFORMAT="elf32-s390"; NO_UNALIGNED_ACCESS=1 ;; > s390x) LIBFORMAT="elf64-s390"; NO_UNALIGNED_ACCESS=1 ;; > armv5) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;; > + armv7l) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;; > arm) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;; > mips*) LIBFORMAT=""; NO_UNALIGNED_ACCESS=1;; > *) AC_MSG_ERROR([unable to detect library format (unsupported > architecture ($host_cpu)?)]) ;; > > Make sure after making this change that you run the autoreconf command > like this: > > autoreconf -i -v > > And then rerun ./configure with your platform specific flags. > The configure test should now pass without problem :). > > Thanks, > > Christian > > On Mon, Sep 24, 2012 at 12:31 PM, meher chaitanya > wrote: > > 1) I am using NFS file system and i am directly trying to set up the > lttng > > tool on my target ( its 3.1 kernel ) ( NO CROSS COMPILING : downloading > it > > on target and trying to set up ) > > a) downloaded and extracted the files > > b) userspace-rcu was successfully installed , > > configured and compiled using make and make install > > c) But for Lttng-ust i am getting the error " > > checking library format for the host system... configure: error: unable > to > > > > > > detect library format (unsupported architecture (armv7l)? " > > I tried to change the configure.ac file to make > a > > new entry for armv7l . but even then this issue reproduces. > > > > can you help me with this as i am new to LTTNG and this is very much > needed > > for my project . Thanks in advance. > > > > > > Thanks & Regards > > > > On Mon, Sep 24, 2012 at 3:46 PM, meher chaitanya > > wrote: > >> > >> root at lttng:/home/ltt/lttng-ust-2.0.4# ./configure > >> checking build system type... armv7l-unknown-linux-gnueabi > >> checking host system type... armv7l-unknown-linux-gnueabi > >> checking target system type... armv7l-unknown-linux-gnueabi > >> checking for a BSD-compatible install... /usr/bin/install -c > >> checking whether build environment is sane... yes > >> checking for a thread-safe mkdir -p... /bin/mkdir -p > >> checking for gawk... no > >> checking for mawk... mawk > >> checking whether make sets $(MAKE)... yes > >> checking whether make supports nested variables... yes > >> checking for a sed that does not truncate output... /bin/sed > >> checking for gcc... gcc > >> checking whether the C compiler works... yes > >> checking for C compiler default output file name... a.out > >> checking for suffix of executables... > >> checking whether we are cross compiling... no > >> checking for suffix of object files... o > >> checking whether we are using the GNU C compiler... yes > >> checking whether gcc accepts -g... yes > >> checking for gcc option to accept ISO C89... none needed > >> checking for style of include used by make... GNU > >> checking dependency style of gcc... gcc3 > >> checking for g++... g++ > >> checking whether we are using the GNU C++ compiler... yes > >> checking whether g++ accepts -g... yes > >> checking dependency style of g++... gcc3 > >> checking whether make sets $(MAKE)... (cached) yes > >> checking how to print strings... printf > >> checking for a sed that does not truncate output... (cached) /bin/sed > >> checking for grep that handles long lines and -e... /bin/grep > >> checking for egrep... /bin/grep -E > >> checking for fgrep... /bin/grep -F > >> checking for ld used by gcc... /usr/bin/ld > >> checking if the linker (/usr/bin/ld) is GNU ld... yes > >> checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B > >> checking the name lister (/usr/bin/nm -B) interface... BSD nm > >> checking whether ln -s works... yes > >> checking the maximum length of command line arguments... 1572864 > >> checking whether the shell understands some XSI constructs... yes > >> checking whether the shell understands "+="... yes > >> checking how to convert armv7l-unknown-linux-gnueabi file names to > >> armv7l-unknown-linux-gnueabi format... func_convert_file_noop > >> checking how to convert armv7l-unknown-linux-gnueabi file names to > >> toolchain format... func_convert_file_noop > >> checking for /usr/bin/ld option to reload object files... -r > >> checking for objdump... objdump > >> checking how to recognize dependent libraries... pass_all > >> checking for dlltool... no > >> checking how to associate runtime and link libraries... printf %s\n > >> checking for ar... ar > >> checking for archiver @FILE support... @ > >> checking for strip... strip > >> checking for ranlib... ranlib > >> checking command to parse /usr/bin/nm -B output from gcc object... ok > >> checking for sysroot... no > >> checking for mt... mt > >> checking if mt is a manifest tool... no > >> checking how to run the C preprocessor... gcc -E > >> checking for ANSI C header files... yes > >> checking for sys/types.h... yes > >> checking for sys/stat.h... yes > >> checking for stdlib.h... yes > >> checking for string.h... yes > >> checking for memory.h... yes > >> checking for strings.h... yes > >> checking for inttypes.h... yes > >> checking for stdint.h... yes > >> checking for unistd.h... yes > >> checking for dlfcn.h... yes > >> checking for objdir... .libs > >> checking if gcc supports -fno-rtti -fno-exceptions... no > >> checking for gcc option to produce PIC... -fPIC -DPIC > >> checking if gcc PIC flag -fPIC -DPIC works... yes > >> checking if gcc static flag -static works... yes > >> checking if gcc supports -c -o file.o... yes > >> checking if gcc supports -c -o file.o... (cached) yes > >> checking whether the gcc linker (/usr/bin/ld) supports shared > libraries... > >> yes > >> checking whether -lc should be explicitly linked in... no > >> checking dynamic linker characteristics... GNU/Linux ld.so > >> checking how to hardcode library paths into programs... immediate > >> checking whether stripping libraries is possible... yes > >> checking if libtool supports shared libraries... yes > >> checking whether to build shared libraries... yes > >> checking whether to build static libraries... yes > >> checking how to run the C++ preprocessor... g++ -E > >> checking for ld used by g++... /usr/bin/ld > >> checking if the linker (/usr/bin/ld) is GNU ld... yes > >> checking whether the g++ linker (/usr/bin/ld) supports shared > libraries... > >> yes > >> checking for g++ option to produce PIC... -fPIC -DPIC > >> checking if g++ PIC flag -fPIC -DPIC works... yes > >> checking if g++ static flag -static works... yes > >> checking if g++ supports -c -o file.o... yes > >> checking if g++ supports -c -o file.o... (cached) yes > >> checking whether the g++ linker (/usr/bin/ld) supports shared > libraries... > >> yes > >> checking dynamic linker characteristics... (cached) GNU/Linux ld.so > >> checking how to hardcode library paths into programs... immediate > >> checking for dlopen in -ldl... yes > >> checking for pthread_create in -lpthread... yes > >> checking for uuid_generate in -luuid... yes > >> checking for inline... inline > >> checking for stdlib.h... (cached) yes > >> checking for GNU libc compatible malloc... yes > >> checking for gettimeofday... yes > >> checking for munmap... yes > >> checking for socket... yes > >> checking for strerror... yes > >> checking for strtol... yes > >> checking for sched_getcpu... yes > >> checking for sysconf... yes > >> checking for makeinfo... yes > >> checking urcu-bp.h usability... yes > >> checking urcu-bp.h presence... yes > >> checking for urcu-bp.h... yes > >> checking caa_likely()... yes > >> checking for synchronize_rcu_bp in -lurcu-bp... yes > >> checking for call_rcu_bp in -lurcu-bp... yes > >> checking library format for the host system... configure: error: unable > to > >> detect library format (unsupported architecture (armv7l)?) > >> > >> > >> In the configure.ac file i had made an entry for arm7l but even then i > am > >> seeing this error . I am doing this on my target machine . can anyone > help > >> me with this?? > >> > > > > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev at lists.lttng.org > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From meher.146 at gmail.com Mon Sep 24 15:16:23 2012 From: meher.146 at gmail.com (meher chaitanya) Date: Tue, 25 Sep 2012 00:46:23 +0530 Subject: [lttng-dev] unable to detect library format (unsupported architecture (armv7l) In-Reply-To: References: Message-ID: But while trying to do the make on lttng-modules i am getting the following error root at lttng:/home/meher/ltt/lttng-modules-2.0.4# make make -C /lib/modules/3.1.10-00085-gc7ae3c9/build M=/home/meher/ltt/lttng-modules-2.0.4 modules make: *** /lib/modules/3.1.10-00085-gc7ae3c9/build: No such file or directory. Stop. make: *** [default] Error 2 Thanks & Regards Meher On Tue, Sep 25, 2012 at 12:06 AM, meher chaitanya wrote: > Hi I followed the way you specified ./configure ran successfully . But >> when i am trying to do the make its reporting the following errors >> > > Making all in hello > make[3]: Entering directory `/home/nvidia/ltt/lttng-ust-2.0.4/tests/hello' > make[3]: Warning: File `.deps/tp.Po' has modification time 1.6e+04 s in > the future > CC tp.o > CCLD hello > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `shm_object_table_append' > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `align_shm' > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `shm_object_table_create' > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `_get_num_possible_cpus' > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `zalloc_shm' > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `__num_possible_cpus' > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `shm_object_table_append_shadow' > ../../liblttng-ust/.libs/liblttng-ust.so: undefined reference to > `shm_object_table_destroy' > collect2: ld returned 1 exit status > make[3]: *** [hello] Error 1 > make[3]: Leaving directory `/home/nvidia/ltt/lttng-ust-2.0.4/tests/hello' > make[2]: *** [all-recursive] Error 1 > make[2]: Leaving directory `/home/nvidia/ltt/lttng-ust-2.0.4/tests' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/nvidia/ltt/lttng-ust-2.0.4' > make: *** [all] Error 2 > > can you kindly help me with this error. > > > Thanks & Regards > Meher Chaitanya > > > > >> The change that you applied to your lttng-ust configure.ac should look >> >> like this: >> >> diff --git a/configure.ac b/configure.ac >> index ea73243..efb16d4 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -209,6 +209,7 @@ changequote([,])dnl >> s390) LIBFORMAT="elf32-s390"; NO_UNALIGNED_ACCESS=1 ;; >> s390x) LIBFORMAT="elf64-s390"; NO_UNALIGNED_ACCESS=1 ;; >> armv5) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;; >> + armv7l) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;; >> arm) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;; >> mips*) LIBFORMAT=""; NO_UNALIGNED_ACCESS=1;; >> *) AC_MSG_ERROR([unable to detect library format (unsupported >> architecture ($host_cpu)?)]) ;; >> >> Make sure after making this change that you run the autoreconf command >> like this: >> >> autoreconf -i -v >> >> And then rerun ./configure with your platform specific flags. >> The configure test should now pass without problem :). >> >> Thanks, >> >> Christian >> >> On Mon, Sep 24, 2012 at 12:31 PM, meher chaitanya >> wrote: >> > 1) I am using NFS file system and i am directly trying to set up the >> lttng >> > tool on my target ( its 3.1 kernel ) ( NO CROSS COMPILING : downloading >> it >> > on target and trying to set up ) >> > a) downloaded and extracted the files >> > b) userspace-rcu was successfully installed , >> > configured and compiled using make and make install >> > c) But for Lttng-ust i am getting the error " >> > checking library format for the host system... configure: error: unable >> to >> > >> > >> > detect library format (unsupported architecture (armv7l)? " >> > I tried to change the configure.ac file to >> make a >> > new entry for armv7l . but even then this issue reproduces. >> > >> > can you help me with this as i am new to LTTNG and this is very much >> needed >> > for my project . Thanks in advance. >> > >> > >> > Thanks & Regards >> > >> > On Mon, Sep 24, 2012 at 3:46 PM, meher chaitanya >> > wrote: >> >> >> >> root at lttng:/home/ltt/lttng-ust-2.0.4# ./configure >> >> checking build system type... armv7l-unknown-linux-gnueabi >> >> checking host system type... armv7l-unknown-linux-gnueabi >> >> checking target system type... armv7l-unknown-linux-gnueabi >> >> checking for a BSD-compatible install... /usr/bin/install -c >> >> checking whether build environment is sane... yes >> >> checking for a thread-safe mkdir -p... /bin/mkdir -p >> >> checking for gawk... no >> >> checking for mawk... mawk >> >> checking whether make sets $(MAKE)... yes >> >> checking whether make supports nested variables... yes >> >> checking for a sed that does not truncate output... /bin/sed >> >> checking for gcc... gcc >> >> checking whether the C compiler works... yes >> >> checking for C compiler default output file name... a.out >> >> checking for suffix of executables... >> >> checking whether we are cross compiling... no >> >> checking for suffix of object files... o >> >> checking whether we are using the GNU C compiler... yes >> >> checking whether gcc accepts -g... yes >> >> checking for gcc option to accept ISO C89... none needed >> >> checking for style of include used by make... GNU >> >> checking dependency style of gcc... gcc3 >> >> checking for g++... g++ >> >> checking whether we are using the GNU C++ compiler... yes >> >> checking whether g++ accepts -g... yes >> >> checking dependency style of g++... gcc3 >> >> checking whether make sets $(MAKE)... (cached) yes >> >> checking how to print strings... printf >> >> checking for a sed that does not truncate output... (cached) /bin/sed >> >> checking for grep that handles long lines and -e... /bin/grep >> >> checking for egrep... /bin/grep -E >> >> checking for fgrep... /bin/grep -F >> >> checking for ld used by gcc... /usr/bin/ld >> >> checking if the linker (/usr/bin/ld) is GNU ld... yes >> >> checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B >> >> checking the name lister (/usr/bin/nm -B) interface... BSD nm >> >> checking whether ln -s works... yes >> >> checking the maximum length of command line arguments... 1572864 >> >> checking whether the shell understands some XSI constructs... yes >> >> checking whether the shell understands "+="... yes >> >> checking how to convert armv7l-unknown-linux-gnueabi file names to >> >> armv7l-unknown-linux-gnueabi format... func_convert_file_noop >> >> checking how to convert armv7l-unknown-linux-gnueabi file names to >> >> toolchain format... func_convert_file_noop >> >> checking for /usr/bin/ld option to reload object files... -r >> >> checking for objdump... objdump >> >> checking how to recognize dependent libraries... pass_all >> >> checking for dlltool... no >> >> checking how to associate runtime and link libraries... printf %s\n >> >> checking for ar... ar >> >> checking for archiver @FILE support... @ >> >> checking for strip... strip >> >> checking for ranlib... ranlib >> >> checking command to parse /usr/bin/nm -B output from gcc object... ok >> >> checking for sysroot... no >> >> checking for mt... mt >> >> checking if mt is a manifest tool... no >> >> checking how to run the C preprocessor... gcc -E >> >> checking for ANSI C header files... yes >> >> checking for sys/types.h... yes >> >> checking for sys/stat.h... yes >> >> checking for stdlib.h... yes >> >> checking for string.h... yes >> >> checking for memory.h... yes >> >> checking for strings.h... yes >> >> checking for inttypes.h... yes >> >> checking for stdint.h... yes >> >> checking for unistd.h... yes >> >> checking for dlfcn.h... yes >> >> checking for objdir... .libs >> >> checking if gcc supports -fno-rtti -fno-exceptions... no >> >> checking for gcc option to produce PIC... -fPIC -DPIC >> >> checking if gcc PIC flag -fPIC -DPIC works... yes >> >> checking if gcc static flag -static works... yes >> >> checking if gcc supports -c -o file.o... yes >> >> checking if gcc supports -c -o file.o... (cached) yes >> >> checking whether the gcc linker (/usr/bin/ld) supports shared >> libraries... >> >> yes >> >> checking whether -lc should be explicitly linked in... no >> >> checking dynamic linker characteristics... GNU/Linux ld.so >> >> checking how to hardcode library paths into programs... immediate >> >> checking whether stripping libraries is possible... yes >> >> checking if libtool supports shared libraries... yes >> >> checking whether to build shared libraries... yes >> >> checking whether to build static libraries... yes >> >> checking how to run the C++ preprocessor... g++ -E >> >> checking for ld used by g++... /usr/bin/ld >> >> checking if the linker (/usr/bin/ld) is GNU ld... yes >> >> checking whether the g++ linker (/usr/bin/ld) supports shared >> libraries... >> >> yes >> >> checking for g++ option to produce PIC... -fPIC -DPIC >> >> checking if g++ PIC flag -fPIC -DPIC works... yes >> >> checking if g++ static flag -static works... yes >> >> checking if g++ supports -c -o file.o... yes >> >> checking if g++ supports -c -o file.o... (cached) yes >> >> checking whether the g++ linker (/usr/bin/ld) supports shared >> libraries... >> >> yes >> >> checking dynamic linker characteristics... (cached) GNU/Linux ld.so >> >> checking how to hardcode library paths into programs... immediate >> >> checking for dlopen in -ldl... yes >> >> checking for pthread_create in -lpthread... yes >> >> checking for uuid_generate in -luuid... yes >> >> checking for inline... inline >> >> checking for stdlib.h... (cached) yes >> >> checking for GNU libc compatible malloc... yes >> >> checking for gettimeofday... yes >> >> checking for munmap... yes >> >> checking for socket... yes >> >> checking for strerror... yes >> >> checking for strtol... yes >> >> checking for sched_getcpu... yes >> >> checking for sysconf... yes >> >> checking for makeinfo... yes >> >> checking urcu-bp.h usability... yes >> >> checking urcu-bp.h presence... yes >> >> checking for urcu-bp.h... yes >> >> checking caa_likely()... yes >> >> checking for synchronize_rcu_bp in -lurcu-bp... yes >> >> checking for call_rcu_bp in -lurcu-bp... yes >> >> checking library format for the host system... configure: error: >> unable to >> >> detect library format (unsupported architecture (armv7l)?) >> >> >> >> >> >> In the configure.ac file i had made an entry for arm7l but even then >> i am >> >> seeing this error . I am doing this on my target machine . can anyone >> help >> >> me with this?? >> >> >> > >> > >> > _______________________________________________ >> > lttng-dev mailing list >> > lttng-dev at lists.lttng.org >> > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgoulet at efficios.com Mon Sep 24 16:44:01 2012 From: dgoulet at efficios.com (David Goulet) Date: Mon, 24 Sep 2012 16:44:01 -0400 Subject: [lttng-dev] [PATCH v2 lttng-tools 0/4] Tests cleanup In-Reply-To: <1348503107-3830-1-git-send-email-christian.babeux@efficios.com> References: <1348178720-24610-1-git-send-email-christian.babeux@efficios.com> <1348503107-3830-1-git-send-email-christian.babeux@efficios.com> Message-ID: <5060C611.3050507@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hoy! I fixed a SMALL issue in two "echo" statements that were missing a "-n". Everything is working good and merged! Thanks! David Christian Babeux: > Hi all, > > Here a brief changelog for the tests cleanup patches. > > v2 Changelog: > > 1/4: Use STDOUT_FILENO define instead of fileno(stdout). 2/4: > print_test_banner now accept a string parameter instead of relying > on the global TEST_DESC. 3/4: print_test_banner now requires a > string argument. Pass TEST_DESC string. 4/4: No changes > > Thanks, > > Christian Babeux (4): Tests: Add a check for color support when > printing status Tests: Add helper functions for printing status and > test banner Tests: Cleanup redundant code and use printing helper > functions Tests: Rename helper functions to have consistent names > > tests/kernel/run-kernel-tests.sh | 13 ++--- > tests/tools/streaming/run-kernel | 29 +++++----- > tests/tools/streaming/run-ust | 21 ++++---- > tests/tools/streaming/uri_switch | 30 +++++------ > tests/ust/before-after/run | 30 +++++------ > tests/ust/high-throughput/run | 17 +++--- > tests/ust/low-throughput/run | 17 +++--- > tests/ust/multi-session/run | 23 ++++---- > tests/ust/nprocesses/run | 11 ++-- > tests/ust/nprocesses/ust-nprocesses | 11 ++-- > tests/ust/run-ust-global-tests.sh | 12 ++--- tests/utils.h > | 22 +++++++- tests/utils.sh | 104 > ++++++++++++++++++++++++------------ 13 files changed, 193 > insertions(+), 147 deletions(-) > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQYMYOAAoJEELoaioR9I02qRYH/3L1ATAiQQUamHUsgp4hJr0K f2qWrdQmRMvUg1qs2jsflj2S08isCyhdRnjBvYCisRxoJDhrMSCffFWVg9bdpXxj /5cuzhXYgQB/nImugUF3VzOIraxkLTLbK7SQlUBFvvlNdYI/ytn0WFyVC6/wWlsr kkWkeR/Ja1hiWNEOrT+Q8JL2ogUQfiamnBmqNl05P3SXRKB9WOPdO/mmbjbrJnTf oa+9lZAtPMDh33My5d4USecm/HgQWtFVlNi1sGWPmRmP+Ym+ziHs/wEiGWhBhg9u ZEFmVQPULjgdZwmjFbfLIVk8M9D/N3hY2RLlXg4F8wlOq5iqn4496DNDOtjNlRI= =uXpJ -----END PGP SIGNATURE----- From matthew.khouzam at ericsson.com Mon Sep 24 16:52:28 2012 From: matthew.khouzam at ericsson.com (Matthew Khouzam) Date: Mon, 24 Sep 2012 16:52:28 -0400 Subject: [lttng-dev] CTF model.emf.uri precision Message-ID: <5060C80C.4030600@ericsson.com> Hi tracing paladins, I was going over the most recent CTF specs. I am curious, at the line: 1176 "model.emf.uri = "string";" this looks like a reference to something from eclipse modeling framework. http://download.eclipse.org/modeling/emf/emf/javadoc/2.7.0/org/eclipse/emf/common/util/URI.html Is this part of the CTF specification? Shouldn't this be called model.uri or model_uri to respect the naming convention? I hope someone could clarify this. Matthew From mathieu.desnoyers at efficios.com Mon Sep 24 22:25:30 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Mon, 24 Sep 2012 22:25:30 -0400 Subject: [lttng-dev] CTF model.emf.uri precision In-Reply-To: <5060C80C.4030600@ericsson.com> References: <5060C80C.4030600@ericsson.com> Message-ID: <20120925022530.GA12625@Krystal> * Matthew Khouzam (matthew.khouzam at ericsson.com) wrote: > Hi tracing paladins, > I was going over the most recent CTF specs. I am curious, at the line: > 1176 "model.emf.uri = "string";" this looks like a reference to > something from eclipse modeling framework. > http://download.eclipse.org/modeling/emf/emf/javadoc/2.7.0/org/eclipse/emf/common/util/URI.html > > Is this part of the CTF specification? Shouldn't this be called > model.uri or model_uri to respect the naming convention? if we only call it model.uri, and come up with other model URIs that we want to encode in the future (not emf-related), then we would be stucked, wouldn't we ? What is the benefit of removing the "emf" part ? Thanks, Mathieu > > I hope someone could clarify this. > > Matthew > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From christian.babeux at efficios.com Tue Sep 25 12:06:38 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Tue, 25 Sep 2012 12:06:38 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Tests: Add high throughput with bandwidth limits test Message-ID: <1348589198-16331-1-git-send-email-christian.babeux@efficios.com> This test is used to stress the new streaming feature with high throughput in a bandwidth limited use case. The bandwidth limitation is done via the tc (traffic control) kernel utility. Root permissions are needed to set bandwidth limits. Limits are set on the loopback interface (lo). The test cycle through bandwidth limits from 3200kbits to 50kbits. There are currently two known limitations/issues: - The tests fails when the lttng stop commands is issued right after the traced applications are done executing. - Setting a bandwidth limit on the control port of the relayd will trigger a timeout in the sessiond. Signed-off-by: Christian Babeux --- tests/tools/streaming/high_through_limits | 185 ++++++++++++++++++++++++++++++ tests/tools/streaming/runall | 2 +- 2 files changed, 186 insertions(+), 1 deletion(-) create mode 100755 tests/tools/streaming/high_through_limits diff --git a/tests/tools/streaming/high_through_limits b/tests/tools/streaming/high_through_limits new file mode 100755 index 0000000..0f0a4eb --- /dev/null +++ b/tests/tools/streaming/high_through_limits @@ -0,0 +1,185 @@ +#!/bin/bash +# +# Copyright (C) - 2012 Christian Babeux +# David Goulet +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +TEST_DESC="Streaming - High throughput with bandwith limits" + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../.. +NR_APP_ITER=10 +NR_ITER=1000000 +BIN_NAME="gen-ust-events" +SESSION_NAME="high-throughput" +EVENT_NAME="tp:tptest" +SESSIOND_CTRL_PORT=5342 +SESSIOND_DATA_PORT=5343 +DEFAULT_IF="lo" + +TRACE_PATH=$(mktemp -d) + +source $TESTDIR/utils.sh + +print_test_banner "$TEST_DESC" + +if [ ! -x "$CURDIR/$BIN_NAME" ]; then + echo -e "No UST nevents binary detected. Passing." + exit 0 +fi + +if [ "$(id -u)" != "0" ]; then + echo "This test must be running as root to set bandwith limits. Aborting" + # Exit status 0 so the tests can continue + exit 0 +fi + +function set_bw_limit +{ + limit=$1 + echo -n "Setting bandwith limits to ${limit}kbits... " + tc qdisc add dev $DEFAULT_IF root handle 1: htb default 15 >/dev/null 2>&1 + tc class add dev $DEFAULT_IF parent 1: classid 1:1 htb rate ${limit}kbit ceil ${limit}kbit >/dev/null 2>&1 + + # FIXME: Timeout when setting limits on ctrl port. + #tc filter add dev $DEFAULT_IF parent 1: protocol ip u32 match ip dport $SESSIOND_CTRL_PORT 0xffff flowid 1:1 >/dev/null 2>&1 + + tc filter add dev $DEFAULT_IF parent 1: protocol ip u32 match ip dport $SESSIOND_DATA_PORT 0xffff flowid 1:1 >/dev/null 2>&1 + print_ok +} + +function reset_bw_limit +{ + echo -n "Resetting bandwith limits... " + tc qdisc del dev $DEFAULT_IF root >/dev/null 2>&1 + print_ok +} + +function create_lttng_session_with_uri +{ + sess_name=$1 + uri=$2 + # Create session with custom URI + $TESTDIR/../src/bin/lttng/$LTTNG_BIN create -U $uri $sess_name >/dev/null 2>&1 +} + +function enable_lttng_consumer +{ + uri=$1 + # Create session with custom URI + $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-consumer -u $uri >/dev/null 2>&1 +} + +function run_apps +{ + for i in `seq 1 $NR_APP_ITER`; do + ./$CURDIR/$BIN_NAME $NR_ITER & >/dev/null 2>&1 + done +} + +function wait_apps +{ + echo "Waiting for applications to end" + while [ -n "$(pidof $BIN_NAME)" ]; do + echo -n "." + sleep 1 + done + echo "" +} + +function test_high_throughput +{ + NETWORK_URI="net://localhost" + create_lttng_session_with_uri $SESSION_NAME $NETWORK_URI + enable_lttng_consumer $NETWORK_URI + enable_ust_lttng_event $SESSION_NAME $EVENT_NAME + start_lttng_tracing $SESSION_NAME + run_apps + wait_apps + + # FIXME: Should not be necessary... + #echo "Sleeping..." + #sleep 180 + + stop_lttng_tracing $SESSION_NAME + destroy_lttng_session $SESSION_NAME + validate_event_count +} + +function validate_event_count +{ + + TEMP_FILE=$(mktemp) + TEMP_FILE_2=$(mktemp) + + traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l) + babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2 + + cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE + + dropped=0 + while read line; + do + let dropped=$dropped+$line + done < $TEMP_FILE + + let total=$dropped+$traced + let wanted=$NR_APP_ITER*$NR_ITER + + rm -rf $TRACE_PATH + rm $TEMP_FILE $TEMP_FILE_2 + + if [ $wanted -ne $total ]; then + echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... " + print_fail + return 1 + else + echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... " + print_ok + return 0 + fi +} + +function interrupt_cleanup() +{ + echo -en "\n*** Exiting ***\n" + stop_lttng_relayd + stop_lttng_sessiond + reset_bw_limit + exit 1 +} + +# Catch sigint and try to cleanup limits +trap interrupt_cleanup SIGINT + +BW_LIMITS=(3200 1600 800 400 200 100 50 25) +for BW in ${BW_LIMITS[@]}; +do + echo "" + echo -e "=== Testing high-throughput with bandwith limit set to ${BW}kbits" + set_bw_limit $BW + + start_lttng_sessiond + start_lttng_relayd "-o $TRACE_PATH" + test_high_throughput + result=$? + stop_lttng_relayd + stop_lttng_sessiond + reset_bw_limit + + if [ $result -ne 0 ]; then + exit 1 + fi +done + diff --git a/tests/tools/streaming/runall b/tests/tools/streaming/runall index 6dffd78..a93dcfa 100755 --- a/tests/tools/streaming/runall +++ b/tests/tools/streaming/runall @@ -2,7 +2,7 @@ DIR=$(dirname $0) -tests=( $DIR/unit_tests $DIR/uri_switch $DIR/run-kernel $DIR/run-ust ) +tests=( $DIR/unit_tests $DIR/uri_switch $DIR/high_through_limits $DIR/run-kernel $DIR/run-ust ) exit_code=0 function start_tests () -- 1.7.12 From yannick.brosseau at gmail.com Tue Sep 25 14:20:54 2012 From: yannick.brosseau at gmail.com (Yannick Brosseau) Date: Tue, 25 Sep 2012 14:20:54 -0400 Subject: [lttng-dev] CTF model.emf.uri precision In-Reply-To: <20120925022530.GA12625@Krystal> References: <5060C80C.4030600@ericsson.com> <20120925022530.GA12625@Krystal> Message-ID: <5061F606.5000504@gmail.com> On 2012-09-24 22:25, Mathieu Desnoyers wrote: > * Matthew Khouzam (matthew.khouzam at ericsson.com) wrote: >> Hi tracing paladins, >> I was going over the most recent CTF specs. I am curious, at the line: >> 1176 "model.emf.uri = "string";" this looks like a reference to >> something from eclipse modeling framework. >> http://download.eclipse.org/modeling/emf/emf/javadoc/2.7.0/org/eclipse/emf/common/util/URI.html >> >> Is this part of the CTF specification? Shouldn't this be called >> model.uri or model_uri to respect the naming convention? > if we only call it model.uri, and come up with other model URIs that we > want to encode in the future (not emf-related), then we would be > stucked, wouldn't we ? > > What is the benefit of removing the "emf" part ? > I don't see the benifit of having the "emf". From what I see, its just an URI, so there is no real link to that an EMF. We could put any kind of model there?!?. Also, why not just having a generic way to add a constant string to the event? Yannick From matthew.khouzam at ericsson.com Tue Sep 25 14:39:24 2012 From: matthew.khouzam at ericsson.com (Matthew Khouzam) Date: Tue, 25 Sep 2012 14:39:24 -0400 Subject: [lttng-dev] CTF model.emf.uri precision In-Reply-To: <5061F606.5000504@gmail.com> References: <5060C80C.4030600@ericsson.com> <20120925022530.GA12625@Krystal> <5061F606.5000504@gmail.com> Message-ID: <5061FA5C.90201@ericsson.com> A fun solution could be a map of key values where you can put everything: like event{ eventNameherething :={ {"loglevel" , "1"}, {"model.emf.uri" , "www.thingy"}, {"drink.coca.cola.(tm)" , "pepsi"}, ... } fields:=... } On 12-09-25 02:20 PM, Yannick Brosseau wrote: > On 2012-09-24 22:25, Mathieu Desnoyers wrote: >> * Matthew Khouzam (matthew.khouzam at ericsson.com) wrote: >>> Hi tracing paladins, >>> I was going over the most recent CTF specs. I am curious, at the line: >>> 1176 "model.emf.uri = "string";" this looks like a reference to >>> something from eclipse modeling framework. >>> http://download.eclipse.org/modeling/emf/emf/javadoc/2.7.0/org/eclipse/emf/common/util/URI.html >>> >>> Is this part of the CTF specification? Shouldn't this be called >>> model.uri or model_uri to respect the naming convention? >> if we only call it model.uri, and come up with other model URIs that we >> want to encode in the future (not emf-related), then we would be >> stucked, wouldn't we ? >> >> What is the benefit of removing the "emf" part ? >> > I don't see the benifit of having the "emf". From what I see, its just > an URI, so there is no real link to that an EMF. We could put any kind > of model there?!?. > > Also, why not just having a generic way to add a constant string to the > event? > > Yannick > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev From mathieu.desnoyers at efficios.com Tue Sep 25 17:23:11 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 25 Sep 2012 17:23:11 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: Change sempahore to pthread conditions In-Reply-To: <1348500827-8921-1-git-send-email-dgoulet@efficios.com> References: <1348500827-8921-1-git-send-email-dgoulet@efficios.com> Message-ID: <20120925212311.GA19366@Krystal> * David Goulet (dgoulet at efficios.com) wrote: > Fixes #324 > > Signed-off-by: David Goulet > --- > src/bin/lttng-sessiond/consumer.h | 21 +++++- > src/bin/lttng-sessiond/main.c | 127 ++++++++++++++++++++++++++++--------- > 2 files changed, 116 insertions(+), 32 deletions(-) > > diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h > index 1337f32..6639bd8 100644 > --- a/src/bin/lttng-sessiond/consumer.h > +++ b/src/bin/lttng-sessiond/consumer.h > @@ -18,8 +18,6 @@ > #ifndef _CONSUMER_H > #define _CONSUMER_H > > -#include > - > #include > #include > #include > @@ -54,7 +52,24 @@ struct consumer_data { > enum lttng_consumer_type type; > > pthread_t thread; /* Worker thread interacting with the consumer */ > - sem_t sem; > + > + /* Conditions used by the consumer thread to indicate readiness. */ > + pthread_cond_t cond; > + pthread_condattr_t condattr; > + pthread_mutex_t cond_mutex; > + > + /* > + * This is a flag condition indicating that the consumer thread is ready > + * and connected to the lttng-consumerd daemon. This flag MUST only be > + * updated by locking the condition mutex above or before spawning a > + * consumer thread. > + * > + * A value of 0 means that the thread is NOT ready. A value of 1 means that > + * the thread consumer did connect successfully to the lttng-consumerd > + * daemon. A negative value indicates that there is been an error and the > + * thread as likely quit. as -> has > + */ > + int consumer_thread_is_ready; > > /* Mutex to control consumerd pid assignation */ > pthread_mutex_t pid_mutex; > diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c > index 730ac65..2fb8700 100644 > --- a/src/bin/lttng-sessiond/main.c > +++ b/src/bin/lttng-sessiond/main.c > @@ -21,7 +21,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -81,7 +80,10 @@ static int is_root; /* Set to 1 if the daemon is running as root */ > static pid_t ppid; /* Parent PID for --sig-parent option */ > static char *rundir; > > -/* Consumer daemon specific control data */ > +/* > + * Consumer daemon specific control data. Every value not initialized here is > + * set to 0 by the static definition. > + */ > static struct consumer_data kconsumer_data = { > .type = LTTNG_CONSUMER_KERNEL, > .err_unix_sock_path = DEFAULT_KCONSUMERD_ERR_SOCK_PATH, > @@ -90,6 +92,8 @@ static struct consumer_data kconsumer_data = { > .cmd_sock = -1, > .pid_mutex = PTHREAD_MUTEX_INITIALIZER, > .lock = PTHREAD_MUTEX_INITIALIZER, > + .cond = PTHREAD_COND_INITIALIZER, > + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, > }; > static struct consumer_data ustconsumer64_data = { > .type = LTTNG_CONSUMER64_UST, > @@ -99,6 +103,8 @@ static struct consumer_data ustconsumer64_data = { > .cmd_sock = -1, > .pid_mutex = PTHREAD_MUTEX_INITIALIZER, > .lock = PTHREAD_MUTEX_INITIALIZER, > + .cond = PTHREAD_COND_INITIALIZER, > + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, > }; > static struct consumer_data ustconsumer32_data = { > .type = LTTNG_CONSUMER32_UST, > @@ -108,6 +114,8 @@ static struct consumer_data ustconsumer32_data = { > .cmd_sock = -1, > .pid_mutex = PTHREAD_MUTEX_INITIALIZER, > .lock = PTHREAD_MUTEX_INITIALIZER, > + .cond = PTHREAD_COND_INITIALIZER, > + .cond_mutex = PTHREAD_MUTEX_INITIALIZER, > }; > > /* Shared between threads */ > @@ -789,6 +797,20 @@ error_poll_create: > } > > /* > + * Signal pthread condition of the consumer data that the thread. > + */ > +static void signal_consumer_condition(struct consumer_data *data, int state) > +{ > + pthread_mutex_lock(&data->cond_mutex); > + > + /* Indicates that the thread is ready for action! */ > + data->consumer_thread_is_ready = state; the comment does not match the fact that state can be set to 0 here, thus meaning "not ready" for action anymore ? > + (void) pthread_cond_signal(&data->cond); > + > + pthread_mutex_unlock(&data->cond_mutex); > +} > + > +/* > * This thread manage the consumer error sent back to the session daemon. > */ > static void *thread_manage_consumer(void *data) > @@ -886,13 +908,13 @@ restart: > consumer_data->cmd_sock = > lttcomm_connect_unix_sock(consumer_data->cmd_unix_sock_path); > if (consumer_data->cmd_sock < 0) { > - sem_post(&consumer_data->sem); > + /* On error, signal condition and quit. */ > + signal_consumer_condition(consumer_data, -1); > PERROR("consumer connect"); > goto error; > } > - /* Signal condition to tell that the kconsumerd is ready */ > - sem_post(&consumer_data->sem); > - DBG("consumer command socket ready"); > + signal_consumer_condition(consumer_data, 1); > + DBG("Consumer command socket ready"); > } else { > ERR("consumer error when waiting for SOCK_READY : %s", > lttcomm_get_readable_code(-code)); > @@ -1446,59 +1468,106 @@ error_create_poll: > */ > static int spawn_consumer_thread(struct consumer_data *consumer_data) > { > - int ret; > + int ret, clock_ret; > struct timespec timeout; > > - timeout.tv_sec = DEFAULT_SEM_WAIT_TIMEOUT; > - timeout.tv_nsec = 0; > + /* Make sure we set the readiness flag to 0 because we are NOT ready */ > + consumer_data->consumer_thread_is_ready = 0; > > - /* Setup semaphore */ > - ret = sem_init(&consumer_data->sem, 0, 0); > - if (ret < 0) { > - PERROR("sem_init consumer semaphore"); > + /* Setup pthread condition */ > + ret = pthread_condattr_init(&consumer_data->condattr); > + if (ret != 0) { > + errno = ret; > + PERROR("pthread_condattr_init consumer data"); > + goto error; > + } > + > + /* > + * Set the monotonic clock in order to make sure we DO NOT jump in time > + * between the clock_gettime() call and the timedwait call. See bug #324 > + * for a more details and how we noticed it. > + */ > + ret = pthread_condattr_setclock(&consumer_data->condattr, CLOCK_MONOTONIC); > + if (ret != 0) { > + errno = ret; > + PERROR("pthread_condattr_setclock consumer data"); > goto error; > } > > - ret = pthread_create(&consumer_data->thread, NULL, > - thread_manage_consumer, consumer_data); > + ret = pthread_cond_init(&consumer_data->cond, &consumer_data->condattr); > + if (ret != 0) { > + errno = ret; > + PERROR("pthread_cond_init consumer data"); > + goto error; > + } > + > + ret = pthread_create(&consumer_data->thread, NULL, thread_manage_consumer, > + consumer_data); > if (ret != 0) { > PERROR("pthread_create consumer"); > ret = -1; > goto error; > } > > + /* We are about to wait on a pthread condition */ > + pthread_mutex_lock(&consumer_data->cond_mutex); > + > /* Get time for sem_timedwait absolute timeout */ > - ret = clock_gettime(CLOCK_REALTIME, &timeout); > - if (ret < 0) { > - PERROR("clock_gettime spawn consumer"); > - /* Infinite wait for the kconsumerd thread to be ready */ > - ret = sem_wait(&consumer_data->sem); > - } else { > - /* Normal timeout if the gettime was successful */ > - timeout.tv_sec += DEFAULT_SEM_WAIT_TIMEOUT; > - ret = sem_timedwait(&consumer_data->sem, &timeout); > + clock_ret = clock_gettime(CLOCK_MONOTONIC, &timeout); > + /* > + * Set the timeout for the condition timed wait even if the clock gettime > + * call fails since we might loop on that call and we want to avoid to > + * incremente the timeout too many times. incremente -> increment > + */ > + timeout.tv_sec += DEFAULT_SEM_WAIT_TIMEOUT; > + > + /* Make sure that ret is never set to ETIMEDOUT before reaching the loop */ Just commenting that we reset it would be fine. What matters here is that the loop could be skipped in some conditions, which is why setting it to 0 matters. The rest looks good. So after fixing those cosmetic issues, please add my Acked-by. Thanks! Mathieu > + ret = 0; > + > + /* > + * Loop until the condition is reached or when a timeout is reached. Note > + * that the pthread_cond_timedwait(P) man page specifies that EINTR can NOT > + * be returned but the pthread_cond(3), from the glibc-doc, says that it is > + * possible. This loop does not take any chances and works with both of > + * them. > + */ > + while (!consumer_data->consumer_thread_is_ready && ret != ETIMEDOUT) { > + if (clock_ret < 0) { > + PERROR("clock_gettime spawn consumer"); > + /* Infinite wait for the consumerd thread to be ready */ > + ret = pthread_cond_wait(&consumer_data->cond, > + &consumer_data->cond_mutex); > + } else { > + ret = pthread_cond_timedwait(&consumer_data->cond, > + &consumer_data->cond_mutex, &timeout); > + } > } > > - if (ret < 0) { > - if (errno == ETIMEDOUT) { > + /* Release the pthread condition */ > + pthread_mutex_unlock(&consumer_data->cond_mutex); > + > + if (ret != 0) { > + errno = ret; > + if (ret == ETIMEDOUT) { > /* > * Call has timed out so we kill the kconsumerd_thread and return > * an error. > */ > - ERR("The consumer thread was never ready. Killing it"); > + ERR("Condition timed out. The consumer thread was never ready." > + " Killing it"); > ret = pthread_cancel(consumer_data->thread); > if (ret < 0) { > PERROR("pthread_cancel consumer thread"); > } > } else { > - PERROR("semaphore wait failed consumer thread"); > + PERROR("pthread_cond_wait failed consumer thread"); > } > goto error; > } > > pthread_mutex_lock(&consumer_data->pid_mutex); > if (consumer_data->pid == 0) { > - ERR("Kconsumerd did not start"); > + ERR("Consumerd did not start"); > pthread_mutex_unlock(&consumer_data->pid_mutex); > goto error; > } > -- > 1.7.10.4 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From hollis_blanchard at mentor.com Tue Sep 25 19:33:17 2012 From: hollis_blanchard at mentor.com (Hollis Blanchard) Date: Tue, 25 Sep 2012 16:33:17 -0700 Subject: [lttng-dev] lttng list missing tracepoints? Message-ID: <50623F3D.7090908@mentor.com> I'm trying to use the net_dev_xmit tracepoint, but it's not showing up in my traces. It's not listed by 'lttng list -k', but it is present in debugfs/tracing/available_events. The reporting problem seems to be on the kernel side, because kernel_list_events() in lttng-sessiond also doesn't see any net events. I'm suddenly thinking I must have I misunderstood something, because I see lttng-modules 2.0.2 contains its own tracepoint definitions (e.g. instrumentation/events/lttng-module/block.h), and indeed, only those events seem to be known to lttng. How can I get at all the other tracepoints which are already in the kernel? Is this "feature #6" in lttng-modules TODO file? Thanks! lttng list -k says: timer_init (loglevel: TRACE_EMERG (0)) (type: tracepoint) timer_start (loglevel: TRACE_EMERG (0)) (type: tracepoint) timer_expire_entry (loglevel: TRACE_EMERG (0)) (type: tracepoint) timer_expire_exit (loglevel: TRACE_EMERG (0)) (type: tracepoint) timer_cancel (loglevel: TRACE_EMERG (0)) (type: tracepoint) hrtimer_init (loglevel: TRACE_EMERG (0)) (type: tracepoint) hrtimer_start (loglevel: TRACE_EMERG (0)) (type: tracepoint) hrtimer_expire_entry (loglevel: TRACE_EMERG (0)) (type: tracepoint) hrtimer_expire_exit (loglevel: TRACE_EMERG (0)) (type: tracepoint) hrtimer_cancel (loglevel: TRACE_EMERG (0)) (type: tracepoint) itimer_state (loglevel: TRACE_EMERG (0)) (type: tracepoint) itimer_expire (loglevel: TRACE_EMERG (0)) (type: tracepoint) lttng_statedump_start (loglevel: TRACE_EMERG (0)) (type: tracepoint) lttng_statedump_end (loglevel: TRACE_EMERG (0)) (type: tracepoint) lttng_statedump_process_state (loglevel: TRACE_EMERG (0)) (type: tracepoint) lttng_statedump_file_descriptor (loglevel: TRACE_EMERG (0)) (type: tracepoint) lttng_statedump_vm_map (loglevel: TRACE_EMERG (0)) (type: tracepoint) lttng_statedump_network_interface (loglevel: TRACE_EMERG (0)) (type: tracepoint) lttng_statedump_interrupt (loglevel: TRACE_EMERG (0)) (type: tracepoint) signal_generate (loglevel: TRACE_EMERG (0)) (type: tracepoint) signal_deliver (loglevel: TRACE_EMERG (0)) (type: tracepoint) signal_overflow_fail (loglevel: TRACE_EMERG (0)) (type: tracepoint) signal_lose_info (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_wakeup (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_switch (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_migrate_task (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_process_free (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_process_exit (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_wait_task (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_process_wait (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_process_fork (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_stat_wait (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_stat_sleep (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_stat_iowait (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_stat_runtime (loglevel: TRACE_EMERG (0)) (type: tracepoint) sched_pi_setprio (loglevel: TRACE_EMERG (0)) (type: tracepoint) irq_handler_entry (loglevel: TRACE_EMERG (0)) (type: tracepoint) irq_handler_exit (loglevel: TRACE_EMERG (0)) (type: tracepoint) softirq_entry (loglevel: TRACE_EMERG (0)) (type: tracepoint) softirq_exit (loglevel: TRACE_EMERG (0)) (type: tracepoint) softirq_raise (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_rq_abort (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_rq_requeue (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_rq_complete (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_rq_insert (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_rq_issue (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_bio_bounce (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_bio_complete (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_bio_backmerge (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_bio_frontmerge (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_bio_queue (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_getrq (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_sleeprq (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_plug (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_unplug (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_split (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_bio_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) block_rq_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) debugfs/tracing/available_events: btrfs:btrfs_transaction_commit btrfs:btrfs_inode_new btrfs:btrfs_inode_request btrfs:btrfs_inode_evict btrfs:btrfs_get_extent btrfs:btrfs_ordered_extent_add btrfs:btrfs_ordered_extent_remove btrfs:btrfs_ordered_extent_start btrfs:btrfs_ordered_extent_put btrfs:__extent_writepage btrfs:btrfs_writepage_end_io_hook btrfs:btrfs_sync_file btrfs:btrfs_sync_fs btrfs:btrfs_delayed_tree_ref btrfs:btrfs_delayed_data_ref btrfs:btrfs_delayed_ref_head btrfs:btrfs_chunk_alloc btrfs:btrfs_chunk_free btrfs:btrfs_cow_block btrfs:btrfs_reserved_extent_alloc btrfs:btrfs_reserved_extent_free mac80211:drv_return_void mac80211:drv_return_int mac80211:drv_return_bool mac80211:drv_return_u64 mac80211:drv_start mac80211:drv_suspend mac80211:drv_resume mac80211:drv_stop mac80211:drv_add_interface mac80211:drv_change_interface mac80211:drv_remove_interface mac80211:drv_config mac80211:drv_bss_info_changed mac80211:drv_tx_sync mac80211:drv_finish_tx_sync mac80211:drv_prepare_multicast mac80211:drv_configure_filter mac80211:drv_set_tim mac80211:drv_set_key mac80211:drv_update_tkip_key mac80211:drv_hw_scan mac80211:drv_cancel_hw_scan mac80211:drv_sched_scan_start mac80211:drv_sched_scan_stop mac80211:drv_sw_scan_start mac80211:drv_sw_scan_complete mac80211:drv_get_stats mac80211:drv_get_tkip_seq mac80211:drv_set_frag_threshold mac80211:drv_set_rts_threshold mac80211:drv_set_coverage_class mac80211:drv_sta_notify mac80211:drv_sta_add mac80211:drv_sta_remove mac80211:drv_conf_tx mac80211:drv_get_tsf mac80211:drv_set_tsf mac80211:drv_reset_tsf mac80211:drv_tx_last_beacon mac80211:drv_ampdu_action mac80211:drv_get_survey mac80211:drv_flush mac80211:drv_channel_switch mac80211:drv_set_antenna mac80211:drv_get_antenna mac80211:drv_remain_on_channel mac80211:drv_cancel_remain_on_channel mac80211:drv_offchannel_tx mac80211:drv_set_ringparam mac80211:drv_get_ringparam mac80211:drv_tx_frames_pending mac80211:drv_offchannel_tx_cancel_wait mac80211:drv_set_bitrate_mask mac80211:drv_set_rekey_data mac80211:drv_rssi_callback mac80211:api_start_tx_ba_session mac80211:api_start_tx_ba_cb mac80211:api_stop_tx_ba_session mac80211:api_stop_tx_ba_cb mac80211:api_restart_hw mac80211:api_beacon_loss mac80211:api_connection_loss mac80211:api_cqm_rssi_notify mac80211:api_scan_completed mac80211:api_sched_scan_results mac80211:api_sched_scan_stopped mac80211:api_sta_block_awake mac80211:api_chswitch_done mac80211:api_ready_on_channel mac80211:api_remain_on_channel_expired mac80211:api_gtk_rekey_notify mac80211:api_enable_rssi_reports mac80211:wake_queue mac80211:stop_queue skb:kfree_skb skb:consume_skb skb:skb_copy_datagram_iovec net:net_dev_xmit net:net_dev_queue net:netif_receive_skb net:netif_rx napi:napi_poll sock:sock_rcvqueue_full sock:sock_exceed_buf_limit udp:udp_fail_queue_rcv_skb asoc:snd_soc_reg_write asoc:snd_soc_reg_read asoc:snd_soc_preg_write asoc:snd_soc_preg_read asoc:snd_soc_bias_level_start asoc:snd_soc_bias_level_done asoc:snd_soc_dapm_start asoc:snd_soc_dapm_done asoc:snd_soc_dapm_widget_power asoc:snd_soc_dapm_widget_event_start asoc:snd_soc_dapm_widget_event_done asoc:snd_soc_dapm_walk_done asoc:snd_soc_jack_irq asoc:snd_soc_jack_report asoc:snd_soc_jack_notify asoc:snd_soc_cache_sync scsi:scsi_dispatch_cmd_start scsi:scsi_dispatch_cmd_error scsi:scsi_dispatch_cmd_done scsi:scsi_dispatch_cmd_timeout scsi:scsi_eh_wakeup drm:drm_vblank_event drm:drm_vblank_event_queued drm:drm_vblank_event_delivered regulator:regulator_enable regulator:regulator_enable_delay regulator:regulator_enable_complete regulator:regulator_disable regulator:regulator_disable_complete regulator:regulator_set_voltage regulator:regulator_set_voltage_complete gpio:gpio_direction gpio:gpio_value block:block_rq_abort block:block_rq_requeue block:block_rq_complete block:block_rq_insert block:block_rq_issue block:block_bio_bounce block:block_bio_complete block:block_bio_backmerge block:block_bio_frontmerge block:block_bio_queue block:block_getrq block:block_sleeprq block:block_plug block:block_unplug block:block_split block:block_bio_remap block:block_rq_remap jbd2:jbd2_checkpoint jbd2:jbd2_start_commit jbd2:jbd2_commit_locking jbd2:jbd2_commit_flushing jbd2:jbd2_commit_logging jbd2:jbd2_end_commit jbd2:jbd2_submit_inode_data jbd2:jbd2_run_stats jbd2:jbd2_checkpoint_stats jbd2:jbd2_cleanup_journal_tail jbd:jbd_checkpoint jbd:jbd_start_commit jbd:jbd_commit_locking jbd:jbd_commit_flushing jbd:jbd_commit_logging jbd:jbd_drop_transaction jbd:jbd_end_commit jbd:jbd_do_submit_data jbd:jbd_cleanup_journal_tail jbd:jbd_update_superblock_end ext4:ext4_free_inode ext4:ext4_request_inode ext4:ext4_allocate_inode ext4:ext4_evict_inode ext4:ext4_drop_inode ext4:ext4_mark_inode_dirty ext4:ext4_begin_ordered_truncate ext4:ext4_write_begin ext4:ext4_da_write_begin ext4:ext4_ordered_write_end ext4:ext4_writeback_write_end ext4:ext4_journalled_write_end ext4:ext4_da_write_end ext4:ext4_da_writepages ext4:ext4_da_write_pages ext4:ext4_da_writepages_result ext4:ext4_writepage ext4:ext4_readpage ext4:ext4_releasepage ext4:ext4_invalidatepage ext4:ext4_discard_blocks ext4:ext4_mb_new_inode_pa ext4:ext4_mb_new_group_pa ext4:ext4_mb_release_inode_pa ext4:ext4_mb_release_group_pa ext4:ext4_discard_preallocations ext4:ext4_mb_discard_preallocations ext4:ext4_request_blocks ext4:ext4_allocate_blocks ext4:ext4_free_blocks ext4:ext4_sync_file_enter ext4:ext4_sync_file_exit ext4:ext4_sync_fs ext4:ext4_alloc_da_blocks ext4:ext4_mballoc_alloc ext4:ext4_mballoc_prealloc ext4:ext4_mballoc_discard ext4:ext4_mballoc_free ext4:ext4_forget ext4:ext4_da_update_reserve_space ext4:ext4_da_reserve_space ext4:ext4_da_release_space ext4:ext4_mb_bitmap_load ext4:ext4_mb_buddy_bitmap_load ext4:ext4_read_block_bitmap_load ext4:ext4_load_inode_bitmap ext4:ext4_direct_IO_enter ext4:ext4_direct_IO_exit ext4:ext4_fallocate_enter ext4:ext4_fallocate_exit ext4:ext4_unlink_enter ext4:ext4_unlink_exit ext4:ext4_truncate_enter ext4:ext4_truncate_exit ext4:ext4_ext_map_blocks_enter ext4:ext4_ind_map_blocks_enter ext4:ext4_ext_map_blocks_exit ext4:ext4_ind_map_blocks_exit ext4:ext4_ext_load_extent ext4:ext4_load_inode ext4:ext4_journal_start ext4:ext4_trim_extent ext4:ext4_trim_all_free ext3:ext3_free_inode ext3:ext3_request_inode ext3:ext3_allocate_inode ext3:ext3_evict_inode ext3:ext3_drop_inode ext3:ext3_mark_inode_dirty ext3:ext3_write_begin ext3:ext3_ordered_write_end ext3:ext3_writeback_write_end ext3:ext3_journalled_write_end ext3:ext3_ordered_writepage ext3:ext3_writeback_writepage ext3:ext3_journalled_writepage ext3:ext3_readpage ext3:ext3_releasepage ext3:ext3_invalidatepage ext3:ext3_discard_blocks ext3:ext3_request_blocks ext3:ext3_allocate_blocks ext3:ext3_free_blocks ext3:ext3_sync_file_enter ext3:ext3_sync_file_exit ext3:ext3_sync_fs ext3:ext3_rsv_window_add ext3:ext3_discard_reservation ext3:ext3_alloc_new_reservation ext3:ext3_reserved ext3:ext3_forget ext3:ext3_read_block_bitmap ext3:ext3_direct_IO_enter ext3:ext3_direct_IO_exit ext3:ext3_unlink_enter ext3:ext3_unlink_exit ext3:ext3_truncate_enter ext3:ext3_truncate_exit ext3:ext3_get_blocks_enter ext3:ext3_get_blocks_exit ext3:ext3_load_inode writeback:writeback_nothread writeback:writeback_queue writeback:writeback_exec writeback:writeback_start writeback:writeback_written writeback:writeback_wait writeback:writeback_pages_written writeback:writeback_nowork writeback:writeback_wake_background writeback:writeback_wake_thread writeback:writeback_wake_forker_thread writeback:writeback_bdi_register writeback:writeback_bdi_unregister writeback:writeback_thread_start writeback:writeback_thread_stop writeback:balance_dirty_start writeback:balance_dirty_wait writeback:balance_dirty_written writeback:wbc_writepage writeback:writeback_queue_io writeback:global_dirty_state writeback:writeback_congestion_wait writeback:writeback_wait_iff_congested writeback:writeback_single_inode_requeue writeback:writeback_single_inode kmem:kmalloc kmem:kmem_cache_alloc kmem:kmalloc_node kmem:kmem_cache_alloc_node kmem:kfree kmem:kmem_cache_free kmem:mm_page_free_direct kmem:mm_pagevec_free kmem:mm_page_alloc kmem:mm_page_alloc_zone_locked kmem:mm_page_pcpu_drain kmem:mm_page_alloc_extfrag vmscan:mm_vmscan_kswapd_sleep vmscan:mm_vmscan_kswapd_wake vmscan:mm_vmscan_wakeup_kswapd vmscan:mm_vmscan_direct_reclaim_begin vmscan:mm_vmscan_memcg_reclaim_begin vmscan:mm_vmscan_memcg_softlimit_reclaim_begin vmscan:mm_vmscan_direct_reclaim_end vmscan:mm_vmscan_memcg_reclaim_end vmscan:mm_vmscan_memcg_softlimit_reclaim_end vmscan:mm_shrink_slab_start vmscan:mm_shrink_slab_end vmscan:mm_vmscan_lru_isolate vmscan:mm_vmscan_memcg_isolate vmscan:mm_vmscan_writepage vmscan:mm_vmscan_lru_shrink_inactive vmscan:replace_swap_token vmscan:put_swap_token vmscan:disable_swap_token vmscan:update_swap_token_priority power:cpu_idle power:cpu_frequency power:machine_suspend power:power_start power:power_frequency power:power_end power:clock_enable power:clock_disable power:clock_set_rate power:power_domain_target module:module_load module:module_free module:module_get module:module_put module:module_request workqueue:workqueue_queue_work workqueue:workqueue_activate_work workqueue:workqueue_execute_start workqueue:workqueue_execute_end signal:signal_generate signal:signal_deliver signal:signal_overflow_fail signal:signal_lose_info timer:timer_init timer:timer_start timer:timer_expire_entry timer:timer_expire_exit timer:timer_cancel timer:hrtimer_init timer:hrtimer_start timer:hrtimer_expire_entry timer:hrtimer_expire_exit timer:hrtimer_cancel timer:itimer_state timer:itimer_expire irq:irq_handler_entry irq:irq_handler_exit irq:softirq_entry irq:softirq_exit irq:softirq_raise sched:sched_kthread_stop sched:sched_kthread_stop_ret sched:sched_wakeup sched:sched_wakeup_new sched:sched_switch sched:sched_migrate_task sched:sched_process_free sched:sched_process_exit sched:sched_wait_task sched:sched_process_wait sched:sched_process_fork sched:sched_stat_wait sched:sched_stat_sleep sched:sched_stat_iowait sched:sched_stat_runtime sched:sched_pi_setprio -- Hollis Blanchard Product Owner, Sourcery Analyzer Mentor Graphics, Embedded Systems Division -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.desnoyers at efficios.com Tue Sep 25 20:56:09 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Tue, 25 Sep 2012 20:56:09 -0400 Subject: [lttng-dev] [PULL request lttng-tools] please pull filter fixes from compudj-pull Message-ID: <20120926005609.GA9731@Krystal> Hi David, please pull from: git://git.dorsal.polymtl.ca/~compudj/lttng-tools branch: compudj-pull It is at commit a5dcf53141650ee83af83caf73ab137205ff15a1 Christian and I did fixes in the filter area. Thanks, Mathieu -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Wed Sep 26 12:16:03 2012 From: dgoulet at efficios.com (David Goulet) Date: Wed, 26 Sep 2012 12:16:03 -0400 Subject: [lttng-dev] [RELEASE] LTTng-tools 2.1.0-rc4 Message-ID: <50632A43.5020908@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Greetings everyone (including LTTng elves), The lttng-tools project provides a session daemon (lttng-sessiond) that acts as a tracing registry, the "lttng" command line for tracing control, a lttng-ctl library for tracing control and a lttng-relayd for network streaming. Multiple fixes went in this fourth release candidate. Please don't hesitate to report anything via bugs.lttng.org or the lttng-dev mailing list. Here is the changelog for rc4. 2012-09-26 lttng-tools 2.1.0-rc4 * Fix: Change sempahore to pthread conditions * Fix: relayd relay_send_version: handle sscanf return code * Fix relayd: NULL ptr deref * Fix: relayd: possible NULL ptr deref, memory leak, accept fd leak * Tests: add print bytecode to filter grammar test * Cleanup: assign values to bytecode opcodes * Fix: Filter: Fix allocation length error * Fix: Filter: add missing ast free * Tests: Add high throughput with bandwidth limits test * Fix: Returned code when listing kernel channel * Tests: Rename helper functions to have consistent names * Tests: Cleanup redundant code and use printing helper functions * Tests: Add helper functions for printing status and banner * Tests: Add a check for color support when printing status * Fix: Lib lttng-ctl on error returns lttng code * Fix: lttng_set_event_filter() was returning bad error code * Fix: printing [no write] on lttng list -uf * Fix: Disable event on filter error with lttng * Fix: Wrong returned error code on UST enable event * Add consumer commands to lttng.1 man page * Add lttng_health_check(3) man page * Fix: Remove LPOLLNVAL from consumer metadata revents * Fix: Mismatch of field name between ust and tools * Add the written value when listing fields * Fix: Consumer return value check after mmap/splice * Don't send the subbuffer padding for streaming * Fix: Returned error code in consumer on read buffer Project website: http://lttng.org/lttng2.0 Download link: http://lttng.org/files/lttng-tools/lttng-tools-2.1.0-rc4.tar.bz2 Cheers! David -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQYypDAAoJEELoaioR9I02sL8H/2aBibbZ+z2PT3PwW9iOnoCZ MqknMuE4lbhipRd1OQ3w94CX6ylIecoy0V9FL0fOIu1/axx+YpzuZvB0+ThmaZVw PPBATNI+MP/6oXnkYd5wMExTzzCfLp+M47K16JNpl6RhNtBWB7JUgtyri7q+NVCl DlrhI4K/vHy6xvYDfbi7AqMMWA77K6uWAViIu3s49O06aDfN7Nbj04Isn+ac7kRG Xr0FhdyOABLvdBCdmfgQL1R8Sy9d2ts8k9iqDfcQ0ncvlzNVtmy5xdkUVmCd7kzu 47DepWQrh4XhBHmWl9gFuWZwniXQxhf9u85p96jGeatCoNnFBKsX68RdLDOueTk= =Nn1l -----END PGP SIGNATURE----- From barthelemy at crans.org Thu Sep 27 08:23:35 2012 From: barthelemy at crans.org (=?ISO-8859-1?Q?S=E9bastien_Barth=E9l=E9my?=) Date: Thu, 27 Sep 2012 14:23:35 +0200 Subject: [lttng-dev] clarification about the "provider name" argument Message-ID: A tracepoint is defined with a declaration like TRACEPOINT_EVENT( provider_name, tracepoint_name, TP_ARG(), TP_FIELDS()) I wonder what is the meaning and the role of the "provider_name" argument. In other words, what is the "provider" that we name here? Is it the instrumented component which will generate (provide?) the events ? Or is it the probes provider (the library which we LD_PRELOAD when tracing) ? Note that at some places the provider name argument is also named component_name or domain (this last is in lttng-gen-tp source code). A related question is about the constraints on the "provider name" given in the tracepoints definition file. For instance, is it legit to have two files which define different tracepoints with the same provider name, and with two distinct probes provider libraries Something like tp0.h: TRACEPOINT_EVENT( provider_name, tracepoint_name0, TP_ARG(), TP_FIELDS()) and tp1.h: TRACEPOINT_EVENT( provider_name, tracepoint_name1, TP_ARG(), TP_FIELDS()) Thanks! From mathieu.desnoyers at efficios.com Thu Sep 27 09:47:37 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 27 Sep 2012 09:47:37 -0400 Subject: [lttng-dev] lttng list missing tracepoints? In-Reply-To: <50623F3D.7090908@mentor.com> References: <50623F3D.7090908@mentor.com> Message-ID: <20120927134736.GA30945@Krystal> * Hollis Blanchard (hollis_blanchard at mentor.com) wrote: > I'm trying to use the net_dev_xmit tracepoint, but it's not showing up > in my traces. It's not listed by 'lttng list -k', but it is present in > debugfs/tracing/available_events. The reporting problem seems to be on > the kernel side, because kernel_list_events() in lttng-sessiond also > doesn't see any net events. > > I'm suddenly thinking I must have I misunderstood something, because I > see lttng-modules 2.0.2 contains its own tracepoint definitions (e.g. > instrumentation/events/lttng-module/block.h), and indeed, only those > events seem to be known to lttng. How can I get at all the other > tracepoints which are already in the kernel? Is this "feature #6" in > lttng-modules TODO file? yes, exactly, patches are welcome! Thanks! Mathieu > > Thanks! > > > > lttng list -k says: > timer_init (loglevel: TRACE_EMERG (0)) (type: tracepoint) > timer_start (loglevel: TRACE_EMERG (0)) (type: tracepoint) > timer_expire_entry (loglevel: TRACE_EMERG (0)) (type: tracepoint) > timer_expire_exit (loglevel: TRACE_EMERG (0)) (type: tracepoint) > timer_cancel (loglevel: TRACE_EMERG (0)) (type: tracepoint) > hrtimer_init (loglevel: TRACE_EMERG (0)) (type: tracepoint) > hrtimer_start (loglevel: TRACE_EMERG (0)) (type: tracepoint) > hrtimer_expire_entry (loglevel: TRACE_EMERG (0)) (type: tracepoint) > hrtimer_expire_exit (loglevel: TRACE_EMERG (0)) (type: tracepoint) > hrtimer_cancel (loglevel: TRACE_EMERG (0)) (type: tracepoint) > itimer_state (loglevel: TRACE_EMERG (0)) (type: tracepoint) > itimer_expire (loglevel: TRACE_EMERG (0)) (type: tracepoint) > lttng_statedump_start (loglevel: TRACE_EMERG (0)) (type: tracepoint) > lttng_statedump_end (loglevel: TRACE_EMERG (0)) (type: tracepoint) > lttng_statedump_process_state (loglevel: TRACE_EMERG (0)) (type: > tracepoint) > lttng_statedump_file_descriptor (loglevel: TRACE_EMERG (0)) (type: > tracepoint) > lttng_statedump_vm_map (loglevel: TRACE_EMERG (0)) (type: tracepoint) > lttng_statedump_network_interface (loglevel: TRACE_EMERG (0)) > (type: tracepoint) > lttng_statedump_interrupt (loglevel: TRACE_EMERG (0)) (type: > tracepoint) > signal_generate (loglevel: TRACE_EMERG (0)) (type: tracepoint) > signal_deliver (loglevel: TRACE_EMERG (0)) (type: tracepoint) > signal_overflow_fail (loglevel: TRACE_EMERG (0)) (type: tracepoint) > signal_lose_info (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_wakeup (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_switch (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_migrate_task (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_process_free (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_process_exit (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_wait_task (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_process_wait (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_process_fork (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_stat_wait (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_stat_sleep (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_stat_iowait (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_stat_runtime (loglevel: TRACE_EMERG (0)) (type: tracepoint) > sched_pi_setprio (loglevel: TRACE_EMERG (0)) (type: tracepoint) > irq_handler_entry (loglevel: TRACE_EMERG (0)) (type: tracepoint) > irq_handler_exit (loglevel: TRACE_EMERG (0)) (type: tracepoint) > softirq_entry (loglevel: TRACE_EMERG (0)) (type: tracepoint) > softirq_exit (loglevel: TRACE_EMERG (0)) (type: tracepoint) > softirq_raise (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_rq_abort (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_rq_requeue (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_rq_complete (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_rq_insert (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_rq_issue (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_bio_bounce (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_bio_complete (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_bio_backmerge (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_bio_frontmerge (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_bio_queue (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_getrq (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_sleeprq (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_plug (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_unplug (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_split (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_bio_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) > block_rq_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) > > debugfs/tracing/available_events: > > btrfs:btrfs_transaction_commit > btrfs:btrfs_inode_new > btrfs:btrfs_inode_request > btrfs:btrfs_inode_evict > btrfs:btrfs_get_extent > btrfs:btrfs_ordered_extent_add > btrfs:btrfs_ordered_extent_remove > btrfs:btrfs_ordered_extent_start > btrfs:btrfs_ordered_extent_put > btrfs:__extent_writepage > btrfs:btrfs_writepage_end_io_hook > btrfs:btrfs_sync_file > btrfs:btrfs_sync_fs > btrfs:btrfs_delayed_tree_ref > btrfs:btrfs_delayed_data_ref > btrfs:btrfs_delayed_ref_head > btrfs:btrfs_chunk_alloc > btrfs:btrfs_chunk_free > btrfs:btrfs_cow_block > btrfs:btrfs_reserved_extent_alloc > btrfs:btrfs_reserved_extent_free > mac80211:drv_return_void > mac80211:drv_return_int > mac80211:drv_return_bool > mac80211:drv_return_u64 > mac80211:drv_start > mac80211:drv_suspend > mac80211:drv_resume > mac80211:drv_stop > mac80211:drv_add_interface > mac80211:drv_change_interface > mac80211:drv_remove_interface > mac80211:drv_config > mac80211:drv_bss_info_changed > mac80211:drv_tx_sync > mac80211:drv_finish_tx_sync > mac80211:drv_prepare_multicast > mac80211:drv_configure_filter > mac80211:drv_set_tim > mac80211:drv_set_key > mac80211:drv_update_tkip_key > mac80211:drv_hw_scan > mac80211:drv_cancel_hw_scan > mac80211:drv_sched_scan_start > mac80211:drv_sched_scan_stop > mac80211:drv_sw_scan_start > mac80211:drv_sw_scan_complete > mac80211:drv_get_stats > mac80211:drv_get_tkip_seq > mac80211:drv_set_frag_threshold > mac80211:drv_set_rts_threshold > mac80211:drv_set_coverage_class > mac80211:drv_sta_notify > mac80211:drv_sta_add > mac80211:drv_sta_remove > mac80211:drv_conf_tx > mac80211:drv_get_tsf > mac80211:drv_set_tsf > mac80211:drv_reset_tsf > mac80211:drv_tx_last_beacon > mac80211:drv_ampdu_action > mac80211:drv_get_survey > mac80211:drv_flush > mac80211:drv_channel_switch > mac80211:drv_set_antenna > mac80211:drv_get_antenna > mac80211:drv_remain_on_channel > mac80211:drv_cancel_remain_on_channel > mac80211:drv_offchannel_tx > mac80211:drv_set_ringparam > mac80211:drv_get_ringparam > mac80211:drv_tx_frames_pending > mac80211:drv_offchannel_tx_cancel_wait > mac80211:drv_set_bitrate_mask > mac80211:drv_set_rekey_data > mac80211:drv_rssi_callback > mac80211:api_start_tx_ba_session > mac80211:api_start_tx_ba_cb > mac80211:api_stop_tx_ba_session > mac80211:api_stop_tx_ba_cb > mac80211:api_restart_hw > mac80211:api_beacon_loss > mac80211:api_connection_loss > mac80211:api_cqm_rssi_notify > mac80211:api_scan_completed > mac80211:api_sched_scan_results > mac80211:api_sched_scan_stopped > mac80211:api_sta_block_awake > mac80211:api_chswitch_done > mac80211:api_ready_on_channel > mac80211:api_remain_on_channel_expired > mac80211:api_gtk_rekey_notify > mac80211:api_enable_rssi_reports > mac80211:wake_queue > mac80211:stop_queue > skb:kfree_skb > skb:consume_skb > skb:skb_copy_datagram_iovec > net:net_dev_xmit > net:net_dev_queue > net:netif_receive_skb > net:netif_rx > napi:napi_poll > sock:sock_rcvqueue_full > sock:sock_exceed_buf_limit > udp:udp_fail_queue_rcv_skb > asoc:snd_soc_reg_write > asoc:snd_soc_reg_read > asoc:snd_soc_preg_write > asoc:snd_soc_preg_read > asoc:snd_soc_bias_level_start > asoc:snd_soc_bias_level_done > asoc:snd_soc_dapm_start > asoc:snd_soc_dapm_done > asoc:snd_soc_dapm_widget_power > asoc:snd_soc_dapm_widget_event_start > asoc:snd_soc_dapm_widget_event_done > asoc:snd_soc_dapm_walk_done > asoc:snd_soc_jack_irq > asoc:snd_soc_jack_report > asoc:snd_soc_jack_notify > asoc:snd_soc_cache_sync > scsi:scsi_dispatch_cmd_start > scsi:scsi_dispatch_cmd_error > scsi:scsi_dispatch_cmd_done > scsi:scsi_dispatch_cmd_timeout > scsi:scsi_eh_wakeup > drm:drm_vblank_event > drm:drm_vblank_event_queued > drm:drm_vblank_event_delivered > regulator:regulator_enable > regulator:regulator_enable_delay > regulator:regulator_enable_complete > regulator:regulator_disable > regulator:regulator_disable_complete > regulator:regulator_set_voltage > regulator:regulator_set_voltage_complete > gpio:gpio_direction > gpio:gpio_value > block:block_rq_abort > block:block_rq_requeue > block:block_rq_complete > block:block_rq_insert > block:block_rq_issue > block:block_bio_bounce > block:block_bio_complete > block:block_bio_backmerge > block:block_bio_frontmerge > block:block_bio_queue > block:block_getrq > block:block_sleeprq > block:block_plug > block:block_unplug > block:block_split > block:block_bio_remap > block:block_rq_remap > jbd2:jbd2_checkpoint > jbd2:jbd2_start_commit > jbd2:jbd2_commit_locking > jbd2:jbd2_commit_flushing > jbd2:jbd2_commit_logging > jbd2:jbd2_end_commit > jbd2:jbd2_submit_inode_data > jbd2:jbd2_run_stats > jbd2:jbd2_checkpoint_stats > jbd2:jbd2_cleanup_journal_tail > jbd:jbd_checkpoint > jbd:jbd_start_commit > jbd:jbd_commit_locking > jbd:jbd_commit_flushing > jbd:jbd_commit_logging > jbd:jbd_drop_transaction > jbd:jbd_end_commit > jbd:jbd_do_submit_data > jbd:jbd_cleanup_journal_tail > jbd:jbd_update_superblock_end > ext4:ext4_free_inode > ext4:ext4_request_inode > ext4:ext4_allocate_inode > ext4:ext4_evict_inode > ext4:ext4_drop_inode > ext4:ext4_mark_inode_dirty > ext4:ext4_begin_ordered_truncate > ext4:ext4_write_begin > ext4:ext4_da_write_begin > ext4:ext4_ordered_write_end > ext4:ext4_writeback_write_end > ext4:ext4_journalled_write_end > ext4:ext4_da_write_end > ext4:ext4_da_writepages > ext4:ext4_da_write_pages > ext4:ext4_da_writepages_result > ext4:ext4_writepage > ext4:ext4_readpage > ext4:ext4_releasepage > ext4:ext4_invalidatepage > ext4:ext4_discard_blocks > ext4:ext4_mb_new_inode_pa > ext4:ext4_mb_new_group_pa > ext4:ext4_mb_release_inode_pa > ext4:ext4_mb_release_group_pa > ext4:ext4_discard_preallocations > ext4:ext4_mb_discard_preallocations > ext4:ext4_request_blocks > ext4:ext4_allocate_blocks > ext4:ext4_free_blocks > ext4:ext4_sync_file_enter > ext4:ext4_sync_file_exit > ext4:ext4_sync_fs > ext4:ext4_alloc_da_blocks > ext4:ext4_mballoc_alloc > ext4:ext4_mballoc_prealloc > ext4:ext4_mballoc_discard > ext4:ext4_mballoc_free > ext4:ext4_forget > ext4:ext4_da_update_reserve_space > ext4:ext4_da_reserve_space > ext4:ext4_da_release_space > ext4:ext4_mb_bitmap_load > ext4:ext4_mb_buddy_bitmap_load > ext4:ext4_read_block_bitmap_load > ext4:ext4_load_inode_bitmap > ext4:ext4_direct_IO_enter > ext4:ext4_direct_IO_exit > ext4:ext4_fallocate_enter > ext4:ext4_fallocate_exit > ext4:ext4_unlink_enter > ext4:ext4_unlink_exit > ext4:ext4_truncate_enter > ext4:ext4_truncate_exit > ext4:ext4_ext_map_blocks_enter > ext4:ext4_ind_map_blocks_enter > ext4:ext4_ext_map_blocks_exit > ext4:ext4_ind_map_blocks_exit > ext4:ext4_ext_load_extent > ext4:ext4_load_inode > ext4:ext4_journal_start > ext4:ext4_trim_extent > ext4:ext4_trim_all_free > ext3:ext3_free_inode > ext3:ext3_request_inode > ext3:ext3_allocate_inode > ext3:ext3_evict_inode > ext3:ext3_drop_inode > ext3:ext3_mark_inode_dirty > ext3:ext3_write_begin > ext3:ext3_ordered_write_end > ext3:ext3_writeback_write_end > ext3:ext3_journalled_write_end > ext3:ext3_ordered_writepage > ext3:ext3_writeback_writepage > ext3:ext3_journalled_writepage > ext3:ext3_readpage > ext3:ext3_releasepage > ext3:ext3_invalidatepage > ext3:ext3_discard_blocks > ext3:ext3_request_blocks > ext3:ext3_allocate_blocks > ext3:ext3_free_blocks > ext3:ext3_sync_file_enter > ext3:ext3_sync_file_exit > ext3:ext3_sync_fs > ext3:ext3_rsv_window_add > ext3:ext3_discard_reservation > ext3:ext3_alloc_new_reservation > ext3:ext3_reserved > ext3:ext3_forget > ext3:ext3_read_block_bitmap > ext3:ext3_direct_IO_enter > ext3:ext3_direct_IO_exit > ext3:ext3_unlink_enter > ext3:ext3_unlink_exit > ext3:ext3_truncate_enter > ext3:ext3_truncate_exit > ext3:ext3_get_blocks_enter > ext3:ext3_get_blocks_exit > ext3:ext3_load_inode > writeback:writeback_nothread > writeback:writeback_queue > writeback:writeback_exec > writeback:writeback_start > writeback:writeback_written > writeback:writeback_wait > writeback:writeback_pages_written > writeback:writeback_nowork > writeback:writeback_wake_background > writeback:writeback_wake_thread > writeback:writeback_wake_forker_thread > writeback:writeback_bdi_register > writeback:writeback_bdi_unregister > writeback:writeback_thread_start > writeback:writeback_thread_stop > writeback:balance_dirty_start > writeback:balance_dirty_wait > writeback:balance_dirty_written > writeback:wbc_writepage > writeback:writeback_queue_io > writeback:global_dirty_state > writeback:writeback_congestion_wait > writeback:writeback_wait_iff_congested > writeback:writeback_single_inode_requeue > writeback:writeback_single_inode > kmem:kmalloc > kmem:kmem_cache_alloc > kmem:kmalloc_node > kmem:kmem_cache_alloc_node > kmem:kfree > kmem:kmem_cache_free > kmem:mm_page_free_direct > kmem:mm_pagevec_free > kmem:mm_page_alloc > kmem:mm_page_alloc_zone_locked > kmem:mm_page_pcpu_drain > kmem:mm_page_alloc_extfrag > vmscan:mm_vmscan_kswapd_sleep > vmscan:mm_vmscan_kswapd_wake > vmscan:mm_vmscan_wakeup_kswapd > vmscan:mm_vmscan_direct_reclaim_begin > vmscan:mm_vmscan_memcg_reclaim_begin > vmscan:mm_vmscan_memcg_softlimit_reclaim_begin > vmscan:mm_vmscan_direct_reclaim_end > vmscan:mm_vmscan_memcg_reclaim_end > vmscan:mm_vmscan_memcg_softlimit_reclaim_end > vmscan:mm_shrink_slab_start > vmscan:mm_shrink_slab_end > vmscan:mm_vmscan_lru_isolate > vmscan:mm_vmscan_memcg_isolate > vmscan:mm_vmscan_writepage > vmscan:mm_vmscan_lru_shrink_inactive > vmscan:replace_swap_token > vmscan:put_swap_token > vmscan:disable_swap_token > vmscan:update_swap_token_priority > power:cpu_idle > power:cpu_frequency > power:machine_suspend > power:power_start > power:power_frequency > power:power_end > power:clock_enable > power:clock_disable > power:clock_set_rate > power:power_domain_target > module:module_load > module:module_free > module:module_get > module:module_put > module:module_request > workqueue:workqueue_queue_work > workqueue:workqueue_activate_work > workqueue:workqueue_execute_start > workqueue:workqueue_execute_end > signal:signal_generate > signal:signal_deliver > signal:signal_overflow_fail > signal:signal_lose_info > timer:timer_init > timer:timer_start > timer:timer_expire_entry > timer:timer_expire_exit > timer:timer_cancel > timer:hrtimer_init > timer:hrtimer_start > timer:hrtimer_expire_entry > timer:hrtimer_expire_exit > timer:hrtimer_cancel > timer:itimer_state > timer:itimer_expire > irq:irq_handler_entry > irq:irq_handler_exit > irq:softirq_entry > irq:softirq_exit > irq:softirq_raise > sched:sched_kthread_stop > sched:sched_kthread_stop_ret > sched:sched_wakeup > sched:sched_wakeup_new > sched:sched_switch > sched:sched_migrate_task > sched:sched_process_free > sched:sched_process_exit > sched:sched_wait_task > sched:sched_process_wait > sched:sched_process_fork > sched:sched_stat_wait > sched:sched_stat_sleep > sched:sched_stat_iowait > sched:sched_stat_runtime > sched:sched_pi_setprio > > > -- > Hollis Blanchard > Product Owner, Sourcery Analyzer > Mentor Graphics, Embedded Systems Division > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From christian.babeux at efficios.com Thu Sep 27 14:23:15 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 27 Sep 2012 14:23:15 -0400 Subject: [lttng-dev] [PATCH lttng-tools 1/5] Add testpoints in lttng-sessiond to instrument every threads Message-ID: <1348770199-1618-1-git-send-email-christian.babeux@efficios.com> This commit adds 8 new testpoints in the lttng-sessiond binary. These testpoints rely on the testpoints infrastructure introduced recently. Testpoints: thread_manage_clients thread_manage_clients_before_loop thread_registration_apps thread_manage_apps thread_manage_apps_before_loop thread_manage_kernel thread_manage_kernel_before_loop thread_manage_consumer The thread_ testpoints are placed directly at the thread start and they can be used to trigger failure in . The thread__before_loop testpoints are placed directly before the main processing loop of the thread and thus can be used to stall the processing of the thread. Signed-off-by: Christian Babeux --- src/bin/lttng-sessiond/Makefile.am | 3 ++- src/bin/lttng-sessiond/main.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/Makefile.am b/src/bin/lttng-sessiond/Makefile.am index 73be023..733818e 100644 --- a/src/bin/lttng-sessiond/Makefile.am +++ b/src/bin/lttng-sessiond/Makefile.am @@ -38,7 +38,8 @@ lttng_sessiond_LDADD = -lrt -lurcu-common -lurcu \ $(top_builddir)/src/common/hashtable/libhashtable.la \ $(top_builddir)/src/common/libcommon.la \ $(top_builddir)/src/common/compat/libcompat.la \ - $(top_builddir)/src/common/relayd/librelayd.la + $(top_builddir)/src/common/relayd/librelayd.la \ + $(top_builddir)/src/common/testpoint/libtestpoint.la if HAVE_LIBLTTNG_UST_CTL lttng_sessiond_LDADD += -llttng-ust-ctl diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 730ac65..6e93cf0 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -45,6 +45,7 @@ #include #include #include +#include #include "lttng-sessiond.h" #include "channel.h" @@ -65,6 +66,16 @@ #define CONSUMERD_FILE "lttng-consumerd" +/* Testpoints, internal use only */ +TESTPOINT_DECL(thread_manage_clients); +TESTPOINT_DECL(thread_manage_clients_before_loop); +TESTPOINT_DECL(thread_registration_apps); +TESTPOINT_DECL(thread_manage_apps); +TESTPOINT_DECL(thread_manage_apps_before_loop); +TESTPOINT_DECL(thread_manage_kernel); +TESTPOINT_DECL(thread_manage_kernel_before_loop); +TESTPOINT_DECL(thread_manage_consumer); + /* Const values */ const char default_home_dir[] = DEFAULT_HOME_DIR; const char default_tracing_group[] = DEFAULT_TRACING_GROUP; @@ -680,8 +691,12 @@ static void *thread_manage_kernel(void *data) DBG("Thread manage kernel started"); + testpoint(thread_manage_kernel); + health_code_update(&health_thread_kernel); + testpoint(thread_manage_kernel_before_loop); + ret = create_thread_poll_set(&events, 2); if (ret < 0) { goto error_poll_create; @@ -829,6 +844,9 @@ static void *thread_manage_consumer(void *data) /* Inifinite blocking call, waiting for transmission */ restart: health_poll_update(&consumer_data->health); + + testpoint(thread_manage_consumer); + ret = lttng_poll_wait(&events, -1); health_poll_update(&consumer_data->health); if (ret < 0) { @@ -1026,6 +1044,8 @@ static void *thread_manage_apps(void *data) DBG("[thread] Manage application started"); + testpoint(thread_manage_apps); + rcu_register_thread(); rcu_thread_online(); @@ -1041,6 +1061,8 @@ static void *thread_manage_apps(void *data) goto error; } + testpoint(thread_manage_apps_before_loop); + health_code_update(&health_thread_app_manage); while (1) { @@ -1264,6 +1286,8 @@ static void *thread_registration_apps(void *data) DBG("[thread] Manage application registration started"); + testpoint(thread_registration_apps); + ret = lttcomm_listen_unix_sock(apps_sock); if (ret < 0) { goto error_listen; @@ -2912,6 +2936,8 @@ static void *thread_manage_clients(void *data) DBG("[thread] Manage client started"); + testpoint(thread_manage_clients); + rcu_register_thread(); health_code_update(&health_thread_cmd); @@ -2943,6 +2969,8 @@ static void *thread_manage_clients(void *data) kill(ppid, SIGUSR1); } + testpoint(thread_manage_clients_before_loop); + health_code_update(&health_thread_cmd); while (1) { -- 1.7.12 From christian.babeux at efficios.com Thu Sep 27 14:23:16 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 27 Sep 2012 14:23:16 -0400 Subject: [lttng-dev] [PATCH lttng-tools 2/5] Tests: Add a health check utility program In-Reply-To: <1348770199-1618-1-git-send-email-christian.babeux@efficios.com> References: <1348770199-1618-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1348770199-1618-2-git-send-email-christian.babeux@efficios.com> The health_check program is a simple utility to query the health status of the different threads of the sessiond. Sample output: > ./health_check Health check cmd: 0 Health check app. manage: 0 Health check app. registration: 0 Health check kernel: 0 Health check consumer: 0 The return code is encoded to indicate which thread has failed. Signed-off-by: Christian Babeux --- tests/tools/health/Makefile.am | 20 +++++++++++ tests/tools/health/health_check.c | 73 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 tests/tools/health/Makefile.am create mode 100644 tests/tools/health/health_check.c diff --git a/tests/tools/health/Makefile.am b/tests/tools/health/Makefile.am new file mode 100644 index 0000000..09573db --- /dev/null +++ b/tests/tools/health/Makefile.am @@ -0,0 +1,20 @@ +AM_CFLAGS = -I. -O2 -g -I../../../include +AM_LDFLAGS = + +if LTTNG_TOOLS_BUILD_WITH_LIBDL +AM_LDFLAGS += -ldl +endif +if LTTNG_TOOLS_BUILD_WITH_LIBC_DL +AM_LDFLAGS += -lc +endif + +UTILS= + +noinst_PROGRAMS = health_check + +health_check_SOURCES = health_check.c $(UTILS) +health_check_LDADD = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \ + $(top_builddir)/src/common/libcommon.la + +noinst_SCRIPTS = +EXTRA_DIST = diff --git a/tests/tools/health/health_check.c b/tests/tools/health/health_check.c new file mode 100644 index 0000000..3eef110 --- /dev/null +++ b/tests/tools/health/health_check.c @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2012 - Christian Babeux + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License, version 2 only, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include + +#include "lttng/lttng.h" + +#define HEALTH_CMD_FAIL (1 << 0) +#define HEALTH_APP_MNG_FAIL (1 << 1) +#define HEALTH_APP_REG_FAIL (1 << 2) +#define HEALTH_KERNEL_FAIL (1 << 3) +#define HEALTH_CSMR_FAIL (1 << 4) + +int main(int argc, char *argv[]) +{ + int health = -1; + int status = 0; + + /* Command thread */ + health = lttng_health_check(LTTNG_HEALTH_CMD); + printf("Health check cmd: %d\n", health); + + if (health) { + status |= HEALTH_CMD_FAIL; + } + + /* App manage thread */ + health = lttng_health_check(LTTNG_HEALTH_APP_MANAGE); + printf("Health check app. manage: %d\n", health); + + if (health) { + status |= HEALTH_APP_MNG_FAIL; + } + /* App registration thread */ + health = lttng_health_check(LTTNG_HEALTH_APP_REG); + printf("Health check app. registration: %d\n", health); + + if (health) { + status |= HEALTH_APP_REG_FAIL; + } + + /* Kernel thread */ + health = lttng_health_check(LTTNG_HEALTH_KERNEL); + printf("Health check kernel: %d\n", health); + + if (health) { + status |= HEALTH_KERNEL_FAIL; + } + + /* Consumer thread */ + health = lttng_health_check(LTTNG_HEALTH_CONSUMER); + printf("Health check consumer: %d\n", health); + + if (health) { + status |= HEALTH_CSMR_FAIL; + } + + return status; +} -- 1.7.12 From christian.babeux at efficios.com Thu Sep 27 14:23:17 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 27 Sep 2012 14:23:17 -0400 Subject: [lttng-dev] [PATCH lttng-tools 3/5] Tests: Add health check thread exit test In-Reply-To: <1348770199-1618-1-git-send-email-christian.babeux@efficios.com> References: <1348770199-1618-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1348770199-1618-3-git-send-email-christian.babeux@efficios.com> This test trigger a failure in a specified thread using the recently introduced testpoint mechanism. The testpoints behavior is implemented in health_exit.c. The testpoint code simply calls pthread_exit(3) and effectively "kill" the thread without affecting the other threads behavior. The test select the thread to be "killed" by enabling a specific environment variable. With this test we ensure that each thread can be succesfully terminated and that the health check feature properly detect a failure. Signed-off-by: Christian Babeux --- tests/tools/health/Makefile.am | 6 ++ tests/tools/health/health_exit.c | 80 ++++++++++++++++++++++++++ tests/tools/health/health_thread_exit | 105 ++++++++++++++++++++++++++++++++++ 3 files changed, 191 insertions(+) create mode 100644 tests/tools/health/health_exit.c create mode 100755 tests/tools/health/health_thread_exit diff --git a/tests/tools/health/Makefile.am b/tests/tools/health/Makefile.am index 09573db..0a3f6c5 100644 --- a/tests/tools/health/Makefile.am +++ b/tests/tools/health/Makefile.am @@ -10,6 +10,12 @@ endif UTILS= +lib_LTLIBRARIES=libhealthexit.la + +# Health thread exit ld_preloaded test lib +libhealthexit_la_SOURCES=health_exit.c +libhealthexit_la_LDFLAGS= -module + noinst_PROGRAMS = health_check health_check_SOURCES = health_check.c $(UTILS) diff --git a/tests/tools/health/health_exit.c b/tests/tools/health/health_exit.c new file mode 100644 index 0000000..c2382f2 --- /dev/null +++ b/tests/tools/health/health_exit.c @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2012 - Christian Babeux + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License, version 2 only, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include +#include + +/* + * Check if the specified environment variable is set. + * Return 1 if set, otherwise 0. + */ +int check_env_var(const char *env) +{ + if (env) { + if (getenv(env) != NULL && (strncmp(env_val, "1", 1) == 0)) { + return 1; + } + } + + return 0; +} + +void __testpoint_thread_manage_clients(void) +{ + const char *var = "LTTNG_THREAD_MANAGE_CLIENTS_EXIT"; + + if (check_env_var(var)) { + pthread_exit(NULL); + } +} + +void __testpoint_thread_registration_apps(void) +{ + const char *var = "LTTNG_THREAD_REG_APPS_EXIT"; + + if (check_env_var(var)) { + pthread_exit(NULL); + } +} + +void __testpoint_thread_manage_apps(void) +{ + const char *var = "LTTNG_THREAD_MANAGE_APPS_EXIT"; + + if (check_env_var(var)) { + pthread_exit(NULL); + } +} + +void __testpoint_thread_manage_kernel(void) +{ + const char *var = "LTTNG_THREAD_MANAGE_KERNEL_EXIT"; + + if (check_env_var(var)) { + pthread_exit(NULL); + } +} + +void __testpoint_thread_manage_consumer(void) +{ + const char *var = "LTTNG_THREAD_MANAGE_CONSUMER_EXIT"; + + if (check_env_var(var)) { + pthread_exit(NULL); + } +} diff --git a/tests/tools/health/health_thread_exit b/tests/tools/health/health_thread_exit new file mode 100755 index 0000000..dab6b64 --- /dev/null +++ b/tests/tools/health/health_thread_exit @@ -0,0 +1,105 @@ +#!/bin/bash +# +# Copyright (C) - 2012 Christian Babeux +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License, version 2 only, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 51 +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +TEST_DESC="Health check - Thread exit" + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../.. +LTTNG_BIN="lttng" +SESSION_NAME="health_thread_exit" +EVENT_NAME="bogus" +HEALTH_CHECK_BIN="health_check" +SESSIOND_PRELOAD=".libs/libhealthexit.so" + +source $TESTDIR/utils.sh + +print_test_banner "$TEST_DESC" + +if [ ! -f "$SESSIOND_PRELOAD" ]; then + echo -e "libhealthexit.so not available for this test. Skipping." + exit 0 +fi + +function test_thread_exit +{ + test_thread_exit_name="$1" + test_thread_exit_code="$2" + + echo "" + echo -e "=== Testing health failure with ${test_thread_exit_name}" + + # Activate testpoints + export LTTNG_TESTPOINT_ENABLE=1 + + # Activate specific thread exit + export ${test_thread_exit_name}_EXIT=1 + + # Spawn sessiond with preload healthexit lib + export LD_PRELOAD="$CURDIR/$SESSIOND_PRELOAD" + start_lttng_sessiond + + # Cleanup some env. var. + unset LD_PRELOAD + unset ${test_thread_exit_name}_EXIT + + # Check initial health status + $CURDIR/$HEALTH_CHECK_BIN &> /dev/null + + echo -n "Validating thread ${test_thread_exit_name} failure... " + + # Wait + sleep 25 + + # Check health status, exit code should indicate failure + $CURDIR/$HEALTH_CHECK_BIN &> /dev/null + + health_check_exit_code=$? + + if [ $health_check_exit_code -eq $test_thread_exit_code ]; then + print_ok + stop_lttng_sessiond + else + print_fail + echo -e "Health returned: $health_check_exit_code\n" + + stop_lttng_sessiond + return 1 + fi +} + +THREAD=("LTTNG_THREAD_MANAGE_CLIENTS" + "LTTNG_THREAD_MANAGE_APPS" + "LTTNG_THREAD_REG_APPS" + "LTTNG_THREAD_MANAGE_KERNEL") + +# Exit code value to indicate specific thread failure +EXIT_CODE=(1 2 4 8) + +THREAD_COUNT=${#THREAD[@]} +i=0 +while [ "$i" -lt "$THREAD_COUNT" ]; do + test_thread_exit "${THREAD[$i]}" "${EXIT_CODE[$i]}" + + if [ $? -eq 1 ]; then + exit 1 + fi + + let "i++" +done + +# Special case manage consumer, need to spawn consumer via commands. +#"LTTNG_THREAD_MANAGE_CONSUMER" -- 1.7.12 From christian.babeux at efficios.com Thu Sep 27 14:23:18 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 27 Sep 2012 14:23:18 -0400 Subject: [lttng-dev] [PATCH lttng-tools 4/5] Tests: Add health check thread stall test In-Reply-To: <1348770199-1618-1-git-send-email-christian.babeux@efficios.com> References: <1348770199-1618-1-git-send-email-christian.babeux@efficios.com> Message-ID: <1348770199-1618-4-git-send-email-christian.babeux@efficios.com> This test trigger a "code stall" in a specified thread using the testpoint mechanism. The testpoint behavior is implemented in health_stall.c. The testpoint code stall a specific thread processing by calling sleep(3). The test select the thread to be stalled by enabling a specific environment variable. The test ensure the threads can be succesfully stalled and that the health check feature is able to properly detect stalling in non-polling cases. Signed-off-by: Christian Babeux --- tests/tools/health/Makefile.am | 6 +- tests/tools/health/health_stall.c | 66 +++++++++++++++++ tests/tools/health/health_thread_stall | 128 +++++++++++++++++++++++++++++++++ 3 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 tests/tools/health/health_stall.c create mode 100755 tests/tools/health/health_thread_stall diff --git a/tests/tools/health/Makefile.am b/tests/tools/health/Makefile.am index 0a3f6c5..9fab582 100644 --- a/tests/tools/health/Makefile.am +++ b/tests/tools/health/Makefile.am @@ -10,12 +10,16 @@ endif UTILS= -lib_LTLIBRARIES=libhealthexit.la +lib_LTLIBRARIES=libhealthexit.la libhealthstall.la # Health thread exit ld_preloaded test lib libhealthexit_la_SOURCES=health_exit.c libhealthexit_la_LDFLAGS= -module +# Health thread stall ld_preloaded test lib +libhealthstall_la_SOURCES=health_stall.c +libhealthstall_la_LDFLAGS= -module + noinst_PROGRAMS = health_check health_check_SOURCES = health_check.c $(UTILS) diff --git a/tests/tools/health/health_stall.c b/tests/tools/health/health_stall.c new file mode 100644 index 0000000..86b6986 --- /dev/null +++ b/tests/tools/health/health_stall.c @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 - Christian Babeux + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License, version 2 only, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include +#include +#include + +#define STALL_TIME 60 + +/* + * Check if the specified environment variable is set. + * Return 1 if set, otherwise 0. + */ +int check_env_var(const char *env) +{ + if (env) { + if (getenv(env) != NULL && (strncmp(env_val, "1", 1) == 0)) { + return 1; + } + } + + return 0; +} + +void __testpoint_thread_manage_clients_before_loop(void) +{ + const char *var = "LTTNG_THREAD_MANAGE_CLIENTS_STALL"; + + if (check_env_var(var)) { + sleep(STALL_TIME); + } +} + +void __testpoint_thread_manage_kernel_before_loop(void) +{ + const char *var = "LTTNG_THREAD_MANAGE_KERNEL_STALL"; + + if (check_env_var(var)) { + sleep(STALL_TIME); + } +} + +void __testpoint_thread_manage_apps_before_loop(void) +{ + const char *var = "LTTNG_THREAD_MANAGE_APPS_STALL"; + + if (check_env_var(var)) { + sleep(STALL_TIME); + } +} + diff --git a/tests/tools/health/health_thread_stall b/tests/tools/health/health_thread_stall new file mode 100755 index 0000000..d870895 --- /dev/null +++ b/tests/tools/health/health_thread_stall @@ -0,0 +1,128 @@ +#!/bin/bash +# +# Copyright (C) - 2012 Christian Babeux +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License, version 2 only, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 51 +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +TEST_DESC="Health check - Thread stall" + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../.. +LTTNG_BIN="lttng" +SESSION_NAME="health_thread_stall" +EVENT_NAME="bogus" +HEALTH_CHECK_BIN="health_check" +SESSIOND_PRELOAD=".libs/libhealthstall.so" + +source $TESTDIR/utils.sh + +print_test_banner "$TEST_DESC" + +if [ ! -f "$SESSIOND_PRELOAD" ]; then + echo -e "libhealthstall.so not available for this test. Skipping." + exit 0 +fi + +function test_thread_stall +{ + test_thread_stall_name="$1" + test_thread_exit_code="$2" + + echo "" + echo -e "=== Testing health failure with ${test_thread_stall_name}" + + # Activate testpoints + export LTTNG_TESTPOINT_ENABLE=1 + + # Activate specific thread exit + export ${test_thread_stall_name}_STALL=1 + + # Spawn sessiond with preload healthexit lib + export LD_PRELOAD="$CURDIR/$SESSIOND_PRELOAD" + start_lttng_sessiond + + # Cleanup some env. var. + unset LD_PRELOAD + unset ${test_thread_stall_name}_STALL + + # Check initial health status + $CURDIR/$HEALTH_CHECK_BIN &> /dev/null + + echo -n "Validating that ${test_thread_stall_name} is stalled... " + + # Wait + sleep 25 + + # Check health status, exit code should indicate failure + $CURDIR/$HEALTH_CHECK_BIN &> /dev/null + + health_check_exit_code=$? + + if [ $health_check_exit_code -eq $test_thread_exit_code ]; then + print_ok + else + print_fail + echo -e "Health returned: $health_check_exit_code\n" + + stop_lttng_sessiond + return 1 + fi + + echo -n "Validating that ${test_thread_stall_name} is no longer stalled... " + + # Wait + sleep 40 + + # Check health status, exit code should now pass + $CURDIR/$HEALTH_CHECK_BIN &> /dev/null + + health_check_exit_code=$? + + if [ $health_check_exit_code -eq 0 ]; then + print_ok + stop_lttng_sessiond + else + print_fail + echo -e "Health returned: $health_check_exit_code\n" + stop_lttng_sessiond + return 1 + fi + + +} + +THREAD=("LTTNG_THREAD_MANAGE_CLIENTS" + "LTTNG_THREAD_MANAGE_APPS" +# This thread is a little bit tricky to stall, +# need to send some commands and setup an app. +# "LTTNG_THREAD_REG_APPS" + "LTTNG_THREAD_MANAGE_KERNEL") + +# Exit code value to indicate specific thread failure +EXIT_CODE=(1 + 2 +# 4 + 8) + +THREAD_COUNT=${#THREAD[@]} +i=0 +while [ "$i" -lt "$THREAD_COUNT" ]; do + test_thread_stall "${THREAD[$i]}" "${EXIT_CODE[$i]}" + + if [ $? -eq 1 ]; then + exit 1 + fi + + let "i++" +done -- 1.7.12 From christian.babeux at efficios.com Thu Sep 27 14:25:21 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Thu, 27 Sep 2012 14:25:21 -0400 Subject: [lttng-dev] [PATCH lttng-tools 5/5] Tests: Add health check tests to configure Message-ID: <1348770321-1670-1-git-send-email-christian.babeux@efficios.com> Add health folder to top-level tests Makefile.am. Also add a runall script to run all health check tests. Signed-off-by: Christian Babeux --- configure.ac | 1 + tests/tools/Makefile.am | 2 +- tests/tools/health/runall | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 tests/tools/health/runall diff --git a/configure.ac b/configure.ac index 36c137b..713daa9 100644 --- a/configure.ac +++ b/configure.ac @@ -288,6 +288,7 @@ AC_CONFIG_FILES([ tests/kernel/Makefile tests/tools/Makefile tests/tools/streaming/Makefile + tests/tools/health/Makefile tests/ust/Makefile tests/ust/nprocesses/Makefile tests/ust/high-throughput/Makefile diff --git a/tests/tools/Makefile.am b/tests/tools/Makefile.am index 3d25900..faa836c 100644 --- a/tests/tools/Makefile.am +++ b/tests/tools/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = streaming +SUBDIRS = streaming health AM_CFLAGS = -g -Wall -I../ AM_LDFLAGS = -lurcu -lurcu-cds diff --git a/tests/tools/health/runall b/tests/tools/health/runall new file mode 100755 index 0000000..c22e353 --- /dev/null +++ b/tests/tools/health/runall @@ -0,0 +1,28 @@ +#!/bin/bash + +DIR=$(dirname $0) + +tests=( $DIR/health_thread_exit $DIR/health_thread_stall ) +exit_code=0 + +function start_tests () +{ + for bin in ${tests[@]}; + do + if [ ! -e $bin ]; then + echo -e "$bin not found, passing" + continue + fi + + ./$bin + # Test must return 0 to pass. + if [ $? -ne 0 ]; then + exit_code=1 + break + fi + done +} + +start_tests + +exit $exit_code -- 1.7.12 From mathieu.desnoyers at efficios.com Thu Sep 27 15:45:38 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 27 Sep 2012 15:45:38 -0400 Subject: [lttng-dev] [PATCH lttng-tools 2/5] Tests: Add a health check utility program In-Reply-To: <1348770199-1618-2-git-send-email-christian.babeux@efficios.com> References: <1348770199-1618-1-git-send-email-christian.babeux@efficios.com> <1348770199-1618-2-git-send-email-christian.babeux@efficios.com> Message-ID: <20120927194538.GB1827@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > The health_check program is a simple utility to query the health > status of the different threads of the sessiond. do we want to call it lttng-health-check and install it in the system ? Mathieu > > Sample output: > > > ./health_check > Health check cmd: 0 > Health check app. manage: 0 > Health check app. registration: 0 > Health check kernel: 0 > Health check consumer: 0 > > The return code is encoded to indicate which thread has failed. > > Signed-off-by: Christian Babeux > --- > tests/tools/health/Makefile.am | 20 +++++++++++ > tests/tools/health/health_check.c | 73 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 93 insertions(+) > create mode 100644 tests/tools/health/Makefile.am > create mode 100644 tests/tools/health/health_check.c > > diff --git a/tests/tools/health/Makefile.am b/tests/tools/health/Makefile.am > new file mode 100644 > index 0000000..09573db > --- /dev/null > +++ b/tests/tools/health/Makefile.am > @@ -0,0 +1,20 @@ > +AM_CFLAGS = -I. -O2 -g -I../../../include > +AM_LDFLAGS = > + > +if LTTNG_TOOLS_BUILD_WITH_LIBDL > +AM_LDFLAGS += -ldl > +endif > +if LTTNG_TOOLS_BUILD_WITH_LIBC_DL > +AM_LDFLAGS += -lc > +endif > + > +UTILS= > + > +noinst_PROGRAMS = health_check > + > +health_check_SOURCES = health_check.c $(UTILS) > +health_check_LDADD = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \ > + $(top_builddir)/src/common/libcommon.la > + > +noinst_SCRIPTS = > +EXTRA_DIST = > diff --git a/tests/tools/health/health_check.c b/tests/tools/health/health_check.c > new file mode 100644 > index 0000000..3eef110 > --- /dev/null > +++ b/tests/tools/health/health_check.c > @@ -0,0 +1,73 @@ > +/* > + * Copyright (C) 2012 - Christian Babeux > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms of the GNU General Public License, version 2 only, as > + * published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + * > + * You should have received a copy of the GNU General Public License along with > + * this program; if not, write to the Free Software Foundation, Inc., 51 > + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + */ > + > +#include > + > +#include "lttng/lttng.h" > + > +#define HEALTH_CMD_FAIL (1 << 0) > +#define HEALTH_APP_MNG_FAIL (1 << 1) > +#define HEALTH_APP_REG_FAIL (1 << 2) > +#define HEALTH_KERNEL_FAIL (1 << 3) > +#define HEALTH_CSMR_FAIL (1 << 4) > + > +int main(int argc, char *argv[]) > +{ > + int health = -1; > + int status = 0; > + > + /* Command thread */ > + health = lttng_health_check(LTTNG_HEALTH_CMD); > + printf("Health check cmd: %d\n", health); > + > + if (health) { > + status |= HEALTH_CMD_FAIL; > + } > + > + /* App manage thread */ > + health = lttng_health_check(LTTNG_HEALTH_APP_MANAGE); > + printf("Health check app. manage: %d\n", health); > + > + if (health) { > + status |= HEALTH_APP_MNG_FAIL; > + } > + /* App registration thread */ > + health = lttng_health_check(LTTNG_HEALTH_APP_REG); > + printf("Health check app. registration: %d\n", health); > + > + if (health) { > + status |= HEALTH_APP_REG_FAIL; > + } > + > + /* Kernel thread */ > + health = lttng_health_check(LTTNG_HEALTH_KERNEL); > + printf("Health check kernel: %d\n", health); > + > + if (health) { > + status |= HEALTH_KERNEL_FAIL; > + } > + > + /* Consumer thread */ > + health = lttng_health_check(LTTNG_HEALTH_CONSUMER); > + printf("Health check consumer: %d\n", health); > + > + if (health) { > + status |= HEALTH_CSMR_FAIL; > + } > + > + return status; > +} > -- > 1.7.12 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Thu Sep 27 15:47:28 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Thu, 27 Sep 2012 15:47:28 -0400 Subject: [lttng-dev] [PATCH lttng-tools 4/5] Tests: Add health check thread stall test In-Reply-To: <1348770199-1618-4-git-send-email-christian.babeux@efficios.com> References: <1348770199-1618-1-git-send-email-christian.babeux@efficios.com> <1348770199-1618-4-git-send-email-christian.babeux@efficios.com> Message-ID: <20120927194728.GC1827@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > This test trigger a "code stall" in a specified thread using the > testpoint mechanism. The testpoint behavior is implemented in > health_stall.c. The testpoint code stall a specific thread processing > by calling sleep(3). > > The test select the thread to be stalled by enabling a specific > environment variable. > > The test ensure the threads can be succesfully stalled and that the > health check feature is able to properly detect stalling in non-polling > cases. > > Signed-off-by: Christian Babeux > --- > tests/tools/health/Makefile.am | 6 +- > tests/tools/health/health_stall.c | 66 +++++++++++++++++ > tests/tools/health/health_thread_stall | 128 +++++++++++++++++++++++++++++++++ > 3 files changed, 199 insertions(+), 1 deletion(-) > create mode 100644 tests/tools/health/health_stall.c > create mode 100755 tests/tools/health/health_thread_stall > > diff --git a/tests/tools/health/Makefile.am b/tests/tools/health/Makefile.am > index 0a3f6c5..9fab582 100644 > --- a/tests/tools/health/Makefile.am > +++ b/tests/tools/health/Makefile.am > @@ -10,12 +10,16 @@ endif > > UTILS= > > -lib_LTLIBRARIES=libhealthexit.la > +lib_LTLIBRARIES=libhealthexit.la libhealthstall.la > > # Health thread exit ld_preloaded test lib > libhealthexit_la_SOURCES=health_exit.c > libhealthexit_la_LDFLAGS= -module > > +# Health thread stall ld_preloaded test lib > +libhealthstall_la_SOURCES=health_stall.c > +libhealthstall_la_LDFLAGS= -module > + > noinst_PROGRAMS = health_check > > health_check_SOURCES = health_check.c $(UTILS) > diff --git a/tests/tools/health/health_stall.c b/tests/tools/health/health_stall.c > new file mode 100644 > index 0000000..86b6986 > --- /dev/null > +++ b/tests/tools/health/health_stall.c > @@ -0,0 +1,66 @@ > +/* > + * Copyright (C) 2012 - Christian Babeux > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms of the GNU General Public License, version 2 only, as > + * published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + * > + * You should have received a copy of the GNU General Public License along with > + * this program; if not, write to the Free Software Foundation, Inc., 51 > + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + */ > + > +#include > +#include > +#include > +#include > + > +#define STALL_TIME 60 could we introduce a LTTNG_HEALTH_CHECK_STALL env. var ? Thanks, Mathieu > + > +/* > + * Check if the specified environment variable is set. > + * Return 1 if set, otherwise 0. > + */ > +int check_env_var(const char *env) > +{ > + if (env) { > + if (getenv(env) != NULL && (strncmp(env_val, "1", 1) == 0)) { > + return 1; > + } > + } > + > + return 0; > +} > + > +void __testpoint_thread_manage_clients_before_loop(void) > +{ > + const char *var = "LTTNG_THREAD_MANAGE_CLIENTS_STALL"; > + > + if (check_env_var(var)) { > + sleep(STALL_TIME); > + } > +} > + > +void __testpoint_thread_manage_kernel_before_loop(void) > +{ > + const char *var = "LTTNG_THREAD_MANAGE_KERNEL_STALL"; > + > + if (check_env_var(var)) { > + sleep(STALL_TIME); > + } > +} > + > +void __testpoint_thread_manage_apps_before_loop(void) > +{ > + const char *var = "LTTNG_THREAD_MANAGE_APPS_STALL"; > + > + if (check_env_var(var)) { > + sleep(STALL_TIME); > + } > +} > + > diff --git a/tests/tools/health/health_thread_stall b/tests/tools/health/health_thread_stall > new file mode 100755 > index 0000000..d870895 > --- /dev/null > +++ b/tests/tools/health/health_thread_stall > @@ -0,0 +1,128 @@ > +#!/bin/bash > +# > +# Copyright (C) - 2012 Christian Babeux > +# > +# This program is free software; you can redistribute it and/or modify it > +# under the terms of the GNU General Public License, version 2 only, as > +# published by the Free Software Foundation. > +# > +# This program is distributed in the hope that it will be useful, but WITHOUT > +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > +# more details. > +# > +# You should have received a copy of the GNU General Public License along with > +# this program; if not, write to the Free Software Foundation, Inc., 51 > +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + > +TEST_DESC="Health check - Thread stall" > + > +CURDIR=$(dirname $0)/ > +TESTDIR=$CURDIR/../.. > +LTTNG_BIN="lttng" > +SESSION_NAME="health_thread_stall" > +EVENT_NAME="bogus" > +HEALTH_CHECK_BIN="health_check" > +SESSIOND_PRELOAD=".libs/libhealthstall.so" > + > +source $TESTDIR/utils.sh > + > +print_test_banner "$TEST_DESC" > + > +if [ ! -f "$SESSIOND_PRELOAD" ]; then > + echo -e "libhealthstall.so not available for this test. Skipping." > + exit 0 > +fi > + > +function test_thread_stall > +{ > + test_thread_stall_name="$1" > + test_thread_exit_code="$2" > + > + echo "" > + echo -e "=== Testing health failure with ${test_thread_stall_name}" > + > + # Activate testpoints > + export LTTNG_TESTPOINT_ENABLE=1 > + > + # Activate specific thread exit > + export ${test_thread_stall_name}_STALL=1 > + > + # Spawn sessiond with preload healthexit lib > + export LD_PRELOAD="$CURDIR/$SESSIOND_PRELOAD" > + start_lttng_sessiond > + > + # Cleanup some env. var. > + unset LD_PRELOAD > + unset ${test_thread_stall_name}_STALL > + > + # Check initial health status > + $CURDIR/$HEALTH_CHECK_BIN &> /dev/null > + > + echo -n "Validating that ${test_thread_stall_name} is stalled... " > + > + # Wait > + sleep 25 > + > + # Check health status, exit code should indicate failure > + $CURDIR/$HEALTH_CHECK_BIN &> /dev/null > + > + health_check_exit_code=$? > + > + if [ $health_check_exit_code -eq $test_thread_exit_code ]; then > + print_ok > + else > + print_fail > + echo -e "Health returned: $health_check_exit_code\n" > + > + stop_lttng_sessiond > + return 1 > + fi > + > + echo -n "Validating that ${test_thread_stall_name} is no longer stalled... " > + > + # Wait > + sleep 40 > + > + # Check health status, exit code should now pass > + $CURDIR/$HEALTH_CHECK_BIN &> /dev/null > + > + health_check_exit_code=$? > + > + if [ $health_check_exit_code -eq 0 ]; then > + print_ok > + stop_lttng_sessiond > + else > + print_fail > + echo -e "Health returned: $health_check_exit_code\n" > + stop_lttng_sessiond > + return 1 > + fi > + > + > +} > + > +THREAD=("LTTNG_THREAD_MANAGE_CLIENTS" > + "LTTNG_THREAD_MANAGE_APPS" > +# This thread is a little bit tricky to stall, > +# need to send some commands and setup an app. > +# "LTTNG_THREAD_REG_APPS" > + "LTTNG_THREAD_MANAGE_KERNEL") > + > +# Exit code value to indicate specific thread failure > +EXIT_CODE=(1 > + 2 > +# 4 > + 8) > + > +THREAD_COUNT=${#THREAD[@]} > +i=0 > +while [ "$i" -lt "$THREAD_COUNT" ]; do > + test_thread_stall "${THREAD[$i]}" "${EXIT_CODE[$i]}" > + > + if [ $? -eq 1 ]; then > + exit 1 > + fi > + > + let "i++" > +done > -- > 1.7.12 > > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Thu Sep 27 16:56:20 2012 From: dgoulet at efficios.com (David Goulet) Date: Thu, 27 Sep 2012 16:56:20 -0400 Subject: [lttng-dev] [PATCH lttng-tools 2/5] Tests: Add a health check utility program In-Reply-To: <20120927194538.GB1827@Krystal> References: <1348770199-1618-1-git-send-email-christian.babeux@efficios.com> <1348770199-1618-2-git-send-email-christian.babeux@efficios.com> <20120927194538.GB1827@Krystal> Message-ID: <5064BD74.8000402@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 * Christian Babeux (christian.babeux at efficios.com) wrote: >> The health_check program is a simple utility to query the health >> status of the different threads of the sessiond. > > do we want to call it lttng-health-check and install it in the > system ? > We could but I would really prefer add a "lttng health" that calls this or merge it as a lttng command. I'm no fan of multiplying binaries :). David > Mathieu > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQZL1xAAoJEELoaioR9I02wbgH/j/Qs0my1MzvVvOWtmph08Ll UKfpGFOXsyHgl96dKNuTzqQ8iSZIDHULCkwHCMDCkRRLiXJ7pyCGN/GkU1oCvLmD Rc+nfs2MotUZtoqD1NicCUf2d8VIc37pKU0ImeDZMuWk+3lUIqY1//gcUsVdAYJL 18fkIo5ywr7oIdaZdKTRAuXI0ZesZuChpT7mltbcfnfHAp8viIzvPKuvr48V10sE /jVyYM5tvPvAoCfO15uosTV+m9+/R2taxF1E+Ng5obZtWUurRCPqw28tOW+W9hq4 +Lbwg814ePsVDfOItBjxwXiWhuElGP6SnizD+yUB7ca7Eadcq/Yodb9DvayAtQk= =4p87 -----END PGP SIGNATURE----- From mathieu.desnoyers at efficios.com Fri Sep 28 15:39:42 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 28 Sep 2012 15:39:42 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: consumer should await for initial streams Message-ID: <20120928193942.GA11285@Krystal> lttng-sessiond need to let the consumer know how many streams are sent initially, so that for very short traces (short-lived apps, short kernel trace), the consumerd don't run into the scenario where it deletes the channel when there are still pending streams to receive for this channel. Fixes #355 Signed-off-by: Mathieu Desnoyers --- diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index b69df16..d33f85f 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -486,7 +486,8 @@ void consumer_init_channel_comm_msg(struct lttcomm_consumer_msg *msg, int channel_key, uint64_t max_sb_size, uint64_t mmap_len, - const char *name) + const char *name, + unsigned int nb_init_streams) { assert(msg); @@ -500,6 +501,7 @@ void consumer_init_channel_comm_msg(struct lttcomm_consumer_msg *msg, msg->u.channel.channel_key = channel_key; msg->u.channel.max_sb_size = max_sb_size; msg->u.channel.mmap_len = mmap_len; + msg->u.channel.nb_init_streams = nb_init_streams; } /* diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h index 5e8ad9b..ec4ef3f 100644 --- a/src/bin/lttng-sessiond/consumer.h +++ b/src/bin/lttng-sessiond/consumer.h @@ -195,6 +195,7 @@ void consumer_init_channel_comm_msg(struct lttcomm_consumer_msg *msg, int channel_key, uint64_t max_sb_size, uint64_t mmap_len, - const char *name); + const char *name, + unsigned int nb_init_streams); #endif /* _CONSUMER_H */ diff --git a/src/bin/lttng-sessiond/kernel-consumer.c b/src/bin/lttng-sessiond/kernel-consumer.c index 8251213..33cbbed 100644 --- a/src/bin/lttng-sessiond/kernel-consumer.c +++ b/src/bin/lttng-sessiond/kernel-consumer.c @@ -48,7 +48,8 @@ int kernel_consumer_add_channel(int sock, struct ltt_kernel_channel *channel) channel->fd, channel->channel->attr.subbuf_size, 0, /* Kernel */ - channel->channel->name); + channel->channel->name, + channel->stream_count); ret = consumer_send_channel(sock, &lkm); if (ret < 0) { @@ -116,7 +117,8 @@ int kernel_consumer_add_metadata(int sock, struct ltt_kernel_session *session) session->metadata->fd, session->metadata->conf->attr.subbuf_size, 0, /* for kernel */ - "metadata"); + "metadata", + 1); ret = consumer_send_channel(sock, &lkm); if (ret < 0) { diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 3202cd4..fc8728d 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -2239,7 +2239,8 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app) /* Order is important */ cds_list_add_tail(&ustream->list, &ua_chan->streams.head); ret = snprintf(ustream->name, sizeof(ustream->name), "%s_%u", - ua_chan->name, ua_chan->streams.count++); + ua_chan->name, ua_chan->streams.count); + ua_chan->streams.count++; if (ret < 0) { PERROR("asprintf UST create stream"); /* diff --git a/src/bin/lttng-sessiond/ust-consumer.c b/src/bin/lttng-sessiond/ust-consumer.c index aabe494..44913cb 100644 --- a/src/bin/lttng-sessiond/ust-consumer.c +++ b/src/bin/lttng-sessiond/ust-consumer.c @@ -52,7 +52,8 @@ static int send_channel(int sock, struct ust_app_channel *uchan) uchan->obj->shm_fd, uchan->attr.subbuf_size, uchan->obj->memory_map_size, - uchan->name); + uchan->name, + uchan->streams.count); ret = consumer_send_channel(sock, &msg); if (ret < 0) { @@ -208,7 +209,8 @@ static int send_metadata(int sock, struct ust_app_session *usess, usess->metadata->obj->shm_fd, usess->metadata->attr.subbuf_size, usess->metadata->obj->memory_map_size, - "metadata"); + "metadata", + 1); ret = consumer_send_channel(sock, &msg); if (ret < 0) { diff --git a/src/common/consumer.c b/src/common/consumer.c index a2980e7..be358aa 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -319,7 +319,9 @@ void consumer_del_stream(struct lttng_consumer_stream *stream) } rcu_read_unlock(); - if (!--stream->chan->refcount) { + uatomic_dec(&stream->chan->refcount); + if (!uatomic_read(&stream->chan->refcount) + && !uatomic_read(&stream->chan->nb_init_streams)) { free_chan = stream->chan; } @@ -394,6 +396,16 @@ struct lttng_consumer_stream *consumer_allocate_stream( assert(0); goto end; } + /* + * When nb_init_streams reaches 0, we don't need to trigger any + * action in terms of destroying the associated channel, because + * the action that causes the count to become 0 also causes a + * stream to be added. The channel deletion will thus be + * triggered by the following removal of this stream. + */ + if (uatomic_read(&stream->chan->nb_init_streams) > 0) { + uatomic_dec(&stream->chan->nb_init_streams); + } DBG("Allocated stream %s (key %d, shm_fd %d, wait_fd %d, mmap_len %llu, out_fd %d, net_seq_idx %d)", stream->path_name, stream->key, stream->shm_fd, @@ -671,7 +683,8 @@ struct lttng_consumer_channel *consumer_allocate_channel( int channel_key, int shm_fd, int wait_fd, uint64_t mmap_len, - uint64_t max_sb_size) + uint64_t max_sb_size, + unsigned int nb_init_streams) { struct lttng_consumer_channel *channel; int ret; @@ -687,6 +700,7 @@ struct lttng_consumer_channel *consumer_allocate_channel( channel->mmap_len = mmap_len; channel->max_sb_size = max_sb_size; channel->refcount = 0; + channel->nb_init_streams = nb_init_streams; lttng_ht_node_init_ulong(&channel->node, channel->key); switch (consumer_data.type) { @@ -1602,7 +1616,8 @@ static void consumer_del_metadata_stream(struct lttng_consumer_stream *stream) /* Atomically decrement channel refcount since other threads can use it. */ uatomic_dec(&stream->chan->refcount); - if (!uatomic_read(&stream->chan->refcount)) { + if (!uatomic_read(&stream->chan->refcount) + && !uatomic_read(&stream->chan->nb_init_streams)) { free_chan = stream->chan; } diff --git a/src/common/consumer.h b/src/common/consumer.h index dba7765..6dbece9 100644 --- a/src/common/consumer.h +++ b/src/common/consumer.h @@ -77,6 +77,13 @@ struct lttng_consumer_channel { int key; uint64_t max_sb_size; /* the subbuffer size for this channel */ int refcount; /* Number of streams referencing this channel */ + /* + * nb_init_streams is the number of streams to receive + * initially. Used to guarantee that we do not destroy a + * channel before receiving all its associated streams. + */ + unsigned int nb_init_streams; + /* For UST */ int shm_fd; int wait_fd; @@ -342,7 +349,8 @@ extern struct lttng_consumer_channel *consumer_allocate_channel( int channel_key, int shm_fd, int wait_fd, uint64_t mmap_len, - uint64_t max_sb_size); + uint64_t max_sb_size, + unsigned int nb_init_streams); int consumer_add_channel(struct lttng_consumer_channel *channel); /* lttng-relayd consumer command */ diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index f910f03..5a219fc 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -118,7 +118,8 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, new_channel = consumer_allocate_channel(msg.u.channel.channel_key, -1, -1, msg.u.channel.mmap_len, - msg.u.channel.max_sb_size); + msg.u.channel.max_sb_size, + msg.u.channel.nb_init_streams); if (new_channel == NULL) { lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_OUTFD_ERROR); goto end_nosignal; diff --git a/src/common/sessiond-comm/sessiond-comm.h b/src/common/sessiond-comm/sessiond-comm.h index 62205f4..6d796ef 100644 --- a/src/common/sessiond-comm/sessiond-comm.h +++ b/src/common/sessiond-comm/sessiond-comm.h @@ -255,6 +255,8 @@ struct lttcomm_consumer_msg { uint64_t max_sb_size; /* the subbuffer size for this channel */ /* shm_fd and wait_fd are sent as ancillary data */ uint64_t mmap_len; + /* nb_init_streams is the number of streams open initially. */ + unsigned int nb_init_streams; char name[LTTNG_SYMBOL_NAME_LEN]; } channel; struct { diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 8ab2b81..ad4b014 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -150,7 +150,8 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, new_channel = consumer_allocate_channel(msg.u.channel.channel_key, fds[0], -1, msg.u.channel.mmap_len, - msg.u.channel.max_sb_size); + msg.u.channel.max_sb_size, + msg.u.channel.nb_init_streams); if (new_channel == NULL) { lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_OUTFD_ERROR); goto end_nosignal; -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Fri Sep 28 16:45:57 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Fri, 28 Sep 2012 16:45:57 -0400 Subject: [lttng-dev] [GIT PULL lttng-tools] Please pull from compudj-pull Message-ID: <20120928204557.GA22248@Krystal> Hi David, Please pull from compudj-pull at commit: commit 3870fc0dddd945410af05ac9e65f041acf84731a Author: Mathieu Desnoyers Date: Fri Sep 28 16:41:25 2012 -0400 Fix: consumer_allocate_stream error handling Fix a memory leak and "be nice" when handling stream alloc errors. Upon CPU hotplug, it is possible that we receive a stream only after all other streams are finalized, which means it could happen that we discard that channel, in the unlikely event that we have cpu hotplug concurrently with destroy. Moreover, this fix the return path of channel lookup failure: we were returning an zeroed stream rather than returning an error, which was certainly not the intended behavior. Signed-off-by: Mathieu Desnoyers Thanks! Mathieu -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From dgoulet at efficios.com Fri Sep 28 16:53:25 2012 From: dgoulet at efficios.com (David Goulet) Date: Fri, 28 Sep 2012 16:53:25 -0400 Subject: [lttng-dev] [GIT PULL lttng-tools] Please pull from compudj-pull In-Reply-To: <20120928204557.GA22248@Krystal> References: <20120928204557.GA22248@Krystal> Message-ID: <50660E45.8090204@efficios.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Pulled! Mathieu Desnoyers: > Hi David, > > Please pull from compudj-pull at commit: > > commit 3870fc0dddd945410af05ac9e65f041acf84731a Author: Mathieu > Desnoyers Date: Fri Sep 28 > 16:41:25 2012 -0400 > > Fix: consumer_allocate_stream error handling > > Fix a memory leak and "be nice" when handling stream alloc errors. > Upon CPU hotplug, it is possible that we receive a stream only > after all other streams are finalized, which means it could happen > that we discard that channel, in the unlikely event that we have > cpu hotplug concurrently with destroy. > > Moreover, this fix the return path of channel lookup failure: we > were returning an zeroed stream rather than returning an error, > which was certainly not the intended behavior. > > Signed-off-by: Mathieu Desnoyers > > Thanks! > > Mathieu > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJQZg5CAAoJEELoaioR9I02IZ0H/jfw63XUaIicL5Z5SPZQ7bmY mvp0AtzqHejvhGp9x1uU62OB8bag2jU9hi0mBiGe8I5xZv8Bu5iSXbWu8KZAKCaG JJXpg7M2IVkzVzPuYxr64wcBL7D90ESdbdpHJ6t7oHL/eZ8lgeGEOlu6TjNW+Eum D8rn7uBlEWHzxLWJWKvI+CgbJRSWPbZNbq8ECo2hvutHcKvW18ImJxpwFFi1KUUA HmFDs+5mtNx5yAHFBdGBl8ADFtMdTS6UY1WDgF+3A01glgSchHF7LqW5fWl+6Ni5 yOdvFUSH/hDkHsZESpARKTRrGI2Iovq2ipOXQhPxyuY03mL6iMKLqHmzqCu//Yk= =Fzmx -----END PGP SIGNATURE----- From christian.babeux at efficios.com Fri Sep 28 19:08:29 2012 From: christian.babeux at efficios.com (Christian Babeux) Date: Fri, 28 Sep 2012 19:08:29 -0400 Subject: [lttng-dev] [PATCH lttng-ust] Fix: reloc offset validation error out on filters with no reloc table Message-ID: <1348873709-6547-1-git-send-email-christian.babeux@efficios.com> The reloc table is currently appended at the end of the bytecode data. With this scheme, the reloc table offset will be equal to the length of the bytecode data. <- length -> +----------+-------------+ | BYTECODE | RELOC TABLE | +----------+-------------+ | +--> Reloc table offset A special case arise with filters with no reloc table. Example: Filter: "myString" == "yourString" ./filter-grammar-test -p -B -i -b < bogus Generating IR... done Validating IR... done Generating bytecode... done Size of bytecode generated: 24 bytes. Bytecode: Val. Operator ---- -------- 0x40 (FILTER_OP_LOAD_STRING) 0x6D m 0x79 y 0x53 S 0x74 t 0x72 r 0x69 i 0x6E n 0x67 g 0x00 \0 0x40 (FILTER_OP_LOAD_STRING) 0x79 y 0x6F o 0x75 u 0x72 r 0x53 S 0x74 t 0x72 r 0x69 i 0x6E n 0x67 g 0x00 \0 0x0C (FILTER_OP_EQ) 0x01 (FILTER_OP_RETURN) Reloc table (offset: 24): Empty <- 24 -> +----------+ | BYTECODE | <- No reloc table +----------+ | +--> Reloc table offset In this case, we see that the reloc table offset (24) is indeed equal to the length of the bytecode (24), but the reloc table is _empty_. Thus, the reloc_offset received in handle_message() will be equal to the data_size and will be wrongly flagged as not within the data even thought the filter is entirely valid. The fix is to simply allow a reloc_offset to be equal to the data_size. Fixes #342 Signed-off-by: Christian Babeux --- liblttng-ust/lttng-ust-comm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index a464e88..efc6724 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -294,7 +294,7 @@ int handle_message(struct sock_info *sock_info, goto error; } - if (lum->u.filter.reloc_offset > lum->u.filter.data_size - 1) { + if (lum->u.filter.reloc_offset > lum->u.filter.data_size) { ERR("Filter reloc offset %u is not within data\n", lum->u.filter.reloc_offset); ret = -EINVAL; -- 1.7.12 From francis.giraldeau at gmail.com Sat Sep 29 10:57:30 2012 From: francis.giraldeau at gmail.com (Francis Giraldeau) Date: Sat, 29 Sep 2012 10:57:30 -0400 Subject: [lttng-dev] UST app and lttng-tools compatibility Message-ID: <50670C5A.4060800@gmail.com> Hi, I wanted to share my lttng-ust 2.1 update experience, maybe it will save time for others. I updated lttng-ust recently. After this change, the app would not produce a trace anymore. No error message is displayed by the traced app to indicate that something is wrong. Even when setting LTTNG_DEBUG_UST to the app's environment variable, there is no error message. The debug output suggests that probes are registered and everything is fine, while it's not. By running lttng-sessiond with -vvv --verbose-consumer, I finally got this message: DEBUG2: UST app PID 8112 is not compatible with major version 3 (supporting <= 2) [in ust_app_validate_version() at ust-app.c:2633] Updating lttng-tools to 2.1 solved the issue. Seems that it's mandatory to update lttng-tools to support latest lttng-ust. It may be obvious for developers, but it should be clear for users that they must upgrade both. IMHO, It would be nice if the app side log could tell if the session/consumer refused the registration. Cheers, Francis Giraldeau -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4489 bytes Desc: Signature cryptographique S/MIME URL: From mathieu.desnoyers at efficios.com Sat Sep 29 13:38:52 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Sat, 29 Sep 2012 13:38:52 -0400 Subject: [lttng-dev] [PATCH lttng-ust] Fix: reloc offset validation error out on filters with no reloc table In-Reply-To: <1348873709-6547-1-git-send-email-christian.babeux@efficios.com> References: <1348873709-6547-1-git-send-email-christian.babeux@efficios.com> Message-ID: <20120929173852.GB19525@Krystal> * Christian Babeux (christian.babeux at efficios.com) wrote: > The reloc table is currently appended at the end of the bytecode data. > With this scheme, the reloc table offset will be equal to the length > of the bytecode data. merged, thanks! Mathieu > > <- length -> > +----------+-------------+ > | BYTECODE | RELOC TABLE | > +----------+-------------+ > | > +--> Reloc table offset > > A special case arise with filters with no reloc table. > > Example: > > Filter: "myString" == "yourString" > ./filter-grammar-test -p -B -i -b < bogus > > > > > > > > > > > Generating IR... done > Validating IR... done > Generating bytecode... done > Size of bytecode generated: 24 bytes. > Bytecode: > > Val. Operator > ---- -------- > 0x40 (FILTER_OP_LOAD_STRING) > 0x6D m > 0x79 y > 0x53 S > 0x74 t > 0x72 r > 0x69 i > 0x6E n > 0x67 g > 0x00 \0 > 0x40 (FILTER_OP_LOAD_STRING) > 0x79 y > 0x6F o > 0x75 u > 0x72 r > 0x53 S > 0x74 t > 0x72 r > 0x69 i > 0x6E n > 0x67 g > 0x00 \0 > 0x0C (FILTER_OP_EQ) > 0x01 (FILTER_OP_RETURN) > > Reloc table (offset: 24): > Empty > > <- 24 -> > +----------+ > | BYTECODE | <- No reloc table > +----------+ > | > +--> Reloc table offset > > In this case, we see that the reloc table offset (24) is indeed equal to > the length of the bytecode (24), but the reloc table is _empty_. Thus, > the reloc_offset received in handle_message() will be equal to the > data_size and will be wrongly flagged as not within the data even thought > the filter is entirely valid. > > The fix is to simply allow a reloc_offset to be equal to the data_size. > > Fixes #342 > > Signed-off-by: Christian Babeux > --- > liblttng-ust/lttng-ust-comm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c > index a464e88..efc6724 100644 > --- a/liblttng-ust/lttng-ust-comm.c > +++ b/liblttng-ust/lttng-ust-comm.c > @@ -294,7 +294,7 @@ int handle_message(struct sock_info *sock_info, > goto error; > } > > - if (lum->u.filter.reloc_offset > lum->u.filter.data_size - 1) { > + if (lum->u.filter.reloc_offset > lum->u.filter.data_size) { > ERR("Filter reloc offset %u is not within data\n", > lum->u.filter.reloc_offset); > ret = -EINVAL; > -- > 1.7.12 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From mathieu.desnoyers at efficios.com Sat Sep 29 14:28:00 2012 From: mathieu.desnoyers at efficios.com (Mathieu Desnoyers) Date: Sat, 29 Sep 2012 14:28:00 -0400 Subject: [lttng-dev] UST app and lttng-tools compatibility In-Reply-To: <50670C5A.4060800@gmail.com> References: <50670C5A.4060800@gmail.com> Message-ID: <20120929182800.GA19994@Krystal> * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: > Hi, > > I wanted to share my lttng-ust 2.1 update experience, maybe it will save > time for others. > > I updated lttng-ust recently. After this change, the app would not > produce a trace anymore. No error message is displayed by the traced app > to indicate that something is wrong. Even when setting LTTNG_DEBUG_UST > to the app's environment variable, there is no error message. The debug > output suggests that probes are registered and everything is fine, while > it's not. > > By running lttng-sessiond with -vvv --verbose-consumer, I finally got > this message: > > DEBUG2: UST app PID 8112 is not compatible with major version 3 > (supporting <= 2) [in ust_app_validate_version() at ust-app.c:2633] > > Updating lttng-tools to 2.1 solved the issue. Seems that it's mandatory > to update lttng-tools to support latest lttng-ust. It may be obvious for > developers, but it should be clear for users that they must upgrade both. > > IMHO, It would be nice if the app side log could tell if the > session/consumer refused the registration. I agree we should do better. Regarding lttng-tools, I think changing this DBG2 message to a WARN message would help, so sessiond would show the warning, except in the case where it is started with "-d". On the application side, this is a bit tricky. It has no way to find out that it has been rejected by the sessiond. The application registers at startup, and then the sessiond keeps the connexion active, but flags it as incompatible internally. The reason we do that is because we don't want the application to retry endlessly. Moreover, I cannot change the code for the existing 2.0 UST libs, so adding a new message is not possible. One thing we have in mind for 2.2 or 2.3 is to add syslog support within the sessiond. This would provide a nice centralized place to look at those logs. Thoughts ? Thanks, Mathieu > > Cheers, > > Francis Giraldeau > > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com From francis.giraldeau at gmail.com Sun Sep 30 23:42:23 2012 From: francis.giraldeau at gmail.com (Francis Giraldeau) Date: Sun, 30 Sep 2012 23:42:23 -0400 Subject: [lttng-dev] UST app and lttng-tools compatibility In-Reply-To: <20120929182800.GA19994@Krystal> References: <50670C5A.4060800@gmail.com> <20120929182800.GA19994@Krystal> Message-ID: <5069111F.1080604@gmail.com> Le 2012-09-29 14:28, Mathieu Desnoyers a ?crit : > * Francis Giraldeau (francis.giraldeau at gmail.com) wrote: >> Hi, >> >> I wanted to share my lttng-ust 2.1 update experience, maybe it will save >> time for others. >> >> I updated lttng-ust recently. After this change, the app would not >> produce a trace anymore. No error message is displayed by the traced app >> to indicate that something is wrong. Even when setting LTTNG_DEBUG_UST >> to the app's environment variable, there is no error message. The debug >> output suggests that probes are registered and everything is fine, while >> it's not. >> >> By running lttng-sessiond with -vvv --verbose-consumer, I finally got >> this message: >> >> DEBUG2: UST app PID 8112 is not compatible with major version 3 >> (supporting <= 2) [in ust_app_validate_version() at ust-app.c:2633] >> >> Updating lttng-tools to 2.1 solved the issue. Seems that it's mandatory >> to update lttng-tools to support latest lttng-ust. It may be obvious for >> developers, but it should be clear for users that they must upgrade both. >> >> IMHO, It would be nice if the app side log could tell if the >> session/consumer refused the registration. > > I agree we should do better. > > Regarding lttng-tools, I think changing this DBG2 message to a WARN > message would help, so sessiond would show the warning, except in the > case where it is started with "-d". Excellent idea. > On the application side, this is a bit tricky. It has no way to find out > that it has been rejected by the sessiond. The application registers at > startup, and then the sessiond keeps the connexion active, but flags it > as incompatible internally. The reason we do that is because we don't > want the application to retry endlessly. Could the registration process block until the sessiond returns some status? I understand that in commercial setup, the application should not be prevented to start and run normally if tracing is not available or misconfigured. But for developers, some env var like "LTTNG_ABORT_ON_ERROR" could help to diagnose this king of problem. > Moreover, I cannot change the code for the existing 2.0 UST libs, so > adding a new message is not possible. Of course! ;) > One thing we have in mind for 2.2 or 2.3 is to add syslog support within > the sessiond. This would provide a nice centralized place to look at > those logs. I think it would be great. It's a bit less hidden, but certainly address concerns for production, and still can be used by developers. An error message is better than no one! ;) Cheers, Francis -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4489 bytes Desc: Signature cryptographique S/MIME URL: