Re: [PATCH] coresight: etm3x: convert struct etm_drvdata's spinlock to raw_spinlock
From: Sebastian Siewior
Date: Mon Aug 07 2023 - 09:41:19 EST
On 2023-07-11 15:05:36 [+0800], quanyang.wang@xxxxxxxxxxxxx wrote:
> diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c
> index 116a91d90ac2..af34fb82f4bb 100644
> --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c
> @@ -518,7 +518,7 @@ static int etm_enable_sysfs(struct coresight_device *csdev)
> struct etm_enable_arg arg = { };
> int ret;
>
> - spin_lock(&drvdata->spinlock);
> + raw_spin_lock(&drvdata->spinlock);
>
> /* sysfs needs to allocate and set a trace ID */
> ret = etm_read_alloc_trace_id(drvdata);
This is not going to work because etm_read_alloc_trace_id() acquires
later in the call chain id_map_lock which is a spinlock_t.
This should also lead to a splat like the one you complain about.
Sebastian