From 1e48c794c83cb5d5e4dfbbe5a494e4b86abd2357 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 22 Sep 2008 16:47:03 +1000 Subject: added cross-instrumentation, deploying systemtap --- .../en-US/CrossInstrumenting.xml | 147 +++++++++++++++++++++ .../en-US/Tips_Tricks.xml | 3 + .../en-US/Understanding_How_SystemTap_Works.xml | 2 +- .../en-US/Using_SystemTap.xml | 93 ++++++++++++- 4 files changed, 237 insertions(+), 8 deletions(-) create mode 100644 doc/SystemTap_Beginners_Guide/en-US/CrossInstrumenting.xml (limited to 'doc/SystemTap_Beginners_Guide') diff --git a/doc/SystemTap_Beginners_Guide/en-US/CrossInstrumenting.xml b/doc/SystemTap_Beginners_Guide/en-US/CrossInstrumenting.xml new file mode 100644 index 00000000..cf57f5b2 --- /dev/null +++ b/doc/SystemTap_Beginners_Guide/en-US/CrossInstrumenting.xml @@ -0,0 +1,147 @@ + + + +
+ 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 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 version of a running kernel, run uname -r. To determine the architecture notation of a running kernel, run uname -m. + + +Once the the instrumentation moduleis 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 + + + + +
\ No newline at end of file diff --git a/doc/SystemTap_Beginners_Guide/en-US/Tips_Tricks.xml b/doc/SystemTap_Beginners_Guide/en-US/Tips_Tricks.xml index 662d5b3d..0377c499 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Tips_Tricks.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Tips_Tricks.xml @@ -7,5 +7,8 @@ This chapter covers miscellaneous tips/tricks This is a tentative section, and will only be included if content can be provided + + + diff --git a/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml b/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml index 116e7453..c3fc0d9d 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Understanding_How_SystemTap_Works.xml @@ -30,7 +30,7 @@ A SystemTap session begins when you run a SystemTap script. This session occurs in the following fashion: - + SystemTap Session SystemTap first translates the script to C, running the system C compiler to create a kernel module from it. diff --git a/doc/SystemTap_Beginners_Guide/en-US/Using_SystemTap.xml b/doc/SystemTap_Beginners_Guide/en-US/Using_SystemTap.xml index dfb345c8..da6d4d4c 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Using_SystemTap.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Using_SystemTap.xml @@ -7,6 +7,11 @@ short intro, contents of chapter + + + This chapter instructs users how to install SystemTap, and provides an introduction on how to run SystemTap scripts. + +
Setup and Installation @@ -16,16 +21,90 @@ notes in ~/Desktop/SystemTap/aug21chatlog and ~/Desktop/SystemTap/noted_wcohenmeeting + + + To deploy SystemTap, you need to install the SystemTap packages along with the corresponding set of debug RPMs of your kernel. This means that if your system has multiple kernels installed, and you wish to use SystemTap on more than one kernel, you will need to install the debug RPMs for each of those kernels. + - Cross-Compiling - TBD - -cross-compiling script from here: http://sources.redhat.com/ml/systemtap/2008-q3/msg00310.html - -above; add short description, significance, howto, script (test first) + Preparing For Installation + + To view what kernels and kernel versions are installed on your system, check the contents of /boot. Each installed kernel/kernel version has a corresponding vmlinuz-[kernel version] there. + + + + To determine what kernel your system is currently using, use: + -
+ +uname -r + + + + You will also need to configure yum to point to a repository that houses the necessary debug RPMs. One such repository is: + + + + + find any other such repository, if only for RHEL + + + + Deploying SystemTap + + + Once you've decided which kernels you need to use SystemTap with, install the following packages: + + + systemtap + systemtap-runtime + + This will install the SystemTap suite of tools. + + + + Next, you'll need to download and install the necessary debug RPMs for your kernel. Most debugging RPMs for Red Hat Enterprise Linux 5 can be found at the following link: + + The necessary debugging RPMs are as follows: + + + kernel-debuginfo + kernel-debuginfo-common + kernel-devel + + +For example, if you wish to use SystemTap on kernel version 2.6.18-53.el5, then you need to download the following debugging RPMs: + + + Sample List of Debugging RPMs + + kernel-debuginfo-2.6.18-53.1.13.el5.i686.rpm + kernel-debuginfo-common-2.6.18-53.1.13.el5.i686.rpm + kernel-devel-2.6.18-53.1.13.el5.i686.rpm + + + + + + Install the debugging RPMs using rpm -ivh [RPM] or yum localinstall [RPM]. + + + + + Restart the system, loading the appropriate kernel at the grub screen. + + + + + + + +
Usage -- cgit