On 06/11/2025 14:46, Boris Brezillon wrote:
> We have a full tick when the remaining time to the next tick is zero,
> not the other way around. Declare a full_tick variable so we don't get
> that test wrong in other places.
>
> Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
> Signed-off-by: Boris Brezillon <[email protected]>
Reviewed-by: Steven Price <[email protected]>
> ---
> drivers/gpu/drm/panthor/panthor_sched.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c
> b/drivers/gpu/drm/panthor/panthor_sched.c
> index 69cc1b4c23f2..b6489e9ba1f0 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -2349,6 +2349,7 @@ static void tick_work(struct work_struct *work)
> u64 remaining_jiffies = 0, resched_delay;
> u64 now = get_jiffies_64();
> int prio, ret, cookie;
> + bool full_tick;
>
> if (!drm_dev_enter(&ptdev->base, &cookie))
> return;
> @@ -2360,15 +2361,17 @@ static void tick_work(struct work_struct *work)
> if (time_before64(now, sched->resched_target))
> remaining_jiffies = sched->resched_target - now;
>
> + full_tick = remaining_jiffies == 0;
> +
> mutex_lock(&sched->lock);
> if (panthor_device_reset_is_pending(sched->ptdev))
> goto out_unlock;
>
> - tick_ctx_init(sched, &ctx, remaining_jiffies != 0);
> + tick_ctx_init(sched, &ctx, full_tick);
> if (ctx.csg_upd_failed_mask)
> goto out_cleanup_ctx;
>
> - if (remaining_jiffies) {
> + if (!full_tick) {
> /* Scheduling forced in the middle of a tick. Only RT groups
> * can preempt non-RT ones. Currently running RT groups can't be
> * preempted.