Re: [PATCH RESEND v2 0/3] hung_task: extend blocking task stacktrace dump to semaphore

From: Boqun Feng
Date: Fri Mar 14 2025 - 13:39:01 EST


Hi Lance,

On Fri, Mar 14, 2025 at 10:42:57PM +0800, Lance Yang wrote:
> Hi all,
>
> Inspired by mutex blocker tracking[1], this patch series extend the
> feature to not only dump the blocker task holding a mutex but also to
> support semaphores. Unlike mutexes, semaphores lack explicit ownership
> tracking, making it challenging to identify the root cause of hangs. To
> address this, we introduce a last_holder field to the semaphore structure,
> which is updated when a task successfully calls down() and cleared during
> up().
>
> The assumption is that if a task is blocked on a semaphore, the holders
> must not have released it. While this does not guarantee that the last
> holder is one of the current blockers, it likely provides a practical hint
> for diagnosing semaphore-related stalls.
>

Could you copy John Stultz for the future versions? Because John is
working on proxy execution, which will make a task always track which
mutex it's blocked by:

https://lore.kernel.org/lkml/20250312221147.1865364-3-jstultz@xxxxxxxxxx/

I feel it's better to build the hung task detection with that in mind,
thanks!

Regards,
Boqun

[...]