linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] coresight: Fix CTI module refcount leak by making it a helper device
@ 2023-03-08 17:38 James Clark
  2023-03-08 17:38 ` [PATCH 1/8] coresight: Use enum type for cs_mode wherever possible James Clark
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: James Clark @ 2023-03-08 17:38 UTC (permalink / raw)
  To: coresight
  Cc: James Clark, Mathieu Poirier, Suzuki K Poulose, Mike Leach,
	Leo Yan, Alexander Shishkin, linux-arm-kernel, linux-kernel

Currently there is a refcount leak in CTI when using system wide mode
or tracing multithreaded applications. See the last commit for a
reproducer. This prevents the module from being unloaded.

Historically there have been a few issues and fixes attempted around
here which have resulted in some extra logic and a member to keep
track of CTI being enabled 'struct coresight_device->ect_enabled'.
The fix in commit 665c157e0204 ("coresight: cti: Fix hang in
cti_disable_hw()") was also related to CTI having its own
enable/disable path which came later than other devices.

If we make CTI a helper device and enable helper devices adjacent to
the path we get very similar enable/disable behavior to now, but with
more reuse of the existing reference counting logic in the coresight
core code. This also affects CATU which can have a little bit of
its hard coded enable/disable code removed.

Enabling CATU on the generic path does require that input connections
are tracked so that it can get its associated ETR buffer.

Applies to coresight/next (669c4614236a7) but also requires the
realloc_array patch here [1].

Also available in full here [2].

[1]: https://lore.kernel.org/linux-arm-kernel/20230306152723.3090195-1-james.clark@arm.com/
[2]: https://gitlab.arm.com/linux-arm/linux-jc/-/tree/james-cs-cti-module-refcount-fix-v1

James Clark (8):
  coresight: Use enum type for cs_mode wherever possible
  coresight: Change name of pdata->conns
  coresight: Rename nr_outports to nr_outconns
  coresight: Dynamically add connections
  coresight: Store in-connections as well as out-connections
  coresight: Refactor out buffer allocation function for ETR
  coresight: Enable and disable helper devices adjacent to the path
  coresight: Fix CTI module refcount leak by making it a helper device

 drivers/hwtracing/coresight/coresight-catu.c  |  34 ++-
 drivers/hwtracing/coresight/coresight-core.c  | 258 +++++++++++-------
 .../hwtracing/coresight/coresight-cti-core.c  |  56 ++--
 .../hwtracing/coresight/coresight-cti-sysfs.c |   4 +-
 drivers/hwtracing/coresight/coresight-cti.h   |   4 +-
 drivers/hwtracing/coresight/coresight-etb10.c |   3 +-
 .../coresight/coresight-etm3x-core.c          |   6 +-
 .../coresight/coresight-etm4x-core.c          |   6 +-
 .../hwtracing/coresight/coresight-platform.c  | 168 +++++++++---
 drivers/hwtracing/coresight/coresight-priv.h  |   9 +-
 drivers/hwtracing/coresight/coresight-stm.c   |   6 +-
 drivers/hwtracing/coresight/coresight-sysfs.c |   1 -
 .../hwtracing/coresight/coresight-tmc-etf.c   |   2 +-
 .../hwtracing/coresight/coresight-tmc-etr.c   |  88 +++---
 drivers/hwtracing/coresight/coresight-tmc.h   |   2 +
 drivers/hwtracing/coresight/coresight-tpdm.c  |   4 +-
 drivers/hwtracing/coresight/coresight-tpiu.c  |   3 +-
 drivers/hwtracing/coresight/coresight-trbe.c  |   3 +-
 drivers/hwtracing/coresight/ultrasoc-smb.c    |   3 +-
 drivers/hwtracing/coresight/ultrasoc-smb.h    |   2 +-
 include/linux/coresight.h                     |  92 ++++---
 21 files changed, 483 insertions(+), 271 deletions(-)

-- 
2.34.1


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

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

end of thread, other threads:[~2023-03-09 10:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-08 17:38 [PATCH 0/8] coresight: Fix CTI module refcount leak by making it a helper device James Clark
2023-03-08 17:38 ` [PATCH 1/8] coresight: Use enum type for cs_mode wherever possible James Clark
2023-03-08 17:38 ` [PATCH 2/8] coresight: Change name of pdata->conns James Clark
2023-03-08 17:38 ` [PATCH 3/8] coresight: Rename nr_outports to nr_outconns James Clark
2023-03-08 17:38 ` [PATCH 4/8] coresight: Dynamically add connections James Clark
2023-03-08 17:38 ` [PATCH 5/8] coresight: Store in-connections as well as out-connections James Clark
2023-03-09 10:09   ` Suzuki K Poulose
2023-03-08 17:39 ` [PATCH 6/8] coresight: Refactor out buffer allocation function for ETR James Clark
2023-03-09  8:18   ` kernel test robot
2023-03-08 17:39 ` [PATCH 7/8] coresight: Enable and disable helper devices adjacent to the path James Clark
2023-03-08 17:39 ` [PATCH 8/8] coresight: Fix CTI module refcount leak by making it a helper device James Clark
2023-03-09  8:39   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).