Re: [PATCH 7/7] selftests/proc: Remove idle time monotonicity assertions

From: Frederic Weisbecker
Date: Wed Feb 22 2023 - 09:50:21 EST


On Mon, Feb 20, 2023 at 10:53:17PM +0100, Thomas Gleixner wrote:
> On Mon, Feb 20 2023 at 13:41, Frederic Weisbecker wrote:
>
> > Due to broken iowait task counting design (cf: comments above
> > get_cpu_idle_time_us() and nr_iowait()), it is not possible to provide
> > the guarantee that /proc/stat or /proc/uptime display monotonic idle
> > time values.
> >
> > Remove the selftests that verify the related wrong assumption so that
> > testers and maintainers don't spend more time on that.
> >
> > Reported-by: Yu Liao <liaoyu15@xxxxxxxxxx>
> > Reported-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>
> I did really not ask you to remove the selftests alltogether.
>
> Those tests check uptime and idle time. I asked you to remove the idle
> time monotonicity assertion.
>
> uptime is really supposed to be monotonically increasing. It's based on
> CLOCK_BOOTTIME. If that goes backwards then we surely have more trouble
> than /proc/uptime.

Right, I naively thought it wasn't worth checking CLOCK_BOOTTIME monotonicity
alone... Anyway, kept that in the new version.

>
> But it would be a good thing to change the test in the following way:
>
> ut1 = parse("/proc/uptime");
> bt1 = clock_gettime(CLOCK_BOOTTIME);
> assert(ut1 <= bt1);
> ut2 = parse("/proc/uptime");
> bt2 = clock_gettime(CLOCK_BOOTTIME);
> assert(ut2 <= bt2);
> assert(ut1 <= ut2);
> ....
>
> Hmm?

Makes sense, added to the new version.

Thanks!

>
> Thanks,
>
> tglx