intel_cstates: ignore negative time-delta values

I have no idea why this can happen or if there is a deeper problem.

Should fix #16546.

Change-Id: Ia160e293eabefae636ce4c861864c99b0aaa68db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3717
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
Adrien Destugues 2021-01-30 21:15:48 +01:00 committed by Adrien Destugues
parent e03da2bd84
commit 5504fc757c

View File

@ -100,7 +100,9 @@ cstates_idle(void)
bigtime_t delta = system_time() - start;
locker.Unlock();
sIdleTime[cpu] = (idleTime + delta) / 2;
// Negative delta shouldn't happen, but apparently it does...
if (delta >= 0)
sIdleTime[cpu] = (idleTime + delta) / 2;
}