Re: [PATCH V3] rcu: Update jiffies locally in rcu_cpu_stall_reset()

From: Thomas Gleixner
Date: Thu Aug 24 2023 - 05:38:34 EST


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.

> */
> 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.

It seems the approach taken here seems to be to throw stuff at the wall
and see what sticks.

Thanks,

tglx