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: Simplify group idleness tracking

csg_slot_sync_queues_state_locked() queries the queues state which can
then be used to determine if a group is idle or not. Let's base our
idleness detection logic solely on the {idle,blocked}_queues masks to
avoid inconsistencies between the group state and the state of its
subqueues.

v2:
- Add R-b

v3:
- Collect R-b

Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: https://patch.msgid.link/20251128094839.3856402-2-boris.brezillon@collabora.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>

+2 -29
+2 -29
drivers/gpu/drm/panthor/panthor_sched.c
··· 108 108 109 109 /** @priority: Group priority. */ 110 110 u8 priority; 111 - 112 - /** 113 - * @idle: True if the group bound to this slot is idle. 114 - * 115 - * A group is idle when it has nothing waiting for execution on 116 - * all its queues, or when queues are blocked waiting for something 117 - * to happen (synchronization object). 118 - */ 119 - bool idle; 120 111 }; 121 112 122 113 /** ··· 1047 1056 static bool 1048 1057 group_is_idle(struct panthor_group *group) 1049 1058 { 1050 - struct panthor_device *ptdev = group->ptdev; 1051 - u32 inactive_queues; 1059 + u32 inactive_queues = group->idle_queues | group->blocked_queues; 1052 1060 1053 - if (group->csg_id >= 0) 1054 - return ptdev->scheduler->csg_slots[group->csg_id].idle; 1055 - 1056 - inactive_queues = group->idle_queues | group->blocked_queues; 1057 1061 return hweight32(inactive_queues) == group->queue_count; 1058 1062 } 1059 1063 ··· 1705 1719 return (events & (CS_FAULT | CS_TILER_OOM)) != 0; 1706 1720 } 1707 1721 1708 - static void csg_slot_sync_idle_state_locked(struct panthor_device *ptdev, u32 csg_id) 1709 - { 1710 - struct panthor_csg_slot *csg_slot = &ptdev->scheduler->csg_slots[csg_id]; 1711 - struct panthor_fw_csg_iface *csg_iface; 1712 - 1713 - lockdep_assert_held(&ptdev->scheduler->lock); 1714 - 1715 - csg_iface = panthor_fw_get_csg_iface(ptdev, csg_id); 1716 - csg_slot->idle = csg_iface->output->status_state & CSG_STATUS_STATE_IS_IDLE; 1717 - } 1718 - 1719 1722 static void csg_slot_process_idle_event_locked(struct panthor_device *ptdev, u32 csg_id) 1720 1723 { 1721 1724 struct panthor_scheduler *sched = ptdev->scheduler; ··· 1966 1991 if (acked & CSG_STATE_MASK) 1967 1992 csg_slot_sync_state_locked(ptdev, csg_id); 1968 1993 1969 - if (acked & CSG_STATUS_UPDATE) { 1994 + if (acked & CSG_STATUS_UPDATE) 1970 1995 csg_slot_sync_queues_state_locked(ptdev, csg_id); 1971 - csg_slot_sync_idle_state_locked(ptdev, csg_id); 1972 - } 1973 1996 1974 1997 if (ret && acked != req_mask && 1975 1998 ((csg_iface->input->req ^ csg_iface->output->ack) & req_mask) != 0) {