We have a few path where we schedule the tick work immediately without
changing the resched_target. If the tick was stopped, this would lead
to a remaining_jiffies that's always > 0, and it wouldn't force a full
tick in that case. Add extra checks to cover that case properly.

Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
Signed-off-by: Boris Brezillon <[email protected]>
---
 drivers/gpu/drm/panthor/panthor_sched.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panthor/panthor_sched.c 
b/drivers/gpu/drm/panthor/panthor_sched.c
index b6489e9ba1f0..1eba56e7360d 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -2358,8 +2358,12 @@ static void tick_work(struct work_struct *work)
        if (drm_WARN_ON(&ptdev->base, ret))
                goto out_dev_exit;
 
-       if (time_before64(now, sched->resched_target))
+       if (sched->resched_target != U64_MAX &&
+           time_before64(now, sched->resched_target))
                remaining_jiffies = sched->resched_target - now;
+       else if (sched->resched_target == U64_MAX &&
+                time_before64(now, sched->last_tick + sched->tick_period))
+               remaining_jiffies = sched->last_tick + sched->tick_period - now;
 
        full_tick = remaining_jiffies == 0;
 
-- 
2.51.1

Reply via email to