linux-kernel-test/kernel/trace
Frederic Weisbecker b0dfa978c7 tracing/ftrace: alloc the started cpumask for the trace file
Impact: fix a crash while cat trace file

Currently we are using a cpumask to remind each cpu where a
trace occured. It lets us notice the user that a cpu just had
its first trace.

But on latest -tip we have the following crash once we cat the trace
file:

IP: [<c0270c4a>] print_trace_fmt+0x45/0xe7
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/class/net/eth0/carrier
Pid: 3897, comm: cat Not tainted (2.6.29-tip-02825-g0f22972-dirty #81)
EIP: 0060:[<c0270c4a>] EFLAGS: 00010297 CPU: 0
EIP is at print_trace_fmt+0x45/0xe7
EAX: 00000000 EBX: 00000000 ECX: c12d9e98 EDX: ccdb7010
ESI: d31f4000 EDI: 00322401 EBP: d31f3f10 ESP: d31f3efc
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
Process cat (pid: 3897, ti=d31f2000 task=d3b3cf20 task.ti=d31f2000)
Stack:
d31f4080 ccdb7010 d31f4000 d691fe70 ccdb7010 d31f3f24 c0270e5c d31f4000
d691fe70 d31f4000 d31f3f34 c02718e8 c12d9e98 d691fe70 d31f3f70 c02bfc33
00001000 09130000 d3b46e00 d691fe98 00000000 00000079 00000001 00000000
Call Trace:
[<c0270e5c>] ? print_trace_line+0x170/0x17c
[<c02718e8>] ? s_show+0xa7/0xbd
[<c02bfc33>] ? seq_read+0x24a/0x327
[<c02bf9e9>] ? seq_read+0x0/0x327
[<c02ab18b>] ? vfs_read+0x86/0xe1
[<c02ab289>] ? sys_read+0x40/0x65
[<c0202d8f>] ? sysenter_do_call+0x12/0x3c
Code: 00 00 00 89 45 ec f7 c7 00 20 00 00 89 55 f0 74 4e f6 86 98 10 00 00 02 74 45 8b 86 8c 10 00 00 8b 9e a8 10 00 00 e8 52 f3 ff ff <0f> a3 03 19 c0 85 c0 75 2b 8b 86 8c 10 00 00 8b 9e a8 10 00 00
EIP: [<c0270c4a>] print_trace_fmt+0x45/0xe7 SS:ESP 0068:d31f3efc
CR2: 0000000000000000
---[ end trace aa9cf38e5ebed9dd ]---

This is because we alloc the iter->started cpumask on tracing_pipe_open but
not on tracing_open.

It hadn't been noticed until now because we need to have ring buffer overruns
to activate the starting of cpu buffer detection.

Also, we need a check to not print the messagge for the first trace on the file.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1238619188-6109-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-04-07 14:02:03 +02:00
..
blktrace.c blktrace: fix pdu_len when tracing packet command requests 2009-04-03 15:29:26 +02:00
events.c ftrace: event profile hooks 2009-03-20 10:17:07 +01:00
ftrace.c ftrace: Using FTRACE_WARN_ON() to check "freed record" in ftrace_release() 2009-03-25 17:45:36 -04:00
Kconfig tracing: Fix TRACING_SUPPORT dependency for PPC32 2009-03-23 23:23:03 +01:00
kmemtrace.c tracing: Introduce trace_buffer_{lock_reserve,unlock_commit} 2009-02-06 01:01:41 +01:00
Makefile tracing: add per-event filtering 2009-03-22 18:38:46 +01:00
ring_buffer.c Merge branches 'tracing/docs', 'tracing/filters', 'tracing/ftrace', 'tracing/kprobes', 'tracing/blktrace-v2' and 'tracing/textedit' into tracing/core-v2 2009-03-31 17:46:40 +02:00
trace_boot.c tracing: Introduce trace_buffer_{lock_reserve,unlock_commit} 2009-02-06 01:01:41 +01:00
trace_branch.c tracing: remove funky whitespace in the trace code 2009-03-10 14:13:14 -04:00
trace_clock.c tracing: fix four sparse warnings 2009-03-22 18:16:54 +01:00
trace_event_profile.c ftrace: event profile hooks 2009-03-20 10:17:07 +01:00
trace_event_types.h tracing: remove recording function depth from trace_printk 2009-03-19 15:58:47 -04:00
trace_events_filter.c tracing/filters: disallow integer values for string filters and vice versa 2009-03-24 08:26:52 +01:00
trace_events_stage_1.h tracing: update comments to match event code macros 2009-03-10 13:12:58 -04:00
trace_events_stage_2.h tracing: add run-time field descriptions for event filtering 2009-03-22 18:11:22 +01:00
trace_events_stage_3.h tracing/events: don't discard an event after commit 2009-03-23 09:22:15 +01:00
trace_events.c tracing: filter fix for TRACE_EVENT_FORMAT events 2009-03-26 09:13:14 +01:00
trace_export.c tracing: remove funky whitespace in the trace code 2009-03-10 14:13:14 -04:00
trace_functions_graph.c function-graph: moved the timestamp from arch to generic code 2009-03-24 09:31:34 -04:00
trace_functions.c tracing/core: use appropriate waiting on trace_pipe 2009-02-18 01:40:20 +01:00
trace_hw_branches.c tracing/hw-branch-tracing: convert bts-tracer mutex to a spinlock 2009-02-25 09:16:01 +01:00
trace_irqsoff.c tracing: have latency tracers set the latency format 2009-03-04 22:15:30 -05:00
trace_mmiotrace.c tracing: remove recording function depth from trace_printk 2009-03-19 15:58:47 -04:00
trace_nop.c tracing/ftrace: make nop-tracer use polling wait for events on pipe 2009-03-23 09:22:15 +01:00
trace_output.c tracing: fix incorrect return type of ns2usecs() 2009-04-07 13:59:23 +02:00
trace_output.h trace: make argument 'mem' of trace_seq_putmem() const 2009-03-31 17:45:13 +02:00
trace_power.c tracing: make power tracer start/stop methods lighter weight 2009-03-17 23:12:11 -04:00
trace_printk.c tracing: remove recording function depth from trace_printk 2009-03-19 15:58:47 -04:00
trace_sched_switch.c ftrace: Add check of sched_stopped for probe_sched_wakeup 2009-04-07 14:01:11 +02:00
trace_sched_wakeup.c tracing: remove CALLER_ADDR2 from wakeup tracer 2009-04-07 13:58:54 +02:00
trace_selftest_dynamic.c ftrace: fix dynamic ftrace selftest 2008-05-23 21:13:23 +02:00
trace_selftest.c tracing: keep the tracing buffer after self-test failure 2009-03-22 15:17:21 +01:00
trace_stack.c tracing: left align location header in stack_trace 2009-03-13 00:00:58 -04:00
trace_stat.c trace_stat: keep original order 2009-03-25 18:32:34 +01:00
trace_stat.h tracing/ftrace: separate events tracing and stats tracing engine 2009-01-14 12:11:37 +01:00
trace_syscalls.c tracing/syscalls: protect thread flag toggling from races 2009-03-16 09:13:16 +01:00
trace_sysprof.c tracing: make all file_operations const 2009-03-05 21:46:40 -05:00
trace_workqueue.c trace_workqueues: fix empty line's output 2009-03-25 18:32:35 +01:00
trace.c tracing/ftrace: alloc the started cpumask for the trace file 2009-04-07 14:02:03 +02:00
trace.h tracing: fix incorrect return type of ns2usecs() 2009-04-07 13:59:23 +02:00