From 17557282082870c7168d4bd9f386523c8c60d729 Mon Sep 17 00:00:00 2001 From: Rayson Ho Date: Wed, 23 Feb 2011 11:30:55 -0800 Subject: [PATCH] i386 port of the pthread SystemTap probes --- nptl/ChangeLog | 13 +++++++++++++ nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S | 7 +++++-- .../unix/sysv/linux/i386/i486/pthread_cond_broadcast.S | 5 ++++- .../sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S | 6 ++++-- .../unix/sysv/linux/i386/i486/pthread_cond_timedwait.S | 6 ++++-- nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S | 6 ++++-- .../unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S | 5 ++++- .../unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S | 5 ++++- nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h | 5 ++++- 9 files changed, 46 insertions(+), 12 deletions(-) diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 9b63c53..a488ccb 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,4 +1,17 @@ 2012-05-25 Rayson Ho + + * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Low-level SystemTap + probes for i386. + * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S: Likewise. + +2012-05-25 Rayson Ho Roland McGrath * DESIGN-systemtap-probes.txt: New file. diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S index fe6d4b6..7c3212c 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2004,2006,2007,2009,2010 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 , 2002. @@ -21,6 +21,8 @@ #include #include +#include + .text #ifdef __ASSUME_PRIVATE_FUTEX @@ -90,7 +92,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, %ebx) + movl $SYS_futex, %eax ENTER_KERNEL 2: movl %edx, %eax diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S index 71a6686..99f9bc9 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002,2003,2004,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 , 2002. @@ -23,6 +23,7 @@ #include #include #include +#include .text @@ -48,6 +49,8 @@ __pthread_cond_broadcast: movl 20(%esp), %ebx + LIBC_PROBE (cond_broadcast, 1, %edx) + /* Get internal lock. */ movl $1, %edx xorl %eax, %eax diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S index 2af611a..e204805 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2005,2007,2009,2010 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 , 2002. @@ -23,7 +23,7 @@ #include #include #include - +#include .text @@ -44,6 +44,8 @@ __pthread_cond_signal: movl 12(%esp), %edi + LIBC_PROBE (cond_signal, 1, %edi) + /* Get internal lock. */ movl $1, %edx xorl %eax, %eax diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S index ff3da37..8170ab3 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2004,2006-2007,2009,2010 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 , 2002. @@ -23,7 +23,7 @@ #include #include #include - +#include .text @@ -60,6 +60,8 @@ __pthread_cond_timedwait: movl 20(%esp), %ebx movl 28(%esp), %ebp + LIBC_PROBE (cond_timedwait, 3, %ebx, 24(%esp), %ebp) + cmpl $1000000000, 4(%ebp) movl $EINVAL, %eax jae 18f diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S index 1d7e751..2ae7af2 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S @@ -1,5 +1,4 @@ -/* Copyright (C) 2002-2004,2006-2007,2009,2010,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 , 2002. @@ -25,6 +24,7 @@ #include #include #include +#include .text @@ -61,6 +61,8 @@ __pthread_cond_wait: xorl %esi, %esi movl 20(%esp), %ebx + LIBC_PROBE (cond_wait, 2, 24(%esp), %ebx) + /* Get internal lock. */ movl $1, %edx xorl %eax, %eax diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S index 156fce8..ebbe809 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 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 , 2002. @@ -22,6 +22,7 @@ #include #include +#include .text @@ -40,6 +41,8 @@ __pthread_rwlock_rdlock: xorl %esi, %esi movl 12(%esp), %ebx + LIBC_PROBE (rdlock_entry, 1, %ebx) + /* Get the lock. */ movl $1, %edx xorl %eax, %eax diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S index 3994b06..d30e93a 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 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 , 2002. @@ -22,6 +22,7 @@ #include #include +#include .text @@ -40,6 +41,8 @@ __pthread_rwlock_wrlock: xorl %esi, %esi movl 12(%esp), %ebx + LIBC_PROBE (wrlock_entry, 1, %ebx) + /* Get the lock. */ movl $1, %edx xorl %eax, %eax diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h index 497d473..3d805ff 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2004, 2006-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 , 2002. @@ -19,6 +19,8 @@ #ifndef _LOWLEVELLOCK_H #define _LOWLEVELLOCK_H 1 +#include + #ifndef __ASSEMBLER__ # include # include @@ -225,6 +227,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 (LLL_EBX_LOAD \ LLL_ENTER_KERNEL \ LLL_EBX_LOAD \ -- 2.7.4