Re: locking/csd-lock: Switch from sched_clock() to ktime_get_mono_fast_ns()
From: Paul E. McKenney
Date: Thu Oct 10 2024 - 14:56:47 EST
On Thu, Oct 10, 2024 at 11:13:35AM -0400, Rik van Riel wrote:
> On Wed, 2024-10-09 at 10:57 -0700, Paul E. McKenney wrote:
> > Currently, the CONFIG_CSD_LOCK_WAIT_DEBUG code uses sched_clock()
> > to check for excessive CSD-lock wait times. This works, but does not
> > guarantee monotonic timestamps. Therefore, switch from sched_clock()
> > to ktime_get_mono_fast_ns(), which does guarantee monotonic
> > timestamps,
> > at least in the absence of calls from NMI handlers, which are not
> > involved
> > in this code path.
> >
> > Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
> > Cc: Neeraj Upadhyay <neeraj.upadhyay@xxxxxxxxxx>
> > Cc: Rik van Riel <riel@xxxxxxxxxxx>
> > Cc: Leonardo Bras <leobras@xxxxxxxxxx>
> > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > Cc: "Peter Zijlstra (Intel)" <peterz@xxxxxxxxxxxxx>
>
> The functional change here is that sched_clock() uses rdtsc(),
> while ktime_get_mono_fast_ns() uses rdtsc_ordered().
>
> I don't know if sched_clock() should also be using rdtsc_ordered().
>
> Reviewed-by: Rik van Riel <riel@xxxxxxxxxxx>
Thank you! I will apply this on my next rebase.
Thanx, Paul