]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
11 years agodtrace: reject enabling is referencing module fails and do not count it
Kris Van Hees [Thu, 17 Oct 2013 09:42:04 +0000 (05:42 -0400)]
dtrace: reject enabling is referencing module fails and do not count it

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: ensure state is free'd after use (memleak fix)
Kris Van Hees [Thu, 17 Oct 2013 09:41:37 +0000 (05:41 -0400)]
dtrace: ensure state is free'd after use (memleak fix)

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: align module code with new cyclics API
Kris Van Hees [Thu, 17 Oct 2013 09:40:47 +0000 (05:40 -0400)]
dtrace: align module code with new cyclics API

Orabug: 17553446

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: update getufpstack implementation to be safer
Kris Van Hees [Thu, 10 Oct 2013 20:17:13 +0000 (16:17 -0400)]
dtrace: update getufpstack implementation to be safer

The dtrace_getufpstack() function was a death trap when called for cases where
current happened to be in a transitional state (no mm) or a kthread.  It was
also using find_vma() when that was not quite necessary.  Finally, it was not
correctly using the saved stack pointer from userspace correctly (in one place
it used old_rsp as appropriate, but in another p->thread.usersp).  The code
has been rewritten to make use of the fact that the only valid stack addresses
that can be in use when this function is called must appear between the current
stack pointer position (old_rsp) and the bottom of the stack (mm->start_stack).
Therefore, no vma is necessary anymore.

The new implementation also ensures that when there is no mm, or we're dealing
with a kthread, the resulting data is still formatted correctly, i.e. with a
PID in the first slot, and zeros in all other slots.

This commit effectively builds on top of the fix applied by Nick Alcock.

Orabug: 17591351

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: armour ustack() against kernel threads, !task->mm, and corrupt usersp.
Nick Alcock [Thu, 10 Oct 2013 23:32:25 +0000 (00:32 +0100)]
dtrace: armour ustack() against kernel threads, !task->mm, and corrupt usersp.

Kernel threads have no userspace stack, by definition: we should not assume they
do.  Further, tasks with no mm (whether because they are kernel threads or for
any other reason) should not be ustack()ed, nor tasks in which find_vma() cannot
find the vma corresponding to the usersp.  (Possible causes for this might be a
task which just smashed its own userspace sp or a task which is in the middle of
exiting or exec()ing.)

Orabug: 17591351

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
11 years agodtrace: Ensure that provider names are unique in the context of a PID
Kris Van Hees [Mon, 30 Sep 2013 13:19:20 +0000 (09:19 -0400)]
dtrace: Ensure that provider names are unique in the context of a PID

Orabug: 17476663

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: ensure &tp->ftt_mtp is set to 0s for is-enabled probes also
Kris Van Hees [Sun, 22 Sep 2013 22:03:36 +0000 (18:03 -0400)]
dtrace: ensure &tp->ftt_mtp is set to 0s for is-enabled probes also

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: Update NEWS
Kris Van Hees [Fri, 20 Sep 2013 14:00:57 +0000 (10:00 -0400)]
dtrace: Update NEWS

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: Various memory allocation fixes (leaks, footprint reduction, ...)
Kris Van Hees [Fri, 20 Sep 2013 13:53:05 +0000 (09:53 -0400)]
dtrace: Various memory allocation fixes (leaks, footprint reduction, ...)

Orabug: 17488207

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: UEK3 build -16
Kris Van Hees [Tue, 17 Sep 2013 12:11:47 +0000 (08:11 -0400)]
dtrace: UEK3 build -16

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: prevent Oops caused by preemption issues with probes
Kris Van Hees [Fri, 13 Sep 2013 14:36:07 +0000 (10:36 -0400)]
dtrace: prevent Oops caused by preemption issues with probes

It was possible (specifically with direct-call probes) for the execution of
actions (using the DIF emulator) to get preempted, causing interesting side
effects because dtrace_probe() (and the functions it calls) are designed to
run on a specific CPU without any interruption especially not from another
call to dtrace_probe()).  Since the UEK3 kernel uses voluntary preemption,
the behaviour was not as expected and explicit preemption protection had to
be added to resolve this.

Orabug: 17403196
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: fix for psinfo allocation during execve
Kris Van Hees [Fri, 13 Sep 2013 14:33:41 +0000 (10:33 -0400)]
dtrace: fix for psinfo allocation during execve

Allocate the psinfo structure from a slab (alike other structures related to
the task_struct), and use kmalloc() for the argv and envp members (with size
limit to avoid allocation issues).

Orabug: 17407069
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: General cleanup of debug info and fix syscall probe module name.
Kris Van Hees [Fri, 13 Sep 2013 14:11:59 +0000 (10:11 -0400)]
dtrace: General cleanup of debug info and fix syscall probe module name.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: fixes for the module build
Kris Van Hees [Thu, 5 Sep 2013 21:23:16 +0000 (17:23 -0400)]
dtrace: fixes for the module build

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: remove debugging code
Kris Van Hees [Thu, 5 Sep 2013 21:12:50 +0000 (17:12 -0400)]
dtrace: remove debugging code

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: Ensure that USDT probes are carried over correctly across fork().
Kris Van Hees [Thu, 29 Aug 2013 22:07:21 +0000 (18:07 -0400)]
dtrace: Ensure that USDT probes are carried over correctly across fork().

When a process forks, its child will have a copy of the address space of the
parent, and therefore any enabled USDT probes from the parent will also fire
for the child.  In order for those probe firings to be valid, the child must
have its own pid-specific providers (created by duplicating the parent's
providers).

This commit also adds some additional cleanup.

Orabug: 17346878

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: Fix frame offsets for direct called probes (ERROR and syscalls).
Kris Van Hees [Wed, 28 Aug 2013 22:19:59 +0000 (18:19 -0400)]
dtrace: Fix frame offsets for direct called probes (ERROR and syscalls).

Orabug: 17368166

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agodtrace: fix retrieval of arg5 through arg9
Kris Van Hees [Tue, 27 Aug 2013 19:49:50 +0000 (15:49 -0400)]
dtrace: fix retrieval of arg5 through arg9

