[PATCH 5.9 181/255] perf: Fix event multiplexing for exclusive groups

From: Greg Kroah-Hartman
Date: Tue Nov 17 2020 - 08:39:35 EST


From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>

[ Upstream commit 2714c3962f304d031d5016c963c4b459337b0749 ]

Commit 9e6302056f80 ("perf: Use hrtimers for event multiplexing")
placed the hrtimer (re)start call in the wrong place. Instead of
capturing all scheduling failures, it only considered the PMU failure.

The result is that groups using perf_event_attr::exclusive are no
longer rotated.

Fixes: 9e6302056f80 ("perf: Use hrtimers for event multiplexing")
Reported-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Link: https://lkml.kernel.org/r/20201029162902.038667689@xxxxxxxxxxxxx
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
kernel/events/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index c245ccd426b71..a06ac60d346f1 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2597,7 +2597,6 @@ group_error:

error:
pmu->cancel_txn(pmu);
- perf_mux_hrtimer_restart(cpuctx);
return -EAGAIN;
}

@@ -3653,6 +3652,7 @@ static int merge_sched_in(struct perf_event *event, void *data)

*can_add_hw = 0;
ctx->rotate_necessary = 1;
+ perf_mux_hrtimer_restart(cpuctx);
}

return 0;
--
2.27.0