On suggestion from Brendan Gregg, it would be helpful for the examples
list to highlight "best" scripts, out of the over-one-hundred we ship.
To begin, this is approximated by special support for the .meta keyword
"_best", which results in highlighting the marked samples at the top
of the [keyword-]index.html files.
Frank Ch. Eigler [Tue, 30 Dec 2014 15:25:01 +0000 (10:25 -0500)]
PR17743: stap* help/version text should go peacefully to stdout
As per GNU habits, specifically requested help/version strings for
our programs should go to stdout with rc=0 rather than stderr rc=1.
Adjust stap, staprun, stapio, stapdyn code to taste. helpout.exp
test case to confirm.
Jonathan Lebon [Mon, 22 Dec 2014 17:21:40 +0000 (12:21 -0500)]
listing_mode.exp: update for RHEL5
The listing_mode.exp testcase showed multiple failures on RHEL5. This
commit fixes these errors by making perf probe testing conditional on
system support and by adjusting linenos to play nice with RHEL5's GCC.
Frank Ch. Eigler [Mon, 22 Dec 2014 16:59:40 +0000 (11:59 -0500)]
PR17737: tapset-reference html chapters should not get <toc>
The docbook xsl-stylesheets' html output normally includes generated
TOC for incoming <chapter> blocks. Suppress this with a cunning
choice of generate.toc --stringparam for the xmlto. (On F21 at least,
the parameter needs to contain an embedded \ apparently due to layers
of being passed between shell scripts and xml parsers and whatnot.
Sorry.)
David Smith [Tue, 16 Dec 2014 16:58:05 +0000 (10:58 -0600)]
Fix PR17688 by updating the nfs tapset for kernels >= 3.16.
* tapset/linux/nfs.stp (nfs.fop.aio_read): Only use if the kernel version
is less than 3.16. Upstream kernel has switched from aio_{read,write} to
{read_write}_iter, but using the same function names.
(nfs.fop.aio_write): Ditto.
(nfs.fop.read_iter): New probe for kernel versions >= 3.16.
(nfs.fop.write_iter): Ditto.
* testsuite/buildok/nfs-detailed.stp: Added new tests.
William Cohen [Mon, 15 Dec 2014 19:45:40 +0000 (14:45 -0500)]
Improve the output of cycle_thief.stp to include executable name
Jeremy Eder suggested that it would be good to include the executable
name in the output to save people the step of looking up the
executable name of the various PIDs. The change also includes a
header for the output in that section to make it clearer what each
column is.
William Cohen [Mon, 8 Dec 2014 21:25:37 +0000 (16:25 -0500)]
Fix the SDT_V3 operand handling to recognize arm64 style address modes
The arm64 address operands are very similar to 32-bit arm address
operands, but they are not identical. The arm64 versions may lack
white space and the '#' before the offset value. The regular
expression matching has been adjusted to recognized both 32-bit and
64-bit arm versions.
David Smith [Mon, 8 Dec 2014 20:04:19 +0000 (14:04 -0600)]
Fix BZ1171823 by updating the __svc_fh() nfsd tapset function.
* tapset/linux/nfsd.stp: Rewrite __svc_fh() in systemtap script language
instead of embedded-C to get around the disappearance of struct svc_fh's
declaration from a public kernel header file.
William Cohen [Mon, 8 Dec 2014 19:39:25 +0000 (14:39 -0500)]
Allow speculate.exp to use syscall.openat on arm64
On arm64 the syscall.open is deprecated and will never be used. The
arm64 will use syscall.openat instead. The speculate.exp test has
been adjusted accept syscall.openat in the place of syscall.open.
William Cohen [Mon, 8 Dec 2014 17:08:05 +0000 (12:08 -0500)]
Allow pp.exp to use syscall.openat on arm64
On arm64 the syscall.open is deprecated and will never be used. The
arm64 will use syscall.openat instead. The pp.exp test has been
adjusted accept syscall.openat in the place of syscall.open.
William Cohen [Mon, 8 Dec 2014 14:47:41 +0000 (09:47 -0500)]
Corrections to global_var_kernel.stp tests
Newer kernels have moved kernel/time.c to kernel/time/time.c and the
@var() statements need to be less picky where it looks for sys_tz.
Also some machines such as the arm64 use the syscall.openat than
the deprecated syscall.open.
Martin Cermak [Fri, 5 Dec 2014 16:38:50 +0000 (17:38 +0100)]
PR16716 partial fix: Fix types in 'syscall.sched_{{get,set}param,get_priority_{max,min},yield}'
* tapset/linux/aux_syscalls.stp: Fix handling negative args in _sched_policy_str()
* tapset/linux/nd_syscalls2.stp: Fix argstr in sched_get_priority_{max,min}
* tapset/linux/syscalls2.stp: Fix types and argstr in sched_get_priority_{max,min}
and sched_{get,set}param
* testsuite/systemtap.syscall/mknod.c: Use thin wrapper around the syscall()
* testsuite/systemtap.syscall/sched.c: New testcase
William Cohen [Fri, 28 Nov 2014 05:01:50 +0000 (00:01 -0500)]
Allow systemtap.base/warnings.exp to work with newer kernels
Linux kernel commit f9c78b2be2cac2a7a397d489275e7d9f9ae785f2 moved
fs/bio.c to block/bio.c. Adjusted the test to be less picky about the
location of bio.c file.
William Cohen [Fri, 28 Nov 2014 02:53:16 +0000 (21:53 -0500)]
Allow at_var_tracepoint.stp to handle time.c move in newer Linux kernels
Kernel commit 5cee964597260237dd2cabb3ec22bba0da24b25d moved time.c
from kernel/time.c to kernel/time/time.c. The at_var_tracepoint.stp
test was failing because of the changed location of the file. The
test should not over specify the location of the time.c file. This
change should work with both old and new kernels.
William Cohen [Fri, 21 Nov 2014 15:58:16 +0000 (10:58 -0500)]
Split the access of sp from the rest of pt_regs regs[] accesses
The pt_regs struct has regs[0] through regs[30]. The sp is a separate
field and not regs[31] in the regs array. The compiler will fail to
compile modules when the code includes accesses to the sp because of
the warnings. This change splits out sp (and all the other reg)
accesses so this code compiles correctly without warnings. This
issues observed with the systemtap.base/rlimit.exp tests failures.
The rlimit.exp tests now all pass with the patch.
William Cohen [Fri, 21 Nov 2014 15:17:12 +0000 (10:17 -0500)]
Recognize the arm64 registers in SDT_V3 format
The check for the arm64 architecture was missing, so systemtap was not
recognizing the arm64 registers. This addition should allow systemtap
to find the various arguments being passed in by user-space markers.
William Cohen [Fri, 21 Nov 2014 01:04:23 +0000 (20:04 -0500)]
Allow syscall tests to match the arm64 remapped syscalls
The arm64 does not implement a number of deprecated syscalls. The
deprecated syscalls are remapped to more generic syscalls with the
additional arguments set to so the remapped systemcall emulates the
behavior the deprecated syscalls. The syscall tests matching needed
to be adjusted to match these remaped syscalls for inotify_init(),
pipe(), select(), and vfork(). These fixes are applied to the
following tests:
David Smith [Thu, 20 Nov 2014 15:34:08 +0000 (09:34 -0600)]
PR16716 partial fix: Fix types in 'syscall.{semctl,semget,semop,semtimedop}'.
* tapset/linux/syscalls2.stp: Fix types and nesting in syscall.semctl,
syscall.semget, syscall.semop, and syscall.semtimedop.
* tapset/linux/nd_syscalls2.stp: Ditto.
* tapset/linux/aux_syscalls.stp: Add SEMOP, SEMCTL, and SEMTIMEDOP defines
when needed.
* tapset/linux/syscalls.stpm: Add __compat_syscall_gate_negative macro.
* tapset/linux/s390/syscalls.stp: Since syscall.ipc was interferring with
the new syscall.sem* work, go ahead and deprecate syscall.ipc now.
* tapset/linux/s390/nd_syscalls.stp: Ditto.
* testsuite/systemtap.syscall/semctl.c: New testcase.
* testsuite/systemtap.syscall/semget.c: Ditto.
* testsuite/systemtap.syscall/semop.c: Ditto.
* testsuite/buildok/syscalls2-detailed.stp: Add tests for new convenience vars.
* testsuite/buildok/nd_syscalls2-detailed.stp: Ditto.
* testsuite/buildok/syscalls-arch-detailed.stp: Only test s390x
syscall.ipc when needed.
* testsuite/buildok/nd_syscalls-arch-detailed.stp:: Ditto.
William Cohen [Wed, 19 Nov 2014 14:48:49 +0000 (09:48 -0500)]
Add arm64 loader to the whitelist of interpreters
All the systemtap.base/listing_mode.exp tests that probed the library
were failing (pr17622) because the code did not have the arm64 loader
whitelisted. Added the appropriate arm64 loader to the whitelist to
resolve this issue.
William Cohen [Fri, 14 Nov 2014 04:52:44 +0000 (23:52 -0500)]
Correct nodebug mkdirat syscall argstr
The debuginfo mkdirat syscall prints a string for the first argument.
However, the nodebug version just printed the numerical value of the
first arg. Some of the testsuite/systemtap.syscall/nd_syscall.exp
tests were failing because of the difference in output.
William Cohen [Fri, 14 Nov 2014 04:39:27 +0000 (23:39 -0500)]
Improve arm64 syscall/nd_syscall test results
A number of syscalls are remapped on the arm64 to newer, more general syscalls.
The older syscalls are not implemented on arm64. The tests should match those
newer, more general syscalls.
David Smith [Thu, 6 Nov 2014 20:47:36 +0000 (14:47 -0600)]
Fixed BZ1160837 by updating the iostat-scsi.stp example.
* testsuite/systemtap.examples/io/iostat-scsi.stp: Updated for newer
kernels like RHEL7 and rawhide. Probes the "sd_init_command" kernel
function which replaced "sd_prep_fn" in newer kernels. Added whitespace
for more clarity.
William Cohen [Fri, 31 Oct 2014 16:24:55 +0000 (12:24 -0400)]
Estimate the frequency of the arch64 get_cycle()
Unlike 32-bit arm the 64-bit has a working get_cycle() function and
the SystemTap runtime support should make an attempt to estimate the
frequency of get_cycle(). This change will make scripts using time
information on aarch64 produce accurate results.
Frank Ch. Eigler [Thu, 16 Oct 2014 20:25:55 +0000 (16:25 -0400)]
RHBZ1153673: speculatively correct segv in dead_control_remover
It was reported that ::visit_block was occasionally called with
a 0-size input vs[]. That leads to an array overflow, as the
for condition becomes apprx. (i < UINT_MAX).
for (size_t i = 0; i < vs.size() - 1; ++i)
do_something_with (vs[i]);
Abegail Jakop [Thu, 9 Oct 2014 21:31:35 +0000 (17:31 -0400)]
PR11528: put retval assignment after arg assignments
translate.cxx: moved generated c portion for the retval assignment from
::c_assign to ::visit_functioncall, after function argument assignments
to avoid complicationns with nested functioncalls
William Cohen [Thu, 9 Oct 2014 02:06:32 +0000 (22:06 -0400)]
Make the -DDEBUG_UNWIND output more tolerant of types used in struct pt_regs
On aarch64 u64 rather than unsigned long is used to store various
register values in struct pt_regs. When -DDEBUG_UNWIND is used to
compile SystemTap scripts the warning from the type mismatches causes
the module builds to fail. The kernel's
Documentation/printk-formations.txt suggests explicit typecast to
unsigned long long and using %llu as the print specifier in these
cases.
Lukas Berk [Wed, 8 Oct 2014 17:54:29 +0000 (13:54 -0400)]
Add support for getrandom, memfd_create, seccomp syscalls
Linux 3.17 added several syscalls, we need to add support for them
as well.
*aux_syscalls.stp - aux funcitions for sorting through flags
*nd_syscalls.stp - no debuginfo impl for getrandom,memfd_create
*nd_syscalls2.stp - no debuginfo impl for seccomp
*syscalls.stp - impl for getrandom,memfd_create
*syscalls2.stp - impl for seccomp
*buildok/nd_syscalls-details.stp - testcase for nd getrandom, memfd_create
*buildok/nd_syscalls2-details.stp - testcase for nd seccomp
*buildok/syscalls-details.stp - testcase for getrandom, memfd_create
*buildok/syscalls2-details.stp - testcase for seccomp
*systemtap.syscall/getrandom.c - test of the actual getrandom syscall
*systemtap.syscall/memfd_create.c - test of the actual memfd_create syscall
William Cohen [Tue, 7 Oct 2014 14:44:28 +0000 (10:44 -0400)]
Define __NR_epoll_wait if not defined (PR17462)
On arm64 __NR_epoll_wait is not defined and some of probes will fail
to build because of the lacking define (PR17462). This makes sure there
is a sane definition, so scripts compile.
Abegail Jakop [Wed, 1 Oct 2014 20:49:39 +0000 (16:49 -0400)]
PR11528: new pragma "unmodified-fnargs" for embedded-c
elaborate.cxx: remove the portion in semantic_pass_opt2() that populates
a vector with unmodified function args
translate.cxx: new function that uses a new visitor to determine if the body
of a function modifies the function arguments. for embedded code, it checks
for the presence of the pure or unmodified-fnargs pragma.
translate.cxx: in ::c_assign(), when the rval is a functioncall and the
function returns a string, the retval is points to the destination.
c_unparser::visit_functioncall() handles the case where the return value
of the function is not used, by setting the destination to a tmpvar.
PR16806: tweak test case to guarantee stoppage better
We run the "./loop" executable under /usr/bin/timeout control, but on
RHEL6, uprobes can take a while to sync up for some reason, leading to
a testsuite hang. Switch to timeout -s KILL, moohahahaha, from orbit.
stp: rt: replace stp_print lock with stp style lock
-rt mode preemptable spin lock lead to deadlock causes x86 box to freeze.
Replacing spin lock with stp type raw lock solves the problem. Observed
deadlock in make installcheck testsuite for sched_switch.stp test case.
stp: rt: replace addr_map_lock rd/wr lock with stp type raw lock
Without this change, Noticed that make installcheck freezes x86_64 box, testing
done on IvyBridge v2 12 core (HT). With crash post mortem analysis observed
that multiple threads grabs rd lock and get preempted in rt mode which
shouldn't ideally be the expected flow. rd/wr lock is preemptible which is
causing this problem for -rt mode so replace them with stp style raw lock.
However I poited out in other patches that replacement of rd/wr with rcu lock
in general better approach, we'll revisit them later(todo).