summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/probes/tasklet/Makefile20
-rw-r--r--runtime/probes/tasklet/README5
-rwxr-xr-xruntime/probes/tasklet/build16
-rw-r--r--runtime/probes/tasklet/stp_tasklet.c71
4 files changed, 43 insertions, 69 deletions
diff --git a/runtime/probes/tasklet/Makefile b/runtime/probes/tasklet/Makefile
index dde45d2c..ceb8d4a9 100644
--- a/runtime/probes/tasklet/Makefile
+++ b/runtime/probes/tasklet/Makefile
@@ -1,11 +1,23 @@
# Makefile
-#
-#
-# make -C path/to/kernel/src M=`pwd` modules STP_RUNTIME=path_to_systemtap_rt
-CFLAGS += -I $(STP_RUNTIME) -I $(STP_RUNTIME)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME)\
+PWD := $(shell pwd)
+KVERSION := $(shell uname -r)
+KDIR := /lib/modules/$(KVERSION)/build include
+
+KALLSYMS_LOOKUP_NAME := $(firstword $(shell grep " kallsyms_lookup_name" /boot/System.map-$(KVERSION)))
+KALLSYMS_LOOKUP := $(firstword $(shell grep " kallsyms_lookup$$" /boot/System.map-$(KVERSION)))
+KTA := $(firstword $(shell grep "__kernel_text_address" /boot/System.map-$(KVERSION)))
+
+CFLAGS += -I $(STP_RUNTIME) -I $(STP_RUNTIME)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME) \
-D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP)
+
obj-m := stp_tasklet.o
+default:
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules \
+ KALLSYMS_LOOKUP_NAME=0x$(KALLSYMS_LOOKUP_NAME) \
+ KALLSYMS_LOOKUP=0x$(KALLSYMS_LOOKUP) KTA=0x$(KTA)\
+ STP_RUNTIME=$(PWD)/../..
+
clean:
/bin/rm -rf *.o *.ko *~ *.mod.c .*.cmd .tmp_versions
diff --git a/runtime/probes/tasklet/README b/runtime/probes/tasklet/README
index 0ecdb7c7..8507ad9b 100644
--- a/runtime/probes/tasklet/README
+++ b/runtime/probes/tasklet/README
@@ -2,9 +2,8 @@
Sample probe in a tasklet. Useful for interrupt context testing.
\verbatim
-> ./build
-> insmod stp_tasklet.ko
-> rmmod stp_tasklet.ko
+> make
+> ./stp stp_tasklet.ko
\endverbatim
*/
diff --git a/runtime/probes/tasklet/build b/runtime/probes/tasklet/build
deleted file mode 100755
index 3713f08a..00000000
--- a/runtime/probes/tasklet/build
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-KVERSION=`uname -r`
-echo $KVERSION
-KALLSYMS_LOOKUP_NAME=`grep " kallsyms_lookup_name" /boot/System.map-$KVERSION |awk '{print $1}'`
-KALLSYMS_LOOKUP=`grep " kallsyms_lookup$" /boot/System.map-$KVERSION |awk '{print $1}'`
-
-make V=1 -C /lib/modules/`uname -r`/build M=`pwd` modules \
- KALLSYMS_LOOKUP_NAME=0x$KALLSYMS_LOOKUP_NAME \
- KALLSYMS_LOOKUP=0x$KALLSYMS_LOOKUP \
- STP_RUNTIME=`pwd`/../..
-
-
-
-
-
diff --git a/runtime/probes/tasklet/stp_tasklet.c b/runtime/probes/tasklet/stp_tasklet.c
index c3581eb2..68569fb5 100644
--- a/runtime/probes/tasklet/stp_tasklet.c
+++ b/runtime/probes/tasklet/stp_tasklet.c
@@ -2,23 +2,21 @@
/* Useful for testing probes in interrupt context. */
/* Doesn't do anything useful as is. Put test code in the inst func */
-#define HASH_TABLE_BITS 8
-#define HASH_TABLE_SIZE (1<<HASH_TABLE_BITS)
-#define BUCKETS 16 /* largest histogram width */
-
#define STP_NETLINK_ONLY
#define STP_NUM_STRINGS 1
-
#include "runtime.h"
#include "probes.c"
+
MODULE_DESCRIPTION("test jprobes of tasklets");
MODULE_AUTHOR("Martin Hunt <hunt@redhat.com>");
void inst__rcu_process_callbacks(struct rcu_ctrlblk *rcp,
struct rcu_state *rsp, struct rcu_data *rdp)
-{
- _stp_log ("interrupt=%d\n", in_interrupt());
+{
+ _stp_printf ("count=%d irqs_disabled=%d in_interrupt=%d in_irq=%d",
+ preempt_count(), irqs_disabled(), in_interrupt(), in_irq());
+ _stp_print_flush();
jprobe_return();
}
@@ -30,57 +28,38 @@ static struct jprobe stp_probes[] = {
};
#define MAX_STP_PROBES (sizeof(stp_probes)/sizeof(struct jprobe))
-static unsigned n_subbufs = 4;
-module_param(n_subbufs, uint, 0);
-MODULE_PARM_DESC(n_subbufs, "number of sub-buffers per per-cpu buffer");
-
-static unsigned subbuf_size = 65536;
-module_param(subbuf_size, uint, 0);
-MODULE_PARM_DESC(subbuf_size, "size of each per-cpu sub-buffers");
-
static int pid;
module_param(pid, int, 0);
MODULE_PARM_DESC(pid, "daemon pid");
-static int init_stp(void)
+int init_module(void)
{
- int ret;
-
- if (!pid) {
- printk("init_dtr: Can't start without daemon pid\n");
- return -1;
- }
-
- if (_stp_transport_open(n_subbufs, subbuf_size, pid) < 0) {
- printk("init_dtr: Couldn't open transport\n");
- return -1;
- }
-
- ret = _stp_register_jprobes (stp_probes, MAX_STP_PROBES);
- printk("instrumentation is enabled...\n");
- return ret;
+ int ret;
+
+ if (!pid)
+ {
+ printk("init_dtr: Can't start without daemon pid\n");
+ return -1;
+ }
+
+ if (_stp_transport_open(n_subbufs, subbuf_size, pid) < 0) {
+ printk("init_dtr: Couldn't open transport\n");
+ return -1;
+ }
+
+ ret = _stp_register_jprobes (stp_probes, MAX_STP_PROBES);
+ return ret;
}
-static int exited; /* FIXME: this is a stopgap - if we don't do this
- * and are manually removed, bad things happen */
-
static void probe_exit (void)
{
- exited = 1;
-
- _stp_unregister_jprobes (stp_probes, MAX_STP_PROBES);
- _stp_log ("EXIT\n");
-
+ _stp_unregister_jprobes (stp_probes, MAX_STP_PROBES);
}
-static void cleanup_stp(void)
+
+void cleanup_module(void)
{
- if (!exited)
- probe_exit();
-
- _stp_transport_close();
+ _stp_transport_close();
}
-module_init(init_stp);
-module_exit(cleanup_stp);
MODULE_LICENSE("GPL");