aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_event.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r--kernel/perf_event.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 603c0d8b5df1..2ae7409bf38f 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -3259,8 +3259,6 @@ static void perf_event_task_output(struct perf_event *event,
3259 task_event->event_id.tid = perf_event_tid(event, task); 3259 task_event->event_id.tid = perf_event_tid(event, task);
3260 task_event->event_id.ptid = perf_event_tid(event, current); 3260 task_event->event_id.ptid = perf_event_tid(event, current);
3261 3261
3262 task_event->event_id.time = perf_clock();
3263
3264 perf_output_put(&handle, task_event->event_id); 3262 perf_output_put(&handle, task_event->event_id);
3265 3263
3266 perf_output_end(&handle); 3264 perf_output_end(&handle);
@@ -3268,6 +3266,9 @@ static void perf_event_task_output(struct perf_event *event,
3268 3266
3269static int perf_event_task_match(struct perf_event *event) 3267static int perf_event_task_match(struct perf_event *event)
3270{ 3268{
3269 if (event->state < PERF_EVENT_STATE_INACTIVE)
3270 return 0;
3271
3271 if (event->cpu != -1 && event->cpu != smp_processor_id()) 3272 if (event->cpu != -1 && event->cpu != smp_processor_id())
3272 return 0; 3273 return 0;
3273 3274
@@ -3297,7 +3298,7 @@ static void perf_event_task_event(struct perf_task_event *task_event)
3297 cpuctx = &get_cpu_var(perf_cpu_context); 3298 cpuctx = &get_cpu_var(perf_cpu_context);
3298 perf_event_task_ctx(&cpuctx->ctx, task_event); 3299 perf_event_task_ctx(&cpuctx->ctx, task_event);
3299 if (!ctx) 3300 if (!ctx)
3300 ctx = rcu_dereference(task_event->task->perf_event_ctxp); 3301 ctx = rcu_dereference(current->perf_event_ctxp);
3301 if (ctx) 3302 if (ctx)
3302 perf_event_task_ctx(ctx, task_event); 3303 perf_event_task_ctx(ctx, task_event);
3303 put_cpu_var(perf_cpu_context); 3304 put_cpu_var(perf_cpu_context);
@@ -3328,6 +3329,7 @@ static void perf_event_task(struct task_struct *task,
3328 /* .ppid */ 3329 /* .ppid */
3329 /* .tid */ 3330 /* .tid */
3330 /* .ptid */ 3331 /* .ptid */
3332 .time = perf_clock(),
3331 }, 3333 },
3332 }; 3334 };
3333 3335
@@ -3377,6 +3379,9 @@ static void perf_event_comm_output(struct perf_event *event,
3377 3379
3378static int perf_event_comm_match(struct perf_event *event) 3380static int perf_event_comm_match(struct perf_event *event)
3379{ 3381{
3382 if (event->state < PERF_EVENT_STATE_INACTIVE)
3383 return 0;
3384
3380 if (event->cpu != -1 && event->cpu != smp_processor_id()) 3385 if (event->cpu != -1 && event->cpu != smp_processor_id())
3381 return 0; 3386 return 0;
3382 3387
@@ -3494,6 +3499,9 @@ static void perf_event_mmap_output(struct perf_event *event,
3494static int perf_event_mmap_match(struct perf_event *event, 3499static int perf_event_mmap_match(struct perf_event *event,
3495 struct perf_mmap_event *mmap_event) 3500 struct perf_mmap_event *mmap_event)
3496{ 3501{
3502 if (event->state < PERF_EVENT_STATE_INACTIVE)
3503 return 0;
3504
3497 if (event->cpu != -1 && event->cpu != smp_processor_id()) 3505 if (event->cpu != -1 && event->cpu != smp_processor_id())
3498 return 0; 3506 return 0;
3499 3507
@@ -4571,7 +4579,7 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
4571 if (attr->type >= PERF_TYPE_MAX) 4579 if (attr->type >= PERF_TYPE_MAX)
4572 return -EINVAL; 4580 return -EINVAL;
4573 4581
4574 if (attr->__reserved_1 || attr->__reserved_2) 4582 if (attr->__reserved_1)
4575 return -EINVAL; 4583 return -EINVAL;
4576 4584
4577 if (attr->sample_type & ~(PERF_SAMPLE_MAX-1)) 4585 if (attr->sample_type & ~(PERF_SAMPLE_MAX-1))