public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail•com>
To: FUJITA Tomonori <fujita.tomonori@gmail•com>
Cc: rust-for-linux@vger•kernel.org, Gary Guo <gary@garyguo•net>,
	Fiona Behrens <me@kloenk•dev>,
	Daniel Almeida <daniel.almeida@collabora•com>,
	Andreas Hindborg <a.hindborg@kernel•org>,
	linux-kernel@vger•kernel.org, netdev@vger•kernel.org,
	andrew@lunn•ch, hkallweit1@gmail•com, tmgross@umich•edu,
	ojeda@kernel•org, alex.gaynor@gmail•com,
	bjorn3_gh@protonmail•com, benno.lossin@proton•me,
	a.hindborg@samsung•com, aliceryhl@google•com,
	anna-maria@linutronix•de, frederic@kernel•org,
	tglx@linutronix•de, arnd@arndb•de, jstultz@google•com,
	sboyd@kernel•org, mingo@redhat•com, peterz@infradead•org,
	juri.lelli@redhat•com, vincent.guittot@linaro•org,
	dietmar.eggemann@arm•com, rostedt@goodmis•org,
	bsegall@google•com, mgorman@suse•de, vschneid@redhat•com,
	tgunders@redhat•com, david.laight.linux@gmail•com
Subject: Re: [PATCH v13 3/5] rust: time: Introduce Instant type
Date: Sun, 13 Apr 2025 17:06:15 -0700	[thread overview]
Message-ID: <67fc517b.050a0220.301460.dfe7@mx.google.com> (raw)
In-Reply-To: <20250413104310.162045-4-fujita.tomonori@gmail.com>

On Sun, Apr 13, 2025 at 07:43:08PM +0900, FUJITA Tomonori wrote:
> Introduce a type representing a specific point in time. We could use
> the Ktime type but C's ktime_t is used for both timestamp and
> timedelta. To avoid confusion, introduce a new Instant type for
> timestamp.
> 
> Rename Ktime to Instant and modify their methods for timestamp.
> 
> Implement the subtraction operator for Instant:
> 
> Delta = Instant A - Instant B
> 
> Reviewed-by: Boqun Feng <boqun.feng@gmail•com>

I probably need to drop my Reviewed-by because of something below:

> Reviewed-by: Gary Guo <gary@garyguo•net>
> Reviewed-by: Fiona Behrens <me@kloenk•dev>
> Tested-by: Daniel Almeida <daniel.almeida@collabora•com>
> Reviewed-by: Andreas Hindborg <a.hindborg@kernel•org>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail•com>
> ---
[...]
> diff --git a/rust/kernel/time/hrtimer.rs b/rust/kernel/time/hrtimer.rs
> index ce53f8579d18..27243eaaf8ed 100644
> --- a/rust/kernel/time/hrtimer.rs
> +++ b/rust/kernel/time/hrtimer.rs
> @@ -68,7 +68,7 @@
>  //! `start` operation.
>  
>  use super::ClockId;
> -use crate::{prelude::*, time::Ktime, types::Opaque};
> +use crate::{prelude::*, time::Instant, types::Opaque};
>  use core::marker::PhantomData;
>  use pin_init::PinInit;
>  
> @@ -189,7 +189,7 @@ pub trait HrTimerPointer: Sync + Sized {
>  
>      /// Start the timer with expiry after `expires` time units. If the timer was
>      /// already running, it is restarted with the new expiry time.
> -    fn start(self, expires: Ktime) -> Self::TimerHandle;
> +    fn start(self, expires: Instant) -> Self::TimerHandle;

We should be able to use what I suggested:

	https://lore.kernel.org/rust-for-linux/Z_ALZsnwN53ZPBrB@boqun-archlinux/	

to make different timer modes (rel or abs) choose different expire type.

I don't think we can merge this patch as it is, unfortunately, because
it doesn't make sense for a relative timer to take an Instant as expires
value.

Regards,
Boqun

>  }
>  
[...]

  reply	other threads:[~2025-04-14  0:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-13 10:43 [PATCH v13 0/5] rust: Add IO polling FUJITA Tomonori
2025-04-13 10:43 ` [PATCH v13 1/5] rust: time: Add PartialEq/Eq/PartialOrd/Ord trait to Ktime FUJITA Tomonori
2025-04-13 10:43 ` [PATCH v13 2/5] rust: time: Introduce Delta type FUJITA Tomonori
2025-04-13 10:43 ` [PATCH v13 3/5] rust: time: Introduce Instant type FUJITA Tomonori
2025-04-14  0:06   ` Boqun Feng [this message]
2025-04-14  7:04     ` Andreas Hindborg
2025-04-14 11:59       ` FUJITA Tomonori
2025-04-15 18:01         ` Boqun Feng
2025-04-16  3:46           ` FUJITA Tomonori
2025-04-22 10:07             ` Andreas Hindborg
2025-04-22 13:50               ` FUJITA Tomonori
2025-04-13 10:43 ` [PATCH v13 4/5] rust: time: Add wrapper for fsleep() function FUJITA Tomonori
2025-04-13 10:43 ` [PATCH v13 5/5] MAINTAINERS: rust: Add a new section for all of the time stuff FUJITA Tomonori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67fc517b.050a0220.301460.dfe7@mx.google.com \
    --to=boqun.feng@gmail$(echo .)com \
    --cc=a.hindborg@kernel$(echo .)org \
    --cc=a.hindborg@samsung$(echo .)com \
    --cc=alex.gaynor@gmail$(echo .)com \
    --cc=aliceryhl@google$(echo .)com \
    --cc=andrew@lunn$(echo .)ch \
    --cc=anna-maria@linutronix$(echo .)de \
    --cc=arnd@arndb$(echo .)de \
    --cc=benno.lossin@proton$(echo .)me \
    --cc=bjorn3_gh@protonmail$(echo .)com \
    --cc=bsegall@google$(echo .)com \
    --cc=daniel.almeida@collabora$(echo .)com \
    --cc=david.laight.linux@gmail$(echo .)com \
    --cc=dietmar.eggemann@arm$(echo .)com \
    --cc=frederic@kernel$(echo .)org \
    --cc=fujita.tomonori@gmail$(echo .)com \
    --cc=gary@garyguo$(echo .)net \
    --cc=hkallweit1@gmail$(echo .)com \
    --cc=jstultz@google$(echo .)com \
    --cc=juri.lelli@redhat$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=me@kloenk$(echo .)dev \
    --cc=mgorman@suse$(echo .)de \
    --cc=mingo@redhat$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=ojeda@kernel$(echo .)org \
    --cc=peterz@infradead$(echo .)org \
    --cc=rostedt@goodmis$(echo .)org \
    --cc=rust-for-linux@vger$(echo .)kernel.org \
    --cc=sboyd@kernel$(echo .)org \
    --cc=tglx@linutronix$(echo .)de \
    --cc=tgunders@redhat$(echo .)com \
    --cc=tmgross@umich$(echo .)edu \
    --cc=vincent.guittot@linaro$(echo .)org \
    --cc=vschneid@redhat$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox