]> sourceware.org Git - systemtap.git/log
systemtap.git
9 years agoinitscript: copy uprobes.ko to cache directory
Stefan Hajnoczi [Wed, 3 Sep 2014 21:40:11 +0000 (17:40 -0400)]
initscript: copy uprobes.ko to cache directory

If the uprobes.ko module was built then it will be needed at staprun
time.  Copy the module into the cache directory alongside compiled
scripts.

9 years agostap: add --save-uprobes
Stefan Hajnoczi [Wed, 3 Sep 2014 21:38:30 +0000 (17:38 -0400)]
stap: add --save-uprobes

The stap -m <name> option saves the script module.  For scripts that
rely on uprobes it may also be necessary to get the uprobes module (if
it was built by stap).

The new stap --save-uprobes option saves uprobes/uprobes.ko into the
current directory.

9 years agofix issues related to -E scripts
Jonathan Lebon [Wed, 3 Sep 2014 16:52:34 +0000 (12:52 -0400)]
fix issues related to -E scripts

Fix stap exiting successfully in listing mode even when no probes were
found in the primary script. E.g. the following should return nonzero:

stap -l junk -E 'probe timer.s(1) { next }'

Similarly, fix stap running with no issues even when no probes are
present in the primary script. E.g. the following should error out:

stap -e 'global x' -E 'probe timer.s(1) { next }'

9 years agoenospc.stp: rename warn() function to avoid conflict
Jonathan Lebon [Wed, 3 Sep 2014 18:39:05 +0000 (14:39 -0400)]
enospc.stp: rename warn() function to avoid conflict

Otherwise, we get a conflict with the warn() located in logging.stp.

9 years agolisting_mode_sanity.exp: clarify FAIL messages
Jonathan Lebon [Wed, 3 Sep 2014 16:52:18 +0000 (12:52 -0400)]
listing_mode_sanity.exp: clarify FAIL messages

Use different FAIL messages to know which one failed.

9 years agoupdate AUTHORS list
Jonathan Lebon [Tue, 2 Sep 2014 21:51:09 +0000 (17:51 -0400)]
update AUTHORS list

9 years agoclient_args.exp: avoid propagating PR17301
Martin Cermak [Wed, 3 Sep 2014 12:48:59 +0000 (14:48 +0200)]
client_args.exp: avoid propagating PR17301

9 years agoPR12333: testsuite hashbang "#!stap" -> "#! stap" fix
Frank Ch. Eigler [Wed, 3 Sep 2014 07:22:58 +0000 (03:22 -0400)]
PR12333: testsuite hashbang "#!stap" -> "#! stap" fix

The former confuses the test driver dejagnu code.

9 years agoAdd a NEWS blurb about the autocast type propagation
Josh Stone [Tue, 2 Sep 2014 23:27:45 +0000 (16:27 -0700)]
Add a NEWS blurb about the autocast type propagation

9 years agoUse is_valid_pid in more places
Josh Stone [Tue, 2 Sep 2014 22:06:04 +0000 (15:06 -0700)]
Use is_valid_pid in more places

Several places were duplicating the "kill(pid,0); switch(errno)...", and
can all be replaced by is_valid_pid calls.

9 years agoPR16603 followup: unbreak on rhel4
Frank Ch. Eigler [Tue, 2 Sep 2014 22:29:11 +0000 (18:29 -0400)]
PR16603 followup: unbreak on rhel4

jistone noted that the smp_call_function_single() function call
introduced in commit 590a9ae1acc47 didn't exist on 2.6.9-era kernels.
We de-optimize to plain smp_call_function() on such dinosaurs.

9 years agostap-report: generate fewer incidental errors on unusual platforms
Frank Ch. Eigler [Tue, 2 Sep 2014 15:17:19 +0000 (11:17 -0400)]
stap-report: generate fewer incidental errors on unusual platforms

9 years agoman/stap.1: add portion on array slicing
Abegail Jakop [Tue, 2 Sep 2014 22:03:04 +0000 (18:03 -0400)]
man/stap.1: add portion on array slicing

9 years agoNEWS: added a piece about array slicing (PR12333)
Abegail Jakop [Tue, 2 Sep 2014 20:26:25 +0000 (16:26 -0400)]
NEWS: added a piece about array slicing (PR12333)

9 years agotestsuite: Reduce global timeout to 15 minutes
Josh Stone [Tue, 2 Sep 2014 19:20:31 +0000 (12:20 -0700)]
testsuite: Reduce global timeout to 15 minutes

Very old kernels used jiffies for timer.s, and limit that to 1000000ms
to avoid overflows.  The testsuite rc's timer.s(3100) exceeded that.

A 15 minute timeout, timer.s(900), fits the limit and should suffice.

9 years agofix process_by_pid.exp failing to hit all probes point
Abegail Jakop [Tue, 2 Sep 2014 17:52:13 +0000 (13:52 -0400)]
fix process_by_pid.exp failing to hit all probes point