Fix the retrieval of arguments passed on the stack for SDT, USDT, and direct
call probes.  This commit also adds trivial support for testcases related to
this fix.

Orabug: 17368166

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agoBug fix for logic to determine the (inode, offset) pair for uprobes.
Kris Van Hees [Wed, 14 Aug 2013 12:44:01 +0000 (08:44 -0400)]
Bug fix for logic to determine the (inode, offset) pair for uprobes.

The logic used to determine the (inode, offset) pair needed by uprobes, and
caculated based on an address in a process memory space. was flawed.  This
caused USDT probes in shared libraries to not work correctly.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agoEnsure memory allocation results are checked throughout the code.
Kris Van Hees [Mon, 12 Aug 2013 09:27:40 +0000 (05:27 -0400)]
Ensure memory allocation results are checked throughout the code.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agoBug fix for fasttrap module unloading.
Kris Van Hees [Wed, 7 Aug 2013 20:09:27 +0000 (16:09 -0400)]
Bug fix for fasttrap module unloading.

Various scenarios have been uncovered where unloading of the fasttrap module
would result in an assertion failure.

Essentially, what is going on is that an executable may register providers
for USDT probes (i.e. pass a DOF object to DTrace through the helper interface)
while there isn't any consumer active.  Any attempt to remove the fasttrap
provider at this point in time causes an assertion failure on the reference
count for all providers instantiated by the the meta-provider (fasttrap),
because module removal cannot be stopped once it has been initiated.

The solution is to take a reference on the meta-provider module whenever a new
provider is instantiated in it, and to put the reference back when that
provider is retired (removed from use).  I.e. the module will be listed as in
use as long as there are providers associated with it.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agoRemove pre-alpha features for release.
Kris Van Hees [Wed, 24 Jul 2013 07:31:51 +0000 (03:31 -0400)]
Remove pre-alpha features for release.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agoBug fix for module unloading.
Kris Van Hees [Wed, 7 Aug 2013 07:44:08 +0000 (03:44 -0400)]
Bug fix for module unloading.

Once a consumer has opened the /dev/dtrace/dtrace device file, providers can
no longer be safely unloaded, until the last consumer closed the device file.
This commit adds code to ensure this behaviour.  Failing to do so results in
almost certain OOPSes because Linux does not support kernel modules "refusing"
to be unloaded in response to an rmmod.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
11 years agoFix fasttrap ioctls and headers_check.
Nick Alcock [Wed, 31 Jul 2013 19:01:52 +0000 (20:01 +0100)]
Fix fasttrap ioctls and headers_check.

These were being included before their structure definitions, leading to the
possibility of wrong values for FASTTRAPIOC_*.

