Bug 14690 - the syscall tapsets could be written to prefer the 'syscalls' tracepoints
Summary: the syscall tapsets could be written to prefer the 'syscalls' tracepoints
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: tapsets (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Jafeer Uddin
URL:
Keywords:
Depends on: 14689
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-09 19:41 UTC by David Smith
Modified: 2018-10-11 13:31 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Smith 2012-10-09 19:41:30 UTC
If systemtap could find the 'syscalls' set of tracepoints, the syscall tapsets could be written to prefer those tracepoints over using kprobes.  As an example:

====
probe syscall.access = kernel.trace("sys_enter_access") !,
      kernel.function("sys_access").call
{
  # ... we'd probably need to use @defined() to get the correct arguments
}
====
Comment 1 Josh Stone 2012-10-09 20:14:12 UTC
(In reply to comment #0)
> probe syscall.access = kernel.trace("sys_enter_access") !,
>       kernel.function("sys_access").call
> {
>   # ... we'd probably need to use @defined() to get the correct arguments
> }

IMO, when we already know what variables should be used in which probe point, it's better to split the aliases than use @defined, e.g.

probe syscall.access = tp_syscall.access!, kp_syscall.access
{ /* common stuff */ }
probe tp_syscall.access = kernel.trace("sys_enter_access")
{ /* tracepoint specifics */ }
probe kp_syscall.access = kernel.function("sys_access").call
{ /* kprobe specifics */ }

We might even choose to unify nd_syscall.access in there too.
Comment 2 Frank Ch. Eigler 2018-06-20 19:26:04 UTC
This little toy script checks whether the _stp_syscall_nr() function provides a good-enough substitute for the missing $id parameter from the sys_exit tracepoint.  It turns out that generally yes, at least on x86_64.


global i% 

probe kernel.trace("sys_enter") { __set_usermode_pt_regs($regs) x=$id y=_stp_syscall_nr(); i[tid()]=x; if (x!=y) println("entry ", x, " ", y) } 

probe kernel.trace("sys_exit") { __set_usermode_pt_regs($regs) y = _stp_syscall_nr(); x=i[tid()]; delete i[tid()] ; if(x!=y) println("exit ", x, " ", y) }
Comment 3 Jafeer Uddin 2018-10-11 13:31:27 UTC
All syscall tracepoints have been added in commit 8b8c9b636389b67a2288e31eb1f9b14a3992bc18