process_by_pid.stp: more information is printed if the test case fails
process_by_pid.c: add sleep() so it has a plt that can be reached easily

9 years agotapsets.cxx: throw error for invalid PID, not valid PID
Abegail Jakop [Tue, 2 Sep 2014 17:14:26 +0000 (13:14 -0400)]
tapsets.cxx: throw error for invalid PID, not valid PID

9 years agoMerge branch 'ajakop/12333'
Abegail Jakop [Tue, 2 Sep 2014 15:06:47 +0000 (11:06 -0400)]
Merge branch 'ajakop/12333'

9 years agoPR12333: added another pmaps membership test case
Abegail Jakop [Tue, 2 Sep 2014 14:56:34 +0000 (10:56 -0400)]
PR12333: added another pmaps membership test case

9 years agoPR12333: cleanup and membership test with pmaps
Abegail Jakop [Tue, 2 Sep 2014 14:27:16 +0000 (10:27 -0400)]
PR12333: cleanup and membership test with pmaps

9 years agoPR12333: Aggregate pmaps for sliced array_in
Josh Stone [Fri, 29 Aug 2014 22:37:05 +0000 (15:37 -0700)]
PR12333: Aggregate pmaps for sliced array_in

Since sliced array_in iterates over the aggregate for pmaps, it needs to
actually build that aggregate first, unless we're already in foreach.

9 years agoPR12333: Use 1/0 conditions instead of true/false in C
Josh Stone [Fri, 29 Aug 2014 22:15:47 +0000 (15:15 -0700)]
PR12333: Use 1/0 conditions instead of true/false in C

The kernel happens to declare true/false values for C to use, at least
since commit 6e21828743247 (in 2.6.19), but stapdyn's normal C runtime
doesn't have that.  Use boring old 1/0 instead.

9 years agoDrop passing the last parameter to determin_java_type
Lukas Berk [Fri, 29 Aug 2014 19:35:49 +0000 (15:35 -0400)]
Drop passing the last parameter to determin_java_type

*java/HelperSDT.c - drop passing the lsat parameter to determin_java_type
    and simply return the casted value instead of assigning
    and then returning

9 years agoFix ppc64 value issue by changing how java vars are passed from jni
Lukas Berk [Fri, 29 Aug 2014 14:13:05 +0000 (10:13 -0400)]
Fix ppc64 value issue by changing how java vars are passed from jni

Instead of using a _staparg struct, we now just use a int64_t var
and cast to that, instead of making assumptions on how the struct is
packed.

*java/HelperSDT.c - use int64_t as the arg type instead of _staparg union

9 years agoPR12333: updated and added tests, and removed comment
Abegail Jakop [Thu, 28 Aug 2014 19:49:09 +0000 (15:49 -0400)]
PR12333: updated and added tests, and removed comment

9 years agoPR12333: added minor tests, updated main test case
Abegail Jakop [Thu, 28 Aug 2014 19:18:16 +0000 (15:18 -0400)]
PR12333: added minor tests, updated main test case

9 years agoPR12333: deleting pmap specified by array slice
Abegail Jakop [Thu, 28 Aug 2014 19:08:59 +0000 (15:08 -0400)]
PR12333: deleting pmap specified by array slice

runtime/map.c: have iterdel() use pre-existing functions
translate.cxx: generate code to delete elements from a pmap, based on
an array slice given. rename next() that called iterdel to del_next()
staptree.cxx: cleanup of an unnecessary condition

9 years agoAdd helper that can handle wildcards within arrayindexes
Abegail Jakop [Thu, 28 Aug 2014 19:00:13 +0000 (15:00 -0400)]
Add helper that can handle wildcards within arrayindexes

9 years agoFix runtime-java triggers for ppc64le
Yaakov Selkowitz [Wed, 27 Aug 2014 17:28:51 +0000 (12:28 -0500)]
Fix runtime-java triggers for ppc64le

Signed-off-by: Lukas Berk <lberk@redhat.com>
9 years agostore given pid for process probe for use by task_finder
Abegail Jakop [Tue, 26 Aug 2014 19:53:22 +0000 (15:53 -0400)]
store given pid for process probe for use by task_finder

session.cxx: replace readlink(), which did the pid validation,
with is_valid_pid()
tapsets.cxx: if given, within dwarf_builder::build store the pid
for use by uprobe_derived_probe so that task_finder associates
the probe with the pid
util.*: new function that checks if the given pid is valid. if
not, it generates an error message that can be used.

9 years agotranslate.cxx: declaring tmpvars for array slices
Abegail Jakop [Mon, 25 Aug 2014 14:49:15 +0000 (10:49 -0400)]
translate.cxx: declaring tmpvars for array slices

9 years agoPR12333: store wildcards in array slices as NULL
Abegail Jakop [Fri, 22 Aug 2014 20:52:33 +0000 (16:52 -0400)]
PR12333: store wildcards in array slices as NULL

