coresight: perf: Fix per cpu path management
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Thu, 20 Sep 2018 19:17:47 +0000 (13:17 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Nov 2019 17:00:36 +0000 (18:00 +0100)
commitb6d0dacc13bd1f69eca981d62ab1445046ff3953
tree4bc945f8c796a8ef2a15d1daa72ae793bab19bde
parentbd1810421faad894bac51a378889665b3de476d8
coresight: perf: Fix per cpu path management

[ Upstream commit 5ecabe4a76e8cdb61fa3e24862d9ca240a1c4ddf ]

We create a coresight trace path for each online CPU when
we start the event. We rely on the number of online CPUs
and then go on to allocate an array matching the "number of
online CPUs" for holding the path and then uses normal
CPU id as the index to the array. This is problematic as
we could have some offline CPUs causing us to access beyond
the actual array size (e.g, on a dual SMP system, if CPU0 is
offline, CPU1 could be really accessing beyond the array).
The solution is to switch to per-cpu array for holding the path.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwtracing/coresight/coresight-etm-perf.c