STRUCT PANTHOR_SCHEDULER(9)
π struct panthor_scheduler(9) β like, the whole scheduler object, bestie
okay so this is a page from the Kernel API Manual, and it's literally about struct panthor_scheduler β the object that manages the scheduler for panthor. It's giving "kernel internals but make it cute" β¨ ngl this struct is a whole main character with so many fields, so grab a π and let's go.
β¨ NAME β¨
struct panthor_scheduler β the object used to manage the scheduler π
π¦ SYNOPSIS π¦
struct panthor_scheduler {
struct panthor_device *ptdev;
struct workqueue_struct *wq;
struct workqueue_struct *heap_alloc_wq;
struct delayed_work tick_work;
struct work_struct sync_upd_work;
struct work_struct fw_events_work;
atomic_t fw_events;
u64 resched_target;
u64 last_tick;
u64 tick_period;
struct mutex lock;
struct {
struct list_head runnable[PANTHOR_CSG_PRIORITY_COUNT];
struct list_head idle[PANTHOR_CSG_PRIORITY_COUNT];
struct list_head waiting;
} groups;
struct panthor_csg_slot csg_slots[MAX_CSGS];
u32 csg_slot_count;
u32 cs_slot_count;
u32 as_slot_count;
u32 used_csg_slot_count;
u32 sb_slot_count;
bool might_have_idle_groups;
struct {
bool has_ref;
} pm;
struct {
struct mutex lock;
atomic_t in_progress;
struct list_head stopped_groups;
} reset;
};
π MEMBERS π
here's the tour of every single field, no skips, no cap π
ptdevβ the device, obviously π«Άwqβ the workqueue used by our internal scheduler logic and bydrm_gpu_scheduler.
It's for the scheduler tick, group updates, and other kinds of FW event processing that can't be handled in the threaded interrupt path. It also gets passed to the drm_gpu_scheduler instances embedded in panthor_queue. iconic β¨
heap_alloc_wqβ the workqueue used to scheduletiler_oomworks.
We literally have a whole dedicated queue just for heap chunk allocation works, so that we don't block the rest of the scheduler when an allocation tries to reclaim memory. considerate queen behavior π
tick_workβ the work that gets executed on a scheduling tick. β°sync_upd_workβ the work used to process synchronization object updates.
We use this work to unblock queues/groups that were waiting on a synchronization object. π
fw_events_workβ the work used to process FW events outside the interrupt path.
Even though the interrupt is threaded, any event processing that needs to take panthor_scheduler::lock has to be processed outside the interrupt path, so we don't block the tick logic when it calls panthor_fw_{csg,wait}_wait_acks. And since most of the event processing requires taking this lock, we just delegate all FW event processing to the scheduler workqueue. delegation slay π
fw_eventsβ a bitmask encoding pending FW events. π₯resched_targetβ when the next tick should occur.
Expressed in jiffies. β±οΈ
last_tickβ when the last tick occurred.
Expressed in jiffies. fr fr
tick_periodβ the tick period, in jiffies.lockβ the lock protecting access to all the scheduler fields.
It should be taken in the tick work, in the irq handler, and anywhere the groups fields are touched. protect her at all costs π
groupsβ the various lists used to classify groups.groups.runnableβ the runnable group lists.
When a group has queues that want to execute something, its panthor_group::run_node should be inserted here.
There's one list per-priority. π
groups.idleβ the idle group lists.
When all queues of a group are idle (either because they have nothing to execute, or because they're blocked), the panthor_group::run_node field should be inserted here.
One list per-priority, again. π€
groups.waitingβ the list of groups whose queues are blocked on a synchronization object.
Insert panthor_group::wait_node here when a group is waiting for synchronization objects to be signaled.
This list gets evaluated in the sync_upd_work work. π¦
csg_slotsβ FW command stream group slots.csg_slot_countβ the number of command stream group slots exposed by the FW.cs_slot_countβ the number of command stream slots per group slot exposed by the FW.as_slot_countβ the number of address space slots supported by the MMU.used_csg_slot_countβ the number of command stream group slots currently used. π―sb_slot_countβ the number of scoreboard slots.might_have_idle_groupsβtrueif an active group might have become idle.
This will force a tick, so other runnable groups can be scheduled if one or more active groups became idle. highkey important π
pmβ power management related fields.pm.has_refβtrueif the scheduler owns a runtime PM reference. πresetβ reset related fields.reset.lockβ the lock protecting the other reset fields.reset.in_progressβtrueif a reset is in progress.
It gets set to true in panthor_sched_pre_reset and back to false in panthor_sched_post_reset. π§
reset.stopped_groupsβ the list containing all groups that were stopped before a reset.
Insert panthor_group::run_node in the pre_reset path. πΈ
π SEE ALSO π
okay bestie, here's the whole friend group β go read these too, iykyk:
Kernel file ./drivers/gpu/drm/panthor/panthor_sched.c Scheduler(9), struct panthor_csg_slot(9), enum panthor_csg_priority(9), struct panthor_syncobj_32b(9), struct panthor_syncobj_64b(9), struct panthor_queue(9), enum panthor_group_state(9), struct panthor_group(9), group_queue_work(9), sched_queue_work(9), sched_queue_delayed_work(9), struct panthor_group_pool(9), struct panthor_job(9), group_bind_locked(9), group_unbind_locked(9), cs_slot_prog_locked(9), cs_slot_reset_locked(9), csg_slot_sync_priority_locked(9), cs_slot_sync_queue_state_locked(9), sched_process_global_irq_locked(9), panthor_sched_report_fw_events(9), panthor_sched_report_mmu_fault(9), panthor_fdinfo_gather_group_mem_info(9)
and that's the whole page, periodt π
β¨ this gem lives over in ./drivers/gpu/drm/panthor, dated October 2026 β thanks for reading my little kernel group chat, love u, bye π«Άππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms