aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/events/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/events/core.c')
-rw-r--r--kernel/events/core.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index b0cd86501c30..9fcb0944f071 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4434,12 +4434,15 @@ static void perf_event_task_event(struct perf_task_event *task_event)
4434 if (ctxn < 0) 4434 if (ctxn < 0)
4435 goto next; 4435 goto next;
4436 ctx = rcu_dereference(current->perf_event_ctxp[ctxn]); 4436 ctx = rcu_dereference(current->perf_event_ctxp[ctxn]);
4437 if (ctx)
4438 perf_event_task_ctx(ctx, task_event);
4437 } 4439 }
4438 if (ctx)
4439 perf_event_task_ctx(ctx, task_event);
4440next: 4440next:
4441 put_cpu_ptr(pmu->pmu_cpu_context); 4441 put_cpu_ptr(pmu->pmu_cpu_context);
4442 } 4442 }
4443 if (task_event->task_ctx)
4444 perf_event_task_ctx(task_event->task_ctx, task_event);
4445
4443 rcu_read_unlock(); 4446 rcu_read_unlock();
4444} 4447}
4445 4448
@@ -4593,6 +4596,7 @@ void perf_event_comm(struct task_struct *task)
4593 struct perf_event_context *ctx; 4596 struct perf_event_context *ctx;
4594 int ctxn; 4597 int ctxn;
4595 4598
4599 rcu_read_lock();
4596 for_each_task_context_nr(ctxn) { 4600 for_each_task_context_nr(ctxn) {
4597 ctx = task->perf_event_ctxp[ctxn]; 4601 ctx = task->perf_event_ctxp[ctxn];
4598 if (!ctx) 4602 if (!ctx)
@@ -4600,6 +4604,7 @@ void perf_event_comm(struct task_struct *task)
4600 4604
4601 perf_event_enable_on_exec(ctx); 4605 perf_event_enable_on_exec(ctx);
4602 } 4606 }
4607 rcu_read_unlock();
4603 4608
4604 if (!atomic_read(&nr_comm_events)) 4609 if (!atomic_read(&nr_comm_events))
4605 return; 4610 return;
@@ -4734,7 +4739,8 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
4734 } else { 4739 } else {
4735 if (arch_vma_name(mmap_event->vma)) { 4740 if (arch_vma_name(mmap_event->vma)) {
4736 name = strncpy(tmp, arch_vma_name(mmap_event->vma), 4741 name = strncpy(tmp, arch_vma_name(mmap_event->vma),
4737 sizeof(tmp)); 4742 sizeof(tmp) - 1);
4743 tmp[sizeof(tmp) - 1] = '\0';
4738 goto got_name; 4744 goto got_name;
4739 } 4745 }
4740 4746
@@ -5327,7 +5333,7 @@ static void sw_perf_event_destroy(struct perf_event *event)
5327 5333
5328static int perf_swevent_init(struct perf_event *event) 5334static int perf_swevent_init(struct perf_event *event)
5329{ 5335{
5330 int event_id = event->attr.config; 5336 u64 event_id = event->attr.config;
5331 5337
5332 if (event->attr.type != PERF_TYPE_SOFTWARE) 5338 if (event->attr.type != PERF_TYPE_SOFTWARE)
5333 return -ENOENT; 5339 return -ENOENT;
@@ -5647,6 +5653,7 @@ static void perf_swevent_init_hrtimer(struct perf_event *event)
5647 event->attr.sample_period = NSEC_PER_SEC / freq; 5653 event->attr.sample_period = NSEC_PER_SEC / freq;
5648 hwc->sample_period = event->attr.sample_period; 5654 hwc->sample_period = event->attr.sample_period;
5649 local64_set(&hwc->period_left, hwc->sample_period); 5655 local64_set(&hwc->period_left, hwc->sample_period);
5656 hwc->last_period = hwc->sample_period;
5650 event->attr.freq = 0; 5657 event->attr.freq = 0;
5651 } 5658 }
5652} 5659}
@@ -5982,6 +5989,7 @@ skip_type:
5982 if (pmu->pmu_cpu_context) 5989 if (pmu->pmu_cpu_context)
5983 goto got_cpu_context; 5990 goto got_cpu_context;
5984 5991
5992 ret = -ENOMEM;
5985 pmu->pmu_cpu_context = alloc_percpu(struct perf_cpu_context); 5993 pmu->pmu_cpu_context = alloc_percpu(struct perf_cpu_context);
5986 if (!pmu->pmu_cpu_context) 5994 if (!pmu->pmu_cpu_context)
5987 goto free_dev; 5995 goto free_dev;