Cross-Instrumentation cross-compiling script from here: http://sources.redhat.com/ml/systemtap/2008-q3/msg00310.html above; add short description, significance, howto, script (test first) When users run a SystemTap script, SystemTap builds a kernel module out of that script. SystemTap then loads the module onto the kernel, allowing it to extract the specified data directly from the kernel (refer to in for more information). Normally, however, SystemTap scripts can only be run on systems where SystemTap is deployed (as in ). This could mean that if you want to run SystemTap on ten systems, you'd need to deploy SystemTap on all those systems. In some cases, this may be neither feasible nor desired. For instance, running SystemTap on 25 systems — all of which are using a different kernel — may require fully deploying SystemTap on all 25 machines. This task may even increase in complexity if some (or all) systems are remote from the administrator. Sometimes, corporate policy may prohibit an administrator from installing a debug version of an RPM on specific machines, which will prevent the deployment of SystemTap altogether. To work around this, you can resort to cross-instrumentation. Cross-instrumentation is the process of compiling a kernel module (out of a SystemTap script) to be used on a different machine. This process offers the following benefits: The debug RPMs for all target machines can be installed into one system: the host machine. Each target machine only needs one RPM to load and use the compiled kernel module: systemtap-runtime. You do not need to restart any of the target machines. Note For the sake of simplicity, we will be using the following terms throughout this section: instrumentation module — the kernel module built from a SystemTap script; i.e. the SystemTap module is built on the host system, and will be loaded on the target kernel of target system. host system — the system on which you compile the kernel modules (from SystemTap scripts), to be loaded on target systems. target system — the system for which you are building the instrumentation module (from SystemTap scripts). target kernel — the kernel of the target system. This is the kernel on which you wish to load/run the instrumentation module. Configuring a Host System and Target Systems Configure yum on the host system to point to a repository containing the necessary debug RPMs for the target kernels. The following yum repository file (which you can add to /etc/yum.repos.d/ points to a popular debug RPM repository for i386 systems running Red Hat Enterprise Linux 5: [rhel-debuginfo] name=Red Hat Enterprise Linux $releasever - $basearch - Debug baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Client/en/os/i386/Debuginfo/ enabled=1 Deploy SystemTap on the host system. It is from this machine that you will be building the instrumentation module (to be used on target systems). For instructions on how to deploy SystemTap, refer to . Install the target kernel on the host system. If multiple target systems use different target kernel, you will need to install each target kernel. Install the corresponding debug RPMs for the target kernel of each target system on the host system. Install yum-utils on the host system. Install systemtap-runtime on each target system. After performing , you can now build the instrumentation module (for any target system) on the host system. To build the instrumentation module, run the following command on the host system (be sure to specify the appropriate values): stap -r kernel version script -m module name Here, kernel version refers to the version of target kernel (including the architecture notation), script refers to the script to be converted into an instrumentation module, and instrumentation name is the desired name of the instrumentation module. Note To determine the architecture notation of a running kernel, run uname -m. Once the the instrumentation module is compiled, copy it to the target system and load it using: staprun instrumentation For example, to create the instrumentation module module.ko from the SystemTap script script.stp for the target kernel 2.6.25.9-76.fc9 (on i686 architecture), use the following command: stap -r 2.6.25.9-76.fc9.x86_64 script.stp -m module This will create a module named module.ko. To use the instrumentation module module.ko, copy it to the target system and run the following command (on the target system): staprun module.ko Important The host system must be the same architecture as the target system in order for the instrumentation module to work.