MIPS, Perf-events: Use unsigned delta for right shift in event update
MIPS, Perf-events: Use unsigned delta for right shift in event update

Leverage the commit for ARM by Will Deacon:

- 446a5a8b1eb91a6990e5c8fe29f14e7a95b69132
    ARM: 6205/1: perf: ensure counter delta is treated as unsigned

    Hardware performance counters on ARM are 32-bits wide but atomic64_t
    variables are used to represent counter data in the hw_perf_event structure.

    The armpmu_event_update function right-shifts a signed 64-bit delta variable
    and adds the result to the event count. This can lead to shifting in sign-bits
    if the MSB of the 32-bit counter value is set. This results in perf output
    such as:

     Performance counter stats for 'sleep 20':

     18446744073460670464  cycles             <-- 0xFFFFFFFFF12A6000
            7783773  instructions             #      0.000 IPC
                465  context-switches
                161  page-faults
            1172393  branches

       20.154242147  seconds time elapsed

    This patch ensures that the delta value is treated as unsigned so that the
    right shift sets the upper bits to zero.

Acked-by: Will Deacon <b913f13ef92ac157955c954ccaaff7be065faba4@arm.com>
Acked-by: David Daney <0662de36cfb0706ed279bff52abef14720945acc@caviumnetworks.com>
Signed-off-by: Deng-Cheng Zhu <6450bd59f6a4396d6c98d1ea08e75894ab0b4cda@gmail.com>
To: 645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl
To: e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com
To: b913f13ef92ac157955c954ccaaff7be065faba4@arm.com
Cc: 562397917b9a8bf316569a848858b12fb417723f@linux-mips.org
Cc: 2578944098299abf708b08eff6fcf60565553586@vger.kernel.org
Cc: 0f93e24a900c64af20f0433e44e890fcc03d0233@gmail.com
Cc: 19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org
Cc: 9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu
Cc: 293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com
Cc: 1fa2ef4755a9226cb9a0a4840bd89b158ac71391@console-pimps.org
Cc: 38a867ea26f35d3eeb42270f1bc7b9d1d135e6a2@mvista.com
Patchwork: http://patchwork.linux-mips.org/patch/2015/
Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>

KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs