Re: [PATCH v2] coresight: Fix scheduling while atomic in coresight_put_percpu_source_ref()
From: Sebastian Andrzej Siewior
Date: Thu Jul 16 2026 - 08:32:56 EST
On 2026-07-16 06:07:35 [+0300], MOHAMED AYMAN wrote:
> Hi Sebastian,
Hi,
> The fix would simply be rewriting `coresight_cpu_get_active_path()` like this:
>
> static struct coresight_path *coresight_cpu_get_active_path(enum cs_mode mode)
> {
> struct coresight_device *source;
> struct coresight_path *path = NULL;
>
> guard(raw_spinlock_irqsave)(&coresight_dev_lock);
>
> source = per_cpu(csdev_source, smp_processor_id());
> if (source && (coresight_get_mode(source) & mode))
> path = source->path;
>
> return path;
> }
>
> This means we don't need `coresight_put_percpu_source_ref()` inside
> the PM path at all.
>
> Does this align with your suggestion !??
> If so, I will prepare a v3 patch that drops the workqueue architecture
> entirely and just applies this much simpler fix..
It looks doable. I don't know what the lifetime expectation is of the
`path' but this returns `path' object on the same rules without the
get/put dance. So yes, why not.
> Best regards,
> Mohamed Ayman
Sebastian