linux/drivers/hwtracing/coresight
Yabin Cui d3416b89ce coresight: Serialize enabling/disabling a link device.
commit edda32dabe upstream.

When tracing etm data of multiple threads on multiple cpus through perf
interface, some link devices are shared between paths of different cpus.
It creates race conditions when different cpus wants to enable/disable
the same link device at the same time.

Example 1:
Two cpus want to enable different ports of a coresight funnel, thus
calling the funnel enable operation at the same time. But the funnel
enable operation isn't reentrantable.

Example 2:
For an enabled coresight dynamic replicator with refcnt=1, one cpu wants
to disable it, while another cpu wants to enable it. Ideally we still have
an enabled replicator with refcnt=1 at the end. But in reality the result
is uncertain.

Since coresight devices claim themselves when enabled for self-hosted
usage, the race conditions above usually make the link devices not usable
after many cycles.

To fix the race conditions, this patch uses spinlocks to serialize
enabling/disabling link devices.

Fixes: a06ae8609b ("coresight: add CoreSight core layer framework")
Signed-off-by: Yabin Cui <yabinc@google.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: stable <stable@vger.kernel.org> # 5.3
Link: https://lore.kernel.org/r/20191104181251.26732-14-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 19:56:41 +01:00
..
Kconfig
Makefile
coresight-catu.c
coresight-catu.h
coresight-cpu-debug.c
coresight-etb10.c
coresight-etm-cp14.c
coresight-etm-perf.c
coresight-etm-perf.h
coresight-etm.h
coresight-etm3x-sysfs.c
coresight-etm3x.c
coresight-etm4x-sysfs.c
coresight-etm4x.c
coresight-etm4x.h
coresight-funnel.c coresight: Serialize enabling/disabling a link device. 2019-12-17 19:56:41 +01:00
coresight-platform.c
coresight-priv.h
coresight-replicator.c coresight: Serialize enabling/disabling a link device. 2019-12-17 19:56:41 +01:00
coresight-stm.c
coresight-tmc-etf.c coresight: Serialize enabling/disabling a link device. 2019-12-17 19:56:41 +01:00
coresight-tmc-etr.c
coresight-tmc.c
coresight-tmc.h
coresight-tpiu.c
coresight.c coresight: Serialize enabling/disabling a link device. 2019-12-17 19:56:41 +01:00