[PATCH v5 8/9] coresight-tmc: change tmc_drvdata spinlock's type to raw_spinlock_t

Suzuki K Poulose suzuki.poulose at arm.com
Thu Mar 6 02:25:37 PST 2025


Hi Levi,

On 06/03/2025 09:47, Yeoreum Yun wrote:
> In coresight-tmc drivers, tmc_drvdata->spinlock can be held
> during __schedule() by perf_event_task_sched_out()/in().
> 
> Since tmc_drvdata->spinlock type is spinlock_t and
> perf_event_task_sched_out()/in() is called after acquiring rq_lock,
> which is raw_spinlock_t (an unsleepable lock),
> this poses an issue in PREEMPT_RT kernel where spinlock_t is sleepable.
> 
> To address this, change type tmc_drvdata->spinlock in coresight-tmc drivers,
> which can be called by perf_event_task_sched_out()/in(),
> from spinlock_t to raw_spinlock_t.
> 
> Reviewed-by: James Clark <james.clark at linaro.org>
> Reviewed-by: Mike Leach <mike.leach at linaro.org>
> Signed-off-by: Yeoreum Yun <yeoreum.yun at arm.com>


Unfortunately, this still doesn't cover the current coresight next 
branch. I get build errors as below :

"[PATCH] coresight-tmc: change tmc_drvdata spinlock's type to" has style 
problems, please review. This is because, we merged the coresight panic
trace support in the coresight next, on 21st Feb.


NOTE: If any of the errors are false positives, please report
       them to the maintainer, see CHECKPATCH in MAINTAINERS.
   CALL    scripts/checksyscalls.sh
   CC [M]  drivers/hwtracing/coresight/coresight-tmc-core.o
   CC [M]  drivers/hwtracing/coresight/coresight-tmc-etf.o
   CC [M]  drivers/hwtracing/coresight/coresight-tmc-etr.o
   CC [M]  drivers/hwtracing/coresight/coresight-catu.o
In file included from ./include/linux/mmzone.h:8,
                  from ./include/linux/gfp.h:7,
                  from ./include/linux/slab.h:16,
                  from ./include/linux/resource_ext.h:11,
                  from ./include/linux/acpi.h:13,
                  from drivers/hwtracing/coresight/coresight-tmc-core.c:7:
drivers/hwtracing/coresight/coresight-tmc-core.c: In function 
‘tmc_crashdata_open’:
drivers/hwtracing/coresight/coresight-tmc-core.c:361:20: error: passing 
argument 1 of ‘spinlock_check’ from incompatible pointer type 
[-Werror=incompatible-pointer-types]
   361 |  spin_lock_irqsave(&drvdata->spinlock, flags);
       |                    ^~~~~~~~~~~~~~~~~~
       |                    |
       |                    raw_spinlock_t * {aka struct raw_spinlock *}
./include/linux/spinlock.h:244:34: note: in definition of macro 
‘raw_spin_lock_irqsave’
   244 |   flags = _raw_spin_lock_irqsave(lock); \
       |                                  ^~~~
drivers/hwtracing/coresight/coresight-tmc-core.c:361:2: note: in 
expansion of macro ‘spin_lock_irqsave’
   361 |  spin_lock_irqsave(&drvdata->spinlock, flags);
       |  ^~~~~~~~~~~~~~~~~
In file included from ./include/linux/mmzone.h:8,
                  from ./include/linux/gfp.h:7,
                  from ./include/linux/slab.h:16,
                  from ./include/linux/resource_ext.h:11,
                  from ./include/linux/acpi.h:13,
                  from drivers/hwtracing/coresight/coresight-tmc-core.c:7:
./include/linux/spinlock.h:324:67: note: expected ‘spinlock_t *’ {aka 
‘struct spinlock *’} but argument is of type ‘raw_spinlock_t *’ {aka 
‘struct raw_spinlock *’}
   324 | static __always_inline raw_spinlock_t 
*spinlock_check(spinlock_t *lock)


Cheers
Suzuki




More information about the linux-arm-kernel mailing list