Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796289639; b=1IduJYXPGfgzuhV7SPZwFEETJCBaQGS95/ebP+ssor+KPAdN7hCN10EjOiy8r3NdpEJE 2+MQp8GqZxYOz2fEPfp3jVKQ9RbIEFBZHGjaxwKENXYpyXYUwOIRxJ+iYOMdlSR8+CfKu EIi3Mdxb4ohFk6oJaPyO4nMns1RZWrLfWM+qjELZYYdUyMyQdvtPY+BbCD7vL0yFee7dU p6R5980ZQQc0GE5/rpkdT5ZG1Fko3GDDxZ+jD1jtAgiFqTjZuIPimlXTM4zlySRXG6cfU qIkdqDA0qwahj6gRtoiotMyjzmssPVmPdzfgpXaeQyyMNAvagx/AMtQhyegGN78NSnQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796289639; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=69bdi/WyCMyU9EuczwoiHWMQ1IMS8hIjGhsp5Zi2sWQ=; b=Brg7/b95UuwIgtZEd2qH3tmiY5wIPdKkz9B5jVxuIBcE8RPRM8wVLv866E1vGRe8Ao5+ LbUR+VgIV5FWE3KCak1P9u7q4bnWHIQH42rwTRszz/YVqw1fY4n5YMDiZS6n7ik5Bknvj je47trQhg3IS2YsJPvQNB4nVzUKGB/X4LgbFE+PkrLo62Yfj1JLhXsUE10Os9TWDR6hmj Yv5ZIBWiRyaaJ2v+guk3RS3gjmH9Jz9yzrR6XRh1VJQPx/XD5pPG/5UjWWNYZ2AipxjZD gkClAlpQF1HF3rgHHipmvoSlHGzClxxbErySJu1gDgV8glbzjF/it8Wf0I4pyOzTsQw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=mNJPw9OU; arc=none smtp.remote-ip=209.85.216.50 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55027606A686 for ; Thu, 3 Dec 2026 09:20:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 55027606A686 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.a=rsa-sha256 header.s=20260707 header.b=mNJPw9OU Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-3b4a93d0814so5737526a91.1 for ; Thu, 03 Dec 2026 01:20:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796289638; x=1796894438; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=69bdi/WyCMyU9EuczwoiHWMQ1IMS8hIjGhsp5Zi2sWQ=; b=mNJPw9OUCkj4rj5cuF6fbSMNaNQSoD6jPTvuRaq3xlZcaqzVckPJLKAcA/hZ6v6cl3 j0UiziNIojH+A7ddNUhiivdp9ZA2IjNU6pjZxuqx+000+zWKpidYVqnwtT2yu9jRzmSh Pqni+jfbPZqyRlgFBDgxftS+Box4buD08vwa/AI620rsLuk12aOgI/PUdToK83+powDr jVGgtZAqReVLSr3p51VeenEWr/8HdTSPRhHXg2FqDXVNTnnSBJJ9adEW6KvRUhuhN9ag f1m4EBCe2rlWVkcXJ1qCstxGcVhbpopL0ihD4IFDeKgj8mizlyhd0oMta7R6G/1uiDsM kOrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796289638; x=1796894438; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=69bdi/WyCMyU9EuczwoiHWMQ1IMS8hIjGhsp5Zi2sWQ=; b=rtI1iuzhSdSsu8giuw9k51ugG9tWiW15yCVEs/hL2a0n4RQN9SXlVpx+9DaWFRZEfK DQV8dfpA8QeAFJyDaL7Ci5eCgLerfJYWaqO9kTGZJQBUwh5JMkUFREzsOhgdSM8ZuJ69 81QKpHGRF4c5JQNaktQYYzx83xv7PYPmXblkV2I08Dx4AEpV75W+v9FODgRdOUFAXv9r A9xUA66r1JvAH/eQUpL/TUvrynJq+/erZoHSILTaL5Nj+4VD2bSfv+1/8UlDb1lqlDwC FifmuiveBeYLcYhmB67zl9eFav3cpOe4VxDzuAQ0bryGm0uj9KBc4DmRfHiz6Y+/yom8 mIZA== X-Forwarded-Encrypted: i=1; AL+hErGfWHSTaeoR4c1c2v3h04ABTcko5BN4kAX6sqUTorSioRMqyyPcl6wZ0j8FIXhCZXKlF3DduvVfzpshAU94Ew==@vger.kernel.org X-Gm-Message-State: APuU4Z/zx2hoAk5vsMv13xwOSF5Onad3zMNwoflnLe9d1nQJAe14lK1W 4QBvNJKtdrqHTU1+cSeloRxaWzhGP0VDz+8NB/ZDBR74ViHCor4bTQi8 X-Gm-Gg: AZFdTZdkMEAjc8iYA9GZBYiL2un4JUTs1GggeHCRWqx2om/hWcUrZq0B/5AEdwbjOgJ 1N4oOAiD6CmPbL0KitercP4UIHXZlFGim9k4ZvpUJvLCGisfbD550jZdmxBXrZ3/p/SxGawupQg +D0LZ9YdWxFuOyz91GR0u2JAkaTxRrQAfay/UGmwVS47LS8EN/IUWAM95iNUc89SlUIkKNo89qr eGI8eWfG+4FGyPgUvMoZjx/BySFHIZMMYPKPYIwxRtZirZthoX5zpm3dRateM//k/UYa4nTRHc7 98sBO5uZB6FrM8CXw5dn6GJTBzUlXJuk4a5dXmQ/gq2lUX0bGP5h7Goh8c8IGZIWs1ZOVcXggNM ZHbBc4xbWif+uD9BdDlaoEP/TKAXyzz5pfoaAV/ld81UCTpmQL8hyUwj4XfqDrp1UXuThHmdq2y VlcM3o2DoK+uyw0G4FsxjeBceSb/WDYI1Sc71CrvUg6S2fm7Ie/9GcotyZQN1aFsdwSve4rF5zt hTl3ixtnHuF9cuyh+zAUgJDmecNNefafLzrW383H8/wMImrw4SUxDJVY6oPvLDHnPjcVHITWxuw wioHAB7iQM83xGsskUlxuZ8gq9w8OTkAL/yckg== X-Received: by 2002:a17:90b:4b05:b0:3a0:516d:9f88 with SMTP id 98e67ed59e1d1-3b41c911c9emr40079045a91.26.1796289638271; Thu, 03 Dec 2026 01:20:38 -0800 (PST) Received: from ysq-QiTianM428-A376 ([111.201.209.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c7d10d06sm3575201a91.3.2026.12.03.01.20.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 01:20:37 -0800 (PST) From: Franklin-Qi To: FUJITA Tomonori Cc: Andreas Hindborg , Lyude Paul , Miguel Ojeda , Alice Ryhl , FUJITA Tomonori , Boqun Feng , Danilo Krummrich , rust-for-linux@vger.kernel.org, Thomas Gleixner , John Stultz , Stephen Boyd , Frederic Weisbecker , Anna-Maria Behnsen , Georgios Androutsopoulos , stable@vger.kernel.org, Franklin-Qi Subject: Re: [PATCH v2] rust: time: keep Instant invariant when adding/subtracting Delta Date: Thu, 3 Dec 2026 17:20:11 +0800 Message-ID: <20261203092011.63792-1-yusq77@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261202.202702.1454196968303324239.tomo@flapping.org> References: <20261202080227.898512-1-yusq77@gmail.com> <20261202.202702.1454196968303324239.tomo@flapping.org> X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Tomonori, Thanks for the review. > The doc says a warning is printed when the result is clamped, but > saturating_add() and saturating_sub() saturate to KTIME_MAX without a > warning. Only a negative result prints the warning. > > With overflow checks, both cases panic. So without overflow checks, I > think both cases should print the warning. Agreed. In v3, without CONFIG_RUST_OVERFLOW_CHECKS, both a negative result and a saturation at KTIME_MAX print the warning once (by comparing the saturating and wrapping results before clamping into 0..=KTIME_MAX). > This conflicts with timekeeping-next. Instant has changed there. v3 is rebased onto timekeeping-next and updated for Instant. I am also sending a second patch with KUnit tests for the clamping paths, as Andreas and Miguel suggested. I verified rust_kernel_time with CONFIG_RUST_OVERFLOW_CHECKS=n; all Instant clamp tests passed. Best regards, Franklin