parse.cxx: set the index for array slices as NULL if it's a wildcard
elaborate.cxx: account for NULL indexes. added error message in
symresolution_info::visit_arrayindex if it encounters a NULL index,
since all expressions that support wildcards dealt with separately
staptree.cxx: when printing out foreach, delete and array_in, replace
NULL indexes with "*"
translate.cxx: account for NULL indexes. don't generate a tmpvar
for a wildcard array index

9 years agoPR12333: use parent for symresolution in delete array index
Abegail Jakop [Fri, 22 Aug 2014 15:28:28 +0000 (11:28 -0400)]
PR12333: use parent for symresolution in delete array index

9 years agooptim_arridx.exp: avoid propagating PR17301
Martin Cermak [Fri, 22 Aug 2014 12:55:28 +0000 (14:55 +0200)]
optim_arridx.exp: avoid propagating PR17301

9 years agoalias_tapset.exp: avoid unwanted interference with the "timeout feature" (commit...
Martin Cermak [Fri, 22 Aug 2014 08:52:37 +0000 (10:52 +0200)]
alias_tapset.exp: avoid unwanted interference with the "timeout feature" (commit d13c9b7)

9 years agoPR12333: test file for array slicing
Abegail Jakop [Thu, 21 Aug 2014 17:25:41 +0000 (13:25 -0400)]
PR12333: test file for array slicing

9 years agoPR12333" array slicing for membership test
Abegail Jakop [Thu, 21 Aug 2014 16:17:40 +0000 (12:17 -0400)]
PR12333" array slicing for membership test

parse.cxx: accept wildcards in the arrayindex for array_in
elaborate.cxx: new function symresolution_info::visit_array_in
that skips processing wildcards that are present in the arrayindex
translate.cxx: generate code to iterate over the array until a
match is found or until the end of the array

9 years agoPR12333: don't store array slice indexes as lrvalues
Abegail Jakop [Wed, 20 Aug 2014 21:11:05 +0000 (17:11 -0400)]
PR12333: don't store array slice indexes as lrvalues

9 years agoPR12333: treat array slice indexes as rvalues
Abegail Jakop [Wed, 20 Aug 2014 20:12:14 +0000 (16:12 -0400)]
PR12333: treat array slice indexes as rvalues

9 years agoPR12333: array slicing for delete statements
Abegail Jakop [Tue, 19 Aug 2014 18:12:52 +0000 (14:12 -0400)]
PR12333: array slicing for delete statements

parse.cxx: accept wildcards (*) within array indexes
elaborate.cxx: skip processing wildcards in array indexes for delete
staptree.cxx: for the varuse_collecting_visitor, don't throw an error
about no referent if the symbol is a wildcard
translate.cxx: generate code for deleting variables if the indexes match
the array slice given. Also generate code to initialize tmpvars used to
store indexes in the array slice.
runtime/map.c: new function _stp_map_iterdel that deletes the node given,
and returns the next node in the map.

9 years agoruntime: improve robustness of shutdown phase via flush_scheduled_work()
Frank Ch. Eigler [Sun, 17 Aug 2014 14:55:35 +0000 (10:55 -0400)]
runtime: improve robustness of shutdown phase via flush_scheduled_work()

It has been observed that schedule_work() artifacts have the potential
to overstay their welcome during shutdown, triggering some time after
their operand data structures have been deallocated.  This has shown
up most recently on 3.17-rc0 during the on-the-fly stress-testing, but
also can be observed with plain pseudo-utrace callbacks.  We now add a
flush_scheduled_work() into our cargo-cult stp_synchronize_sched(),
which we now call during the on-the-fly shutdown phase too.

9 years agotranslator: in -u (unoptimized) mode, don't merge identical probe handler bodies
Frank Ch. Eigler [Sun, 17 Aug 2014 14:50:52 +0000 (10:50 -0400)]
translator: in -u (unoptimized) mode, don't merge identical probe handler bodies

Normal optimized mode can make it difficult to see which stap probe
was being invoked for which C probe handler body, as identical probe
handlers are reused.  This is inconvenient if one just has a kernel
crash backtrace to start from from.

* translate.cxx (emit_common_header, emit_probe): In -u mode,
  eschew duplicate probe handler body elision.

9 years agoPR12333: printscript() prints array slice in foreach loops
Abegail Jakop [Fri, 15 Aug 2014 20:42:48 +0000 (16:42 -0400)]
PR12333: printscript() prints array slice in foreach loops

9 years agoPR12333: evaluating the indexes before the loop body
Abegail Jakop [Fri, 15 Aug 2014 20:33:33 +0000 (16:33 -0400)]
PR12333: evaluating the indexes before the loop body

translate.cxx: evaluate the expressions that make up the array slice
index for foreach loops. updated c_tmpcounter::visit_foreach_loop to
account for the additional tmpvars used to store array slice indexes

9 years agoFix PR17275 by fixing testcase problems on s390x.
David Smith [Fri, 15 Aug 2014 20:07:52 +0000 (15:07 -0500)]
Fix PR17275 by fixing testcase problems on s390x.

* testsuite/buildok/memory-all-probes.stp: Tweak test to avoid overly
  broad wildcards, which can cause the test to fail on systems without
  uprobes (like s390x).
* testsuite/buildok/tcp-all-probes.stp: Ditto.

9 years agoPR16716 partial fix: Fix types in 'syscall.{mmap[2],[p]poll}'.
David Smith [Fri, 15 Aug 2014 16:07:28 +0000 (11:07 -0500)]
PR16716 partial fix: Fix types in 'syscall.{mmap[2],[p]poll}'.

* tapset/linux/syscalls.stp (syscall.mmap2): Fixed type.
* tapset/linux/nd_syscalls.stp (nd_syscall.mmap2): Ditto.
* tapset/linux/syscalls2.stp: Fixed types in syscall.poll, syscall.ppoll,
  and syscall.compat_ppoll.
* tapset/linux/nd_syscalls2.stp: Ditto.
* tapset/linux/aux_syscalls.stp (_mremap_flags): Updated and improved.
  (get_mmap_args): Fixed type.
* tapset/linux/i386/syscalls.stp: Fixed types in syscall.mmap2.
* tapset/linux/i386/nd_syscalls.stp: Ditto.

* tapset/linux/ia64/syscalls.stp: Fixed types in syscall.mmap and
  syscall.mmap2.
* tapset/linux/ia64/nd_syscalls.stp: Ditto.
* tapset/linux/powerpc/syscalls.stp: Ditto.
* tapset/linux/powerpc/nd_syscalls.stp: Ditto.
* tapset/linux/x86_64/syscalls.stp: Ditto.
* tapset/linux/x86_64/nd_syscalls.stp: Ditto.
* tapset/linux/s390/syscalls.stp: Ditto.
* tapset/linux/s390/nd_syscalls.stp (get_32mmap_args): Updated and fixed
  types.
* testsuite/buildok/syscalls2-detailed.stp: Made syscall.uselib tests
  optional, since rawhide kernels have dropped the syscall.
* testsuite/buildok/nd_syscalls2-detailed.stp: Ditto.
* testsuite/systemtap.syscall/mmap.c: Added more tests.
* testsuite/systemtap.syscall/poll.c: Ditto.
* testsuite/systemtap.syscall/recv.c: Ignore error code.

9 years agostap_run.exp: avoid propagating PR17274
Martin Cermak [Fri, 15 Aug 2014 15:37:25 +0000 (17:37 +0200)]
stap_run.exp: avoid propagating PR17274

9 years agohrtimer/kprobes_onthefly.exp: use process.function only if supported
Jonathan Lebon [Thu, 14 Aug 2014 19:07:15 +0000 (15:07 -0400)]
hrtimer/kprobes_onthefly.exp: use process.function only if supported

We should test for uprobes support before testing with the
process("echo").function probe.

9 years agoImprove on-the-fly initialization code.
David Smith [Thu, 14 Aug 2014 18:49:44 +0000 (13:49 -0500)]
Improve on-the-fly initialization code.

* translate.cxx (c_unparser::emit_probe_condition_initialize): Only output
  'cond_enabled' field initialization if the probe isn't always enabled.
  (translate_pass): Always initialize 'cond_enabled' to 1. This can get
  overridden by the output of
  c_unparser::emit_probe_condition_initialize().

9 years agoPR17242 extra: Remove _stp_register_regs() from x86_gs test
Josh Stone [Thu, 14 Aug 2014 15:52:11 +0000 (08:52 -0700)]
PR17242 extra: Remove _stp_register_regs() from x86_gs test

9 years agoPR17242 extra: Change dangling _stp_register_regs() function to init probes.
David Smith [Thu, 14 Aug 2014 14:56:39 +0000 (09:56 -0500)]
PR17242 extra: Change dangling _stp_register_regs() function to init probes.

* tapset/i386/registers.stp: Convert the _stp_register_regs() function to
  an init probe.
* tapset/powerpc/registers.stp: Ditto.

9 years agoAdd perf.return functionality to ltrace.stp.
Stan Cox [Wed, 13 Aug 2014 18:41:00 +0000 (14:41 -0400)]
Add perf.return functionality to ltrace.stp.

* ltrace.stp (filter_p, arg, report, begin, end):  New
(process.plt, process.plt.return): Handle return value.
(end): Display summary statistics.

* perf.sh (poly): Add guard for negative and too large values.

9 years agoruntime: plea with the gods for a lockless stp_print_flush
Frank Ch. Eigler [Tue, 12 Aug 2014 19:57:01 +0000 (15:57 -0400)]
runtime: plea with the gods for a lockless stp_print_flush

9 years agoPR17260: Use get_context to guard stp_print_flush's lock
Josh Stone [Tue, 12 Aug 2014 17:29:30 +0000 (10:29 -0700)]
PR17260: Use get_context to guard stp_print_flush's lock

Holding a context ensures that any probes triggered in the interim will
be considered reentrant and skipped, since such a nested probe might
have recursed on that spinlock.  We faced a similar situation before
with _stp_ctl_send and all the locks it touches.

Reverts "PR17260: make stp_print_flush use spin_trylock instead of
spin_lock", commit 80c97a2fab46b9d6213d93d63e18d6fd2cbd88f1.

9 years agotranslator: fix function-call actioncount optimization regression
Frank Ch. Eigler [Tue, 12 Aug 2014 15:14:26 +0000 (11:14 -0400)]
translator: fix function-call actioncount optimization regression

commit #765e6976 accidentally emitted actioncount-tracking code in the
wrong place in the function-call sequence.

* translate.cxx (visit_functioncall): Move it up a wee little bit.

9 years agoPR17260: make stp_print_flush use spin_trylock instead of spin_lock
Frank Ch. Eigler [Tue, 12 Aug 2014 15:05:42 +0000 (11:05 -0400)]
PR17260: make stp_print_flush use spin_trylock instead of spin_lock

This risks "WARNING: NNNN transport failures..." messages at stap
shutdown, but appears to work around this particular reentrancy
problem.

9 years agotestsuite: switch from kernel.function("copy_flags") -> "copy_signal"
Frank Ch. Eigler [Mon, 11 Aug 2014 21:23:11 +0000 (17:23 -0400)]
testsuite: switch from kernel.function("copy_flags") -> "copy_signal"

The former was retired in kernel commit #514ddb446c; the latter
exists as far back as RHEL4.

9 years agoPR10995: stapprobes.3stap: armability corrections from jlebon
Frank Ch. Eigler [Mon, 11 Aug 2014 20:33:28 +0000 (16:33 -0400)]
PR10995: stapprobes.3stap: armability corrections from jlebon

9 years agoPR10995: extend man pages re. arming/disarming
Frank Ch. Eigler [Mon, 11 Aug 2014 20:24:07 +0000 (16:24 -0400)]
PR10995: extend man pages re. arming/disarming

9 years agostatement.nearest probes followup: some docs, samples, tweakage
Frank Ch. Eigler [Mon, 11 Aug 2014 19:56:15 +0000 (15:56 -0400)]
statement.nearest probes followup: some docs, samples, tweakage

* NEWS: Mention it.
* man/stapprobes.3stap: Document it.
* testsuite/systemtap.examples/*: Use it.
* testsuite/systemtap.*/: Baby test it.
* dwflpp.cxx: Drop debugging statement and make a speech.

9 years agodwflpp: register statement.nearest suffix
Honggyu Kim [Mon, 4 Aug 2014 13:18:40 +0000 (22:18 +0900)]
dwflpp: register statement.nearest suffix

If a line number is given in 'statement', line records in dwarf may not
be found for a given line number.
In this case, alternative line numbers were suggested and exited.

With statement.nearest suffix, a kprobe is inserted into the nearest
line number that is available in dwarf line record.

 * dwflpp.cxx(dwflpp.cxx::insert_alternative_linenos): Add a new method,
       Add an arg "has_nearest" in dwflpp::iterate_over_srcfile_lines
 * dwflpp.h(dwflpp.cxx::insert_alternative_linenos): Ditto.
 * tapsets.cxx: Add a new suffix statement.nearest

Signed-off-by: Honggyu Kim <hong.gyu.kim@lge.com>
9 years agoMerge branch 'jlebon/onthefly' (PR10995)
Jonathan Lebon [Mon, 11 Aug 2014 19:40:19 +0000 (15:40 -0400)]
Merge branch 'jlebon/onthefly' (PR10995)

This branch adds support for on-the-fly probes as described in PR10995.
It also includes various minor fixes as well as a new file
runtime/linux/kprobes.c which hosts kprobes-related code (rather than
being dynamically emitted from tapsets.cxx).

9 years agoNEWS: add blurb for on-the-fly
Jonathan Lebon [Fri, 8 Aug 2014 16:30:27 +0000 (12:30 -0400)]
NEWS: add blurb for on-the-fly

9 years agopr13306.exp: adapt to new timing report
Jonathan Lebon [Mon, 11 Aug 2014 14:46:15 +0000 (10:46 -0400)]
pr13306.exp: adapt to new timing report

9 years agoon-the-fly: don't use background timer if hrtimers missing
Jonathan Lebon [Wed, 23 Jul 2014 20:24:45 +0000 (16:24 -0400)]
on-the-fly: don't use background timer if hrtimers missing

On older systems (< 2.6.17), hrtimers are not supported. Guard code
related to the background timer with this check so that we can at least
still compile code on these older platforms.

9 years agoon-the-fly: only start background timer if needed
Jonathan Lebon [Tue, 22 Jul 2014 18:41:42 +0000 (14:41 -0400)]
on-the-fly: only start background timer if needed

Rather than always starting the background timer, only start it when it
is needed. That is, start the background timer when a probe which has an
effect on the conditions of probes which support on-the-fly operations
isn't a safe context for calling schedule_work() (determined by
otf_safe_context()).

