The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [RFC PATCH v2] Documentation/rv: Explain epoll and aborted sleeps
@ 2026-07-29  8:11 Chao Liu
  2026-08-04 10:45 ` Gabriele Monaco
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Liu @ 2026-07-29  8:11 UTC (permalink / raw)
  To: Steven Rostedt, Gabriele Monaco, Jonathan Corbet
  Cc: zhouzhouyi, lianux.mm, lianux.wang, Shuah Khan,
	linux-trace-kernel, linux-doc, linux-kernel, Chao Liu

epoll_wait() is a valid sleeping reason for real-time tasks because it
uses PI-aware locking, but the rtapp sleep monitor documentation only
discusses clock_nanosleep() and futexes. Document it.

ABORT_SLEEP represents a task restoring TASK_RUNNING before entering
the scheduler. Since the task does not actually block, it becomes
runnable again without a wakeup sequence unsafe for real-time. Document
this behavior.

This RFC is based on Nam Cao's pending "rv: rtapp monitor update" v2
series:

https://lore.kernel.org/r/cover.1781852967.git.namcao@linutronix.de

Signed-off-by: Chao Liu <chao.liu@processmission.com>
---
Changes in v2:
- Explain why epoll_wait() is RT-safe in terms of PI-aware locking.
- Explain that ABORT_SLEEP does not require an RT-unsafe wakeup sequence.
- Update the commit message accordingly.

Link to v1:
https://lore.kernel.org/linux-trace-kernel/20260722045706.85633-1-chao.liu@processmission.com/

 Documentation/trace/rv/monitor_rtapp.rst | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/trace/rv/monitor_rtapp.rst b/Documentation/trace/rv/monitor_rtapp.rst
index 238b59395ff5..b95994ade14a 100644
--- a/Documentation/trace/rv/monitor_rtapp.rst
+++ b/Documentation/trace/rv/monitor_rtapp.rst
@@ -67,6 +67,8 @@ thread to sleep for one of the following reasons:
     variables as safe for real-time. As an alternative, the librtpi library
     exists to provide a conditional variable implementation that is correct for
     real-time applications in Linux.
+  - Real-time thread waiting for events using `epoll_wait`, which is a
+    real-time-safe syscall for sleeping as it uses PI-aware locking.
 
 Beside the reason for sleeping, the eventual waker should also be
 real-time-safe. Namely, one of:
@@ -114,6 +116,10 @@ The monitor's specification is::
   ALLOWLIST = BLOCK_ON_RT_MUTEX
            or FUTEX_LOCK_PI
 
+`ABORT_SLEEP` represents a task restoring its state to `TASK_RUNNING` before
+entering the scheduler. In this case, the task does not actually block, so the
+task is back to runnable without any wakeup sequence unsafe for real-time.
+
 Beside the scenarios described above, this specification also defines an allow list
 to handle some special cases:
 

base-commit: 248951ddc14de84de3910f9b13f51491a8cd91df
prerequisite-patch-id: d8b6c952a954662852e6b0684e0a3386eaab7f41
prerequisite-patch-id: 940f7637aeabe4ba15a09c048c6f48138406f332
prerequisite-patch-id: b99812692691f76d825778e01a2e771e058febd6
prerequisite-patch-id: 512c300dce2cb74ac9cc007f9234aa507ef5c008
-- 
2.54.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH v2] Documentation/rv: Explain epoll and aborted sleeps
  2026-07-29  8:11 [RFC PATCH v2] Documentation/rv: Explain epoll and aborted sleeps Chao Liu
@ 2026-08-04 10:45 ` Gabriele Monaco
  2026-08-04 14:02   ` Nam Cao
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriele Monaco @ 2026-08-04 10:45 UTC (permalink / raw)
  To: Chao Liu, Nam Cao
  Cc: Steven Rostedt, Jonathan Corbet, zhouzhouyi, lianux.mm,
	lianux.wang, Shuah Khan, linux-trace-kernel, linux-doc,
	linux-kernel

On Wed, 2026-07-29 at 16:11 +0800, Chao Liu wrote:
> epoll_wait() is a valid sleeping reason for real-time tasks because it
> uses PI-aware locking, but the rtapp sleep monitor documentation only
> discusses clock_nanosleep() and futexes. Document it.
> 
> ABORT_SLEEP represents a task restoring TASK_RUNNING before entering
> the scheduler. Since the task does not actually block, it becomes
> runnable again without a wakeup sequence unsafe for real-time. Document
> this behavior.
> 

Looks good, thanks! Please next time you send a patch, even if it's an RFC, put
the extra comments after the --- . This way I can pull it directly without
changing the commit message because git am ignores everything after the --- .
Also, no big deal, but for simple patches like this one, and even after getting
comments, there's no need to mark as RFC.

Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>

I'd appreciate an ack from Nam, then I might be able to squeeze this before the
merge window together with the last fixes.

Thanks,
Gabriele

> This RFC is based on Nam Cao's pending "rv: rtapp monitor update" v2
> series:
> 
> https://lore.kernel.org/r/cover.1781852967.git.namcao@linutronix.de
> 
> Signed-off-by: Chao Liu <chao.liu@processmission.com>
> ---
> Changes in v2:
> - Explain why epoll_wait() is RT-safe in terms of PI-aware locking.
> - Explain that ABORT_SLEEP does not require an RT-unsafe wakeup sequence.
> - Update the commit message accordingly.
> 
> Link to v1:
> https://lore.kernel.org/linux-trace-kernel/20260722045706.85633-1-chao.liu@processmission.com/
> 
>  Documentation/trace/rv/monitor_rtapp.rst | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Documentation/trace/rv/monitor_rtapp.rst
> b/Documentation/trace/rv/monitor_rtapp.rst
> index 238b59395ff5..b95994ade14a 100644
> --- a/Documentation/trace/rv/monitor_rtapp.rst
> +++ b/Documentation/trace/rv/monitor_rtapp.rst
> @@ -67,6 +67,8 @@ thread to sleep for one of the following reasons:
>      variables as safe for real-time. As an alternative, the librtpi library
>      exists to provide a conditional variable implementation that is correct
> for
>      real-time applications in Linux.
> +  - Real-time thread waiting for events using `epoll_wait`, which is a
> +    real-time-safe syscall for sleeping as it uses PI-aware locking.
>  
>  Beside the reason for sleeping, the eventual waker should also be
>  real-time-safe. Namely, one of:
> @@ -114,6 +116,10 @@ The monitor's specification is::
>    ALLOWLIST = BLOCK_ON_RT_MUTEX
>             or FUTEX_LOCK_PI
>  
> +`ABORT_SLEEP` represents a task restoring its state to `TASK_RUNNING` before
> +entering the scheduler. In this case, the task does not actually block, so
> the
> +task is back to runnable without any wakeup sequence unsafe for real-time.
> +
>  Beside the scenarios described above, this specification also defines an
> allow list
>  to handle some special cases:
>  
> 
> base-commit: 248951ddc14de84de3910f9b13f51491a8cd91df
> prerequisite-patch-id: d8b6c952a954662852e6b0684e0a3386eaab7f41
> prerequisite-patch-id: 940f7637aeabe4ba15a09c048c6f48138406f332
> prerequisite-patch-id: b99812692691f76d825778e01a2e771e058febd6
> prerequisite-patch-id: 512c300dce2cb74ac9cc007f9234aa507ef5c008


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH v2] Documentation/rv: Explain epoll and aborted sleeps
  2026-08-04 10:45 ` Gabriele Monaco
@ 2026-08-04 14:02   ` Nam Cao
  0 siblings, 0 replies; 3+ messages in thread
From: Nam Cao @ 2026-08-04 14:02 UTC (permalink / raw)
  To: Gabriele Monaco, Chao Liu
  Cc: Steven Rostedt, Jonathan Corbet, zhouzhouyi, lianux.mm,
	lianux.wang, Shuah Khan, linux-trace-kernel, linux-doc,
	linux-kernel

Gabriele Monaco <gmonaco@redhat.com> writes:
> I'd appreciate an ack from Nam, then I might be able to squeeze this before the
> merge window together with the last fixes.

Reviewed-by: Nam Cao <namcao@linutronix.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-04 14:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29  8:11 [RFC PATCH v2] Documentation/rv: Explain epoll and aborted sleeps Chao Liu
2026-08-04 10:45 ` Gabriele Monaco
2026-08-04 14:02   ` Nam Cao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox