Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0514073f authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Lingutla Chandrasekhar
Browse files

sched: walt: Add BUG_ON() when wallclock goes backwards



This reverts 'commit b5e1207658f0 ("ANDROID: arch_timer: add error
handling when the MPM global timer is cleared")'

The above mentioned commit removed a BUG_ON() which gets hit, when
the wallclock goes backwards compared to the rq->window_start. This
condition is fatal for WALT accounting. The update_task_ravg() strictly
expects the wallclock - rq->window_start to be positive and when it
becomes negative, the accounting issues would show up at later point
of time which makes debugging difficult.

This BUG_ON() is a false positive only when the MPM global timer is
cleared and CPUs are running for a short time during force reset. It
is very easy to identify this condition than debugging the scheduler
accounting and time going backwards issues. So add the BUG_ON() back.

Change-Id: Ib52862abb9448dc6db70bb7db958d11545db095f
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: default avatarLingutla Chandrasekhar <clingutla@codeaurora.org>
parent 907327c1
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -272,15 +272,7 @@ update_window_start(struct rq *rq, u64 wallclock, int event)
	u64 old_window_start = rq->window_start;

	delta = wallclock - rq->window_start;
	/*
	 * If the MPM global timer is cleared, set delta as 0 to
	 * avoid kernel BUG happening
	 */
	if (delta < 0) {
		delta = 0;
		WARN_ONCE(1, "WALT wallclock appears to have gone backwards or reset\n");
	}

	BUG_ON(delta < 0);
	if (delta < sched_ravg_window)
		return old_window_start;