9 years agomake schedule_work() call depend on otf_safe_context()
Jonathan Lebon [Thu, 24 Jul 2014 18:15:22 +0000 (14:15 -0400)]
make schedule_work() call depend on otf_safe_context()

Now that each probe group directly describes whether their context is
safe for workqueue manipulations, we can directly emit in the probe
epilogue a call to schedule_work() if the probe is safe, rather than
doing it on a case-by-case basis.

9 years agoon-the-fly: make support a property of group rather than probe
Jonathan Lebon [Wed, 23 Jul 2014 18:32:15 +0000 (14:32 -0400)]
on-the-fly: make support a property of group rather than probe

Support for on-the-fly operations is more a property of the
derived_probe_group (which does the actual emitting), rather than
derived_probe.

For example, not because a dwarf_derived_probe supports on-the-fly
operations does it mean that a uprobe_derived_probe (which inherits from
dwarf_derived_probe) does. Similarly, a uprobe_derived_probe's support
for on-the-fly operations depends on the actual code emitted by the
group, which will emit different things depending on whether we're using
utrace or inode-uprobes for example.

To do this, we introduce a 'group' attribute which remembers to which
group a derived_probe has been added. This is then used during
translation time to check if the probe group supports on-the-fly
operations.

This patch also introduces otf_safe_context(), which determines whether
the context of the probe type is safe enough for direct workqueue
manipulations. This then allows us to only use the background timer if
the probe doing the toggling does not support workqueue manipulations.

9 years agoimplement STP_ON_THE_FLY_INTERVAL
Jonathan Lebon [Wed, 23 Jul 2014 14:15:10 +0000 (10:15 -0400)]
implement STP_ON_THE_FLY_INTERVAL

9 years agosplit linux/timer.c into .c and .h
Jonathan Lebon [Tue, 22 Jul 2014 20:24:00 +0000 (16:24 -0400)]
split linux/timer.c into .c and .h

For the background timer, it is useful to have some of the definitions
currently sitting in linux/timer.c. Split it into a header file and
include the header.

9 years agoon-the-fly: use a background timer to schedule work
Jonathan Lebon [Tue, 22 Jul 2014 18:16:27 +0000 (14:16 -0400)]
on-the-fly: use a background timer to schedule work

Calling schedule_work() is not always safe from some contexts (e.g. when
tracing/probing the internals of workqueues themselves).

We remove the code which previously called schedule_work() in the common
epilogue of all probe types. We will need to vet on a case-by-case basis
which probe types are safe.

Meanwhile, we implement a background timer which simply checks if
schedule_work() needs to be called.

9 years agoaffection.exp: also check probe globals locking
Jonathan Lebon [Thu, 17 Jul 2014 14:50:21 +0000 (10:50 -0400)]
affection.exp: also check probe globals locking

In light of the locking issue mentioned in the previous commit, this
commit now updates affection.exp so that locking is also checked to
ensure probes lock the right vars for the right access.

9 years agoon-the-fly: read-lock visited globals
Jonathan Lebon [Wed, 16 Jul 2014 16:31:15 +0000 (12:31 -0400)]
on-the-fly: read-lock visited globals

If we have the following situation

   probe X if (a || b) {...}
   probe Y {a = ...}
   probe Z {b = ...}

then we will have Y write-locking a and Z write-locking b, but because
these variables affect X's condition, the cond_enabled of X will be
re-evaluated in the out: path of both Y and Z. This means that it could
happen that Y tries to read b at the same time as Z updates it, and
vice-versa.

This patch ensures that Y and Z also read-lock b and a, respectively. It
does this by making the varuse collector also visit the conditions of
probes who we can affect.

9 years agoon-the-fly: use atomic_t for need_module_refresh
Jonathan Lebon [Wed, 16 Jul 2014 15:59:56 +0000 (11:59 -0400)]
on-the-fly: use atomic_t for need_module_refresh

The need_module_refresh global can get written to in two different
locations at the same time. To avoid getting a messed up value, use
atomic_t operations.

Concurrency-wise, in the worse case, we get work scheduled twice rather
than once only.

9 years agouprobes_onthefly.exp: new testcase
Jonathan Lebon [Fri, 27 Jun 2014 18:57:02 +0000 (14:57 -0400)]
uprobes_onthefly.exp: new testcase

9 years agokprobes_onthefly.exp: new testcase
Jonathan Lebon [Fri, 27 Jun 2014 14:00:53 +0000 (10:00 -0400)]
kprobes_onthefly.exp: new testcase

9 years agohrtimer_onthefly.exp: new testcase
Jonathan Lebon [Tue, 24 Jun 2014 19:59:06 +0000 (15:59 -0400)]
hrtimer_onthefly.exp: new testcase

9 years agoonthefly_common.tcl: new file for on-the-fly testing
Jonathan Lebon [Thu, 10 Jul 2014 21:35:00 +0000 (17:35 -0400)]
onthefly_common.tcl: new file for on-the-fly testing

