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 81A9A263C7C; Tue, 25 Feb 2025 09:05:09 +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=1740474309; cv=none; b=c7oJL+pFI7f7XQomHXYJ+Z5qFbGhNvZWOJ+6s1da190NAFyXGM8xEvv5UdwtRHNyj9foIrDjUHxVM/alZpx6Dq81ywCR1wDZHusrqAgbco9DBcE4/KLM7zXzwwAZDgPwBiTcm2BHHnuUFb9pZ4rEBPvW/gx1wUaz0mtUjXjv/sY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740474309; c=relaxed/simple; bh=NyHEQgvLE7O2czGyw9kOf6jBpywmIwe7uLlUw5iQ80o=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=dJU6fBRHEibQ27SuXyeNpVsc62rmdh23zopNXguOj85gvdPZtwXS9/ZJuZCK5LKoTLD6xYTc0EDrOtVQgDpoO7qpdtzaryHgxsEg0wtG2zaE1ee3g+mfrkcQ8bxKx2PINlQZrB3HMVCh3DCbjGcZYDtnpfNTQg/rAwJS507A9GU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=f07vn4vY; 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="f07vn4vY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92B8CC4CEE2; Tue, 25 Feb 2025 09:05:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740474309; bh=NyHEQgvLE7O2czGyw9kOf6jBpywmIwe7uLlUw5iQ80o=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=f07vn4vYD8d7AzBvbbenYgA/Cadt0cKhjZQ6uzelHZppMYtXwMDS7HGng6nwZJvQu USHF09zJQfF8KllYEkRpoQNbhPMUkLGtuLFB2TEaVKnUx4SUIbjC6BZxH4RJC2lK7L FlmNgjHcgPcayoz+vys4FRG6sQqTZtoktCYKglW/OLtcEu2DfTg0Hcir0WOF4r3MBF e+0OgUKYSRT4lvvBmfscJLGzdjsEvKuSCBsH3FkSg/DVW96wGYwRLHQP1tPjWB4Sir XJeZ50r+f7kESgiXQw9pfkfaFcKehKUXxVJFg8OhA71nuAzi64z1H/jYqjvl8r0wcZ VF3sOVk4kaymg== From: Andreas Hindborg To: "Lyude Paul" Cc: "Miguel Ojeda" , "Anna-Maria Behnsen" , "Frederic Weisbecker" , "Thomas Gleixner" , "Danilo Krummrich" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?Q?Bj?= =?utf-8?Q?=C3=B6rn?= Roy Baron , "Benno Lossin" , "Alice Ryhl" , "Trevor Gross" , "Guangbo Cui" <2407018371@qq.com>, "Dirk Behme" , "Daniel Almeida" , "Tamir Duberstein" , , Subject: Re: [PATCH v9 07/13] rust: hrtimer: implement `UnsafeHrTimerPointer` for `Pin<&T>` In-Reply-To: <832fbd60f5c3d78955bd77fce8539423d7669a39.camel@redhat.com> (Lyude Paul's message of "Mon, 24 Feb 2025 18:32:11 -0500") References: <20250224-hrtimer-v3-v6-12-rc2-v9-0-5bd3bf0ce6cc@kernel.org> <20250224-hrtimer-v3-v6-12-rc2-v9-7-5bd3bf0ce6cc@kernel.org> <832fbd60f5c3d78955bd77fce8539423d7669a39.camel@redhat.com> User-Agent: mu4e 1.12.7; emacs 29.4 Date: Tue, 25 Feb 2025 10:01:37 +0100 Message-ID: <871pvmxury.fsf@kernel.org> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Lyude Paul" writes: > On Mon, 2025-02-24 at 13:03 +0100, Andreas Hindborg wrote: >> Allow pinned references to structs that contain a `HrTimer` node to be >> scheduled with the `hrtimer` subsystem. >> >> Acked-by: Frederic Weisbecker >> Signed-off-by: Andreas Hindborg >> --- >> rust/kernel/time/hrtimer.rs | 2 + >> rust/kernel/time/hrtimer/pin.rs | 99 +++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 101 insertions(+) >> >> diff --git a/rust/kernel/time/hrtimer.rs b/rust/kernel/time/hrtimer.rs >> index 64b769ad59cc..52a3dd1c3984 100644 >> --- a/rust/kernel/time/hrtimer.rs >> +++ b/rust/kernel/time/hrtimer.rs >> @@ -428,3 +428,5 @@ unsafe fn raw_get_timer(ptr: *const Self) -> >> >> mod arc; >> pub use arc::ArcHrTimerHandle; >> +mod pin; >> +pub use pin::PinHrTimerHandle; >> diff --git a/rust/kernel/time/hrtimer/pin.rs b/rust/kernel/time/hrtimer/pin.rs >> new file mode 100644 >> index 000000000000..6c9f2190f8e1 >> --- /dev/null >> +++ b/rust/kernel/time/hrtimer/pin.rs >> @@ -0,0 +1,99 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> + >> +use super::HasHrTimer; >> +use super::HrTimer; >> +use super::HrTimerCallback; >> +use super::HrTimerHandle; >> +use super::RawHrTimerCallback; >> +use super::UnsafeHrTimerPointer; >> +use crate::time::Ktime; >> +use core::pin::Pin; >> + >> +/// A handle for a `Pin<&HasHrTimer>`. When the handle exists, the timer might be >> +/// running. >> +pub struct PinHrTimerHandle<'a, T> >> +where >> + T: HasHrTimer, >> +{ >> + pub(crate) inner: Pin<&'a T>, >> +} > > Any reason this isn't just: > > pub struct PinHrTimerHandle<'a, T: HasHrTimer>(Pin<&'a T>) > where > T: HasHrTimer; > > With that nit (feel free to take it or leave it) resolved: I had review comments in the past asking me to not use tuple structs. The rationale being that the name carries context/intent. In this particular case, I don't think the name helps a lot, but I also don't mind having it there. > > Reviewed-by: Lyude Paul Thanks you! Best regards, Andreas Hindborg