]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.trace/lttng-instrumentation-timer.patch
Updated xen patches taken from suse.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.trace / lttng-instrumentation-timer.patch
1 From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
2 Subject: LTTng instrumentation - timer
3
4 Original patch header:
5 LTTng instrumentation - timer
6
7 Instrument timer activity (timer set, expired, current time updates) to keep
8 information about the "real time" flow within the kernel. It can be used by a
9 trace analysis tool to synchronize information coming from various sources, e.g.
10 to merge traces with system logs.
11
12 Those tracepoints are used by LTTng.
13
14 About the performance impact of tracepoints (which is comparable to markers),
15 even without immediate values optimizations, tests done by Hideo Aoki on ia64
16 show no regression. His test case was using hackbench on a kernel where
17 scheduler instrumentation (about 5 events in code scheduler code) was added.
18 See the "Tracepoints" patch header for performance result detail.
19
20 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
21 CC: 'Ingo Molnar' <mingo@elte.hu>
22 CC: "David S. Miller" <davem@davemloft.net>
23 CC: Masami Hiramatsu <mhiramat@redhat.com>
24 CC: 'Peter Zijlstra' <peterz@infradead.org>
25 CC: "Frank Ch. Eigler" <fche@redhat.com>
26 CC: 'Hideo AOKI' <haoki@redhat.com>
27 CC: Takashi Nishiie <t-nishiie@np.css.fujitsu.com>
28 CC: 'Steven Rostedt' <rostedt@goodmis.org>
29 CC: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
30
31 Acked-by: Jan Blunck <jblunck@suse.de>
32 ---
33 ---
34 include/trace/timer.h | 24 ++++++++++++++++++++++++
35 kernel/itimer.c | 5 +++++
36 kernel/timer.c | 8 +++++++-
37 3 files changed, 36 insertions(+), 1 deletion(-)
38
39 --- /dev/null
40 +++ b/include/trace/timer.h
41 @@ -0,0 +1,24 @@
42 +#ifndef _TRACE_TIMER_H
43 +#define _TRACE_TIMER_H
44 +
45 +#include <linux/tracepoint.h>
46 +
47 +DEFINE_TRACE(timer_itimer_expired,
48 + TPPROTO(struct signal_struct *sig),
49 + TPARGS(sig));
50 +DEFINE_TRACE(timer_itimer_set,
51 + TPPROTO(int which, struct itimerval *value),
52 + TPARGS(which, value));
53 +DEFINE_TRACE(timer_set,
54 + TPPROTO(struct timer_list *timer),
55 + TPARGS(timer));
56 +/*
57 + * xtime_lock is taken when kernel_timer_update_time tracepoint is reached.
58 + */
59 +DEFINE_TRACE(timer_update_time,
60 + TPPROTO(struct timespec *_xtime, struct timespec *_wall_to_monotonic),
61 + TPARGS(_xtime, _wall_to_monotonic));
62 +DEFINE_TRACE(timer_timeout,
63 + TPPROTO(struct task_struct *p),
64 + TPARGS(p));
65 +#endif
66 --- a/kernel/itimer.c
67 +++ b/kernel/itimer.c
68 @@ -12,6 +12,7 @@
69 #include <linux/time.h>
70 #include <linux/posix-timers.h>
71 #include <linux/hrtimer.h>
72 +#include <trace/timer.h>
73
74 #include <asm/uaccess.h>
75
76 @@ -132,6 +133,8 @@ enum hrtimer_restart it_real_fn(struct h
77 struct signal_struct *sig =
78 container_of(timer, struct signal_struct, real_timer);
79
80 + trace_timer_itimer_expired(sig);
81 +
82 kill_pid_info(SIGALRM, SEND_SIG_PRIV, sig->leader_pid);
83
84 return HRTIMER_NORESTART;
85 @@ -157,6 +160,8 @@ int do_setitimer(int which, struct itime
86 !timeval_valid(&value->it_interval))
87 return -EINVAL;
88
89 + trace_timer_itimer_set(which, value);
90 +
91 switch (which) {
92 case ITIMER_REAL:
93 again:
94 --- a/kernel/timer.c
95 +++ b/kernel/timer.c
96 @@ -37,12 +37,14 @@
97 #include <linux/delay.h>
98 #include <linux/tick.h>
99 #include <linux/kallsyms.h>
100 +#include <trace/timer.h>
101
102 #include <asm/uaccess.h>
103 #include <asm/unistd.h>
104 #include <asm/div64.h>
105 #include <asm/timex.h>
106 #include <asm/io.h>
107 +#include <asm/irq_regs.h>
108
109 u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
110
111 @@ -357,6 +359,7 @@ static void internal_add_timer(struct tv
112 i = (expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK;
113 vec = base->tv5.vec + i;
114 }
115 + trace_timer_set(timer);
116 /*
117 * Timers are FIFO:
118 */
119 @@ -1135,6 +1138,7 @@ void do_timer(unsigned long ticks)
120 {
121 jiffies_64 += ticks;
122 update_times(ticks);
123 + trace_timer_update_time(&xtime, &wall_to_monotonic);
124 }
125
126 #ifdef __ARCH_WANT_SYS_ALARM
127 @@ -1216,7 +1220,9 @@ SYSCALL_DEFINE0(getegid)
128
129 static void process_timeout(unsigned long __data)
130 {
131 - wake_up_process((struct task_struct *)__data);
132 + struct task_struct *task = (struct task_struct *)__data;
133 + trace_timer_timeout(task);
134 + wake_up_process(task);
135 }
136
137 /**