This Tcl file contains a library of common procs for on-the-fly testing.
Other testcases will source it.

9 years agoaffection.exp: new testcase
Jonathan Lebon [Tue, 24 Jun 2014 13:38:41 +0000 (09:38 -0400)]
affection.exp: new testcase

9 years agokprobes.c: add DEBUG_KPROBES to monitor kprobe [un]registration
Jonathan Lebon [Mon, 11 Aug 2014 15:23:21 +0000 (11:23 -0400)]
kprobes.c: add DEBUG_KPROBES to monitor kprobe [un]registration

This re-implements the functionality added by the the initially reverted
commit 9108b75 (revert commit fd777b5).

9 years agokprobes.c: link stap_dwarf_probe to stap_dwarf_kprobe
Jonathan Lebon [Wed, 16 Jul 2014 14:52:32 +0000 (10:52 -0400)]
kprobes.c: link stap_dwarf_probe to stap_dwarf_kprobe

Prior to PR5673, the stap_dwarf_kprobe struct was embedded in the
stap_dwarf_probe struct. It was then moved out due to issues mentioned
in PR5673.

In this patch we simply add back a pointer member in stap_dwarf_probe to
its own stap_dwarf_kprobe so that they may never be mistakenly shared.
This also greatly simplifies many of the function signatures which
previously took in the stap_dwarf_probe and the stap_dwarf_kprobe as
separate parameters.

9 years agokprobes.c: memset also after batch unregistration
Jonathan Lebon [Wed, 16 Jul 2014 15:16:29 +0000 (11:16 -0400)]
kprobes.c: memset also after batch unregistration

We should not only clear the kprobe struct after a single
unregistration, but also when batch unregistration is used. (Even though
batch unregistration is normally only done when exiting, but better safe
than sorry!).

9 years agokprobes.c: add misses before resetting struct
Jonathan Lebon [Wed, 16 Jul 2014 14:44:20 +0000 (10:44 -0400)]
kprobes.c: add misses before resetting struct

If we memset before, then all the missed counts will be reset as well.

9 years agokprobes.c: remove enabled_p from stap_dwarf_probe
Jonathan Lebon [Wed, 16 Jul 2014 14:27:37 +0000 (10:27 -0400)]
kprobes.c: remove enabled_p from stap_dwarf_probe

Using the kernel function kprobe_disabled(), we can directly query
whether a kprobe is enabled or not. This makes the enabled_p field
redundant. We replace its use with a stapkp_enabled() function which
simply call kprobe_disabled().

9 years agoruntime: remove STP_ON_THE_FLY
Jonathan Lebon [Tue, 15 Jul 2014 20:17:31 +0000 (16:17 -0400)]
runtime: remove STP_ON_THE_FLY

This patch removes the use of the STP_ON_THE_FLY macro so that
on-the-fly related code is always emitted/executed. When no probes use
conditions, the overhead is quite small: the cond_enabled field of each
stap_probe is set to 1 at start-up.

In general, blocks that were previously incompatible with dyninst and
were behind an STP_ON_THE_FLY guard are now emitted only if !usermode.

The tests were adjusted to not test STP_ON_THE_FLY_DISABLED, which no
longer exists.

9 years agoon-the-fly: handle non-0/1 probe condition expressions
Frank Ch. Eigler [Tue, 15 Jul 2014 22:03:06 +0000 (18:03 -0400)]
on-the-fly: handle non-0/1 probe condition expressions

It is necessary to evaluate a given if(FOO) expression with a !!
prefix in order to turn it into a 0/1 boolean for probe.cond_enabled
matching purposes.  With that done, a 1-bit field for cond_enabled is
sufficient.

9 years agokprobes.c: check for kernel version
Jonathan Lebon [Tue, 15 Jul 2014 13:34:55 +0000 (09:34 -0400)]
kprobes.c: check for kernel version

Support for kprobes enabling/disabling was added in v2.6.30 (kernel
commit de5bd88d). Guard arming related code with this check as well.

bla

9 years agokprobes.c: register as disabled instead of post disabling
Jonathan Lebon [Fri, 20 Jun 2014 19:10:53 +0000 (15:10 -0400)]
kprobes.c: register as disabled instead of post disabling

The register_kprobe() function supports settings the kprobe struct
flags member to KPROBE_FLAG_DISABLED to indicate that we want it
registered but disabled (see also Documentation/kprobes.txt).

This patch takes advantage of this by setting the flags member
accordingly during registration, rather than calling disable_kprobe()
after a successful registration.

9 years agoPR16861: reset kprobe struct and improve refresh
Jonathan Lebon [Thu, 19 Jun 2014 20:41:17 +0000 (16:41 -0400)]
PR16861: reset kprobe struct and improve refresh

We need to ensure that the stap_dwarf_kprobe struct is completely
zero'ed out after each unregistration so as not to affect future
registrations which will use the same struct.

