summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README6
-rw-r--r--tapset/ChangeLog4
-rw-r--r--tapset/s390x/registers.stp213
-rw-r--r--testsuite/ChangeLog4
-rw-r--r--testsuite/systemtap.context/num_args.stp1
-rw-r--r--testsuite/systemtap.examples/ChangeLog4
-rw-r--r--testsuite/systemtap.examples/index.html4
-rw-r--r--testsuite/systemtap.examples/index.txt14
-rw-r--r--testsuite/systemtap.examples/keyword-index.html11
-rw-r--r--testsuite/systemtap.examples/keyword-index.txt35
-rw-r--r--testsuite/systemtap.examples/process/sleepingBeauties.meta10
-rw-r--r--testsuite/systemtap.examples/subsystem-index.html4
-rw-r--r--testsuite/systemtap.examples/subsystem-index.txt14
13 files changed, 276 insertions, 48 deletions
diff --git a/README b/README
index b7434256..59173166 100644
--- a/README
+++ b/README
@@ -18,7 +18,11 @@ Prerequisites:
Installation steps:
-- Install the kernel-debuginfo, kernel-devel, gcc packages.
+- Install the kernel development and gcc packages.
+- Install any debuginfo packages you need, for kernel and/or userspace.
+ (Beware of confusion between kernel vs. kernel-debug vs kernel-PAE etc.
+ variants. Each likely has a corresponding development and debuginfo
+ package.)
- Install the systemtap package, if one already exists.
Build steps:
diff --git a/tapset/ChangeLog b/tapset/ChangeLog
index d50e3fd5..377a7785 100644
--- a/tapset/ChangeLog
+++ b/tapset/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-19 Ananth Mavinakayanahalli <ananth@us.ibm.com> and Jim Keniston <jkenisto@us.ibm.com>
+
+ * s390x/registers.stp: Added
+
2008-11-13 William Cohen <wcohen@redhat.com>
* networking.stp: Order entries in table.
diff --git a/tapset/s390x/registers.stp b/tapset/s390x/registers.stp
new file mode 100644
index 00000000..48c5d59b
--- /dev/null
+++ b/tapset/s390x/registers.stp
@@ -0,0 +1,213 @@
+/* Dwarfless register access for s390x */
+
+global _reg_offsets, _stp_regs_registered
+
+function _stp_register_regs() {
+ /* Same order as pt_regs */
+ _reg_offsets["args"] = 0
+ _reg_offsets["psw.mask"] = 8
+ _reg_offsets["psw.addr"] = 16
+ _reg_offsets["r0"] = 24
+ _reg_offsets["r1"] = 32
+ _reg_offsets["r2"] = 40
+ _reg_offsets["r3"] = 48
+ _reg_offsets["r4"] = 56
+ _reg_offsets["r5"] = 64
+ _reg_offsets["r6"] = 72
+ _reg_offsets["r7"] = 80
+ _reg_offsets["r8"] = 88
+ _reg_offsets["r9"] = 96
+ _reg_offsets["r10"] = 104
+ _reg_offsets["r11"] = 112
+ _reg_offsets["r12"] = 120
+ _reg_offsets["r13"] = 128
+ _reg_offsets["r14"] = 136
+ _reg_offsets["r15"] = 144
+
+ _reg_offsets["orig_gpr2"] = 152
+ _reg_offsets["ilc"] = 160
+ _reg_offsets["trap"] = 162
+
+ /*
+ * If we ever need to support s390 (31-bit arch), we can
+ * get to the register offsets by using just a
+ * reg32_offset = _reg_offsets["reg"]/2
+ * or somesuch
+ */
+ _stp_regs_registered = 1
+}
+
+
+/*
+ * Though the flag says 31bit, asm-s390/thread_info.h comment
+ * says "32bit process"
+ */
+function probing_32bit_app() %{ /* pure */
+ if (CONTEXT->regs)
+ THIS->__retvalue = (user_mode(CONTEXT->regs) &&
+ test_tsk_thread_flag(current, TIF_31BIT));
+ else
+ THIS->__retvalue = 0;
+%}
+
+function _stp_probing_kernel: long () %{ /* pure */
+ THIS->__retvalue = !user_mode(CONTEXT->regs);
+%}
+
+function _stp_get_register_by_offset:long (offset:long) %{ /* pure */
+ long value;
+
+ if (offset <= 152)
+ memcpy(&value, ((char *)CONTEXT->regs) + THIS->offset,
+ sizeof(value));
+ else {
+ /* ilc or trap */
+ unsigned short us_value;
+ memcpy(&us_value, ((char *)CONTEXT->regs) + THIS->offset,
+ sizeof(us_value));
+ value = us_value; // not sign-extended
+ }
+ THIS->__retvalue = value;
+%}
+
+function _stp_sign_extend32:long (value:long) {
+ if (value & 0x80000000)
+ value |= (0xffffffff << 32)
+ return value
+}
+
+function _stp_register:long (name:string, sign_extend:long) {
+ if (!registers_valid()) {
+ error("cannot access CPU registers in this context")
+ return 0
+ }
+ if (!_stp_regs_registered)
+ _stp_register_regs()
+ offset = _reg_offsets[name]
+ if (offset == 0 && !(name in _reg_offsets)) {
+ error("Unknown register: " . name)
+ return 0
+ }
+ value = _stp_get_register_by_offset(offset)
+ if (probing_32bit_app()) {
+ if (sign_extend)
+ value = _stp_sign_extend32(value)
+ else
+ value &= 0xffffffff
+ }
+ return value
+}
+
+/* Return the named register value as a signed value. */
+function register:long (name:string) {
+ return _stp_register(name, 1)
+}
+
+/*
+ * Return the named register value as an unsigned value. Specifically,
+ * don't sign-extend the register value when promoting it to 64 bits.
+ */
+function u_register:long (name:string) {
+ return _stp_register(name, 0)
+}
+
+/*
+ * Return the value of function arg #argnum (1=first arg).
+ * If truncate=1, mask off the top 32 bits.
+ * If sign_extend=1 and (truncate=1 or the probepoint we've hit is in a
+ * 32-bit app), sign-extend the 32-bit value.
+ *
+ * We don't yet support extracting arg #6 and beyond, which are passed
+ * on stack
+ */
+function _stp_arg:long (argnum:long, sign_extend:long, truncate:long) {
+ val = 0
+ if (argnum < 1 || argnum > 5) {
+ error(sprintf("Cannot access arg(%d)", argnum))
+ return 0
+ }
+
+ if (argnum == 1)
+ val = u_register("r2")
+ else if (argnum == 2)
+ val = u_register("r3")
+ else if (argnum == 3)
+ val = u_register("r4")
+ else if (argnum == 4)
+ val = u_register("r5")
+ else (argnum == 5)
+ val = u_register("r6")
+
+ if (truncate) {
+ if (sign_extend)
+ val = _stp_sign_extend32(val)
+ else
+ /* High bits may be garbage. */
+ val = (val & 0xffffffff);
+ }
+ return val;
+}
+
+/* Return the value of function arg #argnum (1=first arg) as a signed int. */
+function int_arg:long (argnum:long) {
+ return _stp_arg(argnum, 1, 1)
+}
+
+/* Return the value of function arg #argnum (1=first arg) as an unsigned int. */
+function uint_arg:long (argnum:long) {
+ return _stp_arg(argnum, 0, 1)
+}
+
+function long_arg:long (argnum:long) {
+ return _stp_arg(argnum, 1, 0)
+}
+
+function ulong_arg:long (argnum:long) {
+ return _stp_arg(argnum, 0, 0)
+}
+
+function longlong_arg:long (argnum:long) {
+ if (probing_32bit_app()) {
+ /* TODO verify if this is correct for 31bit apps */
+ highbits = _stp_arg(argnum, 0, 1)
+ lowbits = _stp_arg(argnum+1, 0, 1)
+ return ((highbits << 32) | lowbits)
+ } else
+ return _stp_arg(argnum, 0, 0)
+}
+
+function ulonglong_arg:long (argnum:long) {
+ return longlong_arg(argnum)
+}
+
+function pointer_arg:long (argnum:long) {
+ return _stp_arg(argnum, 0, 0)
+}
+
+function s32_arg:long (argnum:long) {
+ return int_arg(argnum)
+}
+
+function u32_arg:long (argnum:long) {
+ return uint_arg(argnum)
+}
+
+function s64_arg:long (argnum:long) {
+ return longlong_arg(argnum)
+}
+
+function u64_arg:long (argnum:long) {
+ return ulonglong_arg(argnum)
+}
+
+function asmlinkage() {
+}
+
+function fastcall() {
+}
+
+function regparm() %{
+ snprintf(CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
+ "regparm is invalid on s390.");
+ CONTEXT->last_error = CONTEXT->error_buffer;
+%}
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index f0e72dbd..96095b26 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-19 Jim Keniston <jkenisto@us.ibm.com>
+
+ * systemtap.context/num_args.stp: Added s390x case.
+
2008-11-18 Frank Ch. Eigler <fche@elastic.org>
PR6925.
diff --git a/testsuite/systemtap.context/num_args.stp b/testsuite/systemtap.context/num_args.stp
index 9f15bb01..5cc01d52 100644
--- a/testsuite/systemtap.context/num_args.stp
+++ b/testsuite/systemtap.context/num_args.stp
@@ -2,6 +2,7 @@
%( arch == "i686" %? global ir = "eax", lr = "eax" %)
%( arch == "x86_64" %? global ir = "eax", lr = "rax" %)
%( arch == "ppc64" %? global ir = "r3", lr = "r3" %)
+%( arch == "s390x" %? global ir = "r2", lr = "r2" %)
probe module("systemtap_test_module2").function("yyy_int") {
printf("yyy_int %d %d %d\n", int_arg(1), int_arg(2), int_arg(3))
diff --git a/testsuite/systemtap.examples/ChangeLog b/testsuite/systemtap.examples/ChangeLog
index ac8b0d0e..25d02a2a 100644
--- a/testsuite/systemtap.examples/ChangeLog
+++ b/testsuite/systemtap.examples/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-19 Frank Ch. Eigler <fche@elastic.org>
+
+ * process/sleepingBeauties.meta: Updated description.
+
2008-10-27 William Cohen <wcohen@redhat.com>
* io/traceio2.stp: Use local variable available from vfs tapset.
diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html
index d6b1c99b..54305057 100644
--- a/testsuite/systemtap.examples/index.html
+++ b/testsuite/systemtap.examples/index.html
@@ -93,8 +93,8 @@ subsystems: signals, keywords: signals<br>
subsystems: signals, keywords: signals<br>
<p>The script watches for a particular signal sent to a specific process. When that signal is sent to the specified process, the script prints out the PID and executable of the process sending the signal, the PID and executable name of the process receiving the signal, and the signal number and name.</p></li>
<li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br>
-subsystems: scheduler, keywords: io scheduler<br>
-<p>The script monitor time threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms wall-clock time waiting, information is printed out describing the thread number and executable name. When slow the wait_for_completion function complete, backtraces for the long duration calls are printed out.</p></li>
+subsystems: scheduler, keywords: io scheduler backtrace<br>
+<p>The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li>
<li><a href="process/sleeptime.stp">process/sleeptime.stp</a> - Trace Time Spent in nanosleep Syscalls<br>
subsystems: syscall, keywords: syscall sleep<br>
<p>The script watches each nanosleep syscall on the system. At the end of each nanosleep syscall the script prints out a line with a timestamp in microseconds, the pid, the executable name in paretheses, the "nanosleep:" key, and the duration of the sleep in microseconds.</p></li>
diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt
index 1372afb0..72ae3633 100644
--- a/testsuite/systemtap.examples/index.txt
+++ b/testsuite/systemtap.examples/index.txt
@@ -148,14 +148,12 @@ subsystems: signals, keywords: signals
process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations
-subsystems: scheduler, keywords: io scheduler
-
- The script monitor time threads spend waiting for IO operations (in
- "D" state) in the wait_for_completion function. If a thread spends
- over 10ms wall-clock time waiting, information is printed out
- describing the thread number and executable name. When slow the
- wait_for_completion function complete, backtraces for the long
- duration calls are printed out.
+subsystems: scheduler, keywords: io scheduler backtrace
+
+ The script monitors the time that threads spend waiting for IO
+ operations (in "D" state) in the wait_for_completion function. If a
+ thread spends over 10ms, its name and backtrace is printed, and later
+ so is the total delay.
process/sleeptime.stp - Trace Time Spent in nanosleep Syscalls
diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html
index 2825bc2e..8a673c2f 100644
--- a/testsuite/systemtap.examples/keyword-index.html
+++ b/testsuite/systemtap.examples/keyword-index.html
@@ -46,6 +46,9 @@
<li><a href="io/io_submit.stp">io/io_submit.stp</a> - Tally Reschedule Reason During AIO io_submit Call<br>
subsystems: io, keywords: io backtrace<br>
<p>When a reschedule occurs during an AIO io_submit call, accumulate the traceback in a histogram. When the script exits prints out a sorted list from most common to least common backtrace.</p></li>
+<li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br>
+subsystems: scheduler, keywords: io scheduler backtrace<br>
+<p>The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li>
</ul>
<h3><a name="CALLGRAPH">CALLGRAPH</a></h3>
<ul>
@@ -104,8 +107,8 @@ subsystems: io, keywords: io<br>
subsystems: io, keywords: io<br>
<p>Print out the executable name and process number as reads and writes to the specified device occur.</p></li>
<li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br>
-subsystems: scheduler, keywords: io scheduler<br>
-<p>The script monitor time threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms wall-clock time waiting, information is printed out describing the thread number and executable name. When slow the wait_for_completion function complete, backtraces for the long duration calls are printed out.</p></li>
+subsystems: scheduler, keywords: io scheduler backtrace<br>
+<p>The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li>
</ul>
<h3><a name="LOCKING">LOCKING</a></h3>
<ul>
@@ -149,8 +152,8 @@ subsystems: syscall, keywords: syscall read write time io<br>
<h3><a name="SCHEDULER">SCHEDULER</a></h3>
<ul>
<li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br>
-subsystems: scheduler, keywords: io scheduler<br>
-<p>The script monitor time threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms wall-clock time waiting, information is printed out describing the thread number and executable name. When slow the wait_for_completion function complete, backtraces for the long duration calls are printed out.</p></li>
+subsystems: scheduler, keywords: io scheduler backtrace<br>
+<p>The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li>
</ul>
<h3><a name="SIGNALS">SIGNALS</a></h3>
<ul>
diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt
index 22065e76..470e7c45 100644
--- a/testsuite/systemtap.examples/keyword-index.txt
+++ b/testsuite/systemtap.examples/keyword-index.txt
@@ -11,6 +11,15 @@ subsystems: io, keywords: io backtrace
list from most common to least common backtrace.
+process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations
+subsystems: scheduler, keywords: io scheduler backtrace
+
+ The script monitors the time that threads spend waiting for IO
+ operations (in "D" state) in the wait_for_completion function. If a
+ thread spends over 10ms, its name and backtrace is printed, and later
+ so is the total delay.
+
+
= CALLGRAPH =
general/para-callgraph.stp - Callgraph tracing with arguments
@@ -132,14 +141,12 @@ subsystems: io, keywords: io
process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations
-subsystems: scheduler, keywords: io scheduler
+subsystems: scheduler, keywords: io scheduler backtrace
- The script monitor time threads spend waiting for IO operations (in
- "D" state) in the wait_for_completion function. If a thread spends
- over 10ms wall-clock time waiting, information is printed out
- describing the thread number and executable name. When slow the
- wait_for_completion function complete, backtraces for the long
- duration calls are printed out.
+ The script monitors the time that threads spend waiting for IO
+ operations (in "D" state) in the wait_for_completion function. If a
+ thread spends over 10ms, its name and backtrace is printed, and later
+ so is the total delay.
= LOCKING =
@@ -236,14 +243,12 @@ subsystems: syscall, keywords: syscall read write time io
= SCHEDULER =
process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations
-subsystems: scheduler, keywords: io scheduler
-
- The script monitor time threads spend waiting for IO operations (in
- "D" state) in the wait_for_completion function. If a thread spends
- over 10ms wall-clock time waiting, information is printed out
- describing the thread number and executable name. When slow the
- wait_for_completion function complete, backtraces for the long
- duration calls are printed out.
+subsystems: scheduler, keywords: io scheduler backtrace
+
+ The script monitors the time that threads spend waiting for IO
+ operations (in "D" state) in the wait_for_completion function. If a
+ thread spends over 10ms, its name and backtrace is printed, and later
+ so is the total delay.
= SIGNALS =
diff --git a/testsuite/systemtap.examples/process/sleepingBeauties.meta b/testsuite/systemtap.examples/process/sleepingBeauties.meta
index 95e08361..3338edbf 100644
--- a/testsuite/systemtap.examples/process/sleepingBeauties.meta
+++ b/testsuite/systemtap.examples/process/sleepingBeauties.meta
@@ -1,13 +1,7 @@
title: Generating Backtraces of Threads Waiting for IO Operations
name: sleepingBeauties.stp
-version: 1.0
-author: anonymous
-keywords: io scheduler
+keywords: io scheduler backtrace
subsystem: scheduler
-status: production
-exit: user-controlled
-output: trace
-scope: system-wide
-description: The script monitor time threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms wall-clock time waiting, information is printed out describing the thread number and executable name. When slow the wait_for_completion function complete, backtraces for the long duration calls are printed out.
+description: The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.
test_check: stap -p4 sleepingBeauties.stp
test_installcheck: stap sleepingBeauties.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/subsystem-index.html b/testsuite/systemtap.examples/subsystem-index.html
index 0f2517ce..ef07ccec 100644
--- a/testsuite/systemtap.examples/subsystem-index.html
+++ b/testsuite/systemtap.examples/subsystem-index.html
@@ -113,8 +113,8 @@ subsystems: none, keywords: simple<br>
<h3><a name="SCHEDULER">SCHEDULER</a></h3>
<ul>
<li><a href="process/sleepingBeauties.stp">process/sleepingBeauties.stp</a> - Generating Backtraces of Threads Waiting for IO Operations<br>
-subsystems: scheduler, keywords: io scheduler<br>
-<p>The script monitor time threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms wall-clock time waiting, information is printed out describing the thread number and executable name. When slow the wait_for_completion function complete, backtraces for the long duration calls are printed out.</p></li>
+subsystems: scheduler, keywords: io scheduler backtrace<br>
+<p>The script monitors the time that threads spend waiting for IO operations (in "D" state) in the wait_for_completion function. If a thread spends over 10ms, its name and backtrace is printed, and later so is the total delay.</p></li>
</ul>
<h3><a name="SIGNALS">SIGNALS</a></h3>
<ul>
diff --git a/testsuite/systemtap.examples/subsystem-index.txt b/testsuite/systemtap.examples/subsystem-index.txt
index d34ac64c..0e116a60 100644
--- a/testsuite/systemtap.examples/subsystem-index.txt
+++ b/testsuite/systemtap.examples/subsystem-index.txt
@@ -146,14 +146,12 @@ subsystems: none, keywords: simple
= SCHEDULER =
process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations
-subsystems: scheduler, keywords: io scheduler
-
- The script monitor time threads spend waiting for IO operations (in
- "D" state) in the wait_for_completion function. If a thread spends
- over 10ms wall-clock time waiting, information is printed out
- describing the thread number and executable name. When slow the
- wait_for_completion function complete, backtraces for the long
- duration calls are printed out.
+subsystems: scheduler, keywords: io scheduler backtrace
+
+ The script monitors the time that threads spend waiting for IO
+ operations (in "D" state) in the wait_for_completion function. If a
+ thread spends over 10ms, its name and backtrace is printed, and later
+ so is the total delay.
= SIGNALS =