android_kernel_motorola_sm6225/drivers/hwtracing
Guilherme G. Piccoli d7b69816dd coresight: cpu-debug: Replace mutex with mutex_trylock on panic notifier
[ Upstream commit 1adff542d67a2ed1120955cb219bfff8a9c53f59 ]

The panic notifier infrastructure executes registered callbacks when
a panic event happens - such callbacks are executed in atomic context,
with interrupts and preemption disabled in the running CPU and all other
CPUs disabled. That said, mutexes in such context are not a good idea.

This patch replaces a regular mutex with a mutex_trylock safer approach;
given the nature of the mutex used in the driver, it should be pretty
uncommon being unable to acquire such mutex in the panic path, hence
no functional change should be observed (and if it is, that would be
likely a deadlock with the regular mutex).

Fixes: 2227b7c746 ("coresight: add support for CPU debug module")
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20220427224924.592546-10-gpiccoli@igalia.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-14 16:59:32 +02:00
..
coresight coresight: cpu-debug: Replace mutex with mutex_trylock on panic notifier 2022-06-14 16:59:32 +02:00
intel_th intel_th: Wait until port is in reset before programming it 2021-07-20 16:16:10 +02:00
stm stm class: Fix module init return on allocation failure 2021-01-27 11:05:40 +01:00
Kconfig hwtracing: Add HW tracing support menu 2018-03-29 13:38:10 +03:00