powerpc/perf: Never program book3s PMCs with values >= 0x80000000
authorAnton Blanchard <anton@samba.org>
Wed, 28 May 2014 22:15:38 +0000 (08:15 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2014 23:21:04 +0000 (16:21 -0700)
commit3848c22cf6a5536281714e771fe69873bde50cc6
treeed95d7c2ca7b1f638a86adbc18f0d839c5a77b84
parent8d706077c28caf60cf675fb1b550ed5b1b6927fe
powerpc/perf: Never program book3s PMCs with values >= 0x80000000

commit f56029410a13cae3652d1f34788045c40a13ffc7 upstream.

We are seeing a lot of PMU warnings on POWER8:

    Can't find PMC that caused IRQ

Looking closer, the active PMC is 0 at this point and we took a PMU
exception on the transition from negative to 0. Some versions of POWER8
have an issue where they edge detect and not level detect PMC overflows.

A number of places program the PMC with (0x80000000 - period_left),
where period_left can be negative. We can either fix all of these or
just ensure that period_left is always >= 1.

This patch takes the second option.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/perf/core-book3s.c