Skip to content

Commit 56eb02f

Browse files
LeviYeoReumSuzuki K Poulose
authored andcommitted
coresight-funnel: change funnel_drvdata spinlock's type to raw_spinlock_t
In coresight-funnel drivers, cti_drvdata->spinlock can be held during __schedule() by perf_event_task_sched_out()/in(). Since funnel_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 funnel_drvdata->spinlock in coresight-funnel drivers, which can be called by perf_event_task_sched_out()/in(), from spinlock_t 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-7-yeoreum.yun@arm.com
1 parent 6b80c0a commit 56eb02f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/hwtracing/coresight/coresight-funnel.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct funnel_drvdata {
4747
struct clk *pclk;
4848
struct coresight_device *csdev;
4949
unsigned long priority;
50-
spinlock_t spinlock;
50+
raw_spinlock_t spinlock;
5151
};
5252

5353
static int dynamic_funnel_enable_hw(struct funnel_drvdata *drvdata, int port)
@@ -85,7 +85,7 @@ static int funnel_enable(struct coresight_device *csdev,
8585
unsigned long flags;
8686
bool first_enable = false;
8787

88-
spin_lock_irqsave(&drvdata->spinlock, flags);
88+
raw_spin_lock_irqsave(&drvdata->spinlock, flags);
8989
if (in->dest_refcnt == 0) {
9090
if (drvdata->base)
9191
rc = dynamic_funnel_enable_hw(drvdata, in->dest_port);
@@ -94,7 +94,7 @@ static int funnel_enable(struct coresight_device *csdev,
9494
}
9595
if (!rc)
9696
in->dest_refcnt++;
97-
spin_unlock_irqrestore(&drvdata->spinlock, flags);
97+
raw_spin_unlock_irqrestore(&drvdata->spinlock, flags);
9898

9999
if (first_enable)
100100
dev_dbg(&csdev->dev, "FUNNEL inport %d enabled\n",
@@ -129,13 +129,13 @@ static void funnel_disable(struct coresight_device *csdev,
129129
unsigned long flags;
130130
bool last_disable = false;
131131

132-
spin_lock_irqsave(&drvdata->spinlock, flags);
132+
raw_spin_lock_irqsave(&drvdata->spinlock, flags);
133133
if (--in->dest_refcnt == 0) {
134134
if (drvdata->base)
135135
dynamic_funnel_disable_hw(drvdata, in->dest_port);
136136
last_disable = true;
137137
}
138-
spin_unlock_irqrestore(&drvdata->spinlock, flags);
138+
raw_spin_unlock_irqrestore(&drvdata->spinlock, flags);
139139

140140
if (last_disable)
141141
dev_dbg(&csdev->dev, "FUNNEL inport %d disabled\n",
@@ -266,7 +266,7 @@ static int funnel_probe(struct device *dev, struct resource *res)
266266
}
267267
dev->platform_data = pdata;
268268

269-
spin_lock_init(&drvdata->spinlock);
269+
raw_spin_lock_init(&drvdata->spinlock);
270270
desc.type = CORESIGHT_DEV_TYPE_LINK;
271271
desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_MERG;
272272
desc.ops = &funnel_cs_ops;

0 commit comments

Comments
 (0)