]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
coresight: cti: Make spinlock usage consistent
authorLeo Yan <leo.yan@arm.com>
Thu, 26 Feb 2026 09:23:49 +0000 (09:23 +0000)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Tue, 3 Mar 2026 10:23:45 +0000 (10:23 +0000)
commitef7d4aaf686785b8b0f70c9fe373fb5455d3e5b5
treeff77164e3e19db9f84961dfd7901d59d533cdfbd
parent061c39a17136376f368a6082d4948301641f7db1
coresight: cti: Make spinlock usage consistent

The spinlock is acquired sometimes with IRQs disabled and sometimes
without.  This leads to inconsistent semantics: the lock can be either
HARDIRQ-safe or HARDIRQ-unsafe, which may trigger lockdep complaints.

Make spinlock usage consistent by acquiring it with disabling IRQs.  It
is possible for sysfs knobs to acquire the spinlock for accessing a
CTI device, while at the same time a perf session sends an IPI to
enable the same CTI device.  In this case, the spinlock must be
IRQ-safe, which is why all lock acquisitions are changed to disable
IRQs.

Use guard() and scoped_guard() for spinlock to tidy up the code.

Fixes: 984f37efa385 ("coresight: cti: Write regsiters directly in cti_enable_hw()")
Tested-by: James Clark <james.clark@linaro.org>
Reviewed-by: Mike Leach <mike.leach@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20260226-arm_coresight_cti_refactor_v1-v2-1-b30fada3cfec@arm.com
drivers/hwtracing/coresight/coresight-cti-core.c
drivers/hwtracing/coresight/coresight-cti-sysfs.c