Paul Mackerras
23a185ca8a
perf_counters: make software counters work as per-cpu counters
...
Impact: kernel crash fix
Yanmin Zhang reported that using a PERF_COUNT_TASK_CLOCK software
counter as a per-cpu counter would reliably crash the system, because
it calls __task_delta_exec with a null pointer. The page fault,
context switch and cpu migration counters also won't function
correctly as per-cpu counters since they reference the current task.
This fixes the problem by redirecting the task_clock counter to the
cpu_clock counter when used as a per-cpu counter, and by implementing
per-cpu page fault, context switch and cpu migration counters.
Along the way, this:
- Initializes counter->ctx earlier, in perf_counter_alloc, so that
sw_perf_counter_init can use it
- Adds code to kernel/sched.c to count task migrations into each
cpu, in rq->nr_migrations_in
- Exports the per-cpu context switch and task migration counts
via new functions added to kernel/sched.c
- Makes sure that if sw_perf_counter_init fails, we don't try to
initialize the counter as a hardware counter. Since the user has
passed a negative, non-raw event type, they clearly don't intend
for it to be interpreted as a hardware event.
Reported-by: "Zhang Yanmin" <yanmin_zhang@linux.intel.com >
Signed-off-by: Paul Mackerras <paulus@samba.org >
Signed-off-by: Ingo Molnar <mingo@elte.hu >
2009-02-09 12:47:16 +01:00
..
2009-01-06 18:10:26 -08:00
2009-01-06 11:07:54 -08:00
2009-01-02 17:15:07 -02:00
2009-01-06 17:14:01 -08:00
2009-01-06 11:53:56 -05:00
2009-01-11 01:34:25 +01:00
2008-12-31 18:18:13 +01:00
2009-01-09 12:37:15 -08:00
2009-01-12 21:18:37 -08:00
2009-01-07 17:38:32 -05:00
2009-01-09 08:31:11 +11:00
2009-01-08 20:10:38 +00:00
2009-01-08 20:11:07 +00:00
2009-01-06 11:53:47 -05:00
2009-01-07 10:00:06 -08:00
2009-01-07 10:00:22 -08:00
2009-01-02 10:19:37 -08:00
2009-01-09 03:41:08 -05:00
2009-01-15 16:39:41 -08:00
2008-12-29 08:29:50 +01:00
2009-01-06 11:38:14 -07:00
2009-01-07 08:45:46 -08:00
2009-01-15 16:39:41 -08:00
2009-01-09 11:52:14 -08:00
2009-01-04 15:14:42 -05:00
2009-01-06 15:59:23 -08:00
2009-01-06 15:59:23 -08:00
2009-01-08 08:31:12 -08:00
2009-01-08 15:37:43 +00:00
2009-01-06 15:59:29 -08:00
2008-12-29 08:29:50 +01:00
2008-12-30 09:05:13 +10:30
2009-01-01 10:12:19 +10:30
2009-01-02 11:10:35 -06:00
2009-01-04 13:33:20 -08:00
2009-01-09 16:54:42 -08:00
2009-01-07 09:38:48 +11:00
2009-01-15 16:39:41 -08:00
2009-01-08 08:31:10 -08:00
2009-01-14 14:15:14 +01:00
2009-01-02 12:19:34 -08:00
2009-01-02 09:29:43 -08:00
2009-01-09 16:54:41 -08:00
2009-01-02 09:23:03 -08:00
2009-01-15 16:39:41 -08:00
2008-12-29 17:47:23 +10:00
2009-01-06 09:05:31 +01:00
2009-01-01 10:12:30 +10:30
2009-01-08 08:31:11 -08:00
2008-12-25 11:01:43 +11:00
2008-12-25 11:01:33 +11:00
2009-01-15 16:39:41 -08:00
2008-12-31 18:07:38 -05:00
2009-01-07 10:00:16 -08:00
2009-01-06 03:05:09 +00:00
2009-01-09 15:06:12 -08:00
2009-01-12 20:56:41 +01:00
2009-01-04 11:00:05 +01:00
2009-01-11 00:20:39 -08:00
2009-01-03 11:57:35 +01:00
2008-12-29 07:39:34 -05:00
2009-01-05 08:40:21 -08:00
2009-01-05 08:40:25 -08:00
2009-01-05 08:40:25 -08:00
2009-01-06 11:38:16 -07:00
2008-12-29 08:29:50 +01:00
2009-01-08 08:31:00 -08:00
2009-01-08 08:31:00 -08:00
2009-01-08 17:14:59 -08:00
2009-01-08 17:14:59 -08:00
2008-12-29 11:27:46 +02:00
2009-01-15 16:39:41 -08:00
2008-12-31 18:07:42 -05:00
2008-12-31 18:07:42 -05:00
2009-01-09 16:54:42 -08:00
2009-01-02 10:19:38 -08:00
2008-12-29 08:29:51 +01:00
2009-01-06 15:59:01 -08:00
2008-12-30 16:10:19 -08:00
2009-01-04 01:00:53 +01:00
2009-01-04 01:00:51 +01:00
2009-01-06 15:58:58 -08:00
2009-01-07 14:29:17 +01:00
2009-01-14 19:19:04 +01:00
2009-01-15 16:39:41 -08:00
2009-01-15 16:39:41 -08:00
2009-01-06 10:50:09 -08:00
2009-01-11 02:42:53 +01:00
2009-01-15 16:39:41 -08:00
2009-01-03 14:11:08 +01:00
2009-01-12 17:39:24 -08:00
2009-01-03 14:10:09 +01:00
2009-01-15 16:39:38 -08:00
2009-01-05 22:46:26 -05:00
2009-01-11 19:13:02 +01:00
2009-01-11 19:13:45 +01:00
2009-01-02 10:19:40 -08:00
2009-01-08 17:14:59 -08:00
2009-01-15 16:39:37 -08:00
2009-01-05 08:40:30 -08:00
2009-01-15 16:39:41 -08:00
2009-01-07 10:00:22 -08:00
2009-01-11 02:42:53 +01:00
2009-01-08 08:31:15 -08:00
2009-01-06 10:44:30 -08:00
2009-01-06 15:59:21 -08:00
2009-01-03 14:11:07 +01:00
2009-01-15 16:39:41 -08:00
2009-01-08 12:38:58 +00:00
2009-01-08 17:55:03 +00:00
2008-12-30 09:26:11 +10:30
2009-01-16 10:23:37 -05:00
2008-12-30 16:20:19 -08:00
2009-01-15 16:39:41 -08:00
2009-01-21 10:39:51 +01:00
2008-12-29 04:59:31 -08:00
2009-01-15 16:39:41 -08:00
2009-01-08 08:31:10 -08:00
2009-01-06 15:59:00 -08:00
2009-01-06 15:59:00 -08:00
2009-01-09 16:54:41 -08:00
2009-01-06 15:59:00 -08:00
2009-01-09 22:44:25 +01:00
2009-01-11 17:55:16 +01:00
2009-01-08 08:31:07 -08:00
2009-01-08 12:04:47 +00:00
2009-01-14 07:32:44 -08:00
2009-01-08 08:31:07 -08:00
2009-01-06 15:59:20 -08:00
2009-01-05 08:40:13 +10:30
2008-12-31 18:07:38 -05:00
2009-01-06 11:28:07 +01:00
2009-01-14 21:05:05 -08:00
2009-01-07 17:38:31 -05:00
2009-01-06 15:59:00 -08:00
2009-01-08 16:25:18 +11:00
2009-01-09 15:49:06 -07:00
2009-01-07 22:48:15 +01:00
2009-01-07 09:59:50 -08:00
2009-01-08 08:31:05 -08:00
2009-01-06 15:59:07 -08:00
2009-01-04 13:33:20 -08:00
2009-01-06 15:59:00 -08:00
2009-01-09 03:39:43 -05:00
2009-01-14 19:19:02 +01:00
2009-01-07 11:13:22 -08:00
2009-01-07 11:13:11 -08:00
2009-01-07 11:13:25 -08:00
2009-01-06 17:10:04 -08:00
2009-01-20 12:29:19 +09:00
2009-01-23 14:50:02 +01:00
2009-01-15 16:39:41 -08:00
2009-01-08 08:31:12 -08:00
2009-01-08 08:31:12 -08:00
2009-01-06 10:44:29 -08:00
2009-01-06 10:44:30 -08:00
2009-01-06 15:59:12 -08:00
2009-01-04 12:17:39 +01:00
2009-01-07 21:44:20 +01:00
2009-01-07 21:44:20 +01:00
2009-01-05 08:40:25 -08:00
2009-01-05 08:40:25 -08:00
2009-01-15 16:39:41 -08:00
2009-01-05 18:31:12 -08:00
2009-01-03 12:01:23 -08:00
2009-01-10 06:04:33 -08:00
2009-01-01 10:12:26 +10:30
2009-01-05 10:18:08 +01:00
2009-01-15 16:39:37 -08:00
2008-12-30 17:31:25 -08:00
2009-01-06 15:59:28 -08:00
2009-01-06 15:59:07 -08:00
2009-01-04 13:33:20 -08:00
2009-02-09 12:47:16 +01:00
2009-01-07 09:58:22 +11:00
2008-12-30 09:05:19 +10:30
2009-01-02 10:19:43 -08:00
2009-01-08 16:25:18 +11:00
2009-01-02 10:19:42 -08:00
2008-12-29 11:45:47 +02:00
2009-01-11 03:41:58 +01:00
2009-01-05 08:40:14 +10:30
2009-01-14 19:56:50 -08:00
2009-01-08 08:31:10 -08:00
2008-12-28 09:54:52 +01:00
2009-01-21 16:37:27 +01:00
2008-12-30 09:05:12 +10:30
2009-01-01 10:12:25 +10:30
2008-12-31 09:53:21 +01:00
2009-01-11 19:12:49 +01:00
2009-01-02 10:19:36 -08:00
2009-01-02 10:19:40 -08:00
2009-01-07 11:27:12 -08:00
2009-01-06 10:44:44 -08:00
2009-01-07 10:00:11 -08:00
2009-01-07 10:00:14 -08:00
2009-01-02 17:11:52 -02:00
2008-12-30 09:26:04 +10:30
2008-12-30 09:26:10 +10:30
2008-12-30 09:25:58 +10:30
2008-12-30 09:26:03 +10:30
2009-01-06 15:59:05 -08:00
2009-01-07 10:00:16 -08:00
2009-01-06 15:59:09 -08:00