Linux userland API discussions
 help / color / mirror / Atom feed
From: Artem Andreenko <miolini@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, Pavel Begunkov <asml.silence@gmail.com>
Cc: io-uring@vger.kernel.org, Artem Andreenko <miolini@gmail.com>,
	linux-api@vger.kernel.org
Subject: [RFC PATCH 0/2] io_uring: add CLOCK_TAI support for waits and timeouts
Date: Fri, 27 Nov 2026 13:20:02 -0800	[thread overview]
Message-ID: <20261127212001.18516-4-miolini@gmail.com> (raw)

This series adds CLOCK_TAI support to io_uring for both
IORING_REGISTER_CLOCK (ring wait timers) and IORING_OP_TIMEOUT /
IORING_OP_LINK_TIMEOUT (via IORING_TIMEOUT_TAI).

5G NR gNodeB DU/CU radio-slot loops, O-RAN 7.2x fronthaul, and TSN
workloads anchor periodic activations and TX deadlines to PTP-steered
CLOCK_TAI (matching SO_TXTIME, sch_etf, and bpf_ktime_get_tai_ns()).
Adding CLOCK_TAI directly to io_uring avoids per-slot userspace clock
conversion or separate timerfd(CLOCK_TAI) syscalls.

Patch 1/2 removes the redundant ctx->clock_offset field (deriving the
timekeeper offset from ctx->clockid) and snapshots iowq.clockid once per
io_cqring_wait() cycle, fixing a pre-existing data race between
IORING_REGISTER_CLOCK and lockless waiters (which becomes severe once
CLOCK_TAI and CLOCK_MONOTONIC differ by ~56 years).

Patch 2/2 enables CLOCK_TAI in IORING_REGISTER_CLOCK and adds
IORING_TIMEOUT_TAI (bit 8) to IORING_TIMEOUT_CLOCK_MASK.

Tool-assisted content note (per Documentation/process/generated-content.rst):
An AI coding assistant (Google Antigravity / Gemini) assisted with source
analysis, drafting the patches/changelogs, and writing the standalone
arm64 QEMU test harness. Both patches were built with W=1 and runtime-tested
on arm64 QEMU with PROVE_LOCKING, DEBUG_ATOMIC_SLEEP, and a 37-second
ADJ_TAI offset.

Open question for RFC feedback:
Should IORING_REGISTER_CLOCK(CLOCK_TAI) and IORING_TIMEOUT_TAI be split
into separate patches or kept together as in Patch 2/2?

Artem Andreenko (2):
  io_uring: snapshot clockid per wait and drop clock_offset
  io_uring: add CLOCK_TAI support for waits and timeouts

 include/linux/io_uring_types.h |  1 -
 include/uapi/linux/io_uring.h  |  5 ++++-
 io_uring/io_uring.c            |  1 -
 io_uring/io_uring.h            | 13 +++++++++----
 io_uring/napi.c                |  3 ++-
 io_uring/register.c            |  6 ++----
 io_uring/timeout.c             |  2 ++
 io_uring/wait.c                |  9 +++++----
 8 files changed, 24 insertions(+), 16 deletions(-)


base-commit: 822ba3a89c7896b26e4beb70e2ebffb881924dfe
-- 
2.54.0 (Apple Git-157)


             reply	other threads:[~2026-11-27 21:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 21:20 Artem Andreenko [this message]
2026-11-27 21:20 ` [RFC PATCH 2/2] io_uring: add CLOCK_TAI support for waits and timeouts Artem Andreenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261127212001.18516-4-miolini@gmail.com \
    --to=miolini@gmail.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-api@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox