Re: [PATCH] rust: time: Pass correct timer mode ID to hrtimer_start_range_ns
From: Miguel Ojeda
Date: Wed Jul 16 2025 - 20:05:38 EST
On Fri, Jul 11, 2025 at 12:51 AM Lyude Paul <lyude@xxxxxxxxxx> wrote:
>
> While rebasing rvkms I noticed that timers I was setting seemed to have
> pretty random timer values that amounted slightly over 2x the time value I
> set each time. After a lot of debugging, I finally managed to figure out
> why: it seems that since we moved to Instant and Delta, we mistakenly
> began passing the clocksource ID to hrtimer_start_range_ns, when we should
> be passing the timer mode instead. Presumably, this works fine for simple
> relative timers - but immediately breaks on other types of timers.
>
> So, fix this by passing the ID for the timer mode instead.
>
> Signed-off-by: Lyude Paul <lyude@xxxxxxxxxx>
> Cc: FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>
> Fixes: fcc1dd8c8656 ("rust: time: Make HasHrTimer generic over HrTimerMode")
Applied to `rust-next` (on top of the timekeeping merge) -- thanks everyone!
[ Removed cast, applied `rustfmt`, fixed `Fixes:` tag. - Miguel ]
I assume the cast was there just because the original line (`Clock::ID`) had it.
Cheers,
Miguel