Commit 5ffaf037 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "Misc fixes: a handful of AUX event handling related fixes, a Sparse
  fix and two ABI fixes"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/core: Fix missing static inline on perf_cgroup_switch()
  perf/core: Consistently fail fork on allocation failures
  perf/aux: Disallow aux_output for kernel events
  perf/core: Reattach a misplaced comment
  perf/aux: Fix the aux_output group inheritance fix
  perf/core: Disallow uncore-cgroup events
parents 8be636dd d00dbd29
...@@ -1031,7 +1031,7 @@ perf_cgroup_set_timestamp(struct task_struct *task, ...@@ -1031,7 +1031,7 @@ perf_cgroup_set_timestamp(struct task_struct *task,
{ {
} }
void static inline void
perf_cgroup_switch(struct task_struct *task, struct task_struct *next) perf_cgroup_switch(struct task_struct *task, struct task_struct *next)
{ {
} }
...@@ -10535,6 +10535,15 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, ...@@ -10535,6 +10535,15 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
goto err_ns; goto err_ns;
} }
/*
* Disallow uncore-cgroup events, they don't make sense as the cgroup will
* be different on other CPUs in the uncore mask.
*/
if (pmu->task_ctx_nr == perf_invalid_context && cgroup_fd != -1) {
err = -EINVAL;
goto err_pmu;
}
if (event->attr.aux_output && if (event->attr.aux_output &&
!(pmu->capabilities & PERF_PMU_CAP_AUX_OUTPUT)) { !(pmu->capabilities & PERF_PMU_CAP_AUX_OUTPUT)) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
...@@ -11323,8 +11332,11 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, ...@@ -11323,8 +11332,11 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
int err; int err;
/* /*
* Get the target context (task or percpu): * Grouping is not supported for kernel events, neither is 'AUX',
* make sure the caller's intentions are adjusted.
*/ */
if (attr->aux_output)
return ERR_PTR(-EINVAL);
event = perf_event_alloc(attr, cpu, task, NULL, NULL, event = perf_event_alloc(attr, cpu, task, NULL, NULL,
overflow_handler, context, -1); overflow_handler, context, -1);
...@@ -11336,6 +11348,9 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, ...@@ -11336,6 +11348,9 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
/* Mark owner so we could distinguish it from user events. */ /* Mark owner so we could distinguish it from user events. */
event->owner = TASK_TOMBSTONE; event->owner = TASK_TOMBSTONE;
/*
* Get the target context (task or percpu):
*/
ctx = find_get_context(event->pmu, task, event); ctx = find_get_context(event->pmu, task, event);
if (IS_ERR(ctx)) { if (IS_ERR(ctx)) {
err = PTR_ERR(ctx); err = PTR_ERR(ctx);
...@@ -11787,7 +11802,7 @@ inherit_event(struct perf_event *parent_event, ...@@ -11787,7 +11802,7 @@ inherit_event(struct perf_event *parent_event,
GFP_KERNEL); GFP_KERNEL);
if (!child_ctx->task_ctx_data) { if (!child_ctx->task_ctx_data) {
free_event(child_event); free_event(child_event);
return NULL; return ERR_PTR(-ENOMEM);
} }
} }
...@@ -11890,7 +11905,7 @@ static int inherit_group(struct perf_event *parent_event, ...@@ -11890,7 +11905,7 @@ static int inherit_group(struct perf_event *parent_event,
if (IS_ERR(child_ctr)) if (IS_ERR(child_ctr))
return PTR_ERR(child_ctr); return PTR_ERR(child_ctr);
if (sub->aux_event == parent_event && if (sub->aux_event == parent_event && child_ctr &&
!perf_get_aux_event(child_ctr, leader)) !perf_get_aux_event(child_ctr, leader))
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment