aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_stack.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-12-12 05:53:43 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-12 05:53:43 -0500
commite18d7af85296cb6999aae171e8a9f8612bea5ae0 (patch)
tree97a675ecc17bef2f710c50f5ea2a480df0e362c0 /kernel/trace/trace_stack.c
parent3555105333ae55414d0fe051557bd7dc590f5255 (diff)
parent8b1fae4e4200388b64dd88065639413cb3f1051c (diff)
Merge commit 'v2.6.28-rc8' into x86/mm
Diffstat (limited to 'kernel/trace/trace_stack.c')
-rw-r--r--kernel/trace/trace_stack.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 74c5d9a3afae..3bdb44bde4b7 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -44,6 +44,10 @@ static inline void check_stack(void)
44 if (this_size <= max_stack_size) 44 if (this_size <= max_stack_size)
45 return; 45 return;
46 46
47 /* we do not handle interrupt stacks yet */
48 if (!object_is_on_stack(&this_size))
49 return;
50
47 raw_local_irq_save(flags); 51 raw_local_irq_save(flags);
48 __raw_spin_lock(&max_stack_lock); 52 __raw_spin_lock(&max_stack_lock);
49 53
@@ -180,11 +184,16 @@ static struct file_operations stack_max_size_fops = {
180static void * 184static void *
181t_next(struct seq_file *m, void *v, loff_t *pos) 185t_next(struct seq_file *m, void *v, loff_t *pos)
182{ 186{
183 long i = (long)m->private; 187 long i;
184 188
185 (*pos)++; 189 (*pos)++;
186 190
187 i++; 191 if (v == SEQ_START_TOKEN)
192 i = 0;
193 else {
194 i = *(long *)v;
195 i++;
196 }
188 197
189 if (i >= max_stack_trace.nr_entries || 198 if (i >= max_stack_trace.nr_entries ||
190 stack_dump_trace[i] == ULONG_MAX) 199 stack_dump_trace[i] == ULONG_MAX)
@@ -197,12 +206,15 @@ t_next(struct seq_file *m, void *v, loff_t *pos)
197 206
198static void *t_start(struct seq_file *m, loff_t *pos) 207static void *t_start(struct seq_file *m, loff_t *pos)
199{ 208{
200 void *t = &m->private; 209 void *t = SEQ_START_TOKEN;
201 loff_t l = 0; 210 loff_t l = 0;
202 211
203 local_irq_disable(); 212 local_irq_disable();
204 __raw_spin_lock(&max_stack_lock); 213 __raw_spin_lock(&max_stack_lock);
205 214
215 if (*pos == 0)
216 return SEQ_START_TOKEN;
217
206 for (; t && l < *pos; t = t_next(m, t, &l)) 218 for (; t && l < *pos; t = t_next(m, t, &l))
207 ; 219 ;
208 220
@@ -231,10 +243,10 @@ static int trace_lookup_stack(struct seq_file *m, long i)
231 243
232static int t_show(struct seq_file *m, void *v) 244static int t_show(struct seq_file *m, void *v)
233{ 245{
234 long i = *(long *)v; 246 long i;
235 int size; 247 int size;
236 248
237 if (i < 0) { 249 if (v == SEQ_START_TOKEN) {
238 seq_printf(m, " Depth Size Location" 250 seq_printf(m, " Depth Size Location"
239 " (%d entries)\n" 251 " (%d entries)\n"
240 " ----- ---- --------\n", 252 " ----- ---- --------\n",
@@ -242,6 +254,8 @@ static int t_show(struct seq_file *m, void *v)
242 return 0; 254 return 0;
243 } 255 }
244 256
257 i = *(long *)v;
258
245 if (i >= max_stack_trace.nr_entries || 259 if (i >= max_stack_trace.nr_entries ||
246 stack_dump_trace[i] == ULONG_MAX) 260 stack_dump_trace[i] == ULONG_MAX)
247 return 0; 261 return 0;
@@ -271,10 +285,6 @@ static int stack_trace_open(struct inode *inode, struct file *file)
271 int ret; 285 int ret;
272 286
273 ret = seq_open(file, &stack_trace_seq_ops); 287 ret = seq_open(file, &stack_trace_seq_ops);
274 if (!ret) {
275 struct seq_file *m = file->private_data;
276 m->private = (void *)-1;
277 }
278 288
279 return ret; 289 return ret;
280} 290}