We also modify the signature of systemtap_module_refresh so that the
name of the module is passed. This allows us to only update the kprobes
related to that module, rather than checking all of them.

Finally, we also set the priority of the module notifier to 0 to
indicate we don't care in which order we are called (i.e. it shouldn't
matter whether we're called before or after the kprobes callback).

9 years agokprobes.c: split stapkp_refresh_probe()
Jonathan Lebon [Tue, 17 Jun 2014 21:42:10 +0000 (17:42 -0400)]
kprobes.c: split stapkp_refresh_probe()

We break down stapkp_refresh_probe() into stapkp_enable_probe() and
stapkp_disable_probe(). We also introduce predicate functions
stapkp_should_enable_probe() and stapkp_should_disable_probe() to
improve clarity.

9 years agokprobes.c: refactor stapkp_register_probe()
Jonathan Lebon [Tue, 17 Jun 2014 20:54:47 +0000 (16:54 -0400)]
kprobes.c: refactor stapkp_register_probe()

Here, we split the general stapkp_register_probe into a kprobe and
kretprobe variant, and then further split the work into preparing the
kprobe for registration and actually registering it.

9 years agokprobes.c: factor out stapkp_refresh_probe()
Jonathan Lebon [Tue, 17 Jun 2014 20:08:35 +0000 (16:08 -0400)]
kprobes.c: factor out stapkp_refresh_probe()

We take out everything from stapkp_refresh() related to actual
enable/disable and move it to stapkp_refresh_probe().

9 years agokprobes.c: factor out stapkp_unregister_probes()
Jonathan Lebon [Tue, 17 Jun 2014 19:07:12 +0000 (15:07 -0400)]
kprobes.c: factor out stapkp_unregister_probes()

In this commit, we do a few things:
1. We separate the kprobe nmissed accounting from actual unregistration.
   The stapkp_add_missed() function now solely takes care of this.
2. We abstract away support for bulk unregistration behind one main
   stapkp_unregister_probes() function. This function uses the bulk
   method if supported, falling back on manual one-by-one unregistration
   if not.

9 years agokprobes.c: factor out stapkp_unregister_probe()
Jonathan Lebon [Tue, 17 Jun 2014 18:03:22 +0000 (14:03 -0400)]
kprobes.c: factor out stapkp_unregister_probe()

Factor out the unregistration part of the code in stapkp_refresh() into
the new function stapkp_unregister_probe().

9 years agokprobes.c: factor out stapkp_register_probe() [2/2]
Jonathan Lebon [Tue, 17 Jun 2014 17:31:38 +0000 (13:31 -0400)]
kprobes.c: factor out stapkp_register_probe() [2/2]

This commit and the previous were split in two to make the diff more
legible.

In this commit, we actually replace the code we factored out in
stapkp_init() and stapkp_refresh() by a simple call to
stapkp_register_probe().

9 years agokprobes.c: factor out stapkp_register_probe() [1/2]
Jonathan Lebon [Wed, 18 Jun 2014 14:46:04 +0000 (10:46 -0400)]
kprobes.c: factor out stapkp_register_probe() [1/2]

This commit and the next were split in two to make the diff more
legible.

In this commit, we add a stapkp_register_probe() function which is
directly taken from stapkp_init() (also found in stapkp_refresh()).

9 years agokprobes.c: add stapkp_exit()
Jonathan Lebon [Tue, 17 Jun 2014 14:38:08 +0000 (10:38 -0400)]
kprobes.c: add stapkp_exit()

We move off everything from emit_module_exit() and into a new
stapkp_exit() function.

9 years agokprobes.c: add stapkp_refresh()
Jonathan Lebon [Tue, 17 Jun 2014 14:22:13 +0000 (10:22 -0400)]
kprobes.c: add stapkp_refresh()

We move off everything from emit_module_refresh() and into a new
stapkp_refresh() function.

9 years agokprobes.c: add stapkp_init()
Jonathan Lebon [Wed, 18 Jun 2014 14:39:50 +0000 (10:39 -0400)]
kprobes.c: add stapkp_init()

We move off everything from emit_module_init() and into a new
stapkp_init() function.

9 years agokprobes.c: new file for dwarf kprobes handling
Jonathan Lebon [Tue, 17 Jun 2014 13:50:38 +0000 (09:50 -0400)]
kprobes.c: new file for dwarf kprobes handling

This is the first in a series of patches to move off as much of the
static code previously emitted by dwarf_derived_probe_group into a new
runtime/linux/kprobes.c file. This should greatly help legibility and
maintainability. No refactoring will be performed until everything has
been moved over.

In this first patch, we simply move off as much as possible from
emit_module_decls() into kprobes.c.

The one tricky bit is whether the 'module' and 'section' members of the
stap_dwarf_probe struct is a char* or a char[]. This is determined
dynamically, but we use macros to allow us to still declare the struct
in kprobes.c.

This page took 0.068497 seconds and 5 git commands to generate.