Yang Jihong
90639a0e19
arm_pmu: Fix write counter incorrect in ARMv7 big-endian mode
...
commit fdbef8c4e68ad423416aa6cc93d1616d6f8ac5b3 upstream.
Commit 3a95200d3f89 ("arm_pmu: Change API to support 64bit counter values")
changes the input "value" type from 32-bit to 64-bit, which introduces the
following problem: ARMv7 PMU counters is 32-bit width, in big-endian mode,
write counter uses high 32-bit, which writes an incorrect value.
Before:
Performance counter stats for 'ls':
2.22 msec task-clock # 0.675 CPUs utilized
0 context-switches # 0.000 K/sec
0 cpu-migrations # 0.000 K/sec
49 page-faults # 0.022 M/sec
2150476593 cycles # 966.663 GHz
2148588788 instructions # 1.00 insn per cycle
2147745484 branches # 965435.074 M/sec
2147508540 branch-misses # 99.99% of all branches
None of the above hw event counters are correct.
Solution:
"value" forcibly converted to 32-bit type before being written to PMU register.
After:
Performance counter stats for 'ls':
2.09 msec task-clock # 0.681 CPUs utilized
0 context-switches # 0.000 K/sec
0 cpu-migrations # 0.000 K/sec
46 page-faults # 0.022 M/sec
2807301 cycles # 1.344 GHz
1060159 instructions # 0.38 insn per cycle
250496 branches # 119.914 M/sec
23192 branch-misses # 9.26% of all branches
Fixes: 3a95200d3f89 ("arm_pmu: Change API to support 64bit counter values")
Cc: <stable@vger.kernel.org>
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20210430012659.232110-1-yangjihong1@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-20 16:15:39 +02:00
..
2018-01-21 15:37:56 +00:00
2021-05-22 10:59:49 +02:00
2017-09-29 13:57:21 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-18 23:07:43 -06:00
2019-02-20 10:25:38 +01:00
2017-08-16 22:25:30 +02:00
2017-11-08 19:42:43 +00:00
2017-08-16 22:25:30 +02:00
2018-05-16 07:23:35 +02:00
2017-10-12 11:29:29 +01:00
2016-04-28 11:33:53 +02:00
2017-11-16 12:50:35 -08:00
2020-06-03 08:19:34 +02:00
2019-11-24 08:20:56 +01:00
2017-06-18 22:25:16 +01:00
2020-06-03 08:19:34 +02:00
2019-04-05 22:33:12 +02:00
2017-11-02 11:10:55 +01:00
2018-12-05 19:32:09 +01:00
2019-11-06 13:06:10 +01:00
2017-09-10 19:34:53 -04:00
2020-01-27 14:50:28 +01:00
2020-12-30 11:25:50 +01:00
2016-02-08 15:48:32 +00:00
2021-05-22 10:59:42 +02:00
2020-02-05 14:43:50 +00:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-03-23 20:09:48 +01:00
2017-08-14 16:22:55 +01:00
2019-06-04 08:02:34 +02:00
2017-11-02 11:10:55 +01:00
2021-02-23 15:00:57 +01:00
2018-05-31 10:39:18 +01:00
2017-03-17 10:01:28 +00:00
2017-05-11 14:43:31 +01:00
2017-11-02 11:10:55 +01:00
2019-04-20 09:16:04 +02:00
2017-11-02 11:10:55 +01:00
2018-07-10 18:19:02 +01:00
2021-07-20 16:15:39 +02:00
2018-07-10 18:19:02 +01:00
2017-11-02 11:10:55 +01:00
2018-08-22 10:52:44 -07:00
2020-06-22 09:04:59 +02:00
2017-04-09 07:49:24 -07:00
2017-11-02 11:10:55 +01:00
2021-02-23 15:00:57 +01:00
2021-06-30 08:48:28 -04:00
2021-02-23 15:00:57 +01:00
2017-09-10 19:31:46 -04:00
2017-09-10 19:31:46 -04:00
2020-01-27 14:50:28 +01:00
2021-05-22 10:59:49 +02:00
2017-10-29 08:29:30 -07:00
2017-01-16 17:30:46 +00:00
2017-06-14 11:58:45 +02:00
2019-06-15 11:54:00 +02:00
2020-10-01 13:14:31 +02:00
2021-05-22 10:59:48 +02:00
2018-06-04 15:23:48 -07:00
2018-04-02 20:16:10 +02:00
2019-02-20 10:25:36 +01:00
2018-07-20 00:02:41 +02:00
2017-08-16 22:25:30 +02:00
2020-10-01 13:14:31 +02:00
2019-04-05 22:33:01 +02:00
2020-03-20 11:55:59 +01:00
2018-05-19 11:53:46 +01:00
2018-10-12 08:54:58 +11:00
2018-05-19 11:53:46 +01:00