Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: perf: Do not write event type for cycle counter
@ 2019-03-28  9:49 Julien Thierry
  2019-04-01  8:02 ` Mark Rutland
  0 siblings, 1 reply; 7+ messages in thread
From: Julien Thierry @ 2019-03-28  9:49 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Mark Rutland, Julien Thierry, Peter Zijlstra, Catalin Marinas,
	Jiri Olsa, Will Deacon, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Ingo Molnar, huawei.libin, guohanjun,
	Namhyung Kim, liwei391

Perf events using the dedicated cycle counter do not need to program the
event type, the counter only ever counts that kind of events.

Even worse, trying to program an event type without excluding the
cycle counter index might end up in the modification of the type of
event counted by another perf event.

Reported-by: Wei Li <liwei391@huawei.com>
Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
---
 arch/arm64/kernel/perf_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index 4addb38..3f898bc 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -514,7 +514,7 @@ static inline void armv8pmu_write_event_type(struct perf_event *event)

 		armv8pmu_write_evtype(idx - 1, hwc->config_base);
 		armv8pmu_write_evtype(idx, chain_evt);
-	} else {
+	} else if (idx != ARMV8_IDX_CYCLE_COUNTER) {
 		armv8pmu_write_evtype(idx, hwc->config_base);
 	}
 }
--
1.9.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-03 14:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-28  9:49 [PATCH] arm64: perf: Do not write event type for cycle counter Julien Thierry
2019-04-01  8:02 ` Mark Rutland
2019-04-02 15:42   ` Julien Thierry
2019-04-03  3:10     ` Mark Rutland
2019-04-03  7:26       ` Julien Thierry
2019-04-03 13:54         ` Will Deacon
2019-04-03 14:09           ` Julien Thierry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox