[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a5tn1kp6.ffs@tglx>
Date: Fri, 15 Sep 2023 18:10:29 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Peter Hilber <peter.hilber@...nsynergy.com>,
linux-kernel@...r.kernel.org
Cc: Peter Hilber <peter.hilber@...nsynergy.com>,
John Stultz <jstultz@...gle.com>,
Stephen Boyd <sboyd@...nel.org>,
"Christopher S. Hall" <christopher.s.hall@...el.com>
Subject: Re: [RFC PATCH v2 2/6] timekeeping: Fix cross-timestamp
interpolation corner case decision
On Fri, Aug 18 2023 at 03:20, Peter Hilber wrote:
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -1247,7 +1247,8 @@ int get_device_system_crosststamp(int (*get_time_fn)
> */
> now = tk_clock_read(&tk->tkr_mono);
> interval_start = tk->tkr_mono.cycle_last;
> - if (!cycle_between(interval_start, cycles, now)) {
> + if (!cycle_between(interval_start, cycles, now) &&
> + cycles != interval_start) {
> clock_was_set_seq = tk->clock_was_set_seq;
> cs_was_changed_seq = tk->cs_was_changed_seq;
> cycles = interval_start;
So the explanation in the changelog makes some sense, but this code
without any further explanation just makes my brain explode.
This whole thing screams for a change to cycle_between() so it becomes:
timestamp_in_interval(start, end, ts)
and make start inclusive and not exclusive, no?
That's actually correct for both usage sites because for interpolation
the logic is the same. history_begin->cycles is a valid timestamp, no?
Thanks,
tglx
Powered by blists - more mailing lists