Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

coresight: change coresight_trace_id_map's lock type to raw_spinlock_t

coresight_trace_id_map->lock can be acquired while coresight devices'
drvdata_lock.

But the drvdata_lock can be raw_spinlock_t (i.e) coresight-etm4x.

To address this, change type of coresight_trace_id_map->lock to
raw_spinlock_t

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250306121110.1647948-4-yeoreum.yun@arm.com

authored by

Yeoreum Yun and committed by
Suzuki K Poulose
4cf364ca 743c5a97

+13 -13
+1 -1
drivers/hwtracing/coresight/coresight-core.c
··· 1296 1296 1297 1297 if (csdev->type == CORESIGHT_DEV_TYPE_SINK || 1298 1298 csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) { 1299 - spin_lock_init(&csdev->perf_sink_id_map.lock); 1299 + raw_spin_lock_init(&csdev->perf_sink_id_map.lock); 1300 1300 csdev->perf_sink_id_map.cpu_map = alloc_percpu(atomic_t); 1301 1301 if (!csdev->perf_sink_id_map.cpu_map) { 1302 1302 kfree(csdev);
+11 -11
drivers/hwtracing/coresight/coresight-trace-id.c
··· 22 22 static DEFINE_PER_CPU(atomic_t, id_map_default_cpu_ids) = ATOMIC_INIT(0); 23 23 static struct coresight_trace_id_map id_map_default = { 24 24 .cpu_map = &id_map_default_cpu_ids, 25 - .lock = __SPIN_LOCK_UNLOCKED(id_map_default.lock) 25 + .lock = __RAW_SPIN_LOCK_UNLOCKED(id_map_default.lock) 26 26 }; 27 27 28 28 /* #define TRACE_ID_DEBUG 1 */ ··· 131 131 unsigned long flags; 132 132 int cpu; 133 133 134 - spin_lock_irqsave(&id_map->lock, flags); 134 + raw_spin_lock_irqsave(&id_map->lock, flags); 135 135 bitmap_zero(id_map->used_ids, CORESIGHT_TRACE_IDS_MAX); 136 136 for_each_possible_cpu(cpu) 137 137 atomic_set(per_cpu_ptr(id_map->cpu_map, cpu), 0); 138 - spin_unlock_irqrestore(&id_map->lock, flags); 138 + raw_spin_unlock_irqrestore(&id_map->lock, flags); 139 139 DUMP_ID_MAP(id_map); 140 140 } 141 141 ··· 144 144 unsigned long flags; 145 145 int id; 146 146 147 - spin_lock_irqsave(&id_map->lock, flags); 147 + raw_spin_lock_irqsave(&id_map->lock, flags); 148 148 149 149 /* check for existing allocation for this CPU */ 150 150 id = _coresight_trace_id_read_cpu_id(cpu, id_map); ··· 171 171 atomic_set(per_cpu_ptr(id_map->cpu_map, cpu), id); 172 172 173 173 get_cpu_id_out_unlock: 174 - spin_unlock_irqrestore(&id_map->lock, flags); 174 + raw_spin_unlock_irqrestore(&id_map->lock, flags); 175 175 176 176 DUMP_ID_CPU(cpu, id); 177 177 DUMP_ID_MAP(id_map); ··· 188 188 if (!id) 189 189 return; 190 190 191 - spin_lock_irqsave(&id_map->lock, flags); 191 + raw_spin_lock_irqsave(&id_map->lock, flags); 192 192 193 193 coresight_trace_id_free(id, id_map); 194 194 atomic_set(per_cpu_ptr(id_map->cpu_map, cpu), 0); 195 195 196 - spin_unlock_irqrestore(&id_map->lock, flags); 196 + raw_spin_unlock_irqrestore(&id_map->lock, flags); 197 197 DUMP_ID_CPU(cpu, id); 198 198 DUMP_ID_MAP(id_map); 199 199 } ··· 204 204 unsigned long flags; 205 205 int id; 206 206 207 - spin_lock_irqsave(&id_map->lock, flags); 207 + raw_spin_lock_irqsave(&id_map->lock, flags); 208 208 id = coresight_trace_id_alloc_new_id(id_map, preferred_id, traceid_flags); 209 - spin_unlock_irqrestore(&id_map->lock, flags); 209 + raw_spin_unlock_irqrestore(&id_map->lock, flags); 210 210 211 211 DUMP_ID(id); 212 212 DUMP_ID_MAP(id_map); ··· 217 217 { 218 218 unsigned long flags; 219 219 220 - spin_lock_irqsave(&id_map->lock, flags); 220 + raw_spin_lock_irqsave(&id_map->lock, flags); 221 221 coresight_trace_id_free(id, id_map); 222 - spin_unlock_irqrestore(&id_map->lock, flags); 222 + raw_spin_unlock_irqrestore(&id_map->lock, flags); 223 223 224 224 DUMP_ID(id); 225 225 DUMP_ID_MAP(id_map);
+1 -1
include/linux/coresight.h
··· 239 239 DECLARE_BITMAP(used_ids, CORESIGHT_TRACE_IDS_MAX); 240 240 atomic_t __percpu *cpu_map; 241 241 atomic_t perf_cs_etm_session_active; 242 - spinlock_t lock; 242 + raw_spinlock_t lock; 243 243 }; 244 244 245 245 /**