1
0
Fork 0
alistair23-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 docs: fix a couple of new broken references 2019-07-31 14:12:26 -06:00
Makefile coresight: Rename of_coresight to coresight-platform 2019-06-20 07:56:10 +02:00
coresight-catu.c coresight: Use platform agnostic names 2019-06-20 07:56:13 +02:00
coresight-catu.h coresight: catu: Cleanup device specific data 2019-06-19 20:29:14 +02:00
coresight-cpu-debug.c coresight: cpu-debug: Add support for Qualcomm Kryo 2019-09-03 22:01:15 +02:00
coresight-etb10.c coresight: etb10: Do not call smp_processor_id from preemptible 2019-07-03 21:15:33 +02:00
coresight-etm-cp14.c coresight: Moving framework and drivers to SPDX identifier 2018-05-14 16:19:59 +02:00
coresight-etm-perf.c coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute 2019-08-01 20:51:34 +02:00
coresight-etm-perf.h coresight: perf: Add "sinks" group to PMU directory 2019-02-08 12:27:36 +01:00
coresight-etm.h coresight: etm: Clean up device specific data 2019-06-19 20:29:14 +02:00
coresight-etm3x-sysfs.c coresight: etm: Clean up device specific data 2019-06-19 20:29:14 +02:00
coresight-etm3x.c coresight: Do not default to CPU0 for missing CPU phandle 2019-07-04 12:23:26 +02:00
coresight-etm4x-sysfs.c coresight: etm4x: Fix input validation for sysfs. 2019-12-13 08:42:43 +01:00
coresight-etm4x.c coresight: etm4x: improve clarity of etm4_os_unlock comment 2019-09-03 22:01:17 +02:00
coresight-etm4x.h coresight: etm: Clean up device specific data 2019-06-19 20:29:14 +02:00
coresight-funnel.c coresight: Serialize enabling/disabling a link device. 2019-12-17 19:56:41 +01:00
coresight-platform.c drivers: Introduce device lookup variants by fwnode 2019-07-30 13:07:42 +02:00
coresight-priv.h Char/Misc driver patches for 5.4-rc1 2019-09-18 11:14:31 -07:00
coresight-replicator.c coresight: Serialize enabling/disabling a link device. 2019-12-17 19:56:41 +01:00
coresight-stm.c coresight: stm: ACPI support for parsing stimulus base 2019-06-20 07:56:14 +02:00
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-etr: Add barrier packets when moving offset forward 2019-09-03 22:01:18 +02:00
coresight-tmc.c coresight: tmc: Make memory width mask computation into a function 2019-09-03 22:01:18 +02:00
coresight-tmc.h coresight: tmc: Make memory width mask computation into a function 2019-09-03 22:01:18 +02:00
coresight-tpiu.c coresight: Use platform agnostic names 2019-06-20 07:56:13 +02:00
coresight.c coresight: Serialize enabling/disabling a link device. 2019-12-17 19:56:41 +01:00