Re: [PATCH 02/10] perf: Fix leader for removed sibling event in perf_group_detach
From: Peter Zijlstra
Date: Mon Aug 28 2017 - 15:23:40 EST
On Thu, Aug 24, 2017 at 06:27:29PM +0200, Jiri Olsa wrote:
> Mark reported warning in x86_perf_event_update caused
> by reading unscheduled leader of an event that was
> already removed from the group.
>
> As he pointed out we don't properly reset event's leader
> once it's been detached from the group and he posted the
> attached fix.
>
> [1] https://marc.info/?l=linux-kernel&m=150238662928203&w=2
>
> Originally-From: Mark Rutland <mark.rutland@xxxxxxx>
> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> ---
> kernel/events/core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index d704e23914bf..30e30e94ea32 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -1727,6 +1727,7 @@ static void perf_group_detach(struct perf_event *event)
> if (event->group_leader != event) {
> list_del_init(&event->group_entry);
> event->group_leader->nr_siblings--;
> + event->group_leader = event;
> goto out;
> }
No, I think this breaks other things... but I again forgot what. The
original issue he reported is fixed by patch:
2bcb88eb04d3 ("perf/core: fix group {cpu,task} validation")
Also by Mark.