From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B2173451AB for ; Fri, 27 Feb 2026 20:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772222623; cv=none; b=T3m4ZKYwcuXzhQxXPFF12wo7vO6oUC6ftPQSFVRze2TJMnrG38gnzZQge+Qm8Waq756wzbLsd+/duTS9rDLN90pcc4aWd996N2hLMy67xeKXX/CgRkniEzG/gCsnMy5dx67anqkLvCTXxtNEmxaCO8ZeMQ5ks209WwKlGoPVapI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772222623; c=relaxed/simple; bh=7iYCDeqOQ7ZWydkycqxu8uk9FFQMas6z/tLOdKWYmvU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=st+th7GAaouZmpjbEH1Fa4CigGdUttdLpLAABiAmehE+ykluGBixYEtkGlT+0VSgdLBb2g26zIrZ/1choOTfW8L7bYpfSDy2s2bB66e3N7GbV0nr7wYV/gAZrB9fWr6RLpnq5Ly/wym4/mKhZ05QIOwLNksXeUMpGcNQVDIRbKs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XXpAhIh9; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XXpAhIh9" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-439857ec679so2184259f8f.2 for ; Fri, 27 Feb 2026 12:03:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772222620; x=1772827420; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=X7ry9dRoWjSPaoxwUgxxQliDkZlIdEiZwMbRrYjZMjg=; b=XXpAhIh9rUEYWsFB2kR3H3gRy7bH+elYIJ6oBJi1VUSQw8l4SkBN51L95wL79UrM8C 1fvnl3gEbaJ//DJgwFNHEKRz/MK7A7GnMO4tgYmesg854HTRR1Fwg7HKfykQVsdUdx+x GHD+qceaQEhWInkKoK8KsK2P2cAFVBWA0dzeG8W4AyViN9d9BSxD3c1bJCEWIisUrSav DP+xlwPnD3AplOaRhjUqsl12hUFdhJ7NsMYN7zKcJyuLnp01Mbvs/FEIQsSwf4xDwUwe l/2pmnaVAtbZK+jjxlOQpYlg8VeEcouc2bGGHlsZXb+LfKEspZRU5M/VOyBKZwAgTlWS 9htw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772222620; x=1772827420; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=X7ry9dRoWjSPaoxwUgxxQliDkZlIdEiZwMbRrYjZMjg=; b=FczTYt6E26HLVqLPcwz1EbINV8UnhYmio6rxpJJzVIUXNWl/Z2mMVymIFsybnajxG3 cwNct78k3Xj1mClRvpCV+eoFBKb9msmMIjZTRZ78vQP55KUlOfPhWVcbYy2IHNReD+0r sV8YIujeLUVpoyTdVFZVR0DGbdgK+AExvTzJTroY5P/PeZC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4399de3ab67mr7073718f8f.55.1772222620519; Fri, 27 Feb 2026 12:03:40 -0800 (PST) Received: from ?IPV6:2a01:4b00:bd21:4f00:7cc6:d3ca:494:116c? ([2a01:4b00:bd21:4f00:7cc6:d3ca:494:116c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4399c60e404sm10133924f8f.8.2026.02.27.12.03.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Feb 2026 12:03:40 -0800 (PST) Message-ID: Date: Fri, 27 Feb 2026 20:03:36 +0000 Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/2] io_uring/timeout: immediate timeout arg To: Jens Axboe , Stefan Metzmacher , io-uring@vger.kernel.org Cc: Keith Busch References: <6151302f1dc01d1c4e3176da50ab4224947b709f.1772015321.git.asml.silence@gmail.com> <3ae98749-590e-4f8b-a835-c9a15d7866c2@samba.org> <1cd9a071-dc93-48d1-81c9-24b65e65e8bf@kernel.dk> Content-Language: en-US From: Pavel Begunkov In-Reply-To: <1cd9a071-dc93-48d1-81c9-24b65e65e8bf@kernel.dk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/27/26 19:39, Jens Axboe wrote: > On 2/27/26 12:08 PM, Pavel Begunkov wrote: >> On 2/27/26 14:08, Stefan Metzmacher wrote: >>> Hi Pavel, >>> >>>> if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT))) >>>> return -EINVAL; >>>> @@ -460,10 +461,20 @@ int io_timeout_remove_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) >>>> return -EINVAL; >>>> if (tr->flags & IORING_LINK_TIMEOUT_UPDATE) >>>> tr->ltimeout = true; >>>> - if (tr->flags & ~(IORING_TIMEOUT_UPDATE_MASK|IORING_TIMEOUT_ABS)) >>>> + if (tr->flags & ~(IORING_TIMEOUT_UPDATE_MASK | >>>> + IORING_TIMEOUT_ABS | >>>> + IORING_TIMEOUT_IMMEDIATE_ARG)) >>>> return -EINVAL; >>>> - if (get_timespec64(&tr->ts, u64_to_user_ptr(READ_ONCE(sqe->addr2)))) >>>> + >>>> + arg = READ_ONCE(sqe->addr2); >>>> + if (tr->flags & IORING_TIMEOUT_IMMEDIATE_ARG) { >>>> + if (tr->flags & IORING_TIMEOUT_ABS) >>>> + return -EINVAL; >>>> + tr->ts = ns_to_timespec64(arg); >>> >>> I'm wondering if there is enough free space in a small sqe to hold a full timespec? >>> So that there is no restriction for IORING_TIMEOUT_ABS... >> >> Well, u64 gives ~500 years in ns, it should be fine to just >> allow the abs mode. We just need to make sure to zero check >> the unused fields in case it'd need to be extended. > > I don't think it's about length of it - if you can avoid the div by > doing ns_to_timespec64(), that might be very useful? Would make hrtimer_start(&data->timer, timespec64_to_ktime(data->ts), mode); ^^^ io_uring just needs to flip it and use ktime, but I left it for later. > userspace simpler too potentially, and basically make the immediate mode > _exactly_ the same as the non-immediate mode, it just delivers the > __kernel_timespec in a different way. I very much want to believe that everything about kernel_timespec has some deep meaning, but I fail to see why they split it as sec/ns and left invalid ranges for ns, why ns is signed, and why even after a large revamp one of the fields doesn't use a fixed width type. I'm not sure exactly like it is actually a good idea. -- Pavel Begunkov