aboutsummaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2012-05-25 13:35:08 -0700
committerRoland McGrath <roland@hack.frob.com>2012-05-25 13:41:03 -0700
commit5acf7263d52992ce4144e0a3b3644985b9e792b4 (patch)
treec128be190c1c3fb5a1987710033c016d5b881b70 /nptl
parent8422c9a560e6e3c854739c8a13ecb1c6714f930f (diff)
downloadglibc-5acf7263d52992ce4144e0a3b3644985b9e792b4.tar
glibc-5acf7263d52992ce4144e0a3b3644985b9e792b4.tar.gz
glibc-5acf7263d52992ce4144e0a3b3644985b9e792b4.tar.bz2
glibc-5acf7263d52992ce4144e0a3b3644985b9e792b4.zip
Add systemtap static probe points in generic and x86_64 pthread code.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog29
-rw-r--r--nptl/DESIGN-systemtap-probes.txt89
-rw-r--r--nptl/pthread_cond_broadcast.c3
-rw-r--r--nptl/pthread_cond_destroy.c19
-rw-r--r--nptl/pthread_cond_init.c6
-rw-r--r--nptl/pthread_cond_signal.c5
-rw-r--r--nptl/pthread_cond_wait.c9
-rw-r--r--nptl/pthread_create.c4
-rw-r--r--nptl/pthread_join.c8
-rw-r--r--nptl/pthread_mutex_destroy.c6
-rw-r--r--nptl/pthread_mutex_init.c7
-rw-r--r--nptl/pthread_mutex_lock.c10
-rw-r--r--nptl/pthread_mutex_timedlock.c14
-rw-r--r--nptl/pthread_mutex_unlock.c10
-rw-r--r--nptl/pthread_rwlock_destroy.c5
-rw-r--r--nptl/pthread_rwlock_rdlock.c7
-rw-r--r--nptl/pthread_rwlock_unlock.c5
-rw-r--r--nptl/pthread_rwlock_wrlock.c7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S27
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S7
26 files changed, 266 insertions, 53 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index ade0b18bc1..9b63c5365d 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,32 @@
+2012-05-25 Rayson Ho <rho@redhat.com>
+ Roland McGrath <roland@hack.frob.com>
+
+ * DESIGN-systemtap-probes.txt: New file.
+ * pthread_cond_broadcast.c: SystemTap probes.
+ * pthread_cond_init.c: Likewise.
+ * pthread_cond_signal.c: Likewise.
+ * pthread_cond_wait.c: Likewise.
+ * pthread_cond_destroy.c: Likewise.
+ * pthread_create.c: Likewise.
+ * pthread_join.c: Likewise.
+ * pthread_mutex_destroy.c: Likewise.
+ * pthread_mutex_init.c: Likewise.
+ * pthread_mutex_lock.c: Likewise.
+ * pthread_mutex_timedlock.c: Likewise.
+ * pthread_mutex_unlock.c: Likewise.
+ * pthread_rwlock_destroy.c: Likewise.
+ * pthread_rwlock_rdlock.c: Likewise.
+ * pthread_rwlock_unlock.c: Likewise.
+ * pthread_rwlock_wrlock.c: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S: Likewise.
+
2012-05-24 Roland McGrath <roland@hack.frob.com>
* pthread_create.c (start_thread): Define pthread_start LIBC_PROBE.
diff --git a/nptl/DESIGN-systemtap-probes.txt b/nptl/DESIGN-systemtap-probes.txt
new file mode 100644
index 0000000000..16d7c45134
--- /dev/null
+++ b/nptl/DESIGN-systemtap-probes.txt
@@ -0,0 +1,89 @@
+Systemtap is a dynamic tracing/instrumenting tool available on Linux. Probes
+that are not fired at run time have close to zero overhead.
+
+The following probes are available for NPTL:
+
+Thread creation & Join Probes
+=============================
+pthread_create - probe for pthread_create
+ arg1 = pointer (pthread_t*) to thread
+ arg2 = pointer (pthread_attr_t*) to attr
+ arg3 = pointer (void *) to start_routine
+ arg4 = arguments to start_routine
+pthread_start - probe for actual thread creation
+ arg1 = struct pthread (members include thread ID, process ID)
+ arg2 = address of start_routine
+ arg3 = pointer to the list of arguments
+pthread_join - probe for pthread_join
+ arg1 = thread ID
+pthread_join_ret - probe for pthread_join return
+ arg1 = thread ID
+ arg2 = return value
+
+Lock-related Probes
+===================
+mutex_init - probe for pthread_mutex_init
+ arg1 = address of mutex lock
+mutex_acquired - probe for succ. return of pthread_mutex_lock
+ arg1 = address of mutex lock
+mutex_timedlock_acquired - probe for succ. return of pthread_mutex_timedlock
+ arg1 = address of mutex lock
+mutex_entry - probe for entry to the pthread_mutex_lock function
+ arg1 = address of mutex lock
+mutex_timedlock_entry - probe for entry to the pthread_mutex_timedlock function
+ arg1 = address of mutex lock, arg2 = address of timespec
+mutex_release - probe for pthread_mutex_unlock after the successful release of a
+ mutex lock
+ arg1 = address of mutex lock
+mutex_destroy - probe for pthread_mutex_destroy
+ arg1 = address of mutex lock
+
+wrlock_entry - probe for entry to the pthread_rwlock_wrlock function
+ arg1 = address of rw lock
+rdlock_entry - probe for entry to the pthread_rwlock_rdlock function
+ arg1 = address of rw lock
+
+rwlock_destroy - probe for pthread_rwlock_destroy
+ arg1 = address of rw lock
+wrlock_acquire_write - probe for pthread_rwlock_wrlock (after getting the lock)
+ arg1 = address of rw lock
+rdlock_acquire_read - probe for pthread_rwlock_rdlock after successfully getting
+ the lock
+ arg1 = address of rw lock
+rwlock_unlock - probe for pthread_rwlock_unlock
+ arg1 = address of rw lock
+
+lll_lock_wait - probe in low-level (assembly language) locking code, only fired
+ when futex/FUTEX_WAIT is called (i.e. when trying to acquire a
+ contented lock)
+ arg1 = pointer to futex
+ arg2 = flags passed to the futex system call
+lll_lock_wait_private - probe in low-level (assembly language) locking code,
+ only fired when futex/FUTEX_WAIT is called (i.e. when
+ trying to acquire a contented lock)
+ arg1 = pointer to futex
+
+lll_futex_wake - probe in low-level (assembly language) locking code, only fired
+ when futex (FUTEX_WAKE) is called
+ arg1 = pointer to futex
+ arg2 = number of processes to wake
+ arg3 = additional flags
+
+Condition variable Probes
+=========================
+cond_init - probe for pthread_cond_init
+ arg1 = condition
+ arg2 = attr
+cond_destroy - probe for pthread_cond_destroy
+ arg1 = cond
+cond_wait - probe for pthread_cond_wait
+ arg1 = condition
+ arg2 = mutex lock
+cond_timedwait - probe for pthread_cond_timedwait
+ arg1 = condition
+ arg2 = mutex lock
+ arg3 = timespec
+cond_signal - probe for pthread_cond_signal
+ arg1 = condition
+cond_broadcast - probe for pthread_cond_broadcast
+ arg1 = condition
diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c
index 9b67f755f5..7bc76ac0e5 100644
--- a/nptl/pthread_cond_broadcast.c
+++ b/nptl/pthread_cond_broadcast.c
@@ -22,6 +22,7 @@
#include <lowlevellock.h>
#include <pthread.h>
#include <pthreadP.h>
+#include <stap-probe.h>
#include <shlib-compat.h>
#include <kernel-features.h>
@@ -31,6 +32,8 @@ int
__pthread_cond_broadcast (cond)
pthread_cond_t *cond;
{
+ LIBC_PROBE (cond_broadcast, 1, cond);
+
int pshared = (cond->__data.__mutex == (void *) ~0l)
? LLL_SHARED : LLL_PRIVATE;
/* Make sure we are alone. */
diff --git a/nptl/pthread_cond_destroy.c b/nptl/pthread_cond_destroy.c
index 0f03b294b3..5f57b563c0 100644
--- a/nptl/pthread_cond_destroy.c
+++ b/nptl/pthread_cond_destroy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -19,6 +19,7 @@
#include <errno.h>
#include <shlib-compat.h>
#include "pthreadP.h"
+#include <stap-probe.h>
int
@@ -28,6 +29,8 @@ __pthread_cond_destroy (cond)
int pshared = (cond->__data.__mutex == (void *) ~0l)
? LLL_SHARED : LLL_PRIVATE;
+ LIBC_PROBE (cond_destroy, 1, cond);
+
/* Make sure we are alone. */
lll_lock (cond->__data.__lock, pshared);
@@ -50,13 +53,13 @@ __pthread_cond_destroy (cond)
if (nwaiters >= (1 << COND_NWAITERS_SHIFT))
{
/* Wake everybody on the associated mutex in case there are
- threads that have been requeued to it.
- Without this, pthread_cond_destroy could block potentially
- for a long time or forever, as it would depend on other
- thread's using the mutex.
- When all threads waiting on the mutex are woken up, pthread_cond_wait
- only waits for threads to acquire and release the internal
- condvar lock. */
+ threads that have been requeued to it.
+ Without this, pthread_cond_destroy could block potentially
+ for a long time or forever, as it would depend on other
+ thread's using the mutex.
+ When all threads waiting on the mutex are woken up, pthread_cond_wait
+ only waits for threads to acquire and release the internal
+ condvar lock. */
if (cond->__data.__mutex != NULL
&& cond->__data.__mutex != (void *) ~0l)
{
diff --git a/nptl/pthread_cond_init.c b/nptl/pthread_cond_init.c
index dcc6b3c14c..554fe6fedf 100644
--- a/nptl/pthread_cond_init.c
+++ b/nptl/pthread_cond_init.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008
- Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -19,6 +18,7 @@
#include <shlib-compat.h>
#include "pthreadP.h"
+#include <stap-probe.h>
int
@@ -41,6 +41,8 @@ __pthread_cond_init (cond, cond_attr)
? NULL : (void *) ~0l);
cond->__data.__broadcast_seq = 0;
+ LIBC_PROBE (cond_init, 2, cond, cond_attr);
+
return 0;
}
versioned_symbol (libpthread, __pthread_cond_init,
diff --git a/nptl/pthread_cond_signal.c b/nptl/pthread_cond_signal.c
index e4716f2b08..063dcbc32a 100644
--- a/nptl/pthread_cond_signal.c
+++ b/nptl/pthread_cond_signal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
@@ -25,6 +25,7 @@
#include <shlib-compat.h>
#include <kernel-features.h>
+#include <stap-probe.h>
int
@@ -34,6 +35,8 @@ __pthread_cond_signal (cond)
int pshared = (cond->__data.__mutex == (void *) ~0l)
? LLL_SHARED : LLL_PRIVATE;
+ LIBC_PROBE (cond_signal, 1, cond);
+
/* Make sure we are alone. */
lll_lock (cond->__data.__lock, pshared);
diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c
index c05d06c143..35505d9a19 100644
--- a/nptl/pthread_cond_wait.c
+++ b/nptl/pthread_cond_wait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003,2004,2006,2007,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
@@ -24,6 +24,7 @@
#include <pthreadP.h>
#include <shlib-compat.h>
+#include <stap-probe.h>
struct _condvar_cleanup_buffer
@@ -43,7 +44,7 @@ __condvar_cleanup (void *arg)
(struct _condvar_cleanup_buffer *) arg;
unsigned int destroying;
int pshared = (cbuffer->cond->__data.__mutex == (void *) ~0l)
- ? LLL_SHARED : LLL_PRIVATE;
+ ? LLL_SHARED : LLL_PRIVATE;
/* We are going to modify shared data. */
lll_lock (cbuffer->cond->__data.__lock, pshared);
@@ -98,7 +99,9 @@ __pthread_cond_wait (cond, mutex)
struct _condvar_cleanup_buffer cbuffer;
int err;
int pshared = (cond->__data.__mutex == (void *) ~0l)
- ? LLL_SHARED : LLL_PRIVATE;
+ ? LLL_SHARED : LLL_PRIVATE;
+
+ LIBC_PROBE (cond_wait, 2, cond, mutex);
/* Make sure we are alone. */
lll_lock (cond->__data.__lock, pshared);
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index c52ae11379..97d83256a4 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007,2008,2009,2010,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -560,6 +560,8 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
/* Pass the descriptor to the caller. */
*newthread = (pthread_t) pd;
+ LIBC_PROBE (pthread_create, 4, newthread, attr, start_routine, arg);
+
/* Start the thread. */
return create_thread (pd, iattr, STACK_VARIABLES_ARGS);
}
diff --git a/nptl/pthread_join.c b/nptl/pthread_join.c
index b8834cc9c1..bf1a01dbc9 100644
--- a/nptl/pthread_join.c
+++ b/nptl/pthread_join.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -22,6 +22,8 @@
#include <atomic.h>
#include "pthreadP.h"
+#include <stap-probe.h>
+
static void
cleanup (void *arg)
@@ -54,6 +56,8 @@ pthread_join (threadid, thread_return)
struct pthread *self = THREAD_SELF;
int result = 0;
+ LIBC_PROBE (pthread_join, 1, threadid);
+
/* During the wait we change to asynchronous cancellation. If we
are canceled the thread we are waiting for must be marked as
un-wait-ed for again. */
@@ -109,5 +113,7 @@ pthread_join (threadid, thread_return)
__free_tcb (pd);
}
+ LIBC_PROBE (pthread_join_ret, 3, threadid, result, pd->result);
+
return result;
}
diff --git a/nptl/pthread_mutex_destroy.c b/nptl/pthread_mutex_destroy.c
index 408b16a7b2..107ec8e4e4 100644
--- a/nptl/pthread_mutex_destroy.c
+++ b/nptl/pthread_mutex_destroy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -19,11 +19,15 @@
#include <errno.h>
#include "pthreadP.h"
+#include <stap-probe.h>
+
int
__pthread_mutex_destroy (mutex)
pthread_mutex_t *mutex;
{
+ LIBC_PROBE (mutex_destroy, 1, mutex);
+
if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0
&& mutex->__data.__nusers != 0)
return EBUSY;
diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c
index 0596e07f3c..6536e44d0b 100644
--- a/nptl/pthread_mutex_init.c
+++ b/nptl/pthread_mutex_init.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -23,6 +22,8 @@
#include <kernel-features.h>
#include "pthreadP.h"
+#include <stap-probe.h>
+
static const struct pthread_mutexattr default_attr =
{
/* Default is a normal mutex, not shared between processes. */
@@ -134,6 +135,8 @@ __pthread_mutex_init (mutex, mutexattr)
// mutex->__spins = 0; already done by memset
// mutex->__next = NULL; already done by memset
+ LIBC_PROBE (mutex_init, 1, mutex);
+
return 0;
}
strong_alias (__pthread_mutex_init, pthread_mutex_init)
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index c747355e49..2b30bad48d 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -23,6 +23,7 @@
#include <not-cancel.h>
#include "pthreadP.h"
#include <lowlevellock.h>
+#include <stap-probe.h>
#ifndef LLL_MUTEX_LOCK
@@ -47,6 +48,9 @@ __pthread_mutex_lock (mutex)
assert (sizeof (mutex->__size) >= sizeof (mutex->__data));
unsigned int type = PTHREAD_MUTEX_TYPE (mutex);
+
+ LIBC_PROBE (mutex_entry, 1, mutex);
+
if (__builtin_expect (type & ~PTHREAD_MUTEX_KIND_MASK_NP, 0))
return __pthread_mutex_lock_full (mutex);
@@ -126,6 +130,8 @@ __pthread_mutex_lock (mutex)
++mutex->__data.__nusers;
#endif
+ LIBC_PROBE (mutex_acquired, 1, mutex);
+
return 0;
}
@@ -466,6 +472,8 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
++mutex->__data.__nusers;
#endif
+ LIBC_PROBE (mutex_acquired, 1, mutex);
+
return 0;
}
#ifndef __pthread_mutex_lock
diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index b7f34d4fd2..52fa74c0dc 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -23,6 +23,8 @@
#include <lowlevellock.h>
#include <not-cancel.h>
+#include <stap-probe.h>
+
int
pthread_mutex_timedlock (mutex, abstime)
@@ -33,6 +35,8 @@ pthread_mutex_timedlock (mutex, abstime)
pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
int result = 0;
+ LIBC_PROBE (mutex_timedlock_entry, 2, mutex, abstime);
+
/* We must not check ABSTIME here. If the thread does not block
abstime must not be checked for a valid value. */
@@ -171,6 +175,8 @@ pthread_mutex_timedlock (mutex, abstime)
++mutex->__data.__count;
+ LIBC_PROBE (mutex_timedlock_acquired, 1, mutex);
+
return 0;
}
}
@@ -241,6 +247,8 @@ pthread_mutex_timedlock (mutex, abstime)
++mutex->__data.__count;
+ LIBC_PROBE (mutex_timedlock_acquired, 1, mutex);
+
return 0;
}
}
@@ -376,6 +384,8 @@ pthread_mutex_timedlock (mutex, abstime)
++mutex->__data.__count;
+ LIBC_PROBE (mutex_timedlock_acquired, 1, mutex);
+
return 0;
}
}
@@ -476,6 +486,8 @@ pthread_mutex_timedlock (mutex, abstime)
/* Record the ownership. */
mutex->__data.__owner = id;
++mutex->__data.__nusers;
+
+ LIBC_PROBE (mutex_timedlock_acquired, 1, mutex);
}
out:
diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c
index 0f35f6203f..aa8ecbd583 100644
--- a/nptl/pthread_mutex_unlock.c
+++ b/nptl/pthread_mutex_unlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include "pthreadP.h"
#include <lowlevellock.h>
+#include <stap-probe.h>
static int
internal_function
@@ -49,6 +50,9 @@ __pthread_mutex_unlock_usercnt (mutex, decr)
/* Unlock. */
lll_unlock (mutex->__data.__lock, PTHREAD_MUTEX_PSHARED (mutex));
+
+ LIBC_PROBE (mutex_release, 1, mutex);
+
return 0;
}
else if (__builtin_expect (type == PTHREAD_MUTEX_RECURSIVE_NP, 1))
@@ -271,6 +275,9 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
PTHREAD_MUTEX_PSHARED (mutex));
int oldprio = newval >> PTHREAD_MUTEX_PRIO_CEILING_SHIFT;
+
+ LIBC_PROBE (mutex_release, 1, mutex);
+
return __pthread_tpp_change_priority (oldprio, -1);
default:
@@ -278,6 +285,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
return EINVAL;
}
+ LIBC_PROBE (mutex_release, 1, mutex);
return 0;
}
diff --git a/nptl/pthread_rwlock_destroy.c b/nptl/pthread_rwlock_destroy.c
index 606833acf5..78abe5ecef 100644
--- a/nptl/pthread_rwlock_destroy.c
+++ b/nptl/pthread_rwlock_destroy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -17,12 +17,15 @@
<http://www.gnu.org/licenses/>. */
#include "pthreadP.h"
+#include <stap-probe.h>
int
__pthread_rwlock_destroy (rwlock)
pthread_rwlock_t *rwlock;
{
+ LIBC_PROBE (rwlock_destroy, 1, rwlock);
+
/* Nothing to be done. For now. */
return 0;
}
diff --git a/nptl/pthread_rwlock_rdlock.c b/nptl/pthread_rwlock_rdlock.c
index 4aa1c5bb59..14688e2981 100644
--- a/nptl/pthread_rwlock_rdlock.c
+++ b/nptl/pthread_rwlock_rdlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003,2004,2007,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
@@ -21,6 +21,7 @@
#include <lowlevellock.h>
#include <pthread.h>
#include <pthreadP.h>
+#include <stap-probe.h>
/* Acquire read lock for RWLOCK. */
@@ -30,6 +31,8 @@ __pthread_rwlock_rdlock (rwlock)
{
int result = 0;
+ LIBC_PROBE (rdlock_entry, 1, rwlock);
+
/* Make sure we are alone. */
lll_lock (rwlock->__data.__lock, rwlock->__data.__shared);
@@ -48,6 +51,8 @@ __pthread_rwlock_rdlock (rwlock)
--rwlock->__data.__nr_readers;
result = EAGAIN;
}
+ else
+ LIBC_PROBE (rdlock_acquire_read, 1, rwlock);
break;
}
diff --git a/nptl/pthread_rwlock_unlock.c b/nptl/pthread_rwlock_unlock.c
index 15418c82f5..a727d89b9c 100644
--- a/nptl/pthread_rwlock_unlock.c
+++ b/nptl/pthread_rwlock_unlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
@@ -21,11 +21,14 @@
#include <lowlevellock.h>
#include <pthread.h>
#include <pthreadP.h>
+#include <stap-probe.h>
/* Unlock RWLOCK. */
int
__pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
{
+ LIBC_PROBE (rwlock_unlock, 1, rwlock);
+
lll_lock (rwlock->__data.__lock, rwlock->__data.__shared);
if (rwlock->__data.__writer)
rwlock->__data.__writer = 0;
diff --git a/nptl/pthread_rwlock_wrlock.c b/nptl/pthread_rwlock_wrlock.c
index a645487877..6d8fb93c3b 100644
--- a/nptl/pthread_rwlock_wrlock.c
+++ b/nptl/pthread_rwlock_wrlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003,2007,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
@@ -21,6 +21,7 @@
#include <lowlevellock.h>
#include <pthread.h>
#include <pthreadP.h>
+#include <stap-probe.h>
/* Acquire write lock for RWLOCK. */
@@ -30,6 +31,8 @@ __pthread_rwlock_wrlock (rwlock)
{
int result = 0;
+ LIBC_PROBE (wrlock_entry, 1, rwlock);
+
/* Make sure we are alone. */
lll_lock (rwlock->__data.__lock, rwlock->__data.__shared);
@@ -40,6 +43,8 @@ __pthread_rwlock_wrlock (rwlock)
{
/* Mark self as writer. */
rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
+
+ LIBC_PROBE (wrlock_acquire_write, 1, rwlock);
break;
}
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
index b7bfc3706d..dc95421023 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -21,6 +21,8 @@
#include <kernel-features.h>
#include <lowlevellock.h>
+#include <stap-probe.h>
+
.text
#ifdef __ASSUME_PRIVATE_FUTEX
@@ -86,7 +88,8 @@ __lll_lock_wait_private:
cmpl %edx, %eax /* NB: %edx == 2 */
jne 2f
-1: movl $SYS_futex, %eax
+1: LIBC_PROBE (lll_lock_wait_private, 1, %rdi)
+ movl $SYS_futex, %eax
syscall
2: movl %edx, %eax
@@ -125,7 +128,8 @@ __lll_lock_wait:
cmpl %edx, %eax /* NB: %edx == 2 */
jne 2f
-1: movl $SYS_futex, %eax
+1: LIBC_PROBE (lll_lock_wait, 2, %rdi, %rsi)
+ movl $SYS_futex, %eax
syscall
2: movl %edx, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
index ad14185d1b..3686970f08 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 2002-2004, 2006-2008, 2009, 2012
- Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -20,6 +19,8 @@
#ifndef _LOWLEVELLOCK_H
#define _LOWLEVELLOCK_H 1
+#include <stap-probe.h>
+
#ifndef __ASSEMBLER__
# include <time.h>
# include <sys/param.h>
@@ -227,6 +228,7 @@ LLL_STUB_UNWIND_INFO_END
do { \
int __ignore; \
register __typeof (nr) _nr __asm ("edx") = (nr); \
+ LIBC_PROBE (lll_futex_wake, 3, futex, nr, private); \
__asm __volatile ("syscall" \
: "=a" (__ignore) \
: "0" (SYS_futex), "D" (futex), \
@@ -286,7 +288,7 @@ LLL_STUB_UNWIND_INFO_END
"je 0f\n\t" \
"lock; cmpxchgl %4, %2\n\t" \
"jnz 1f\n\t" \
- "jmp 24f\n" \
+ "jmp 24f\n" \
"0:\tcmpxchgl %4, %2\n\t" \
"jnz 1f\n\t"
#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
index 7b0eec10e0..67ff5fc4cd 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
@@ -1,5 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
- Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -24,7 +23,7 @@
#include <kernel-features.h>
#include <pthread-pi-defines.h>
#include <pthread-errnos.h>
-
+#include <stap-probe.h>
.text
@@ -34,6 +33,8 @@
.align 16
__pthread_cond_broadcast:
+ LIBC_PROBE (cond_broadcast, 1, %rdi)
+
/* Get internal lock. */
movl $1, %esi
xorl %eax, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
index a77b7d5965..3bff19bd12 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -23,6 +23,7 @@
#include <pthread-pi-defines.h>
#include <kernel-features.h>
#include <pthread-errnos.h>
+#include <stap-probe.h>
.text
@@ -33,6 +34,8 @@
.align 16
__pthread_cond_signal:
+ LIBC_PROBE (cond_signal, 1, %rdi)
+
/* Get internal lock. */
movq %rdi, %r8
movl $1, %esi
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
index 79bfecdbf2..50e1ffd551 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2005,2007,2009,2010,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -22,6 +22,7 @@
#include <lowlevelcond.h>
#include <pthread-pi-defines.h>
#include <pthread-errnos.h>
+#include <stap-probe.h>
#include <kernel-features.h>
@@ -67,6 +68,8 @@ __pthread_cond_timedwait:
cfi_adjust_cfa_offset(FRAME_SIZE)
cfi_remember_state
+ LIBC_PROBE (cond_timedwait, 3, %rdi, %rsi, %rdx)
+
cmpq $1000000000, 8(%rdx)
movl $EINVAL, %eax
jae 48f
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
index 6c1031ee05..61948523a6 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2009, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -23,6 +23,7 @@
#include <tcb-offsets.h>
#include <pthread-pi-defines.h>
#include <pthread-errnos.h>
+#include <stap-probe.h>
#include <kernel-features.h>
@@ -54,20 +55,22 @@ __pthread_cond_wait:
rsp + 32
+--------------------------+
rsp + 24 | old wake_seq value |
- +--------------------------+
+ +--------------------------+
rsp + 16 | mutex pointer |
- +--------------------------+
+ +--------------------------+
rsp + 8 | condvar pointer |
- +--------------------------+
+ +--------------------------+
rsp + 4 | old broadcast_seq value |
- +--------------------------+
+ +--------------------------+
rsp + 0 | old cancellation mode |
- +--------------------------+
+ +--------------------------+
*/
+ LIBC_PROBE (cond_wait, 2, %rdi, %rsi)
+
LP_OP(cmp) $-1, dep_mutex(%rdi)
- /* Prepare structure passed to cancellation handler. */
+ /* Prepare structure passed to cancellation handler. */
movq %rdi, 8(%rsp)
movq %rsi, 16(%rsp)
@@ -406,15 +409,15 @@ __condvar_cleanup1:
rsp + 32
+--------------------------+
rsp + 24 | unused |
- +--------------------------+
+ +--------------------------+
rsp + 16 | mutex pointer |
- +--------------------------+
+ +--------------------------+
rsp + 8 | condvar pointer |
- +--------------------------+
+ +--------------------------+
rsp + 4 | old broadcast_seq value |
- +--------------------------+
+ +--------------------------+
rsp + 0 | old cancellation mode |
- +--------------------------+
+ +--------------------------+
*/
movq %rax, 24(%rsp)
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
index c0761850d6..abb305791c 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -21,7 +21,7 @@
#include <lowlevelrwlock.h>
#include <pthread-errnos.h>
#include <kernel-features.h>
-
+#include <stap-probe.h>
.text
@@ -30,6 +30,9 @@
.align 16
__pthread_rwlock_rdlock:
cfi_startproc
+
+ LIBC_PROBE (rdlock_entry, 1, %rdi)
+
xorq %r10, %r10
/* Get the lock. */
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
index b349554eda..f6a6bff091 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -21,7 +21,7 @@
#include <lowlevelrwlock.h>
#include <pthread-errnos.h>
#include <kernel-features.h>
-
+#include <stap-probe.h>
.text
@@ -30,6 +30,9 @@
.align 16
__pthread_rwlock_wrlock:
cfi_startproc
+
+ LIBC_PROBE (wrlock_entry, 1, %rdi)
+
xorq %r10, %r10
/* Get the lock. */