Instead, split the FASTTRAPIOC* definitions into a new header, fasttrap_ioctl.h:
this includes fasttrap.h to get the structure definitions, and is also included
by it, so that either header can be included to get the ioctl definitions. We
then extend "make headers_check" so that it does the extended ioctl checks on
all headers named *ioctl.h, not just ioctl.h. (These checks are quite grotesque:
we don't want to run them on every DTrace uapi header if that can be avoided.)

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
11 years agoRe-enable DTrace ioctl()-size debugging.
Nick Alcock [Wed, 31 Jul 2013 15:17:30 +0000 (16:17 +0100)]
Re-enable DTrace ioctl()-size debugging.

We move the shared user/kernel ioctl-debugging function to a new
<linux/dtrace/ioctl_debug.h> header, to avoid problems with other
<linux/dtrace/ioctl.h> users.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoAdd RPM changelog.
Nick Alcock [Thu, 25 Jul 2013 17:52:57 +0000 (18:52 +0100)]
Add RPM changelog.

Allow specification of build_kver to override the kver at RPM build time,
as with variant and build_variant.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoAdd a warning to be displayed when tracepoint enabling fails. Update NEWS.
Kris Van Hees [Tue, 23 Jul 2013 21:30:31 +0000 (17:30 -0400)]
Add a warning to be displayed when tracepoint enabling fails.  Update NEWS.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoFix provider header requirements.
Nick Alcock [Tue, 23 Jul 2013 18:54:32 +0000 (19:54 +0100)]
Fix provider header requirements.

This should depend on dtrace-modules-headers with a version equal to the dtrace
kernel interface, not on dtrace-modules-headers-%{kver}, which doesn't exist.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoSPEC: Changes for UEK merge.
Nick Alcock [Tue, 23 Jul 2013 12:32:19 +0000 (13:32 +0100)]
SPEC: Changes for UEK merge.

Boost the associated kernel version to 3.8.13-1.  Kernel package
is now named kernel-uek, not kernel-uek-dtrace, unless the build_variant
is defined to specify a different name.  Reintroduce merging of
config-dtrace into .config.  Revert unnecessary changes from upstream
UEK specfile, in preparation for merge (e.g. forced building of firmware).

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoBoost ustackframes_default.
Nick Alcock [Mon, 22 Jul 2013 23:43:23 +0000 (00:43 +0100)]
Boost ustackframes_default.

The incidence of false positives in ustack scanning is quite high,
so a substantial number of frames are needed for quite short actual
call stacks in userspace.

So boost the default to 100 for now.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoMake old_rsp available to kernel modules.
Kris Van Hees [Mon, 22 Jul 2013 12:19:29 +0000 (08:19 -0400)]
Make old_rsp available to kernel modules.

In order to get access to the RSP value during system call and trap processing,
code needs access to the old_rsp per-cpu variable.  Since we use this from a
kernel module, it needs to be exported (it is only accessible through macros -
there isn't an accessor function exported anywhere for it).

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoRemove unnecessary 32-bit code.
Kris Van Hees [Fri, 19 Jul 2013 22:17:57 +0000 (18:17 -0400)]
Remove unnecessary 32-bit code.

Since DTrace for Linux is only being developed for 64-bit platforms, various
pieces of conditional-controlled code can be removed because they only apply
for 32-bit DTrace implementations.  Note that this does not have anything to
do with (future) support for 32-bit applications runnings and being traced on
a 64-bit host.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoClean up ioctl debugging output, and remove dtrace_ioctl_sizes().
Kris Van Hees [Fri, 19 Jul 2013 22:15:48 +0000 (18:15 -0400)]
Clean up ioctl debugging output, and remove dtrace_ioctl_sizes().

The debugging messages printed for ioctl code were not clear enough.  This has
been rectified.

The dtrace_ioctl_sizes() function and call to it were removed from the code
because the function defined in ioctl.h was causing interference with the
compilation of userspace tools.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoAdd debugging for enablings.
Kris Van Hees [Fri, 19 Jul 2013 22:14:06 +0000 (18:14 -0400)]
Add debugging for enablings.

Added dt_dbg_enable() to support adding debugging statements in the handling
of enablings.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoEnsure that the fasttrap device file can be opened.
Kris Van Hees [Fri, 19 Jul 2013 21:58:43 +0000 (17:58 -0400)]
Ensure that the fasttrap device file can be opened.

The DTrace utility tries to open the fasttrap provider device file when USDT
probes are being used, and due to the open function returning -EAGAIN, the
DTrace utility would report that the pid provider is unavailable because the
resource is temporarily unavailable.  The function now correctly returns 0.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoFix format string errors in buffer storage debugging messages.
Nick Alcock [Thu, 20 Jun 2013 15:28:33 +0000 (16:28 +0100)]
Fix format string errors in buffer storage debugging messages.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoDrop stack debugging messages.
Nick Alcock [Thu, 20 Jun 2013 15:27:17 +0000 (16:27 +0100)]
Drop stack debugging messages.

We don't need these any more, we know ustack()'s kernel side works.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoSPEC: Fix the name of the kernel development package in BuildRequires.
Nick Alcock [Thu, 6 Jun 2013 16:53:46 +0000 (17:53 +0100)]
SPEC: Fix the name of the kernel development package in BuildRequires.

We flipped it to kernel-uek-devel, but now (after fixing the package name)
it is called kernel-uek-dtrace-devel again.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoSPEC: Boost the associated kernel version to 3.8.12.
Nick Alcock [Thu, 6 Jun 2013 16:08:50 +0000 (17:08 +0100)]
SPEC: Boost the associated kernel version to 3.8.12.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoEnsure that arg6 through arg9 get retrieved correctly for USDT probes.
Kris Van Hees [Fri, 31 May 2013 06:48:37 +0000 (02:48 -0400)]
Ensure that arg6 through arg9 get retrieved correctly for USDT probes.

A bug in the implementation of retrieving arguments from the stack caused
bogus values to be returned for arg6 through arg9 on x86_64.  This has been
resolved.

This commit also removes various debugging output that is no longer needed.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoFinish the implementation of is-enabled USDT probes.
Kris Van Hees [Thu, 23 May 2013 14:52:00 +0000 (10:52 -0400)]
Finish the implementation of is-enabled USDT probes.

This commit completes the implementation of is-enabled USDT probes, i.e. probes
that when fired cause an execution flow change.  This makes it possible (when
using USDT) to encode more complex code sections that are only executed if a
specific USDT probe has been enabled, i.e. when a consumer is listening for
s specific USDT probe.  This is most commonly used for cases where a USDT probe
might require additional computation for one or more of its arguments, and so
it would be too expensive to always do that computation, whether the probe is
enabled or not.  With is-enabled probes, the overhead when DTrace is not used
is negligible (2 NOPs), and when DTrace is in use but the guarded probe is not
enabled, the cost is a single probe firing (without calling dtrace_probe()).

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoFixes for tracepoint cleanup.
Kris Van Hees [Wed, 22 May 2013 23:25:48 +0000 (19:25 -0400)]
Fixes for tracepoint cleanup.

Various fixes to handle tracepoint cleanup.  It is important to note that it is
most common that USDT providers will be cleaned up (asynchronously) when the
process/task they relate to is already gone.  We therefore cannot use a (pid,
addr) pair to identify the tracepoint for removal.  The new implementation
stores the (inode, offset) pair calculated right before registering the uprobe,
so that we can use that same pair again when unregistering.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoFixes for locking issues and cleanup workqueue handling.
Kris Van Hees [Wed, 22 May 2013 07:48:44 +0000 (03:48 -0400)]
Fixes for locking issues and cleanup workqueue handling.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoUpdate syscall tracing in view of Linux 3.8 changes.
Kris Van Hees [Tue, 21 May 2013 06:48:39 +0000 (02:48 -0400)]
Update syscall tracing in view of Linux 3.8 changes.

The handling of various stub-based syscalls in Linux 3.8 changed to no longer
use the saved registers directly.  This change is now also reflected in the
DTrace overrides for those system calls.

Also reset the compilatio debug settings to all-off (they should only be
turned on in local compilations - never in the repo.)

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoUSDT implementation (phase 2).
Kris Van Hees [Mon, 20 May 2013 20:46:58 +0000 (16:46 -0400)]
USDT implementation (phase 2).

This commit contains the 2nd phase of the USDT implementation for DTrace for
Linux.  It provides the mechanics of fasttrap probes (enabling, firing, and
disabling).  It also contains various debugging statements that will be cleaned
up in a future commit.  They exist right now, because this commit represents a
work in progress that is known to contain various bugs and loose ends.  The
commit for this code is provided as a "sharing of the pain" , and to ensure
that others can start playing with this code and test the interaction with
userspace.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoFix to exclude stack addresses from pcstack.
Kris Van Hees [Thu, 2 May 2013 19:24:22 +0000 (15:24 -0400)]
Fix to exclude stack addresses from pcstack.

Because the stack is considered executable memory, addresses on the stack that
point back into the stack were considered potential return address addresses,
and therefore they were (incorrectly) included in the pcstack output.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoRevamp and split up DTrace headers. Add ioctl() debugging machinery.
Nick Alcock [Mon, 29 Apr 2013 12:57:15 +0000 (13:57 +0100)]
Revamp and split up DTrace headers.  Add ioctl() debugging machinery.

It has always been annoying that we have a duplicate set of DTrace headers
in userspace, and further annoying that the DTrace header we have is such a
monolithic monster.

This fixes both of these, at the cost of a (very) little extra complexity when
maintaining the headers.  It also adds automated machinery to verify that each
of the new headers is 'standalone enough'.

What does 'standalone enough' mean?  This is the problem that has stopped us
sharing DTrace headers between userspace and kernelspace for a long time: they
depend on types that come from different places and have different definitions
in the kernel and in userspace, and can never be made to come from the same
place.

So we fix this by dictating that the headers are standalone *given* that certain
headers are included first.  For userspace, this set is <sys/types.h>,
<ctf/types.h>, and <unistd.h>; for kernelspace, the set is <linux/types.h> and a
newly-introduced header included as <dtrace/types.h>.  We avoid exposing this
requirement to header users by arranging for the header included as "dtrace.h"
in kernelspace and as <sys/dtrace.h> to include the prerequisite headers, and
enough other headers that the users of those headers can keep using them exactly
as they did before.  (There is a single exception for dtrace/iocl.h: see below.)

Where have the headers gone? They have been split in two directions (and the
Kbuild machinery has been adjusted to have its include paths point at the
appropriate places).

All DTrace headers, even <linux/dtrace_cpu.h> in the global kernel tree, have
had 'defines headers' split out of them, named ${header}_defines.h.  These
headers contain all typedefs, enums and #defines which do not depend on
visibility into structure definitions declared in the main non-defines header,
and opaque forwardings for all structure definitions declared in that header.
This means that users can include the defines header if they only want opaque
use of structures and relevant constants.  (This has necessitated some
mechanical changes to the DTrace headers to convert uses of foo_t typedefs into
'struct foo' where necessary.  Not all uses have been converted: only those that
need to be).  An _defines header is always accompanied by a corresponding non
_defines header (even if it is just one #include), but the reverse is not true.

In addition to this split, the core dtrace.h header has been split into three
pieces:

 - dtrace/include/uapi/linux/dtrace/*.h contains the majority of the headers,
   split into _defines and further by section roughly corresponding with the
   comment-delimited sections in the original file.  The include paths have been
   set up so that these can be used via

   #include <linux/dtrace/blah.h>

   in both userspace and kernelspace.

   #include <linux/include/dtrace.h> includes all the headers in the same order
   as they were originally.

   These headers are installed in userspace and used by dtrace-util.  They
   should always contain a CDDL license header, and should not use any
   kernel-specific types (modulo those that userspace normally uses, such as
   those related to kernel-specific functionality such as ioctl()).  If you use
   a new kernel-specific type, please add a definition of it to
   uts/common/sys/dtrace_types.h in userspace too.

   The old dtrace_ioctl.h has been renamed to <linux/dtrace/ioctl.h> and
   moved in here too.  It has gained some extra machinery to help debug
   ioctl() type size conflicts.  If you call dtrace_ioctl_sizes(), then
   dtrace_size_dbg_print() (not defined here) is repeatedly called with
   two parameters, the name of each ioctl() type and the size of that type.
   Please keep this list up to date, it is useful!

   There is one unfortunate exception to the userspace-types rule here:
   ioctl.h needs types from <linux/dtrace_cpu_defines.h>, which is not
   even a userspace-installed header.  So userspace must provide a copy of
   this header with appropriate typedefs as well.  (This should probably
   be fixed in due course.)

   <linux/dtrace/universal.h> defines constants and types used by virtually
   everything in any way related to dtrace.

 - dtrace/include/dtrace/*.h contains headers that are not shared with
   userspace, included as <dtrace/blah.h>:

   - <dtrace/types.h>: this contains the kernel-side definitions of types
     used in the shared headers.  (It has not been 'gardened' in any way,
     so probably contains a lot of other types as well).  This header is
     installed into the same place as the shared userspace headers.  This
     header needs a bit of care maintaining, as not everything kernel-
     side is allowable in it: see below.

   - <dtrace/provider.h>: The provider API, and its corresponding
     <dtrace/provider_defines.h> defines header.  This includes <dtrace/types.h>
     itself, so should be standalone -- however, this has not been in any way
     tested yet, unlike for the userspace headers.  This header is also
     installed into the same place as the shared userspace headers.

   - <dtrace/dtrace_impl.h> and <dtrace/dtrace_impl_defines.h>.

     These headers contain definitions used only by the DTrace core, and are
     not installed anywhere.

Note that because of the rules regarding kernel-specific types in the UAPI
DTrace headers, a number of uses of CONFIG_64BIT and CONFIG_BIG_ENDIAN have been
reverted to their Solaris-era-and-userspace _LP64 and _LITTLE_ENDIAN forms;
<dtrace/types.h> translates between the two.  (We have also fixed up a
couple of places in core DTrace where the nonexistent _BIG_ENDIAN was used.)

There are several things called dtrace.h now, which might get confusing:

- dtrace.h at the top level is for the DTrace core and included providers
  alone.  Anything goes in here.  It is never installed anywhere, and not even
  standalone providers can see it.

- dtrace/include/uapi/linux/dtrace/dtrace.h is shared with userspace and with
  standalone providers, and needs to follow the same rules as all such shared
  headers.

We have two new packages, dtrace-modules-$kver-headers and
dtrace-modules-$kver-provider-headers; to make it easy for people to Require
them, they provide features named 'dtrace-modules-headers' and
'dtrace-modules-provider-headers' using the same incrementing API version number
as 'dtrace-kernel-interface' (both currently 1).  dtrace-modules-headers serves
much the same purpose as dtrace-kernel-interface, tracking changes in the
userspace/kernelspace API: the dtrace-modules-provider-headers version number
tracks changes in the DTrace core/provider API.

The top-level Makefile has acquired two new rules, headers_install and
headers_check.  The former is a simple emulation of the top-level
headers_install rule, and is used by the RPM build system.  The latter checks to
be sure that the userspace-side headers can be #included on their own
(modulo only <unistd.h> et al, as above), and that dtrace/ioctl.h has all its
types in scope with appropriate sizes, since if they aren't everything will
appear to work until userspace tries to invoke the ioctl() and gets an -ENOTTY
error.

The latter is particularly difficult, since the size-checking machinery only
works for kernelspace builds, and the headers_check build is userspace.  So that
machinery hacks up a sort of halfway-house to the kernel environment, enough to
do the ioctl() size checks but not enough to #include arbitrary kernel
headers (among other things, there are no CONFIG constants here).  This means
that changes to those kernel-side headers which are included by this
machinery (in particular dtrace/types.h, dtrace_os.h) need to include a
headers_check run to make sure that machinery hasn't broken.  In general,
surrounding suspect definitions with an #ifndef HEADERS_CHECK should suffice:
nearly all of dtrace_os.h is so surrounded (and if we ever move dtrace_id_t out
into the shared headers, as perhaps we should, this problem will become less
serious).  (Feel free to make the headers_check dtrace/ioctl.h compilation
environment more like that used for the real kernel.)

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoOS/arch specific ustack implementation.
Kris Van Hees [Fri, 26 Apr 2013 06:09:26 +0000 (02:09 -0400)]
OS/arch specific ustack implementation.

This provides the implementation for ustack's getupcstack function, and the
related ustackdepth.  Due to the frequent use of omit-framepointer in the
compilation of userspace code, ustack will return all addresses on the stack
that reference into memory areas with executable code.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoEnsure PID is passed as first element for ustack.
Kris Van Hees [Tue, 23 Apr 2013 08:08:25 +0000 (04:08 -0400)]
Ensure PID is passed as first element for ustack.

Code that uses getupcstack and getufpstack expects to see the PID of the
associated process in the first slot of the program counter array.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoRevert "stack() / jstack(): Send PID to userspace."
Kris Van Hees [Wed, 10 Apr 2013 08:40:53 +0000 (04:40 -0400)]
Revert "stack() / jstack(): Send PID to userspace."

This reverts commit d42235829341592e23996d727bc5c3beebec1e57.  The bug with
the PID not being passed is a bug in dtrace_isa.c instead, and there is a slot
already reserved for that.  So this patch was not necessary, and the bug will
be fixed in dtrace_isa.c get_ufpstack and get_upcstack with a subsequent
commit.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agostack() / jstack(): Send PID to userspace.
Nick Alcock [Thu, 28 Mar 2013 20:46:09 +0000 (20:46 +0000)]
stack() / jstack(): Send PID to userspace.

The stack() and jstack() actions expect the buffer to begin with the PID under
investigation, rather than just being a stream of addresses, as now.

Adjust the buffer size and contents accordingly.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoAdding more compile time debugging for development.
Kris Van Hees [Thu, 7 Feb 2013 21:30:08 +0000 (16:30 -0500)]
Adding more compile time debugging for development.

This patch expands the developer debugging coverage, adding more (compile time
enabled) debugging statements that can help during DTrace kernel side bug
hunting.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoUSDT implementation (Phase 1).
Kris Van Hees [Wed, 23 Jan 2013 09:53:14 +0000 (04:53 -0500)]
USDT implementation (Phase 1).

This rather large patch provides the implementation for USDT support at the
DTrace kernel core level, and the fasttrap provider level.  It ensures that
executables can register their embedded providers (with USDT probes), that
the probes are visible to the dtrace userspace utility, and that probes are
properly removed upon executable completion, execve() invocation, or any
unexpected executable termination.

The following parts are provided by this patch:
- meta-provider support (dtrace_ptofapi)
- helper ioctl interface (dtrace_dev)
- DIF validation for helper objects (dtrace_dif)
- DOF processing for helpers for provider and probe definitions (dtrace_dof)
- fasttrap meta-provider for USDT only (fasttrap*)

The dtrace_helper.c file was removed because this code belongs in dtrace_dof.c
instead.

Minimal changes were made to the core kernel in exec.c, sched.h, exit.c, and
fork.c to add support for process-specific helpers (and those encapsulate
providers and probes).

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoAdd basic development debugging framework.
Kris Van Hees [Wed, 23 Jan 2013 09:42:32 +0000 (04:42 -0500)]
Add basic development debugging framework.

This patch adds some defines that can be used to provide debugging output in
support of development.  This is debugging output that is controlled at build
time rather than runtime.  For production builds, this will always be disabled.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoUpdate copyright statements.
Kris Van Hees [Wed, 23 Jan 2013 09:37:30 +0000 (04:37 -0500)]
Update copyright statements.

Various updates were made to files in the past months, and copyright statements
were never updated to reflect that.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoDisable providers that do not work.
Kris Van Hees [Wed, 23 Jan 2013 09:29:45 +0000 (04:29 -0500)]
Disable providers that do not work.

We currently do not have fbt and lockstat available as providers in a stable
state.  Disable building them until we are ready to release them in alpha
status with at least a reasonable expectation that they won't crash anything.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoDifferentiate between multi-providers and meta-providers.
Kris Van Hees [Sun, 6 Jan 2013 09:51:59 +0000 (04:51 -0500)]
Differentiate between multi-providers and meta-providers.

Renamed and module init/exit macro to reflect that this is a multi-provider
module (i.e. one that registers multiple providers in one kernel module) rather
than a meta-provider (a module that dynamically creates providers on demand).
Also added the list of providers to register/unregister as a 2nd argument to
the macro rather than expecting that the list of providers will be provided by
a global variable with a specific name.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoAdding missing build specs for dt_perf.
Kris Van Hees [Fri, 26 Oct 2012 13:32:44 +0000 (09:32 -0400)]
Adding missing build specs for dt_perf.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoRemove unnecessary and inconsistemt use of argument name in prototypes.
Kris Van Hees [Mon, 22 Oct 2012 08:48:01 +0000 (04:48 -0400)]
Remove unnecessary and inconsistemt use of argument name in prototypes.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoClean up a file that is no longer used.
Kris Van Hees [Fri, 19 Oct 2012 09:12:48 +0000 (05:12 -0400)]
Clean up a file that is no longer used.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoInternal performance measurement support code.
Kris Van Hees [Fri, 19 Oct 2012 08:37:53 +0000 (04:37 -0400)]
Internal performance measurement support code.

The dt_perf provider implements a few probes that are used in performance
(or more accurately put, overhead) measurements.  It uses an ioctl()
interface to trigger N-count interations of invoking probes through
various mechanisms, and a probe to post the results back to userspace.
This code also adds an SDT probe in the DTrace kernel support code, just
to measure overhead for triggering trap based SDT probes.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoMiscellaneous 3.6 porting work.
Kris Van Hees [Thu, 18 Oct 2012 15:53:56 +0000 (16:53 +0100)]
Miscellaneous 3.6 porting work.

Missing headers, catering for header movement, the occasional missing
prototype, and changes in the way the syscall table is built.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoDTrace-independent CTF.
Nick Alcock [Wed, 10 Oct 2012 18:37:49 +0000 (19:37 +0100)]
DTrace-independent CTF.

These largely cosmetic changes remove mention of DTrace from the CTF code,
making it clear that it is freely usable by non-DTrace consumers.

The changes are:

 - dtrace_ctf.ko is now named ctf.ko, and is stored in kernel/ctf rather than
   kernel/dtrace, controlled by a new CONFIG_CTF Kconfig option select'ed by
   CONFIG_DTRACE.  (CONFIG_DT_DISABLE_CTF, being largely a DTrace debugging
   option, remains under DTrace configure control).  The function used to
   trigger loading of ctf.ko has changed name similarly, from
   dtrace_ctf_forceload() to ctf_forceload().

 - The CTF section names have changed, from .dtrace_ctf.* to .ctf.* (which as a
   bonus is more obviously related to the .ctf directory long used to store the
   CTF data during the build process).

 - The shared CTF repository is now stored in .ctf.shared_ctf instead of
   .dtrace_ctf.dtrace_ctf, making its intended use somewhat clearer.

These changes depend on a suitably changed libdtrace-ctf: a suitably changed
userspace is needed to take advantage of them.  The dtrace-kernel-interface is
bumped accordingly.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoType and grammar fix.
Kris Van Hees [Wed, 19 Sep 2012 06:40:37 +0000 (02:40 -0400)]
Type and grammar fix.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoFix name of lwp-create and lwp-exit probes in SDT argument mappings.
Kris Van Hees [Tue, 18 Sep 2012 22:33:36 +0000 (18:33 -0400)]
Fix name of lwp-create and lwp-exit probes in SDT argument mappings.

The argument mapping for SDT probes incorrectly listed lwp_create instead of
lwp-create, and lwp_exit instead of lwp-exit.  Also, lwp-exit was listed to
have a single int argument whereas it is not supposed to have any arguments.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoAdd NEWS file.
Kris Van Hees [Tue, 18 Sep 2012 22:32:15 +0000 (18:32 -0400)]
Add NEWS file.

Added the NEWS file to the branch, and updated the spec file to ensure that
the NEWS file gets installed properly.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoSPEC: Rename the DTrace kernel to kernel-uek-dtrace-.
Nick Alcock [Thu, 13 Sep 2012 14:01:58 +0000 (15:01 +0100)]
SPEC: Rename the DTrace kernel to kernel-uek-dtrace-.

This means that automatic upgrades between DTrace and non-DTrace kernels are no
longer an issue.

(The kernel still provides all the same RPM capabilities as it used to, so no
other packages need change, excepting only the DTrace module, which explicitly
requires the matching DTrace kernel.)

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoFix depmod invocation on RPM %post-installation.
Nick Alcock [Wed, 12 Sep 2012 21:53:27 +0000 (22:53 +0100)]
Fix depmod invocation on RPM %post-installation.

The kernel module directory name includes the karch, so our depmod invocation
should as well.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoAdd a specfile.
Nick Alcock [Mon, 10 Sep 2012 19:38:52 +0000 (20:38 +0100)]
Add a specfile.

No changelog for this release yet.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
12 years agoAdditional action support (and bug fixes).
Kris Van Hees [Sun, 9 Sep 2012 21:34:48 +0000 (17:34 -0400)]
Additional action support (and bug fixes).

Removed ASSIST_* definitions because they are no longer necessary (though they
may come back in the future).

Changed the behaviour of DTrace in interrupt context to base it on in_irq()
rather than in_interrupt().

On Linux it is always safe to dereference current, so there is no need to do
special casing on various process-based DIF functions.  There is no need to
fake values coming from the 0-pid process.

Added curcpu variables.

Added d_path() function.  This takes a struct path and turns it into a string.

Renumbered the register IDs to match the xlator support at userspace, and to
also match the on-stack order of registers.

Have dtrace_getreg() operate on the task rather than just a set of registers,
because (in 64-bit mode) segment registers have their value stored in fields
in the process-specific task info.

Implemented the raise() action.

Changed the deadman interal to 10s, and timeout/user to 120s.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoChange the DTrace startup handling (at boot time) for SDT.
Kris Van Hees [Sun, 9 Sep 2012 21:18:42 +0000 (17:18 -0400)]
Change the DTrace startup handling (at boot time) for SDT.

The DTrace OS level handling was initialized at DTrace module load, which
caused major indigestion on the side of the scheduler when SDT probe points at
crucial locations in the scheduler were being patched by one CPU while another
was trying to get some real work done.  Even a nice stop_machine() based
approach turned out not to be possible, because that *cough* depends on the
scheduler also.

Instead, the DTrace OS support is initialized from the Linux boot sequence,
before SMP is enabled, which removes the complications altogether (and it is a
lot cleaner and faster).  We also call CPU-specific initialization for DTrace
during the boot sequence, albeit *after* the CPUs have been identified for SMP,
to ensure that we get accurate information.

Renamed sdt_register.c to be dtrace_sdt.c (for consistency).  And implemented
a better patching of SDT probe points.

Added a 'nosdt' kernel command line option to allow system wide diabling of
SDT probe points (at the kernel level).  This can be used when the patching of
SDT probe points somehow causes a problem.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoCleanup (and adding) of SDT probe points.
Kris Van Hees [Sun, 9 Sep 2012 20:56:15 +0000 (16:56 -0400)]
Cleanup (and adding) of SDT probe points.

Changed io SDT probe points to be located at the buffer_head level rather than
the bio level.  This may need to be revisted depending on further analysis,
but doing it this way provides consistent semantics that were not guaranteed by
the previous bio-based placement.

Changed the sched STD probes to not pass irrelevant arguments, and to pass
specific runqueue CPU information.  The CPU information is not available from
the task structure, so it needs to be passed explicily.

Added proc SDT probes start and lwp-start.

Added proc SDT probes for signal-discard and signal-clear.

Corrected the argument to the exit proc SDT probe, which should indicate the
reason for the process termination (exit, killed, core dumped) rather than the
return code of the process.

Provided argument information for all the new (and changed) SDT probe points.
This depends on working xlator support in userspace.

Enabling of SDT probes now uses a generic dtrace_invop_(enable|disable) rather
than SDT-specific functions.

SDT probes are not destroyed correctly, to ensure that subsequent uses will not
result in unpleasant events.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
12 years agoRemove remnant of internal, for-my-use-only test code.
Kris Van Hees [Mon, 6 Aug 2012 07:41:05 +0000 (03:41 -0400)]
Remove remnant of internal, for-my-use-only test code.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoDIF_SUBR_RW_READ_HELD's parameter should be an rwlock_t.
Nick Alcock [Fri, 20 Jul 2012 22:02:56 +0000 (23:02 +0100)]
DIF_SUBR_RW_READ_HELD's parameter should be an rwlock_t.

Even if Solaris gives DIF_SUBR_RW_READ_HELD and DIF_SUBR_RW_WRITE_HELD different
parameter types, that doesn't mean we have to copy its mistake.  An rwlock is an
rwlock whether you are testing for a read or a write hold.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
13 years agoForce dtrace_ctf.ko to be loaded whenever dtrace.ko is.
Nick Alcock [Fri, 20 Jul 2012 22:00:07 +0000 (23:00 +0100)]
Force dtrace_ctf.ko to be loaded whenever dtrace.ko is.

DTrace userspace makes the simplifying assumption that dtrace_ctf.ko (containing
the CTF for the kernel, for built-in modules, and for shared types, but no code)
is always loaded whenever DTrace is usable.  (The CTF itself is in a non-loaded
section, but having dtrace_ctf.ko in the list of loaded modules means that we
can eliminate an annoying set of dtrace_ctf-related special case.)

We do this by introducing a dummy function dtrace_ctf_forceload() into the
dtrace_ctf module, which DTrace then calls: depmod will then arrange for
dtrace_ctf to be loaded when we need it.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
13 years agoMissing file.
Kris Van Hees [Wed, 23 May 2012 07:53:19 +0000 (03:53 -0400)]
Missing file.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years ago- sched-tick SDT probe.
Kris Van Hees [Thu, 19 Apr 2012 21:19:40 +0000 (17:19 -0400)]
- sched-tick SDT probe.
- FBT probe point discovery and probe creation.
- Moving code around for the kernel pseudo-module handling since it gets used
  by both the SDT code and the FBT code.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoAdd argument description info for SDT probes.
Kris Van Hees [Thu, 5 Apr 2012 11:24:03 +0000 (07:24 -0400)]
Add argument description info for SDT probes.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoImplement refcount handling in DTrace modules to ensure that they cannot be
Kris Van Hees [Tue, 14 Feb 2012 21:22:33 +0000 (16:22 -0500)]
Implement refcount handling in DTrace modules to ensure that they cannot be
unloaded while probes are enabled.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoNew DTrace option DTRACEOPT_QUIETRESIZE, and accordingly-boosted DTRACEOPT_MAX.
Nick Alcock [Thu, 9 Feb 2012 18:32:25 +0000 (18:32 +0000)]
New DTrace option DTRACEOPT_QUIETRESIZE, and accordingly-boosted DTRACEOPT_MAX.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
13 years agoChanged from using mutex_is_locked() to a new mutex_owned(), in support of the
Kris Van Hees [Tue, 7 Feb 2012 09:31:48 +0000 (04:31 -0500)]
Changed from using mutex_is_locked() to a new mutex_owned(), in support of the
Solaris MUTEX_HELD() macro.  The former was merely testing whether the mutex was
locked, whereas the real test needed here is whether the mutex is held by the
current thread.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoMake all allocations that are allowed to fail atomic, and surpress warnings
Kris Van Hees [Tue, 31 Jan 2012 10:04:53 +0000 (05:04 -0500)]
Make all allocations that are allowed to fail atomic, and surpress warnings
about out-of-memory conditions, since they are not harmful.  Also, do not allow
DTrace allocations to access the emergency pools.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoFix signed division and modulo operations in DIF.
Kris Van Hees [Tue, 17 Jan 2012 20:03:17 +0000 (15:03 -0500)]
Fix signed division and modulo operations in DIF.
Ensure that SDT probe points are patched with a NOP sequence at boot time.
Remove debugging output during SDT registration.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoForgot to commit the changes to the header file.
Kris Van Hees [Thu, 12 Jan 2012 22:34:35 +0000 (17:34 -0500)]
Forgot to commit the changes to the header file.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoThe idr_empty() macro is no longer needed.
Kris Van Hees [Thu, 12 Jan 2012 21:39:42 +0000 (16:39 -0500)]
The idr_empty() macro is no longer needed.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoFix for incorrect handling of BUFSIZE = 0. The handling of aggregations was
Kris Van Hees [Thu, 12 Jan 2012 21:36:54 +0000 (16:36 -0500)]
Fix for incorrect handling of BUFSIZE = 0.  The handling of aggregations was
flawed in that even without any ECBs with aggregation, the code logic was
assuming there was at least one aggregation (the sentinel in the IDR).  The
handling of the aggregations IDR in the DTrace state has been updated to use
an explicit counter because the IDR functionality does not provide us with an
API function to determine the amount of elements in the IDR.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoInitial values for min and max aggregate functions were incorrectly set to be
Kris Van Hees [Thu, 12 Jan 2012 20:15:15 +0000 (15:15 -0500)]
Initial values for min and max aggregate functions were incorrectly set to be
UINT64 values rather than INT64 values, causing the initial minimum value to
be -1, and the initial maximum value to be 0.  Corrected to be INT64 values.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoEnsure that the trap handler is regisstered only once.
Kris Van Hees [Thu, 12 Jan 2012 14:25:35 +0000 (09:25 -0500)]
Ensure that the trap handler is regisstered only once.
Register with first use,

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoEnsure that the die notifier hook is installed whenever DTrace is enabled,
Kris Van Hees [Wed, 11 Jan 2012 06:18:41 +0000 (01:18 -0500)]
Ensure that the die notifier hook is installed whenever DTrace is enabled,
since page fault and general protection fault handling depends on it, and that
is needed for safe memory access support in DTrace.

Work around an apparent bug in Xen where an invalid opcode fault is delivered
as a general protection failure instead.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoSupport for page fault and general protection fault detection for DTrace, to
Kris Van Hees [Wed, 14 Dec 2011 05:09:14 +0000 (00:09 -0500)]
Support for page fault and general protection fault detection for DTrace, to
ensure that DTrace memory access faults are non-fatal.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoSDT implementation (core kernel support for providing a list of static probe
Kris Van Hees [Mon, 5 Dec 2011 20:01:27 +0000 (15:01 -0500)]
SDT implementation (core kernel support for providing a list of static probe
points for the kernel pseudo-module, dtrace SDT meta-provider support, ...).
Also, new script (dtrace_sdt.sh) to extract locations of SDT probe points in
the core kernel.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoEnable processing the SDT probe point info at boot time (before SMP is actually
Kris Van Hees [Mon, 14 Nov 2011 15:17:45 +0000 (10:17 -0500)]
Enable processing the SDT probe point info at boot time (before SMP is actually
enabled), if DTrace SDT support has been enabled (built-in or as module).  For
now, provide some verbose info on the probe points getting resolved.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoFix resolving addresses of relocation records for SDT probe points. The
Kris Van Hees [Fri, 11 Nov 2011 07:34:04 +0000 (02:34 -0500)]
Fix resolving addresses of relocation records for SDT probe points.  The
addresses were being calculated based on the wrong starting point (_stext
whereas it ought to be _text), and the base was not taken into account.
Fixed the writing of NOPs in the location of the probe point calls, since
the existing case was causing kernel paging faults.  Made the add_nops()
function in alternative.c non-static so it can be used in sdt_register.
Use add_nops() to select the most appropriate NOP sequence for replacing the
probe point call, and write the NOPs using text_poke().

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoFixed the allocation of cyclics that was the cuase for some obscure crashes
Kris Van Hees [Thu, 3 Nov 2011 17:59:00 +0000 (13:59 -0400)]
Fixed the allocation of cyclics that was the cuase for some obscure crashes
during the testsuite execution.  Problem was that cyclics were being allocated
in chunks, with a new array being allocated as (prev-size + chink-size), and
then the old entries being copied over.  However, because the hrtimer struct is
embedded in the cyclic struct, this meant that hrtimer structs were being moved
outside the hrtimer code.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoHandle the case where regs (during cyclic processing) is NULL. This indicates
Kris Van Hees [Thu, 27 Oct 2011 17:15:26 +0000 (13:15 -0400)]
Handle the case where regs (during cyclic processing) is NULL.  This indicates
a bug but with this code change we'll survive that case and simply not have
meaningful PC and UPC values as argument to the probe, which is better than a
full scale OOPS due to NULL pointer dereference.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoRemoved dead code (was #if 0 ... #endif). Cleaned up ;; -> ;.
Kris Van Hees [Thu, 27 Oct 2011 15:18:38 +0000 (11:18 -0400)]
Removed dead code (was #if 0 ... #endif).  Cleaned up ;; -> ;.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoImplementation for tracing stub-based system calls. Due to the need for
Kris Van Hees [Thu, 27 Oct 2011 14:39:19 +0000 (10:39 -0400)]
Implementation for tracing stub-based system calls.  Due to the need for
specialized code handling (mainly passing in a pt_regs structure as one of
the arguments), some syscalls are called through a stub in assembly code.
We duplicate the stub cdode in dtrace_stubs_x86_64.S, but instead of calling
the actual syscall implementation code call our own syscall-specific handler,
which ensures that entry and return probes are called as enabled, and then
call the underlying implementation directly for handling the syscall.

Also removed debugging output that is no longer relevant (code cleanup).

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoStacktrace dumping has been moved to the GPL-licensed dtrace_os.c because it
Kris Van Hees [Fri, 14 Oct 2011 02:42:27 +0000 (22:42 -0400)]
Stacktrace dumping has been moved to the GPL-licensed dtrace_os.c because it
depends on a symbol that is exported as GPL-only.  Functionality in dtrace_isa
that requires stacktrace dumping can now use dtrace_stacktrace().

The GPL-licensed dtrace_os.h C header file is now made available through the
/include/linux hierarchy, and it is included in dtrace.h.

Fixed a bug in dtrace_relocs.c where section names where copied into a memory
area that was 1 byte short, causing various unpleasant forms of behaviour.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoFix porting issues from 2.6.32 to 2.6.39.
Kris Van Hees [Thu, 13 Oct 2011 16:45:48 +0000 (12:45 -0400)]
Fix porting issues from 2.6.32 to 2.6.39.
Disable stub_* based syscalls (for now).

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
13 years agoMove cyclic.h into include/linux.
Nick Alcock [Tue, 4 Oct 2011 11:58:17 +0000 (12:58 +0100)]
Move cyclic.h into include/linux.

This is so that things in dtrace/ can pick it up.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>