diff options
author | Lyude Paul <lyude@redhat.com> | 2025-07-10 18:51:13 -0400 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2025-07-17 00:55:35 +0200 |
commit | 23b128bba76776541dc09efaf3acf6242917e1f0 (patch) | |
tree | 88549dff21d1c65d1b738307246c571986b16249 /rust/kernel | |
parent | 77580e801a981f0c24c886460840d1ed70c794ae (diff) |
rust: time: Pass correct timer mode ID to hrtimer_start_range_ns
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@redhat.com>
Acked-by: Andreas Hindborg <a.hindborg@kernel.org>
Reviewed-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Fixes: e0c0ab04f678 ("rust: time: Make HasHrTimer generic over HrTimerMode")
Link: https://lore.kernel.org/r/20250710225129.670051-1-lyude@redhat.com
[ Removed cast, applied `rustfmt`, fixed `Fixes:` tag. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel')
-rw-r--r-- | rust/kernel/time/hrtimer.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/time/hrtimer.rs b/rust/kernel/time/hrtimer.rs index d6830b6bbee7..144e3b57cc78 100644 --- a/rust/kernel/time/hrtimer.rs +++ b/rust/kernel/time/hrtimer.rs @@ -398,7 +398,7 @@ pub unsafe trait HasHrTimer<T> { Self::c_timer_ptr(this).cast_mut(), expires.as_nanos(), 0, - <Self::TimerMode as HrTimerMode>::Clock::ID as u32, + <Self::TimerMode as HrTimerMode>::C_MODE, ); } } |