Re: [PATCH v1 6/6] perf: Allow set-output for task contexts of different types

From: Peter Zijlstra
Date: Thu Jun 14 2018 - 15:36:31 EST


On Tue, Jun 12, 2018 at 10:51:17AM +0300, Alexander Shishkin wrote:
> From: Adrian Hunter <adrian.hunter@xxxxxxxxx>
>
> 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.

Thing is, __perf_event_task_sched_out() can lazy switch the different
contexts independently. So if someone breaks clone on either software or
hardware but not both, we'll flip only one ctx around and schedule the
other, completely breaking your assumption above.

> This patch changes the logic to check the task directly.

This Changelog completly and utterly fails to explain why though.