aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2013-10-03 14:56:05 +0300
committerAlexander Shishkin <alexander.shishkin@linux.intel.com>2018-03-05 16:26:46 +0200
commit15e225f830fc176f66ea3e0ff64050561690031d (patch)
treefe3b40e257e18ad61f7c114ae3f63e7d19edbe22
parentbfc54636793c5fa1acca45629533baa90c389527 (diff)
downloadlinux-perf-aux-sampling-4.14.tar.gz
HACK: perf: Allow set-output for task contexts of different typesperf-aux-sampling-4.14
Set-output must be limited to events that cannot be active on different cpus at the same time. Thus either the event cpu must be the same, or the event task must be the same. Current logic does not check the task directly but checks whether the perf_event_context is the same, however there are separate contexts for hardware and software events so in that case the perf_event_context is different even though the task is the same. This patch changes the logic to check the task directly. HACK WARNING: since set_output() can be called from perf_event_open() to attach to another event's buffer, we need to take into account that the new event doesn't have a context at that point, so hack around that. This will need a better fix. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-rw-r--r--kernel/events/core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6a2f8b78be022..faee8e594242f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -9917,7 +9917,8 @@ perf_event_set_output(struct perf_event *event, struct perf_event *output_event)
/*
* If its not a per-cpu rb, it must be the same task.
*/
- if (output_event->cpu == -1 && output_event->ctx != event->ctx)
+ if (output_event->cpu == -1 &&
+ output_event->ctx->task != event->ctx->task)
goto out;
/*
@@ -10290,7 +10291,9 @@ SYSCALL_DEFINE5(perf_event_open,
}
if (output_event) {
+ event->ctx = ctx; /* XXX XXX XXX */
err = perf_event_set_output(event, output_event);
+ event->ctx = NULL; /* XXX XXX XXX */
if (err)
goto err_context;
}