linux-stable/drivers/hwtracing/coresight
Mike Leach 03fb59c943 coresight: syscfg: Update load and unload operations
[ Upstream commit 8add26f7ef ]

The configfs system is a source of access to the config information in the
configuration and feature lists.

This can result in additional LOCKDEP issues as a result of the mutex
ordering between the config list mutex (cscfg_mutex) and the configfs
system mutexes.

As such we need to adjust how load/unload operations work to ensure correct
operation.

1) Previously the cscfg_mutex was held throughout the load/unload
operation. This is now only held during configuration list manipulations,
resulting in a multi-stage load/unload process.

2) All operations that manipulate the configfs representation of the
configurations and features are now separated out and run without the
cscfg_mutex being held. This avoids circular lock_dep issue with the
built-in configfs mutexes and semaphores

3) As the load and unload is now multi-stage, some parts under the
cscfg_mutex and others not:
i) A flag indicating a load / unload operation in progress is used to
serialise load / unload operations.
ii) activating any configuration not possible when unload is in progress.
iii) Configurations have an "available" flag set only after the last load
stage for the configuration is complete. Activation of the configuration
not possible till flag is set.

4) Following load/unload rules remain:
i) Unload prevented while any configuration is active remains.
ii) Unload in strict reverse order of load.
iii) Existing configurations can be activated while a new load operation
is underway. (by definition there can be no dependencies between an
existing configuration and a new loading one due to ii) above.)

Fixes: eb2ec49606 ("coresight: syscfg: Update load API for config loadable modules")
Reported-by: Suzuki Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mike Leach <mike.leach@linaro.org>
Reviewed-and-tested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20220628173004.30002-3-mike.leach@linaro.org
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-17 14:41:39 +02:00
..
coresight-catu.c Merge branch 'devel-stable' of git://git.armlinux.org.uk/~rmk/linux-arm into char-misc-next 2021-02-05 11:15:43 +01:00
coresight-catu.h
coresight-cfg-afdo.c coresight: config: Add preloaded configurations 2021-08-18 22:33:28 +02:00
coresight-cfg-preload.c coresight: configuration: Update API to introduce load owner concept 2021-11-26 11:27:21 -07:00
coresight-cfg-preload.h coresight: config: Add preloaded configurations 2021-08-18 22:33:28 +02:00
coresight-config.c coresight: config: Add configuration and feature generic functions 2021-08-18 22:33:27 +02:00
coresight-config.h coresight: syscfg: Update load and unload operations 2022-08-17 14:41:39 +02:00
coresight-core.c coresight: Clear the connection field properly 2022-08-17 14:40:18 +02:00
coresight-cpu-debug.c coresight: cpu-debug: Replace mutex with mutex_trylock on panic notifier 2022-06-14 18:44:50 +02:00
coresight-cti-core.c coresight: cti: Correct the parameter for pm_runtime_put 2021-10-27 11:44:26 -06:00
coresight-cti-platform.c coresight: cti: Reduce scope for the variable 'cs_fwnode' in cti_plat_create_connection() 2021-02-04 17:00:32 +01:00
coresight-cti-sysfs.c coresight: cti: Initialize dynamic sysfs attributes 2020-10-29 20:10:25 +01:00
coresight-cti.h
coresight-etb10.c coresight: Update comments for removing cs_etm_find_snapshot() 2021-10-27 11:44:50 -06:00
coresight-etm-cp14.c
coresight-etm-perf.c coresight: etm-pmu: Ensure the AUX handle is valid 2021-10-27 11:45:20 -06:00
coresight-etm-perf.h coresight: etm-perf: Update to activate selected configuration 2021-08-18 22:33:28 +02:00
coresight-etm.h
coresight-etm3x-core.c coresight: etm3x: Don't trace PID for non-root PID namespace 2022-03-11 10:07:55 +00:00
coresight-etm3x-sysfs.c
coresight-etm4x-cfg.c coresight: etm4x: Add complex configuration handlers to etmv4 2021-08-18 22:33:28 +02:00
coresight-etm4x-cfg.h coresight: config: Add preloaded configurations 2021-08-18 22:33:28 +02:00
coresight-etm4x-core.c coresight: etm4x: Don't trace PID for non-root PID namespace 2022-03-11 10:07:53 +00:00
coresight-etm4x-sysfs.c coresight: etm4x: Don't use virtual contextID for non-root PID namespace 2022-03-11 10:07:50 +00:00
coresight-etm4x.h coresight: etm4x: Use Trace Filtering controls dynamically 2021-10-27 11:45:18 -06:00
coresight-funnel.c Merge branch 'devel-stable' of git://git.armlinux.org.uk/~rmk/linux-arm into char-misc-next 2021-02-05 11:15:43 +01:00
coresight-platform.c hwtracing: coresight: Replace acpi_bus_get_device() 2022-03-11 10:07:34 +00:00
coresight-priv.h coresight: core: Add support for dedicated percpu sinks 2021-04-06 16:05:38 -06:00
coresight-replicator.c Merge branch 'devel-stable' of git://git.armlinux.org.uk/~rmk/linux-arm into char-misc-next 2021-02-05 11:15:43 +01:00
coresight-self-hosted-trace.h coresight: trbe: Prohibit trace before disabling TRBE 2021-10-27 11:45:33 -06:00
coresight-stm.c coresight: Use devm_bitmap_zalloc when applicable 2021-11-16 10:13:21 -07:00
coresight-syscfg-configfs.c coresight: configfs: Allow configfs to activate configuration 2021-11-26 11:34:27 -07:00
coresight-syscfg-configfs.h coresight: configfs: Allow configfs to activate configuration 2021-11-26 11:34:27 -07:00
coresight-syscfg.c coresight: syscfg: Update load and unload operations 2022-08-17 14:41:39 +02:00
coresight-syscfg.h coresight: syscfg: Update load and unload operations 2022-08-17 14:41:39 +02:00
coresight-sysfs.c
coresight-tmc-core.c coresight: tmc: Configure AXI write burst size 2021-10-27 11:44:34 -06:00
coresight-tmc-etf.c coresight: Update comments for removing cs_etm_find_snapshot() 2021-10-27 11:44:50 -06:00
coresight-tmc-etr.c coresight: tmc-etr: Speed up for bounce buffer in flat mode 2021-10-27 11:44:52 -06:00
coresight-tmc.h coresight: tmc: Configure AXI write burst size 2021-10-27 11:44:34 -06:00
coresight-tpiu.c Merge branch 'devel-stable' of git://git.armlinux.org.uk/~rmk/linux-arm into char-misc-next 2021-02-05 11:15:43 +01:00
coresight-trbe.c coresight: trbe: Move check for kernel page table isolation from EL0 to probe 2022-03-11 10:07:43 +00:00
coresight-trbe.h coresight: trbe: Work around the ignored system register writes 2022-03-11 10:06:35 +00:00
Kconfig coresight: cpu-debug: Control default behavior via Kconfig 2021-10-27 11:44:30 -06:00
Makefile coresight: syscfg: Add initial configfs support 2021-08-18 22:33:28 +02:00