Re: [PATCH V3] rcu: Update jiffies locally in rcu_cpu_stall_reset()
From: Huacai Chen
Date: Thu Aug 24 2023 - 08:54:24 EST
Hi, Thomas,
On Thu, Aug 24, 2023 at 5:37 PM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> On Tue, Aug 22 2023 at 12:02, Huacai Chen wrote:
> > + * This function may be called in NMI context, so we cannot use ktime_get_ns()
> > + * and ktime_get_coarse_ns(). Instead, we use their inaccurate but safe friends
> > + * ktime_get_mono_fast_ns() and ktime_get_seconds() which will cause rcu_state.
> > + * jiffies_stall to be a little large than expected (harmless and safer).
>
> What's inaccurate about ktime_get_mono_fast_ns()? Bogus comments are
> even worse than no comments.
ktime_get_mono_fast_ns() is not as accurate as ktime_get_ns(), I get
this conclusion from:
* So if the update lowers the slope, readers who are forced to the
* not yet updated second array are still using the old steeper slope.
>
> > */
> > void rcu_cpu_stall_reset(void)
> > {
> > + u64 curr, last, delta;
> > +
> > + curr = ktime_get_mono_fast_ns();
> > + last = ktime_get_seconds() * NSEC_PER_SEC;
>
> So this will trigger a warning when someone debugs suspend with KGDB.
Yes, ktime_get_seconds() may cause a warning, I haven't noticed this before.
>
> It seems the approach taken here seems to be to throw stuff at the wall
> and see what sticks.
I don't understand what's meaning, but I believe your advice in
another thread is the best solution, so let me try.
Huacai
>
> Thanks,
>
> tglx