Re: [PATCH 0/2] io_uring: honour submitter's time namespace for ABS timeouts
From: Jens Axboe
Date: Wed May 06 2026 - 07:02:34 EST
On 5/6/26 3:05 AM, Pavel Begunkov wrote:
> On 5/4/26 16:37, Maoyi Xie wrote:
>> This series addresses two io_uring code paths that arm an ABS
>> hrtimer from a timestamp supplied by the caller. Both paths skip
>> the conversion from the submitter's time namespace view to host
>> view via timens_ktime_to_host(). The clock is CLOCK_MONOTONIC by
>> default, or optionally CLOCK_BOOTTIME.
>>
>> All four other ABS timer interfaces already do this conversion:
>> timer_settime(TIMER_ABSTIME), clock_nanosleep(TIMER_ABSTIME),
>> alarm_timer_nsleep(TIMER_ABSTIME), and
>> timerfd_settime(TFD_TIMER_ABSTIME).
>>
>> Patch 1/2 (io_uring/timeout) covers IORING_OP_TIMEOUT and
>> IORING_OP_LINK_TIMEOUT via io_parse_user_time(). It is essentially
>> the draft Pavel posted on the original thread. I rebased it on
>> io_uring-7.1 and verified end to end.
>>
>> Patch 2/2 (io_uring/wait) covers the IORING_ENTER_ABS_TIMER path
>> in io_uring_enter(). That path parses ext_arg->ts inline rather
>> than going through io_parse_user_time(). Patch 1/2 therefore does
>> not cover it.
>>
>> Per Pavel and Jens's discussion on the original thread, the two
>> sites use two direct timens_ktime_to_host() call sites rather
>> than a shared helper. Patch 1/2 also splits the existing
>> io_timeout_get_clock() into a flags only io_flags_to_clock(), so
>> io_parse_user_time() can resolve the clock without a
>> struct io_timeout_data.
>>
>> SQPOLL is automatically covered. The SQPOLL kernel thread is
>> created via create_io_thread() with CLONE_THREAD and no CLONE_NEW*
>> flag. copy_namespaces() therefore shares the submitter's nsproxy
>> by reference. timens_ktime_to_host() through "current" sees the
>> submitter's time_ns when called from the SQPOLL kthread. PoCs for
>> both paths confirm this.
>
> At a quick glance, both look good. I think you had an isolated
> reproducer, are you sending it as a liburing test? Would be
> greatly appreciated.
+1 Yes please, test case for liburing would be great!
--
Jens Axboe