Peter Zijlstra
eced1dfcfc
perf_counter: Fix /0 bug in swcounters
We have a race in the swcounter stuff where we can start
counting a counter that has never been enabled, this leads to a
/0 situation.
The below avoids the /0 but doesn't close the race, this would
need a new counter state.
The race is due to perf_swcounter_is_counting() which cannot
discern between disabled due to scheduled out, and disabled for
any other reason.
Such a crash has been seen by Ingo:
[ 967.092372] divide error: 0000 [#1] SMP
[ 967.096499] last sysfs file: /sys/devices/system/cpu/cpu15/cache/index2/shared_cpu_map
[ 967.104846] CPU 5
[ 967.106965] Modules linked in:
[ 967.110169] Pid: 3351, comm: hackbench Not tainted 2.6.31-rc8-tip-01158-gd940a54-dirty #1568 X8DTN
[ 967.119456] RIP: 0010:[<ffffffff810c0aba>] [<ffffffff810c0aba>] perf_swcounter_ctx_event+0x127/0x1af
[ 967.129137] RSP: 0018:ffff8801a95abd70 EFLAGS: 00010046
[ 967.134699] RAX: 0000000000000002 RBX: ffff8801bd645c00 RCX: 0000000000000002
[ 967.142162] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8801bd645d40
[ 967.149584] RBP: ffff8801a95abdb0 R08: 0000000000000001 R09: ffff8801a95abe00
[ 967.157042] R10: 0000000000000037 R11: ffff8801aa1245f8 R12: ffff8801a95abe00
[ 967.164481] R13: ffff8801a95abe00 R14: ffff8801aa1c0e78 R15: 0000000000000001
[ 967.171953] FS: 0000000000000000(0000) GS:ffffc90000a00000(0063) knlGS:00000000f7f486c0
[ 967.180406] CS: 0010 DS: 002b ES: 002b CR0: 000000008005003b
[ 967.186374] CR2: 000000004822c0ac CR3: 00000001b19a2000 CR4: 00000000000006e0
[ 967.193770] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 967.201224] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 967.208692] Process hackbench (pid: 3351, threadinfo ffff8801a95aa000, task ffff8801a96b0000)
[ 967.217607] Stack:
[ 967.219711] 0000000000000000 0000000000000037 0000000200000001 ffffc90000a1107c
[ 967.227296] <0> ffff8801a95abe00 0000000000000001 0000000000000001 0000000000000037
[ 967.235333] <0> ffff8801a95abdf0 ffffffff810c0c20 0000000200a14f30 ffff8801a95abe40
[ 967.243532] Call Trace:
[ 967.246103] [<ffffffff810c0c20>] do_perf_swcounter_event+0xde/0xec
[ 967.252635] [<ffffffff810c0ca7>] perf_tpcounter_event+0x79/0x7b
[ 967.258957] [<ffffffff81037f73>] ftrace_profile_sched_switch+0xc0/0xcb
[ 967.265791] [<ffffffff8155f22d>] schedule+0x429/0x4c4
[ 967.271156] [<ffffffff8100c01e>] int_careful+0xd/0x14
Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1251472247.17617.74.camel@laptop>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-08-29 13:20:11 +02:00
..
2009-06-18 13:03:58 -07:00
2009-08-18 17:22:43 +02:00
2009-07-12 12:22:34 -07:00
2009-08-19 18:15:10 +02:00
2009-08-18 20:39:48 -04:00
2009-06-30 18:56:00 -07:00
2009-06-08 12:31:53 -07:00
2009-06-24 00:02:38 -04:00
2009-06-24 00:00:52 -04:00
2009-06-24 00:02:38 -04:00
2009-06-24 00:02:38 -04:00
2009-06-24 00:00:52 -04:00
2009-06-24 00:02:38 -04:00
2009-04-02 19:04:54 -07:00
2009-07-29 19:10:35 -07:00
2009-04-30 19:24:24 +02:00
2009-06-22 21:18:12 -07:00
2009-06-16 19:47:31 -07:00
2009-05-11 08:15:36 +10:00
2009-03-31 23:00:27 -04:00
2009-07-08 09:31:56 -07:00
2009-04-05 11:04:19 -07:00
2009-08-26 20:06:52 -07:00
2009-07-18 14:19:53 +02:00
2009-08-10 15:41:12 +02:00
2009-08-10 20:38:11 +02:00
2009-06-16 19:47:48 -07:00
2009-07-10 17:32:55 +02:00
2009-06-09 22:37:52 +02:00
2009-07-29 19:10:34 -07:00
2009-06-16 19:47:47 -07:00
2009-05-15 07:56:24 -05:00
2009-07-08 09:31:56 -07:00
2009-07-30 16:44:06 -07:00
2009-07-27 12:15:46 -07:00
2009-05-12 19:59:52 +02:00
2009-08-07 11:58:38 +02:00
2009-05-07 11:17:34 +02:00
2009-06-28 11:05:04 -07:00
2009-08-27 12:33:19 -07:00
2009-06-11 17:55:42 +02:00
2009-04-02 19:04:53 -07:00
2009-06-18 13:03:56 -07:00
2009-07-24 15:30:45 -04:00
2009-06-12 21:46:58 +09:30
2009-08-29 13:20:11 +02:00
2009-06-18 13:03:55 -07:00
2009-07-09 17:07:02 +01:00
2009-08-08 18:30:25 +02:00
2009-08-04 10:16:41 +02:00
2009-06-16 11:02:28 -07:00
2009-07-29 19:10:36 -07:00
2009-07-06 13:57:04 -07:00
2009-04-03 12:23:02 +02:00
2009-04-15 13:55:14 -07:00
2009-05-05 20:28:05 +02:00
2009-03-30 22:05:16 +10:30
2009-04-14 11:33:43 +02:00
2009-06-24 15:02:48 +02:00
2009-04-03 12:23:03 +02:00
2009-04-05 11:04:19 -07:00
2009-06-18 13:03:48 -07:00
2009-06-30 18:56:00 -07:00
2009-04-06 11:14:02 +02:00
2009-08-06 05:50:21 +02:00
2009-05-09 10:08:19 +02:00
2009-08-02 14:23:29 +02:00
2009-03-30 22:05:17 +10:30
2009-06-17 18:29:42 +02:00
2009-08-02 14:10:12 +02:00
2009-03-30 17:17:35 -07:00
2009-05-15 15:32:45 +02:00
2009-07-10 10:43:29 +02:00
2009-03-24 23:16:51 +01:00
2009-07-18 14:19:52 +02:00
2009-03-02 15:41:30 -08:00
2009-08-01 11:18:56 -07:00
2009-06-16 19:47:49 -07:00
2009-08-07 10:39:55 -07:00
2009-07-22 17:01:17 +02:00
2009-04-02 19:05:11 -07:00
2009-03-30 22:05:17 +10:30
2009-06-16 19:47:48 -07:00
2009-08-17 15:09:11 +10:00
2009-07-18 23:11:43 +02:00
2009-03-18 19:55:00 +01:00
2009-03-09 08:13:35 -07:00
2009-02-27 16:26:21 -08:00
2009-06-15 21:30:23 -07:00
2009-04-02 19:05:01 -07:00
2009-06-18 13:03:55 -07:00
2009-08-10 14:43:09 +02:00
2009-06-02 01:10:40 +02:00