mcs: Add debug assert to check scheduling correct

The scheduler cannot correctly schedule once the timestamp exceeds
MAX_RELEASE_TIME as releases beyond this point may be subject to
overflow. For most systems this should still allow a great many years if
the timestamp starts from 0 at system boot.

Some systems currently start with a random initial timestamp and my
begin with a timestamp that prvents correct budgeting. This assert helps
to catch cases where scheduling becomes invalid due to the timestamp
exceeding the give bound.

Signed-off-by: Curtis Millar <curtis.millar@data61.csiro.au>
This commit is contained in:
Curtis Millar 2021-05-13 15:40:46 +10:00 committed by Curtis Millar
parent dd693a924c
commit 2f35873885

View file

@ -225,6 +225,7 @@ static inline void updateTimestamp(void)
{
time_t prev = NODE_STATE(ksCurTime);
NODE_STATE(ksCurTime) = getCurrentTime();
assert(NODE_STATE(ksCurTime) < MAX_RELEASE_TIME);
time_t consumed = (NODE_STATE(ksCurTime) - prev);
NODE_STATE(ksConsumed) += consumed;
if (CONFIG_NUM_DOMAINS > 1) {