<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/samples/hung_task/hung_task_tests.c, branch v6.18.21</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-07-20T02:08:26+00:00</updated>
<entry>
<title>samples: enhance hung_task detector test with read-write semaphore support</title>
<updated>2025-07-20T02:08:26+00:00</updated>
<author>
<name>Zi Li</name>
<email>zi.li@linux.dev</email>
</author>
<published>2025-06-27T07:29:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4efec6c0919d9081a52be50d5b5bfa32bf489c75'/>
<id>urn:sha1:4efec6c0919d9081a52be50d5b5bfa32bf489c75</id>
<content type='text'>
Extend the hung_task detector test module to include read-write semaphore
support alongside existing mutex and semaphore tests.  This module now
creates additional debugfs files under &lt;debugfs&gt;/hung_task, namely
'rw_semaphore_read' and 'rw_semaphore_write', in addition to 'mutex' and
'semaphore'.  Reading these files with multiple processes triggers a
prolonged sleep (256 seconds) while holding the respective lock, enabling
hung_task detector testing for various locking mechanisms.

This change builds on the extensible hung_task_tests module, adding
read-write semaphore functionality to improve test coverage for kernel
locking primitives.  The implementation ensures proper lock handling and
includes checks to prevent redundant data reads.

Usage is:

        &gt; cd /sys/kernel/debug/hung_task
        &gt; cat mutex &amp; cat mutex           # Test mutex blocking
        &gt; cat semaphore &amp; cat semaphore   # Test semaphore blocking
        &gt; cat rw_semaphore_write \
            &amp; cat rw_semaphore_read       # Test rwsem blocking
        &gt; cat rw_semaphore_write \
            &amp; cat rw_semaphore_write      # Test rwsem blocking

Update the Kconfig description to reflect the addition of read-write
semaphore debugfs files.

Link: https://lkml.kernel.org/r/20250627072924.36567-4-lance.yang@linux.dev
Signed-off-by: Zi Li &lt;zi.li@linux.dev&gt;
Suggested-by: Masami Hiramatsu (Google) &lt;mhiramat@kernel.org&gt;
Cc: Anna Schumaker &lt;anna.schumaker@oracle.com&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Joel Granados &lt;joel.granados@kernel.org&gt;
Cc: John Stultz &lt;jstultz@google.com&gt;
Cc: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
Cc: Mingzhe Yang &lt;mingzhe.yang@ly.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Tomasz Figa &lt;tfiga@chromium.org&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Yongliang Gao &lt;leonylgao@tencent.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>samples: extend hung_task detector test with semaphore support</title>
<updated>2025-05-12T00:54:08+00:00</updated>
<author>
<name>Zi Li</name>
<email>amaindex@outlook.com</email>
</author>
<published>2025-04-14T14:59:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1abf729e9d9f4eb42c01fa9cb86eeb1766ecd49f'/>
<id>urn:sha1:1abf729e9d9f4eb42c01fa9cb86eeb1766ecd49f</id>
<content type='text'>
Extend the existing hung_task detector test module to support multiple
lock types, including mutex and semaphore, with room for future additions
(e.g., spinlock, etc.).  This module creates dummy files under
&lt;debugfs&gt;/hung_task, such as 'mutex' and 'semaphore'.  The read process on
any of these files will sleep for enough long time (256 seconds) while
holding the respective lock.  As a result, the second process will wait on
the lock for a prolonged duration and be detected by the hung_task
detector.

This change unifies the previous mutex-only sample into a single,
extensible hung_task_tests module, reducing code duplication and improving
maintainability.

Usage is:

	&gt; cd /sys/kernel/debug/hung_task
	&gt; cat mutex &amp; cat mutex          # Test mutex blocking
	&gt; cat semaphore &amp; cat semaphore  # Test semaphore blocking

Update the Kconfig description to reflect multiple debugfs files support.

Link: https://lkml.kernel.org/r/20250414145945.84916-4-ioworker0@gmail.com
Signed-off-by: Lance Yang &lt;ioworker0@gmail.com&gt;
Signed-off-by: Zi Li &lt;amaindex@outlook.com&gt;
Suggested-by: Masami Hiramatsu (Google) &lt;mhiramat@kernel.org&gt;
Acked-by: Masami Hiramatsu (Google) &lt;mhiramat@kernel.org&gt;
Cc: Anna Schumaker &lt;anna.schumaker@oracle.com&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Joel Granados &lt;joel.granados@kernel.org&gt;
Cc: John Stultz &lt;jstultz@google.com&gt;
Cc: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
Cc: Mingzhe Yang &lt;mingzhe.yang@ly.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Tomasz Figa &lt;tfiga@chromium.org&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Yongliang Gao &lt;leonylgao@tencent.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
</feed>
