[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1402211514560.6395@vincent-weaver-1.um.maine.edu>
Date: Fri, 21 Feb 2014 15:18:38 -0500 (EST)
From: Vince Weaver <vincent.weaver@...ne.edu>
To: Peter Zijlstra <peterz@...radead.org>
cc: Vince Weaver <vincent.weaver@...ne.edu>,
Dave Jones <davej@...hat.com>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
Steven Rostedt <rostedt@...dmis.org>,
Stephane Eranian <eranian@...gle.com>
Subject: Re: 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@...radead.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);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists