Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/panthor: Make sure we resume the tick when new jobs are submitted

If the group is already assigned a slot but was idle before this job
submission, we need to make sure the priority rotation happens in the
future. Extract the existing logic living in group_schedule_locked()
and call this new sched_resume_tick() helper from the "group is
assigned a slot" path.

v2:
- Add R-b

v3:
- Re-use queue_mask to clear the bit
- Collect R-b

Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: https://patch.msgid.link/20251128094839.3856402-8-boris.brezillon@collabora.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>

+34 -9
+34 -9
drivers/gpu/drm/panthor/panthor_sched.c
··· 2624 2624 sched_queue_delayed_work(sched, tick, 0); 2625 2625 } 2626 2626 2627 + static void sched_resume_tick(struct panthor_device *ptdev) 2628 + { 2629 + struct panthor_scheduler *sched = ptdev->scheduler; 2630 + u64 delay_jiffies, now; 2631 + 2632 + drm_WARN_ON(&ptdev->base, sched->resched_target != U64_MAX); 2633 + 2634 + /* Scheduler tick was off, recalculate the resched_target based on the 2635 + * last tick event, and queue the scheduler work. 2636 + */ 2637 + now = get_jiffies_64(); 2638 + sched->resched_target = sched->last_tick + sched->tick_period; 2639 + if (sched->used_csg_slot_count == sched->csg_slot_count && 2640 + time_before64(now, sched->resched_target)) 2641 + delay_jiffies = min_t(unsigned long, sched->resched_target - now, ULONG_MAX); 2642 + else 2643 + delay_jiffies = 0; 2644 + 2645 + sched_queue_delayed_work(sched, tick, delay_jiffies); 2646 + } 2647 + 2627 2648 static void group_schedule_locked(struct panthor_group *group, u32 queue_mask) 2628 2649 { 2629 2650 struct panthor_device *ptdev = group->ptdev; 2630 2651 struct panthor_scheduler *sched = ptdev->scheduler; 2631 2652 struct list_head *queue = &sched->groups.runnable[group->priority]; 2632 - u64 delay_jiffies = 0; 2633 2653 bool was_idle; 2634 - u64 now; 2635 2654 2636 2655 if (!group_can_run(group)) 2637 2656 return; ··· 2695 2676 /* Scheduler tick was off, recalculate the resched_target based on the 2696 2677 * last tick event, and queue the scheduler work. 2697 2678 */ 2698 - now = get_jiffies_64(); 2699 - sched->resched_target = sched->last_tick + sched->tick_period; 2700 - if (sched->used_csg_slot_count == sched->csg_slot_count && 2701 - time_before64(now, sched->resched_target)) 2702 - delay_jiffies = min_t(unsigned long, sched->resched_target - now, ULONG_MAX); 2703 - 2704 - sched_queue_delayed_work(sched, tick, delay_jiffies); 2679 + sched_resume_tick(ptdev); 2705 2680 } 2706 2681 2707 2682 static void queue_stop(struct panthor_queue *queue, ··· 3327 3314 if (group->csg_id < 0) { 3328 3315 group_schedule_locked(group, BIT(job->queue_idx)); 3329 3316 } else { 3317 + u32 queue_mask = BIT(job->queue_idx); 3318 + bool resume_tick = group_is_idle(group) && 3319 + (group->idle_queues & queue_mask) && 3320 + !(group->blocked_queues & queue_mask) && 3321 + sched->resched_target == U64_MAX; 3322 + 3323 + /* We just added something to the queue, so it's no longer idle. */ 3324 + group->idle_queues &= ~queue_mask; 3325 + 3326 + if (resume_tick) 3327 + sched_resume_tick(ptdev); 3328 + 3330 3329 gpu_write(ptdev, CSF_DOORBELL(queue->doorbell_id), 1); 3331 3330 if (!sched->pm.has_ref && 3332 3331 !(group->blocked_queues & BIT(job->queue_idx))) {