lkml.org 
[lkml]   [2014]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: x86_pmu_start WARN_ON.
On Fri, 21 Feb 2014, Peter Zijlstra wrote:

> group_sched_in() that fails (for whatever reason), and without x86_pmu
> TXN support (because the leader is !x86_pmu), will corrupt the n_added
> state.
>
> If this all is correct; the below ought to cure things.

I've applied the patch and have been unable to trigger the warning with
either my testcase or a few hours of fuzzing.

My only comment on the patch is it could always use some comments.

The perf_event code is really hard to follow as is, without adding
more uncommented special cases.

Vince


>
> Signed-off-by: Peter Zijlstra <peterz@infradead.org>
> ---
> arch/x86/kernel/cpu/perf_event.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
> index 895604f2e916..79f9f848bee4 100644
> --- a/arch/x86/kernel/cpu/perf_event.c
> +++ b/arch/x86/kernel/cpu/perf_event.c
> @@ -1192,6 +1192,9 @@ static void x86_pmu_del(struct perf_event *event, int flags)
> for (i = 0; i < cpuc->n_events; i++) {
> if (event == cpuc->event_list[i]) {
>
> + if (i >= cpuc->n_events - cpuc->n_added)
> + --cpuc->n_added;
> +
> if (x86_pmu.put_event_constraints)
> x86_pmu.put_event_constraints(cpuc, event);
>


\
 
 \ /
  Last update: 2014-02-21 22:01    [W:0.096 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site