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_device lock type to raw_spinlock_t

coresight_device->cscfg_csdev_lock can be held during __schedule()
by perf_event_task_sched_out()/in().

Since coresight->cscfg_csdev_lock 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 of coresight_device->cscfg_csdev_lock
from spinlock_t to raw_spinlock_t.

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

authored by

Yeoreum Yun and committed by
Suzuki K Poulose
26f060c1 ab37128a

+14 -14
+13 -13
drivers/hwtracing/coresight/coresight-syscfg.c
··· 89 89 } 90 90 /* if matched features, add config to device.*/ 91 91 if (config_csdev) { 92 - spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 92 + raw_spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 93 93 list_add(&config_csdev->node, &csdev->config_csdev_list); 94 - spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 94 + raw_spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 95 95 } 96 96 97 97 return 0; ··· 194 194 195 195 /* add to internal csdev feature list & initialise using reset call */ 196 196 cscfg_reset_feat(feat_csdev); 197 - spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 197 + raw_spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 198 198 list_add(&feat_csdev->node, &csdev->feature_csdev_list); 199 - spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 199 + raw_spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 200 200 201 201 return 0; 202 202 } ··· 765 765 766 766 INIT_LIST_HEAD(&csdev->feature_csdev_list); 767 767 INIT_LIST_HEAD(&csdev->config_csdev_list); 768 - spin_lock_init(&csdev->cscfg_csdev_lock); 768 + raw_spin_lock_init(&csdev->cscfg_csdev_lock); 769 769 770 770 return 0; 771 771 } ··· 855 855 struct cscfg_feature_csdev *feat_csdev; 856 856 unsigned long flags; 857 857 858 - spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 858 + raw_spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 859 859 if (list_empty(&csdev->feature_csdev_list)) 860 860 goto unlock_exit; 861 861 ··· 863 863 cscfg_reset_feat(feat_csdev); 864 864 865 865 unlock_exit: 866 - spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 866 + raw_spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 867 867 } 868 868 EXPORT_SYMBOL_GPL(cscfg_csdev_reset_feats); 869 869 ··· 1059 1059 * Look for matching configuration - set the active configuration 1060 1060 * context if found. 1061 1061 */ 1062 - spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 1062 + raw_spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 1063 1063 list_for_each_entry(config_csdev_item, &csdev->config_csdev_list, node) { 1064 1064 config_desc = config_csdev_item->config_desc; 1065 1065 if ((atomic_read(&config_desc->active_cnt)) && ··· 1069 1069 break; 1070 1070 } 1071 1071 } 1072 - spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 1072 + raw_spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 1073 1073 1074 1074 /* 1075 1075 * If found, attempt to enable ··· 1090 1090 * 1091 1091 * Set enabled if OK, err if not. 1092 1092 */ 1093 - spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 1093 + raw_spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 1094 1094 if (csdev->active_cscfg_ctxt) 1095 1095 config_csdev_active->enabled = true; 1096 1096 else 1097 1097 err = -EBUSY; 1098 - spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 1098 + raw_spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 1099 1099 } 1100 1100 } 1101 1101 return err; ··· 1124 1124 * If it was not enabled, we have no work to do, otherwise mark as disabled. 1125 1125 * Clear the active config pointer. 1126 1126 */ 1127 - spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 1127 + raw_spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags); 1128 1128 config_csdev = (struct cscfg_config_csdev *)csdev->active_cscfg_ctxt; 1129 1129 if (config_csdev) { 1130 1130 if (!config_csdev->enabled) ··· 1133 1133 config_csdev->enabled = false; 1134 1134 } 1135 1135 csdev->active_cscfg_ctxt = NULL; 1136 - spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 1136 + raw_spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags); 1137 1137 1138 1138 /* true if there was an enabled active config */ 1139 1139 if (config_csdev)
+1 -1
include/linux/coresight.h
··· 302 302 /* system configuration and feature lists */ 303 303 struct list_head feature_csdev_list; 304 304 struct list_head config_csdev_list; 305 - spinlock_t cscfg_csdev_lock; 305 + raw_spinlock_t cscfg_csdev_lock; 306 306 void *active_cscfg_ctxt; 307 307 }; 308 308