/** * DOC: Scheduler * * Mali CSF hardware adopts a firmware-assisted scheduling model, where * the firmware takes care of scheduling aspects, to some extent. * * The scheduling happens at the scheduling group level, each group * contains 1 to N queues (N is FW/hardware dependent, and exposed * through the firmware interface). Each queue is assigned a command * stream ring buffer, which serves as a way to get jobs submitted to * the GPU, among other things. * * The firmware can schedule a maximum of M groups (M is FW/hardware * dependent, and exposed through the firmware interface). Passed * this maximum number of groups, the kernel must take care of * rotating the groups passed to the firmware so every group gets * a chance to have his queues scheduled for execution. * * The current implementation only supports with kernel-mode queues. * In other terms, userspace doesn't have access to the ring-buffer. * Instead, userspace passes indirect command stream buffers that are * called from the queue ring-buffer by the kernel using a pre-defined * sequence of command stream instructions to ensure the userspace driver * always gets consistent results (cache maintenance, * synchronization, ...). * * We rely on the drm_gpu_scheduler framework to deal with job * dependencies and submission. As any other driver dealing with a * FW-scheduler, we use the 1:1 entity:scheduler mode, such that each * entity has its own job scheduler. When a job is ready to be executed * (all its dependencies are met), it is pushed to the appropriate * queue ring-buffer, and the group is scheduled for execution if it * wasn't already active. * * Kernel-side group scheduling is timeslice-based. When we have less * groups than there are slots, the periodic tick is disabled and we * just let the FW schedule the active groups. When there are more * groups than slots, we let each group a chance to execute stuff for * a given amount of time, and then re-evaluate and pick new groups * to schedule. The group selection algorithm is based on * priority+round-robin. * * Even though user-mode queues is out of the scope right now, the * current design takes them into account by avoiding any guess on the * group/queue state that would be based on information we wouldn't have * if userspace was in charge of the ring-buffer. That's also one of the * reason we don't do 'cooperative' scheduling (encoding FW group slot * reservation as dma_fence that would be returned from the * drm_gpu_scheduler::prepare_job() hook, and treating group rotation as * a queue of waiters, ordered by job submission order). This approach * would work for kernel-mode queues, but would make user-mode queues a * lot more complicated to retrofit.
*/
/** * struct panthor_csg_slot - Command stream group slot * * This represents a FW slot for a scheduling group.
*/ struct panthor_csg_slot { /** @group: Scheduling group bound to this slot. */ struct panthor_group *group;
/** @priority: Group priority. */
u8 priority;
/** * @idle: True if the group bound to this slot is idle. * * A group is idle when it has nothing waiting for execution on * all its queues, or when queues are blocked waiting for something * to happen (synchronization object).
*/ bool idle;
};
/** @PANTHOR_CSG_PRIORITY_MEDIUM: Medium priority group. */
PANTHOR_CSG_PRIORITY_MEDIUM,
/** @PANTHOR_CSG_PRIORITY_HIGH: High priority group. */
PANTHOR_CSG_PRIORITY_HIGH,
/** * @PANTHOR_CSG_PRIORITY_RT: Real-time priority group. * * Real-time priority allows one to preempt scheduling of other * non-real-time groups. When such a group becomes executable, * it will evict the group with the lowest non-rt priority if * there's no free group slot available.
*/
PANTHOR_CSG_PRIORITY_RT,
/** @PANTHOR_CSG_PRIORITY_COUNT: Number of priority levels. */
PANTHOR_CSG_PRIORITY_COUNT,
};
/** * struct panthor_scheduler - Object used to manage the scheduler
*/ struct panthor_scheduler { /** @ptdev: Device. */ struct panthor_device *ptdev;
/** * @wq: Workqueue used by our internal scheduler logic and * drm_gpu_scheduler. * * Used for the scheduler tick, group update or other kind of FW * event processing that can't be handled in the threaded interrupt * path. Also passed to the drm_gpu_scheduler instances embedded * in panthor_queue.
*/ struct workqueue_struct *wq;
/** * @heap_alloc_wq: Workqueue used to schedule tiler_oom works. * * We have a queue dedicated to heap chunk allocation works to avoid * blocking the rest of the scheduler if the allocation tries to * reclaim memory.
*/ struct workqueue_struct *heap_alloc_wq;
/** @tick_work: Work executed on a scheduling tick. */ struct delayed_work tick_work;
/** * @sync_upd_work: Work used to process synchronization object updates. * * We use this work to unblock queues/groups that were waiting on a * synchronization object.
*/ struct work_struct sync_upd_work;
/** * @fw_events_work: Work used to process FW events outside the interrupt path. * * Even if the interrupt is threaded, we need any event processing * that require taking the panthor_scheduler::lock to be processed * outside the interrupt path so we don't block the tick logic when * it calls panthor_fw_{csg,wait}_wait_acks(). Since most of the * event processing requires taking this lock, we just delegate all * FW event processing to the scheduler workqueue.
*/ struct work_struct fw_events_work;
/** * @resched_target: When the next tick should occur. * * Expressed in jiffies.
*/
u64 resched_target;
/** * @last_tick: When the last tick occurred. * * Expressed in jiffies.
*/
u64 last_tick;
/** @tick_period: Tick period in jiffies. */
u64 tick_period;
/** * @lock: Lock protecting access to all the scheduler fields. * * Should be taken in the tick work, the irq handler, and anywhere the @groups * fields are touched.
*/ struct mutex lock;
/** @groups: Various lists used to classify groups. */ struct { /** * @runnable: Runnable group lists. * * When a group has queues that want to execute something, * its panthor_group::run_node should be inserted here. * * One list per-priority.
*/ struct list_head runnable[PANTHOR_CSG_PRIORITY_COUNT];
/** * @idle: Idle group lists. * * When all queues of a group are idle (either because they * have nothing to execute, or because they are blocked), the * panthor_group::run_node field should be inserted here. * * One list per-priority.
*/ struct list_head idle[PANTHOR_CSG_PRIORITY_COUNT];
/** * @waiting: 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 is evaluated in the @sync_upd_work work.
*/ struct list_head waiting;
} groups;
/** @csg_slot_count: Number of command stream group slots exposed by the FW. */
u32 csg_slot_count;
/** @cs_slot_count: Number of command stream slot per group slot exposed by the FW. */
u32 cs_slot_count;
/** @as_slot_count: Number of address space slots supported by the MMU. */
u32 as_slot_count;
/** @used_csg_slot_count: Number of command stream group slot currently used. */
u32 used_csg_slot_count;
/** @sb_slot_count: Number of scoreboard slots. */
u32 sb_slot_count;
/** * @might_have_idle_groups: True if 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.
*/ bool might_have_idle_groups;
/** @pm: Power management related fields. */ struct { /** @has_ref: True if the scheduler owns a runtime PM reference. */ bool has_ref;
} pm;
/** @reset: Reset related fields. */ struct { /** @lock: Lock protecting the other reset fields. */ struct mutex lock;
/** * @in_progress: True if a reset is in progress. * * Set to true in panthor_sched_pre_reset() and back to false in * panthor_sched_post_reset().
*/
atomic_t in_progress;
/** * @stopped_groups: List containing all groups that were stopped * before a reset. * * Insert panthor_group::run_node in the pre_reset path.
*/ struct list_head stopped_groups;
} reset;
};
/** * @status: Status. * * Not zero on failure.
*/
u32 status;
/** @pad: MBZ. */
u32 pad;
};
/** * struct panthor_queue - Execution queue
*/ struct panthor_queue { /** @scheduler: DRM scheduler used for this queue. */ struct drm_gpu_scheduler scheduler;
/** @entity: DRM scheduling entity used for this queue. */ struct drm_sched_entity entity;
/** * @remaining_time: Time remaining before the job timeout expires. * * The job timeout is suspended when the queue is not scheduled by the * FW. Every time we suspend the timer, we need to save the remaining * time so we can restore it later on.
*/ unsignedlong remaining_time;
/** @timeout_suspended: True if the job timeout was suspended. */ bool timeout_suspended;
/** * @doorbell_id: Doorbell assigned to this queue. * * Right now, all groups share the same doorbell, and the doorbell ID * is assigned to group_slot + 1 when the group is assigned a slot. But * we might decide to provide fine grained doorbell assignment at some * point, so don't have to wake up all queues in a group every time one * of them is updated.
*/
u8 doorbell_id;
/** * @priority: Priority of the queue inside the group. * * Must be less than 16 (Only 4 bits available).
*/
u8 priority; #define CSF_MAX_QUEUE_PRIO GENMASK(3, 0)
/** @input_fw_va: FW virtual address of the input interface buffer. */
u32 input_fw_va;
/** @output_fw_va: FW virtual address of the output interface buffer. */
u32 output_fw_va;
} iface;
/** * @syncwait: Stores information about the synchronization object this * queue is waiting on.
*/ struct { /** @gpu_va: GPU address of the synchronization object. */
u64 gpu_va;
/** @ref: Reference value to compare against. */
u64 ref;
/** @gt: True if this is a greater-than test. */ bool gt;
/** @sync64: True if this is a 64-bit sync object. */ bool sync64;
/** @seqno: Sequence number of the last initialized fence. */
atomic64_t seqno;
/** * @last_fence: Fence of the last submitted job. * * We return this fence when we get an empty command stream. * This way, we are guaranteed that all earlier jobs have completed * when drm_sched_job::s_fence::finished without having to feed * the CS ring buffer with a dummy job that only signals the fence.
*/ struct dma_fence *last_fence;
/** * @in_flight_jobs: List containing all in-flight jobs. * * Used to keep track and signal panthor_job::done_fence when the * synchronization object attached to the queue is signaled.
*/ struct list_head in_flight_jobs;
} fence_ctx;
/** @profiling: Job profiling data slots and access information. */ struct { /** @slots: Kernel BO holding the slots. */ struct panthor_kernel_bo *slots;
/** @slot_count: Number of jobs ringbuffer can hold at once. */
u32 slot_count;
/** @seqno: Index of the next available profiling information slot. */
u32 seqno;
} profiling;
};
/** * enum panthor_group_state - Scheduling group state.
*/ enum panthor_group_state { /** @PANTHOR_CS_GROUP_CREATED: Group was created, but not scheduled yet. */
PANTHOR_CS_GROUP_CREATED,
/** @PANTHOR_CS_GROUP_ACTIVE: Group is currently scheduled. */
PANTHOR_CS_GROUP_ACTIVE,
/** * @PANTHOR_CS_GROUP_SUSPENDED: Group was scheduled at least once, but is * inactive/suspended right now.
*/
PANTHOR_CS_GROUP_SUSPENDED,
/** * @PANTHOR_CS_GROUP_TERMINATED: Group was terminated. * * Can no longer be scheduled. The only allowed action is a destruction.
*/
PANTHOR_CS_GROUP_TERMINATED,
/** * @PANTHOR_CS_GROUP_UNKNOWN_STATE: Group is an unknown state. * * The FW returned an inconsistent state. The group is flagged unusable * and can no longer be scheduled. The only allowed action is a * destruction. * * When that happens, we also schedule a FW reset, to start from a fresh * state.
*/
PANTHOR_CS_GROUP_UNKNOWN_STATE,
};
/** @vm: VM bound to the group. */ struct panthor_vm *vm;
/** @compute_core_mask: Mask of shader cores that can be used for compute jobs. */
u64 compute_core_mask;
/** @fragment_core_mask: Mask of shader cores that can be used for fragment jobs. */
u64 fragment_core_mask;
/** @tiler_core_mask: Mask of tiler cores that can be used for tiler jobs. */
u64 tiler_core_mask;
/** @max_compute_cores: Maximum number of shader cores used for compute jobs. */
u8 max_compute_cores;
/** @max_fragment_cores: Maximum number of shader cores used for fragment jobs. */
u8 max_fragment_cores;
/** @max_tiler_cores: Maximum number of tiler cores used for tiler jobs. */
u8 max_tiler_cores;
/** @priority: Group priority (check panthor_csg_priority). */
u8 priority;
/** @blocked_queues: Bitmask reflecting the blocked queues. */
u32 blocked_queues;
/** @idle_queues: Bitmask reflecting the idle queues. */
u32 idle_queues;
/** @fatal_lock: Lock used to protect access to fatal fields. */
spinlock_t fatal_lock;
/** @fatal_queues: Bitmask reflecting the queues that hit a fatal exception. */
u32 fatal_queues;
/** @tiler_oom: Mask of queues that have a tiler OOM event to process. */
atomic_t tiler_oom;
/** @queue_count: Number of queues in this group. */
u32 queue_count;
/** @queues: Queues owned by this group. */ struct panthor_queue *queues[MAX_CS_PER_CSG];
/** * @csg_id: ID of the FW group slot. * * -1 when the group is not scheduled/active.
*/ int csg_id;
/** * @destroyed: True when the group has been destroyed. * * If a group is destroyed it becomes useless: no further jobs can be submitted * to its queues. We simply wait for all references to be dropped so we can * release the group object.
*/ bool destroyed;
/** * @timedout: True when a timeout occurred on any of the queues owned by * this group. * * Timeouts can be reported by drm_sched or by the FW. If a reset is required, * and the group can't be suspended, this also leads to a timeout. In any case, * any timeout situation is unrecoverable, and the group becomes useless. We * simply wait for all references to be dropped so we can release the group * object.
*/ bool timedout;
/** * @innocent: True when the group becomes unusable because the group suspension * failed during a reset. * * Sometimes the FW was put in a bad state by other groups, causing the group * suspension happening in the reset path to fail. In that case, we consider the * group innocent.
*/ bool innocent;
/** * @syncobjs: Pool of per-queue synchronization objects. * * One sync object per queue. The position of the sync object is * determined by the queue index.
*/ struct panthor_kernel_bo *syncobjs;
/** @fdinfo: Per-file info exposed through /proc/<process>/fdinfo */ struct { /** @data: Total sampled values for jobs in queues from this group. */ struct panthor_gpu_usage data;
/** * @fdinfo.lock: Spinlock to govern concurrent access from drm file's fdinfo * callback and job post-completion processing function
*/
spinlock_t lock;
/** @fdinfo.kbo_sizes: Aggregate size of private kernel BO's held by the group. */
size_t kbo_sizes;
} fdinfo;
/** @state: Group state. */ enum panthor_group_state state;
/** * @suspend_buf: Suspend buffer. * * Stores the state of the group and its queues when a group is suspended. * Used at resume time to restore the group in its previous state. * * The size of the suspend buffer is exposed through the FW interface.
*/ struct panthor_kernel_bo *suspend_buf;
/** * @protm_suspend_buf: Protection mode suspend buffer. * * Stores the state of the group and its queues when a group that's in * protection mode is suspended. * * Used at resume time to restore the group in its previous state. * * The size of the protection mode suspend buffer is exposed through the * FW interface.
*/ struct panthor_kernel_bo *protm_suspend_buf;
/** @sync_upd_work: Work used to check/signal job fences. */ struct work_struct sync_upd_work;
/** @tiler_oom_work: Work used to process tiler OOM events happening on this group. */ struct work_struct tiler_oom_work;
/** @term_work: Work used to finish the group termination procedure. */ struct work_struct term_work;
/** * @release_work: Work used to release group resources. * * We need to postpone the group release to avoid a deadlock when * the last ref is released in the tick work.
*/ struct work_struct release_work;
/** * @run_node: Node used to insert the group in the * panthor_group::groups::{runnable,idle} and * panthor_group::reset.stopped_groups lists.
*/ struct list_head run_node;
/** * @wait_node: Node used to insert the group in the * panthor_group::groups::waiting list.
*/ struct list_head wait_node;
};
/** * group_queue_work() - Queue a group work * @group: Group to queue the work for. * @wname: Work name. * * Grabs a ref and queue a work item to the scheduler workqueue. If * the work was already queued, we release the reference we grabbed. * * Work callbacks must release the reference we grabbed here.
*/ #define group_queue_work(group, wname) \ do { \
group_get(group); \ if (!queue_work((group)->ptdev->scheduler->wq, &(group)->wname ## _work)) \
group_put(group); \
} while (0)
/** * sched_queue_work() - Queue a scheduler work. * @sched: Scheduler object. * @wname: Work name. * * Conditionally queues a scheduler work if no reset is pending/in-progress.
*/ #define sched_queue_work(sched, wname) \ do { \ if (!atomic_read(&(sched)->reset.in_progress) && \
!panthor_device_reset_is_pending((sched)->ptdev)) \
queue_work((sched)->wq, &(sched)->wname ## _work); \
} while (0)
/** * sched_queue_delayed_work() - Queue a scheduler delayed work. * @sched: Scheduler object. * @wname: Work name. * @delay: Work delay in jiffies. * * Conditionally queues a scheduler delayed work if no reset is * pending/in-progress.
*/ #define sched_queue_delayed_work(sched, wname, delay) \ do { \ if (!atomic_read(&sched->reset.in_progress) && \
!panthor_device_reset_is_pending((sched)->ptdev)) \
mod_delayed_work((sched)->wq, &(sched)->wname ## _work, delay); \
} while (0)
/* * We currently set the maximum of groups per file to an arbitrary low value. * But this can be updated if we need more.
*/ #define MAX_GROUPS_PER_POOL 128
/** * struct panthor_group_pool - Group pool * * Each file get assigned a group pool.
*/ struct panthor_group_pool { /** @xa: Xarray used to manage group handles. */ struct xarray xa;
};
/** * struct panthor_job - Used to manage GPU job
*/ struct panthor_job { /** @base: Inherit from drm_sched_job. */ struct drm_sched_job base;
/** @group: Group of the queue this job will be pushed to. */ struct panthor_group *group;
/** @queue_idx: Index of the queue inside @group. */
u32 queue_idx;
/** @call_info: Information about the userspace command stream call. */ struct { /** @start: GPU address of the userspace command stream. */
u64 start;
/** @size: Size of the userspace command stream. */
u32 size;
/** * @latest_flush: Flush ID at the time the userspace command * stream was built. * * Needed for the flush reduction mechanism.
*/
u32 latest_flush;
} call_info;
/** @ringbuf: Position of this job is in the ring buffer. */ struct { /** @start: Start offset. */
u64 start;
/** @end: End offset. */
u64 end;
} ringbuf;
/** * @node: Used to insert the job in the panthor_queue::fence_ctx::in_flight_jobs * list.
*/ struct list_head node;
/** @done_fence: Fence signaled when the job is finished or cancelled. */ struct dma_fence *done_fence;
if (queue->syncwait.kmap) return queue->syncwait.kmap + queue->syncwait.offset;
bo = panthor_vm_get_bo_for_va(group->vm,
queue->syncwait.gpu_va,
&queue->syncwait.offset); if (drm_WARN_ON(&ptdev->base, IS_ERR_OR_NULL(bo))) goto err_put_syncwait_obj;
queue->syncwait.obj = &bo->base.base;
ret = drm_gem_vmap(queue->syncwait.obj, &map); if (drm_WARN_ON(&ptdev->base, ret)) goto err_put_syncwait_obj;
queue->syncwait.kmap = map.vaddr; if (drm_WARN_ON(&ptdev->base, !queue->syncwait.kmap)) goto err_put_syncwait_obj;
/* Dummy doorbell allocation: doorbell is assigned to the group and * all queues use the same doorbell. * * TODO: Implement LRU-based doorbell assignment, so the most often * updated queues get their own doorbell, thus avoiding useless checks * on queues belonging to the same group that are rarely updated.
*/ for (u32 i = 0; i < group->queue_count; i++)
group->queues[i]->doorbell_id = csg_id + 1;
csg_slot->group = group;
return 0;
}
/** * group_unbind_locked() - Unbind a group from a slot. * @group: Group to unbind. * * Return: 0 on success, a negative error code otherwise.
*/ staticint
group_unbind_locked(struct panthor_group *group)
{ struct panthor_device *ptdev = group->ptdev; struct panthor_csg_slot *slot;
/* Tiler OOM events will be re-issued next time the group is scheduled. */
atomic_set(&group->tiler_oom, 0);
cancel_work(&group->tiler_oom_work);
for (u32 i = 0; i < group->queue_count; i++)
group->queues[i]->doorbell_id = -1;
slot->group = NULL;
group_put(group); return 0;
}
/** * cs_slot_prog_locked() - Program a queue slot * @ptdev: Device. * @csg_id: Group slot ID. * @cs_id: Queue slot ID. * * Program a queue slot with the queue information so things can start being * executed on this queue. * * The group slot must have a group bound to it already (group_bind_locked()).
*/ staticvoid
cs_slot_prog_locked(struct panthor_device *ptdev, u32 csg_id, u32 cs_id)
{ struct panthor_queue *queue = ptdev->scheduler->csg_slots[csg_id].group->queues[cs_id]; struct panthor_fw_cs_iface *cs_iface = panthor_fw_get_cs_iface(ptdev, csg_id, cs_id);
/** * cs_slot_reset_locked() - Reset a queue slot * @ptdev: Device. * @csg_id: Group slot. * @cs_id: Queue slot. * * Change the queue slot state to STOP and suspend the queue timeout if * the queue is not blocked. * * The group slot must have a group bound to it (group_bind_locked()).
*/ staticint
cs_slot_reset_locked(struct panthor_device *ptdev, u32 csg_id, u32 cs_id)
{ struct panthor_fw_cs_iface *cs_iface = panthor_fw_get_cs_iface(ptdev, csg_id, cs_id); struct panthor_group *group = ptdev->scheduler->csg_slots[csg_id].group; struct panthor_queue *queue = group->queues[cs_id];
/* If the queue is blocked, we want to keep the timeout running, so * we can detect unbounded waits and kill the group when that happens.
*/ if (!(group->blocked_queues & BIT(cs_id)) && !queue->timeout_suspended) {
queue->remaining_time = drm_sched_suspend_timeout(&queue->scheduler);
queue->timeout_suspended = true;
WARN_ON(queue->remaining_time > msecs_to_jiffies(JOB_TIMEOUT_MS));
}
return 0;
}
/** * csg_slot_sync_priority_locked() - Synchronize the group slot priority * @ptdev: Device. * @csg_id: Group slot ID. * * Group slot priority update happens asynchronously. When we receive a * %CSG_ENDPOINT_CONFIG, we know the update is effective, and can * reflect it to our panthor_csg_slot object.
*/ staticvoid
csg_slot_sync_priority_locked(struct panthor_device *ptdev, u32 csg_id)
{ struct panthor_csg_slot *csg_slot = &ptdev->scheduler->csg_slots[csg_id]; struct panthor_fw_csg_iface *csg_iface;
/** * cs_slot_sync_queue_state_locked() - Synchronize the queue slot priority * @ptdev: Device. * @csg_id: Group slot. * @cs_id: Queue slot. * * Queue state is updated on group suspend or STATUS_UPDATE event.
*/ staticvoid
cs_slot_sync_queue_state_locked(struct panthor_device *ptdev, u32 csg_id, u32 cs_id)
{ struct panthor_group *group = ptdev->scheduler->csg_slots[csg_id].group; struct panthor_queue *queue = group->queues[cs_id]; struct panthor_fw_cs_iface *cs_iface =
panthor_fw_get_cs_iface(group->ptdev, csg_id, cs_id);
u32 status_wait_cond;
switch (cs_iface->output->status_blocked_reason) { case CS_STATUS_BLOCKED_REASON_UNBLOCKED: if (queue->iface.input->insert == queue->iface.output->extract &&
cs_iface->output->status_scoreboards == 0)
group->idle_queues |= BIT(cs_id); break;
case CS_STATUS_BLOCKED_REASON_SYNC_WAIT: if (list_empty(&group->wait_node)) {
list_move_tail(&group->wait_node,
&group->ptdev->scheduler->groups.waiting);
}
/* The queue is only blocked if there's no deferred operation * pending, which can be checked through the scoreboard status.
*/ if (!cs_iface->output->status_scoreboards)
group->blocked_queues |= BIT(cs_id);
csg_iface = panthor_fw_get_csg_iface(ptdev, csg_id);
group = csg_slot->group;
if (!group) return;
old_state = group->state;
csg_state = csg_iface->output->ack & CSG_STATE_MASK; switch (csg_state) { case CSG_STATE_START: case CSG_STATE_RESUME:
new_state = PANTHOR_CS_GROUP_ACTIVE; break; case CSG_STATE_TERMINATE:
new_state = PANTHOR_CS_GROUP_TERMINATED; break; case CSG_STATE_SUSPEND:
new_state = PANTHOR_CS_GROUP_SUSPENDED; break; default: /* The unknown state might be caused by a FW state corruption, * which means the group metadata can't be trusted anymore, and * the SUSPEND operation might propagate the corruption to the * suspend buffers. Flag the group state as unknown to make * sure it's unusable after that point.
*/
drm_err(&ptdev->base, "Invalid state on CSG %d (state=%d)",
csg_id, csg_state);
new_state = PANTHOR_CS_GROUP_UNKNOWN_STATE; break;
}
if (old_state == new_state) return;
/* The unknown state might be caused by a FW issue, reset the FW to * take a fresh start.
*/ if (new_state == PANTHOR_CS_GROUP_UNKNOWN_STATE)
panthor_device_schedule_reset(ptdev);
if (new_state == PANTHOR_CS_GROUP_SUSPENDED)
csg_slot_sync_queues_state_locked(ptdev, csg_id);
if (old_state == PANTHOR_CS_GROUP_ACTIVE) {
u32 i;
/* Reset the queue slots so we start from a clean * state when starting/resuming a new group on this * CSG slot. No wait needed here, and no ringbell * either, since the CS slot will only be re-used * on the next CSG start operation.
*/ for (i = 0; i < group->queue_count; i++) { if (group->queues[i])
cs_slot_reset_locked(ptdev, csg_id, i);
}
}
if (CS_EXCEPTION_TYPE(fatal) == DRM_PANTHOR_EXCEPTION_CS_UNRECOVERABLE) { /* If this exception is unrecoverable, queue a reset, and make * sure we stop scheduling groups until the reset has happened.
*/
panthor_device_schedule_reset(ptdev);
cancel_delayed_work(&sched->tick_work);
} else {
sched_queue_delayed_work(sched, tick, 0);
}
/* The group got scheduled out, we stop here. We will get a new tiler OOM event * when it's scheduled again.
*/ if (unlikely(csg_id < 0)) return 0;
if (IS_ERR(heaps) || frag_end > vt_end || vt_end >= vt_start) {
ret = -EINVAL;
} else { /* We do the allocation without holding the scheduler lock to avoid * blocking the scheduling.
*/
ret = panthor_heap_grow(heaps, heap_address,
renderpasses_in_flight,
pending_frag_count, &new_chunk_va);
}
/* If the heap context doesn't have memory for us, we want to let the * FW try to reclaim memory by waiting for fragment jobs to land or by * executing the tiler OOM exception handler, which is supposed to * implement incremental rendering.
*/ if (ret && ret != -ENOMEM) {
drm_warn(&ptdev->base, "Failed to extend the tiler heap\n");
group->fatal_queues |= BIT(cs_id);
sched_queue_delayed_work(sched, tick, 0); goto out_put_heap_pool;
}
/* We allocated a chunck, but couldn't link it to the heap * context because the group was scheduled out while we were * allocating memory. We need to return this chunk to the heap.
*/ if (unlikely(csg_id < 0 && new_chunk_va))
panthor_heap_return_chunk(heaps, heap_address, new_chunk_va);
/* We don't use group_queue_work() here because we want to queue the * work item to the heap_alloc_wq.
*/
group_get(group); if (!queue_work(sched->heap_alloc_wq, &group->tiler_oom_work))
group_put(group);
}
if (events & CS_FATAL)
cs_slot_process_fatal_event_locked(ptdev, csg_id, cs_id);
if (events & CS_FAULT)
cs_slot_process_fault_event_locked(ptdev, csg_id, cs_id);
if (events & CS_TILER_OOM)
cs_slot_process_tiler_oom_event_locked(ptdev, csg_id, cs_id);
/* We don't acknowledge the TILER_OOM event since its handling is * deferred to a separate work.
*/
panthor_fw_update_reqs(cs_iface, req, ack, CS_FATAL | CS_FAULT);
/* Schedule a tick so we can evict idle groups and schedule non-idle * ones. This will also update runtime PM and devfreq busy/idle states, * so the device can lower its frequency or get suspended.
*/
sched_queue_delayed_work(sched, tick, 0);
}
/* There may not be any pending CSG/CS interrupts to process */ if (req == ack && cs_irq_req == cs_irq_ack) return;
/* Immediately set IRQ_ACK bits to be same as the IRQ_REQ bits before * examining the CS_ACK & CS_REQ bits. This would ensure that Host * doesn't miss an interrupt for the CS in the race scenario where * whilst Host is servicing an interrupt for the CS, firmware sends * another interrupt for that CS.
*/
csg_iface->input->cs_irq_ack = cs_irq_req;
/* Acknowledge the idle event and schedule a tick. */
panthor_fw_update_reqs(glb_iface, req, glb_iface->output->ack, GLB_IDLE);
sched_queue_delayed_work(ptdev->scheduler, tick, 0);
}
/** * sched_process_global_irq_locked() - Process the scheduling part of a global IRQ * @ptdev: Device.
*/ staticvoid sched_process_global_irq_locked(struct panthor_device *ptdev)
{ struct panthor_fw_global_iface *glb_iface = panthor_fw_get_glb_iface(ptdev);
u32 req, ack, evts;
if (!full_tick) {
list_add_tail(&group->run_node, &ctx->old_groups[group->priority]); return;
}
/* Rotate to make sure groups with lower CSG slot * priorities have a chance to get a higher CSG slot * priority next time they get picked. This priority * has an impact on resource request ordering, so it's * important to make sure we don't let one group starve * all other groups with the same group priority.
*/
list_for_each_entry(other_group,
&ctx->old_groups[csg_slot->group->priority],
run_node) { struct panthor_csg_slot *other_csg_slot = &sched->csg_slots[other_group->csg_id];
if (other_csg_slot->priority > csg_slot->priority) {
list_add_tail(&csg_slot->group->run_node, &other_group->run_node); return;
}
}
ctx->min_priority = PANTHOR_CSG_PRIORITY_COUNT; for (i = 0; i < ARRAY_SIZE(ctx->groups); i++) {
INIT_LIST_HEAD(&ctx->groups[i]);
INIT_LIST_HEAD(&ctx->old_groups[i]);
}
for (i = 0; i < sched->csg_slot_count; i++) { struct panthor_csg_slot *csg_slot = &sched->csg_slots[i]; struct panthor_group *group = csg_slot->group; struct panthor_fw_csg_iface *csg_iface;
/* If there was unhandled faults on the VM, force processing of * CSG IRQs, so we can flag the faulty queue.
*/ if (panthor_vm_has_unhandled_faults(group->vm)) {
sched_process_csg_irq_locked(ptdev, i);
/* No fatal fault reported, flag all queues as faulty. */ if (!group->fatal_queues)
group->fatal_queues |= GENMASK(group->queue_count - 1, 0);
}
for (i = 0; i < ARRAY_SIZE(ctx->old_groups); i++) {
list_for_each_entry_safe(group, tmp, &ctx->old_groups[i], run_node) { /* If everything went fine, we should only have groups * to be terminated in the old_groups lists.
*/
drm_WARN_ON(&ptdev->base, !ctx->csg_upd_failed_mask &&
group_can_run(group));
for (i = 0; i < ARRAY_SIZE(ctx->groups); i++) { /* If everything went fine, the groups to schedule lists should * be empty.
*/
drm_WARN_ON(&ptdev->base,
!ctx->csg_upd_failed_mask && !list_empty(&ctx->groups[i]));
ret = csgs_upd_ctx_apply_locked(ptdev, &upd_ctx); if (ret) {
panthor_device_schedule_reset(ptdev);
ctx->csg_upd_failed_mask |= upd_ctx.timedout_mask; return;
}
/* Unbind evicted groups. */ for (prio = PANTHOR_CSG_PRIORITY_COUNT - 1; prio >= 0; prio--) {
list_for_each_entry(group, &ctx->old_groups[prio], run_node) { /* This group is gone. Process interrupts to clear * any pending interrupts before we start the new * group.
*/ if (group->csg_id >= 0)
sched_process_csg_irq_locked(ptdev, group->csg_id);
group_unbind_locked(group);
}
}
for (i = 0; i < sched->csg_slot_count; i++) { if (!sched->csg_slots[i].group)
free_csg_slots |= BIT(i);
}
/* If the group has been destroyed while we were * scheduling, ask for an immediate tick to * re-evaluate as soon as possible and get rid of * this dangling group.
*/ if (group->destroyed)
ctx->immediate_tick = true;
group_put(group);
}
/* Return evicted groups to the idle or run queues. Groups * that can no longer be run (because they've been destroyed * or experienced an unrecoverable error) will be scheduled * for destruction in tick_ctx_cleanup().
*/
list_for_each_entry_safe(group, tmp, &ctx->old_groups[prio], run_node) { if (!group_can_run(group)) continue;
if (group_is_idle(group))
list_move_tail(&group->run_node, &sched->groups.idle[prio]); else
list_move_tail(&group->run_node, &sched->groups.runnable[prio]);
group_put(group);
}
}
static u64
tick_ctx_update_resched_target(struct panthor_scheduler *sched, conststruct panthor_sched_tick_ctx *ctx)
{ /* We had space left, no need to reschedule until some external event happens. */ if (!tick_ctx_is_full(sched, ctx)) goto no_tick;
/* If idle groups were scheduled, no need to wake up until some external * event happens (group unblocked, new job submitted, ...).
*/ if (ctx->idle_group_count) goto no_tick;
if (drm_WARN_ON(&sched->ptdev->base, ctx->min_priority >= PANTHOR_CSG_PRIORITY_COUNT)) goto no_tick;
/* If there are groups of the same priority waiting, we need to * keep the scheduler ticking, otherwise, we'll just wait for * new groups with higher priority to be queued.
*/ if (!list_empty(&sched->groups.runnable[ctx->min_priority])) {
u64 resched_target = sched->last_tick + sched->tick_period;
if (time_before64(sched->resched_target, sched->last_tick) ||
time_before64(resched_target, sched->resched_target))
sched->resched_target = resched_target;
if (!drm_dev_enter(&ptdev->base, &cookie)) return;
ret = panthor_device_resume_and_get(ptdev); if (drm_WARN_ON(&ptdev->base, ret)) goto out_dev_exit;
if (time_before64(now, sched->resched_target))
remaining_jiffies = sched->resched_target - now;
mutex_lock(&sched->lock); if (panthor_device_reset_is_pending(sched->ptdev)) goto out_unlock;
tick_ctx_init(sched, &ctx, remaining_jiffies != 0); if (ctx.csg_upd_failed_mask) goto out_cleanup_ctx;
if (remaining_jiffies) { /* Scheduling forced in the middle of a tick. Only RT groups * can preempt non-RT ones. Currently running RT groups can't be * preempted.
*/ for (prio = PANTHOR_CSG_PRIORITY_COUNT - 1;
prio >= 0 && !tick_ctx_is_full(sched, &ctx);
prio--) {
tick_ctx_pick_groups_from_list(sched, &ctx, &ctx.old_groups[prio], true, true); if (prio == PANTHOR_CSG_PRIORITY_RT) {
tick_ctx_pick_groups_from_list(sched, &ctx,
&sched->groups.runnable[prio], true, false);
}
}
}
/* Don't mess up with the lists if we're in a middle of a reset. */ if (atomic_read(&sched->reset.in_progress)) return;
if (was_idle && !group_is_idle(group))
list_move_tail(&group->run_node, queue);
/* RT groups are preemptive. */ if (group->priority == PANTHOR_CSG_PRIORITY_RT) {
sched_queue_delayed_work(sched, tick, 0); return;
}
/* Some groups might be idle, force an immediate tick to * re-evaluate.
*/ if (sched->might_have_idle_groups) {
sched_queue_delayed_work(sched, tick, 0); return;
}
/* Scheduler is ticking, nothing to do. */ if (sched->resched_target != U64_MAX) { /* If there are free slots, force immediating ticking. */ if (sched->used_csg_slot_count < sched->csg_slot_count)
sched_queue_delayed_work(sched, tick, 0);
return;
}
/* Scheduler tick was off, recalculate the resched_target based on the * last tick event, and queue the scheduler work.
*/
now = get_jiffies_64();
sched->resched_target = sched->last_tick + sched->tick_period; if (sched->used_csg_slot_count == sched->csg_slot_count &&
time_before64(now, sched->resched_target))
delay_jiffies = min_t(unsignedlong, sched->resched_target - now, ULONG_MAX);
/** * panthor_sched_report_mmu_fault() - Report MMU faults to the scheduler.
*/ void panthor_sched_report_mmu_fault(struct panthor_device *ptdev)
{ /* Force a tick to immediately kill faulty groups. */ if (ptdev->scheduler)
panthor_sched_immediate_tick(ptdev);
}
void panthor_sched_resume(struct panthor_device *ptdev)
{ /* Force a tick to re-evaluate after a resume. */
panthor_sched_immediate_tick(ptdev);
}
/* If the group was still usable before that point, we consider * it innocent.
*/ if (group_can_run(csg_slot->group))
csg_slot->group->innocent = true;
/* We consider group suspension failures as fatal and flag the * group as unusable by setting timedout=true.
*/
csg_slot->group->timedout = true;
/* Terminate command timedout, but the soft-reset will * automatically terminate all active groups, so let's * force the state to halted here.
*/ if (csg_slot->group->state != PANTHOR_CS_GROUP_TERMINATED)
csg_slot->group->state = PANTHOR_CS_GROUP_TERMINATED;
slot_mask &= ~BIT(csg_id);
}
}
/* Flush L2 and LSC caches to make sure suspend state is up-to-date. * If the flush fails, flag all queues for termination.
*/ if (suspended_slots) { bool flush_caches_failed = false;
u32 slot_mask = suspended_slots;
if (panthor_gpu_flush_caches(ptdev, CACHE_CLEAN, CACHE_CLEAN, 0))
flush_caches_failed = true;
if (group_can_run(group)) {
list_add(&group->run_node,
&sched->groups.idle[group->priority]);
} else { /* We don't bother stopping the scheduler if the group is * faulty, the group termination work will finish the job.
*/
list_del_init(&group->wait_node);
group_queue_work(group, term);
}
group_put(group);
}
mutex_unlock(&sched->lock);
}
/* Cancel all scheduler works. Once this is done, these works can't be * scheduled again until the reset operation is complete.
*/
cancel_work_sync(&sched->sync_upd_work);
cancel_delayed_work_sync(&sched->tick_work);
panthor_sched_suspend(ptdev);
/* Stop all groups that might still accept jobs, so we don't get passed * new jobs while we're resetting.
*/ for (i = 0; i < ARRAY_SIZE(sched->groups.runnable); i++) { /* All groups should be in the idle lists. */
drm_WARN_ON(&ptdev->base, !list_empty(&sched->groups.runnable[i]));
list_for_each_entry_safe(group, group_tmp, &sched->groups.runnable[i], run_node)
panthor_group_stop(group);
}
for (i = 0; i < ARRAY_SIZE(sched->groups.idle); i++) {
list_for_each_entry_safe(group, group_tmp, &sched->groups.idle[i], run_node)
panthor_group_stop(group);
}
list_for_each_entry_safe(group, group_tmp, &sched->reset.stopped_groups, run_node) { /* Consider all previously running group as terminated if the * reset failed.
*/ if (reset_failed)
group->state = PANTHOR_CS_GROUP_TERMINATED;
panthor_group_start(group);
}
/* We're done resetting the GPU, clear the reset.in_progress bit so we can * kick the scheduler.
*/
atomic_set(&sched->reset.in_progress, false);
mutex_unlock(&sched->reset.lock);
/* No need to queue a tick and update syncs if the reset failed. */ if (!reset_failed) {
sched_queue_delayed_work(sched, tick, 0);
sched_queue_work(sched, sync_upd);
}
}
/* * We need to write a whole slot, including any trailing zeroes * that may come at the end of it. Also, because instrs.buffer has * been zero-initialised, there's no need to pad it with 0's
*/
instrs->count = ALIGN(instrs->count, NUM_INSTRS_PER_CACHE_LINE);
size = instrs->count * sizeof(u64);
WARN_ON(size > ringbuf_size);
written = min(ringbuf_size - start, size);
/* NEED to be cacheline aligned to please the prefetcher. */
static_assert(sizeof(instrs->buffer) % 64 == 0, "panthor_job_ringbuf_instrs::buffer is not aligned on a cacheline");
/* Make sure we have enough storage to store the whole sequence. */
static_assert(ALIGN(ARRAY_SIZE(instr_seq), NUM_INSTRS_PER_CACHE_LINE) ==
ARRAY_SIZE(instrs->buffer), "instr_seq vs panthor_job_ringbuf_instrs::buffer size mismatch");
for (u32 i = 0; i < ARRAY_SIZE(instr_seq); i++) { /* If the profile mask of this instruction is not enabled, skip it. */ if (instr_seq[i].profile_mask &&
!(instr_seq[i].profile_mask & params->profile_mask)) continue;
/* Stream size is zero, nothing to do except making sure all previously * submitted jobs are done before we signal the * drm_sched_job::s_fence::finished fence.
*/ if (!job->call_info.size) {
job->done_fence = dma_fence_get(queue->fence_ctx.last_fence); return dma_fence_get(job->done_fence);
}
ret = panthor_device_resume_and_get(ptdev); if (drm_WARN_ON(&ptdev->base, ret)) return ERR_PTR(ret);
mutex_lock(&sched->lock); if (!group_can_run(group)) {
done_fence = ERR_PTR(-ECANCELED); goto out_unlock;
}
if (group->csg_id < 0) { /* If the queue is blocked, we want to keep the timeout running, so we * can detect unbounded waits and kill the group when that happens. * Otherwise, we suspend the timeout so the time we spend waiting for * a CSG slot is not counted.
*/ if (!(group->blocked_queues & BIT(job->queue_idx)) &&
!queue->timeout_suspended) {
queue->remaining_time = drm_sched_suspend_timeout(&queue->scheduler);
queue->timeout_suspended = true;
}
mutex_lock(&sched->lock);
group->timedout = true; if (group->csg_id >= 0) {
sched_queue_delayed_work(ptdev->scheduler, tick, 0);
} else { /* Remove from the run queues, so the scheduler can't * pick the group on the next tick.
*/
list_del_init(&group->run_node);
list_del_init(&group->wait_node);
/* * We want to calculate the minimum size of a profiled job's CS, * because since they need additional instructions for the sampling * of performance metrics, they might take up further slots in * the queue's ringbuffer. This means we might not need as many job * slots for keeping track of their profiling information. What we * need is the maximum number of slots we should allocate to this end, * which matches the maximum number of profiled jobs we can place * simultaneously in the queue's ring buffer. * That has to be calculated separately for every single job profiling * flag, but not in the case job profiling is disabled, since unprofiled * jobs don't need to keep track of this at all.
*/ for (u32 i = 0; i < last_flag; i++) {
min_profiled_job_instrs =
min(min_profiled_job_instrs, calc_job_credits(BIT(i)));
}
staticstruct panthor_queue *
group_create_queue(struct panthor_group *group, conststruct drm_panthor_queue_create *args)
{ conststruct drm_sched_init_args sched_args = {
.ops = &panthor_queue_sched_ops,
.submit_wq = group->ptdev->scheduler->wq,
.num_rqs = 1, /* * The credit limit argument tells us the total number of * instructions across all CS slots in the ringbuffer, with * some jobs requiring twice as many as others, depending on * their profiling status.
*/
.credit_limit = args->ringbuf_size / sizeof(u64),
.timeout = msecs_to_jiffies(JOB_TIMEOUT_MS),
.timeout_wq = group->ptdev->reset.wq,
.name = "panthor-queue",
.dev = group->ptdev->base.dev,
}; struct drm_gpu_scheduler *drm_sched; struct panthor_queue *queue; int ret;
if (args->pad[0] || args->pad[1] || args->pad[2]) return ERR_PTR(-EINVAL);
for (i = 0; i < group_args->queues.count; i++) {
group->queues[i] = group_create_queue(group, &queue_args[i]); if (IS_ERR(group->queues[i])) {
ret = PTR_ERR(group->queues[i]);
group->queues[i] = NULL; goto err_put_group;
}
group = xa_erase(&gpool->xa, group_handle); if (!group) return -EINVAL;
mutex_lock(&sched->reset.lock);
mutex_lock(&sched->lock);
group->destroyed = true; if (group->csg_id >= 0) {
sched_queue_delayed_work(sched, tick, 0);
} elseif (!atomic_read(&sched->reset.in_progress)) { /* Remove from the run queues, so the scheduler can't * pick the group on the next tick.
*/
list_del_init(&group->run_node);
list_del_init(&group->wait_node);
group_queue_work(group, term);
}
mutex_unlock(&sched->lock);
mutex_unlock(&sched->reset.lock);
/** * panthor_fdinfo_gather_group_mem_info() - Retrieve aggregate size of all private kernel BO's * belonging to all the groups owned by an open Panthor file * @pfile: File. * @stats: Memory statistics to be updated. *
*/ void
panthor_fdinfo_gather_group_mem_info(struct panthor_file *pfile, struct drm_memory_stats *stats)
{ struct panthor_group_pool *gpool = pfile->groups; struct panthor_group *group; unsignedlong i;
if (IS_ERR_OR_NULL(gpool)) return;
xa_lock(&gpool->xa);
xa_for_each(&gpool->xa, i, group) {
stats->resident += group->fdinfo.kbo_sizes; if (group->csg_id >= 0)
stats->active += group->fdinfo.kbo_sizes;
}
xa_unlock(&gpool->xa);
}
/* If stream_addr is zero, so stream_size should be. */ if ((qsubmit->stream_size == 0) != (qsubmit->stream_addr == 0)) return ERR_PTR(-EINVAL);
/* Make sure the address is aligned on 64-byte (cacheline) and the size is * aligned on 8-byte (instruction size).
*/ if ((qsubmit->stream_addr & 63) || (qsubmit->stream_size & 7)) return ERR_PTR(-EINVAL);
/* bits 24:30 must be zero. */ if (qsubmit->latest_flush & GENMASK(30, 24)) return ERR_PTR(-EINVAL);
job = kzalloc(sizeof(*job), GFP_KERNEL); if (!job) return ERR_PTR(-ENOMEM);
job->group = group_from_handle(gpool, group_handle); if (!job->group) {
ret = -EINVAL; goto err_put_job;
}
if (!group_can_run(job->group)) {
ret = -EINVAL; goto err_put_job;
}
if (job->queue_idx >= job->group->queue_count ||
!job->group->queues[job->queue_idx]) {
ret = -EINVAL; goto err_put_job;
}
/* Empty command streams don't need a fence, they'll pick the one from * the previously submitted job.
*/ if (job->call_info.size) {
job->done_fence = kzalloc(sizeof(*job->done_fence), GFP_KERNEL); if (!job->done_fence) {
ret = -ENOMEM; goto err_put_job;
}
}
job->profiling.mask = pfile->ptdev->profile_mask;
credits = calc_job_credits(job->profiling.mask); if (credits == 0) {
ret = -EINVAL; goto err_put_job;
}
ret = drm_sched_job_init(&job->base,
&job->group->queues[job->queue_idx]->entity,
credits, job->group, drm_client_id); if (ret) goto err_put_job;
sched = drmm_kzalloc(&ptdev->base, sizeof(*sched), GFP_KERNEL); if (!sched) return -ENOMEM;
/* The highest bit in JOB_INT_* is reserved for globabl IRQs. That * leaves 31 bits for CSG IRQs, hence the MAX_CSGS clamp here.
*/
num_groups = min_t(u32, MAX_CSGS, glb_iface->control->group_num);
/* The FW-side scheduler might deadlock if two groups with the same * priority try to access a set of resources that overlaps, with part * of the resources being allocated to one group and the other part to * the other group, both groups waiting for the remaining resources to * be allocated. To avoid that, it is recommended to assign each CSG a * different priority. In theory we could allow several groups to have * the same CSG priority if they don't request the same resources, but * that makes the scheduling logic more complicated, so let's clamp * the number of CSG slots to MAX_CSG_PRIO + 1 for now.
*/
num_groups = min_t(u32, MAX_CSG_PRIO + 1, num_groups);
/* We need at least one AS for the MCU and one for the GPU contexts. */
gpu_as_count = hweight32(ptdev->gpu_info.as_present & GENMASK(31, 1)); if (!gpu_as_count) {
drm_err(&ptdev->base, "Not enough AS (%d, expected at least 2)",
gpu_as_count + 1); return -EINVAL;
}
ret = drmm_mutex_init(&ptdev->base, &sched->reset.lock); if (ret) return ret;
INIT_LIST_HEAD(&sched->reset.stopped_groups);
/* sched->heap_alloc_wq will be used for heap chunk allocation on * tiler OOM events, which means we can't use the same workqueue for * the scheduler because works queued by the scheduler are in * the dma-signalling path. Allocate a dedicated heap_alloc_wq to * work around this limitation. * * FIXME: Ultimately, what we need is a failable/non-blocking GEM * allocation path that we can call when a heap OOM is reported. The * FW is smart enough to fall back on other methods if the kernel can't * allocate memory, and fail the tiling job if none of these * countermeasures worked. * * Set WQ_MEM_RECLAIM on sched->wq to unblock the situation when the * system is running out of memory.
*/
sched->heap_alloc_wq = alloc_workqueue("panthor-heap-alloc", WQ_UNBOUND, 0);
sched->wq = alloc_workqueue("panthor-csf-sched", WQ_MEM_RECLAIM | WQ_UNBOUND, 0); if (!sched->wq || !sched->heap_alloc_wq) {
panthor_sched_fini(&ptdev->base, sched);
drm_err(&ptdev->base, "Failed to allocate the workqueues"); return -ENOMEM;
}
ret = drmm_add_action_or_reset(&ptdev->base, panthor_sched_fini, sched); if (ret) return ret;
ptdev->scheduler = sched; return 0;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.43 Sekunden
(vorverarbeitet am 2026-04-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.