From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6982516F8E9; Thu, 7 Aug 2025 13:01:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754571684; cv=none; b=dAFcLWsw/RdrtvP6nseKtfuaj6pc9OduBOV8OIphQ8no4IS1Co8BTEmTpJEy3uCz7dt3X67eeBvyOe7m9RFM7mVzA+RHtj3cF5rSaBpOWeY6VCxboIIKZUgSVjNqmV5cCANblH4GSlHleZaprT093htHR/ND22HXEKJ2nGTtabg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754571684; c=relaxed/simple; bh=1zr6+DjuR7FSKkZ5IlMn3ByBcRGIQ5WJgEoFapMeqsY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=H+oEQUrxH3Dv947VLrVfB17eyNERsIDXdlb8wANRWkyRg+Sm4OjU7jTrIL4A8VpKblInXkcJtIEYhnTOuU2AE/9KmUVZn49nR6N3DV+12br7u3H5p5rjyPE1dumhyHYq5uAGtaHtlVUwPTzaljxukJ1heuXqPsqIUFG3npMgB58= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rbh2ca7X; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rbh2ca7X" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4610AC4CEEB; Thu, 7 Aug 2025 13:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1754571683; bh=1zr6+DjuR7FSKkZ5IlMn3ByBcRGIQ5WJgEoFapMeqsY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=rbh2ca7XfjERVFFQEjZrZF4ZXzkZvt/NDnPvz+cjh8Y11erlpKfjniP5Nrf9ysUpm YGg+HDMs7z1mL1ZCzBdFzEHXi8BAS8Vci1C084TjRSg4CBerw0XiL4cKFfYRo0dUu6 YB2pDM9zOmsGd+LlrjN3GOC8rZGiErr5mvRTtSE8A2qwJ0GeZOYTn17REVK51XbZF4 IW3Ujbcefu6m3QAIzz0Q0YIdzKbxqdJUynlqtJ1XJMRUBsW5+rVFbhth7X5kRBpJ9D aEQxEc9gx3AHU1ehmGckNniBWiztQGXRC0CYPF3p6PsALVrTo7PXmqFmdAXEavODY3 QBgZPEKnJtMvw== From: Andreas Hindborg To: Daniel Almeida , Lyude Paul Cc: rust-for-linux@vger.kernel.org, Thomas Gleixner , Boqun Feng , linux-kernel@vger.kernel.org, FUJITA Tomonori , Frederic Weisbecker , Anna-Maria Behnsen , John Stultz , Stephen Boyd , Miguel Ojeda , Alex Gaynor , Gary Guo , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , Benno Lossin , Alice Ryhl , Trevor Gross , Danilo Krummrich Subject: Re: [PATCH v6 3/7] rust: hrtimer: Add HrTimer::raw_forward() and forward() In-Reply-To: <4A89EA6C-7683-42CB-BA0E-0ED538480991@collabora.com> References: <20250724185236.556482-1-lyude@redhat.com> <20250724185236.556482-4-lyude@redhat.com> <4A89EA6C-7683-42CB-BA0E-0ED538480991@collabora.com> Date: Thu, 07 Aug 2025 15:01:13 +0200 Message-ID: <87jz3f70bq.fsf@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable "Daniel Almeida" writes: > [=E2=80=A6] > > >> + >> + /// Conditionally forward the timer. >> + /// >> + /// If the timer expires after `now`, this function does nothing an= d returns 0. If the timer >> + /// expired at or before `now`, this function forwards the timer by= `interval` until the timer >> + /// expires after `now` and then returns the number of times the ti= mer was forwarded by >> + /// `interval`. >> + /// >> + /// Returns the number of overruns that occurred as a result of the= timer expiry change. >> + pub fn forward(self: Pin<&mut Self>, now: HrTimerInstant, interv= al: Delta) -> u64 >> + where >> + T: HasHrTimer, >> + { >> + // SAFETY: >> + // - `raw_forward` does not move `self`. >> + // - Self is a mutable reference and thus always points to a va= lid `HrTimer` > > I get what you're trying to say, but IMHO using the word "mutable" here is > confusing. Mutability has nothing to do on whether something is valid. Th= is > should be rephrased, IMHO. Having a reference to something implies validity. We could do: The coertion of `&mut Self` to `*mut Self` results in a pointer to a valid `Self`. Best regards, Andreas Hindborg