This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH 1/3] systemtap: kernel marker tapset
- From: Masami Hiramatsu <mhiramat at redhat dot com>
- To: systemtap-ml <systemtap at sources dot redhat dot com>
- Cc: ltt-dev at lists dot casi dot polymtl dot ca, Hideo AOKI <haoki at redhat dot com>, Takahiro Yasui <tyasui at redhat dot com>
- Date: Fri, 12 Sep 2008 18:20:20 -0400
- Subject: [PATCH 1/3] systemtap: kernel marker tapset
Hi,
Here is a patch which adds a tapset for kernel markers.
this tapset supports lttng's kernel marker(+my cpuid patch) too.
Thank you,
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com
---
tapset/marker.stp | 378 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 378 insertions(+)
Index: systemtap/tapset/marker.stp
===================================================================
--- systemtap.orig/tapset/marker.stp 2008-09-12 13:21:49.000000000 -0400
+++ systemtap/tapset/marker.stp 2008-09-12 13:36:03.000000000 -0400
@@ -20,3 +20,381 @@
(CONTEXT->marker_format)?CONTEXT->marker_format:"",
MAXSTRINGLEN); /* pure */
%}
+
+/*-------------------------------------------*
+ * marker.irq.* - IRQ related markers
+ *-------------------------------------------*/
+
+/*
+ * probe marker.irq.hardirq.entry
+ *
+ * Fires just before handing a hard interrupt.
+ *
+ * Context:
+ * A hard interrupt occurs.
+ *
+ * Arguments:
+ * irq_id - the id of hard irq.
+ * kernel_mode - boolean indicating whether the interrupt occurred
+ * in kernel mode.
+ */
+probe marker.irq.hardirq.entry
+ = kernel.mark("kernel_irq_entry").format("irq_id %u kernel_mode %u ip %lu")!,
+ kernel.mark("kernel_irq_entry").format("irq_id %u kernel_mode %u")
+{
+ irq_id = $arg1
+ kernel_mode = $arg2
+}
+
+/*
+ * probe marker.irq.hardirq.exit
+ *
+ * Fires after handling a hard interrupt.
+ *
+ * Context:
+ * A hard interrupt was handled.
+ *
+ * Arguments:
+ * irq_id - the id of hard irq (if possible).
+ * retval - return value of handle_IRQ_event().
+ */
+probe __marker.irq.hardirq.exit1
+ = kernel.mark("kernel_irq_exit").format("irq_id %u retval %ld")!,
+ kernel.mark("kernel_irq_exit").format("irq_id %u handled #1u%u")
+{
+ irq_id = $arg1
+ retval = $arg2
+}
+
+# we need per-cpu stack variables
+global __marker_irq_stack, __marker_irq_idx;
+function __marker_irq_push(id:long)
+{
+ idx = __marker_irq_idx[cpu()]++;
+ __marker_irq_stack[cpu()][idx]=id;
+}
+function __marker_irq_pop:long()
+{
+ idx = --__marker_irq_idx[cpu()];
+ return __marker_irq_stack[cpu()][idx];
+}
+
+probe __marker.irq.hardirq.enter_helper
+ = kernel.mark("kernel_irq_entry").format("irq_id %u kernel_mode %u ip %lu")
+{
+ __marker_irq_push($arg1)
+}
+
+probe __marker.irq.hardirq.exit2
+ = kernel.mark("kernel_irq_exit").format("handled #1u%u"),
+ __marker.irq.hardirq.enter_helper
+{
+ irq_id = __marker_irq_pop();
+ retval = $arg1
+}
+
+probe marker.irq.hardirq.exit
+ = __marker.irq.hardirq.exit1 !,
+ __marker.irq.hardirq.exit2
+{}
+
+/*
+ * probe marker.irq.softirq.enter
+ *
+ * Fires before calling softirq handler.
+ *
+ * Context:
+ * Softirq handler will be invoked.
+ *
+ * Arguments:
+ * softirq_id - the id of softirq.
+ * func - the pointer of softirq handler (if possible).
+ *
+ * Note:
+ * On specific architecture(ex. ia64) the "func" is not the address of
+ * the actuall function. You might need to derefer *func for getting
+ * actuall address.
+ */
+probe __marker.irq.softirq.entry1
+ = kernel.mark("kernel_softirq_entry").format("softirq_id %lu")
+{
+ softirq_id = $arg1
+ func = 0
+}
+probe __marker.irq.softirq.entry2
+ = kernel.mark("kernel_softirq_entry").format("softirq_id %lu func %p")
+{
+ softirq_id = $arg1
+ func = $arg2
+}
+
+probe marker.irq.softirq.entry
+ = __marker.irq.softirq.entry1 !, __marker.irq.softirq.entry2
+{}
+
+/*
+ * probe marker.irq.softirq.exit
+ *
+ * Fires after calling softirq handler.
+ *
+ * Context:
+ * Softirq handler was handled.
+ *
+ * Arguments:
+ * softirq_id - the id of softirq.
+ */
+probe marker.irq.softirq.exit
+ = kernel.mark("kernel_softirq_exit")
+{
+ softirq_id = $arg1
+}
+
+/*
+ * probe marker.irq.tasklet_low.enter
+ *
+ * Fires before calling tasklet_low handler.
+ *
+ * Context:
+ * Tasklet(low) handler will be invoked.
+ *
+ * Arguments:
+ * func - the pointer of tasklet_low handler.
+ * data - the data passed to the handler.
+ *
+ * Note:
+ * On specific architecture(ex. ia64) the "func" is not the address of
+ * the actuall function. You might need to derefer *func for getting
+ * actuall address.
+ */
+probe marker.irq.tasklet_low.entry
+ = kernel.mark("kernel_tasklet_low_entry")
+{
+ func = $arg1
+ data = $arg2
+}
+
+/*
+ * probe marker.irq.tasklet_low.exit
+ *
+ * Fires after calling tasklet_low handler.
+ *
+ * Context:
+ * Tasklet(low) handler was handled.
+ *
+ * Arguments:
+ * func - the pointer of tasklet_low handler.
+ * data - the data passed to the handler.
+ *
+ * Note:
+ * On specific architecture(ex. ia64) the "func" is not the address of
+ * the actuall function. You might need to derefer *func for getting
+ * actuall address.
+ */
+probe marker.irq.tasklet_low.exit
+ = kernel.mark("kernel_tasklet_low_exit")
+{
+ func = $arg1
+ data = $arg2
+}
+
+/*
+ * probe marker.irq.tasklet_high.enter
+ *
+ * Fires before calling tasklet_high handler.
+ *
+ * Context:
+ * Tasklet(high) handler will be invoked.
+ *
+ * Arguments:
+ * func - the pointer of tasklet_high handler.
+ * data - the data passed to the handler.
+ *
+ * Note:
+ * On specific architecture(ex. ia64) the "func" is not the address of
+ * the actuall function. You might need to derefer *func for getting
+ * actuall address.
+ */
+probe marker.irq.tasklet_high.entry
+ = kernel.mark("kernel_tasklet_high_entry")
+{
+ func = $arg1
+ data = $arg2
+}
+
+/*
+ * probe marker.irq.tasklet_high.exit
+ *
+ * Fires after calling tasklet_high handler.
+ *
+ * Context:
+ * Tasklet(high) handler was handled.
+ *
+ * Arguments:
+ * func - the pointer of tasklet_high handler.
+ * data - the data passed to the handler.
+ *
+ * Note:
+ * On specific architecture(ex. ia64) the "func" is not the address of
+ * the actuall function. You might need to derefer *func for getting
+ * actuall address.
+ */
+probe marker.irq.tasklet_high.exit
+ = kernel.mark("kernel_tasklet_high_exit")
+{
+ func = $arg1
+ data = $arg2
+}
+
+
+/*-------------------------------------------*
+ * marker.process.* - Process related markers
+ *-------------------------------------------*/
+
+/*
+ * probe marker.process.free
+ *
+ * Fires when task_struct will be released.
+ *
+ * Context:
+ * A process is released.
+ *
+ * Arguments:
+ * pid - released process pid.
+ */
+probe marker.process.free
+ = kernel.mark("kernel_process_free")
+{
+ pid = $arg1
+}
+
+/*
+ * probe marker.process.wait
+ *
+ * Fires when do_wait() is called.
+ *
+ * Context:
+ * Current process waits another process.
+ *
+ * Arguments:
+ * pid - waiting target pid.
+ */
+probe marker.process.wait
+ = kernel.mark("kernel_process_wait")
+{
+ pid = $arg1
+}
+
+/*
+ * probe marker.process.exit
+ *
+ * Fires when do_exit() is called.
+ *
+ * Context:
+ * A process exits.
+ *
+ * Arguments:
+ * pid - exit process pid.
+ */
+probe marker.process.exit
+ = kernel.mark("kernel_process_exit")
+{
+ pid = $arg1
+}
+
+/*
+ * probe marker.process.fork
+ *
+ * Fires when a process forked/cloned.
+ *
+ * Context:
+ * A process forked/cloned.
+ *
+ * Arguments:
+ * pid - parent pid.
+ * parent_pid - same as above "pid".
+ * child_pid - forked child pid.
+ * child_tgid - forked child thread group id.
+ */
+probe marker.process.fork
+ = kernel.mark("kernel_process_fork")
+{
+ pid = $arg1
+ parent_pid = $arg1
+ child_pid = $arg2
+ child_tgid = $arg3
+}
+
+
+/*-----------------------------------------------*
+ * marker.scheduler.* - scheduler related markers
+ *-----------------------------------------------*/
+
+probe __marker.scheduler.wakeup
+ = kernel.mark("kernel_sched_wakeup")!,
+ kernel.mark("kernel_sched_try_wakeup")
+{
+}
+probe __marker.scheduler.wakeup_new
+ = kernel.mark("kernel_sched_wakeup_new")!,
+ kernel.mark("kernel_sched_wakeup_new_task")
+{
+}
+
+/*
+ * probe marker.scheduler.wakeup
+ *
+ * Fires a process wakeup.
+ *
+ * Context:
+ * A process wakeup.
+ *
+ * Arguments:
+ * pid - wakeup process pid.
+ * state - process task state.
+ * cpu_id - the id of cpu where the process wakeup.
+ */
+probe marker.scheduler.wakeup
+ = __marker.scheduler.wakeup,
+ __marker.scheduler.wakeup_new
+{
+ pid = $arg1
+ state = $arg2
+ cpu_id = $arg3
+}
+
+/*
+ * probe marker.scheduler.switch
+ *
+ * Fires scheduler switches tasks.
+ *
+ * Context:
+ * A process is switching to another process.
+ *
+ * Arguments:
+ * prev_pid - the pid of the process from which next task is switched.
+ * next_pid - the pid of the process to which previous task switches.
+ * prev_state - task state of previous process
+ * prev_prio - task priority of previous process (if possible)
+ * next_prio - task priority of next process (if possible)
+ */
+probe __marker.scheduler.switch
+ = kernel.mark("kernel_sched_switch")
+{
+ prev_prio = $arg4
+ next_prio = $arg5
+}
+probe __marker.scheduler.schedule
+ = kernel.mark("kernel_sched_schedule").format("prev_pid %d next_pid %d prev_state %ld")
+{
+ prev_prio = 0;
+ next_prio = 0;
+}
+
+probe marker.scheduler.switch
+ = __marker.scheduler.switch !,
+ __marker.scheduler.schedule
+{
+ prev_pid = $arg1
+ next_pid = $arg2
+ prev_state = $arg3
+}