XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions
gpu_scheduler.h File Reference
#include <drm/spsc_queue.h>
#include <linux/average.h>
#include <linux/dma-fence.h>
#include <linux/completion.h>
#include <linux/xarray.h>
#include <linux/workqueue.h>
Include dependency graph for gpu_scheduler.h:

Go to the source code of this file.

Classes

struct  drm_sched_entity
 
struct  drm_sched_rq
 
struct  drm_sched_fence
 
struct  drm_sched_job
 
struct  drm_sched_backend_ops
 
struct  drm_gpu_scheduler
 
struct  drm_sched_init_args
 
struct  drm_sched_pending_job_iter
 

Macros

#define MAX_WAIT_SCHED_ENTITY_Q_EMPTY   msecs_to_jiffies(1000)
 
#define DRM_SCHED_FENCE_DONT_PIPELINE   DMA_FENCE_FLAG_USER_BITS
 
#define DRM_SCHED_FENCE_FLAG_HAS_DEADLINE_BIT   (DMA_FENCE_FLAG_USER_BITS + 1)
 

Enumerations

enum  drm_sched_priority {
  DRM_SCHED_PRIORITY_INVALID = -1 , DRM_SCHED_PRIORITY_KERNEL , DRM_SCHED_PRIORITY_HIGH , DRM_SCHED_PRIORITY_NORMAL ,
  DRM_SCHED_PRIORITY_LOW , DRM_SCHED_PRIORITY_COUNT
}
 
enum  drm_gpu_sched_stat { DRM_GPU_SCHED_STAT_NONE , DRM_GPU_SCHED_STAT_RESET , DRM_GPU_SCHED_STAT_ENODEV , DRM_GPU_SCHED_STAT_NO_HANG }
 

Functions

 DECLARE_EWMA (drm_sched_avgtime, 6, 4)
 
struct drm_sched_fence * to_drm_sched_fence (struct dma_fence *f)
 

: name (typically the driver's name). Used for debugging

struct drm_sched_init_args - parameters for initializing a DRM GPU scheduler

@ops: backend operations provided by the driver @submit_wq: workqueue to use for submission. If NULL, an ordered wq is allocated and used. @num_rqs: Number of run-queues. This may be at most DRM_SCHED_PRIORITY_COUNT, as there's usually one run-queue per priority, but may be less. @credit_limit: the number of credits this scheduler can hold from all jobs @hang_limit: number of times to allow a job to hang before dropping it. This mechanism is DEPRECATED. Set it to 0. @timeout: timeout value in jiffies for submitted jobs. @timeout_wq: workqueue to use for timeout work. If NULL, the system_wq is used. @score: score atomic shared with other schedulers. May be NULL.

@dev: associated device. Used for debugging

#define class_drm_sched_pending_job_iter_is_conditional   false
 
#define drm_sched_for_each_pending_job(__job, __sched, __entity)
 
int drm_sched_init (struct drm_gpu_scheduler *sched, const struct drm_sched_init_args *args)
 
void drm_sched_fini (struct drm_gpu_scheduler *sched)
 
unsigned long drm_sched_suspend_timeout (struct drm_gpu_scheduler *sched)
 
void drm_sched_resume_timeout (struct drm_gpu_scheduler *sched, unsigned long remaining)
 
void drm_sched_tdr_queue_imm (struct drm_gpu_scheduler *sched)
 
bool drm_sched_wqueue_ready (struct drm_gpu_scheduler *sched)
 
void drm_sched_wqueue_stop (struct drm_gpu_scheduler *sched)
 
void drm_sched_wqueue_start (struct drm_gpu_scheduler *sched)
 
void drm_sched_stop (struct drm_gpu_scheduler *sched, struct drm_sched_job *bad)
 
void drm_sched_start (struct drm_gpu_scheduler *sched, int errno)
 
void drm_sched_resubmit_jobs (struct drm_gpu_scheduler *sched)
 
void drm_sched_fault (struct drm_gpu_scheduler *sched)
 
bool drm_sched_is_stopped (struct drm_gpu_scheduler *sched)
 
struct drm_gpu_scheduler * drm_sched_pick_best (struct drm_gpu_scheduler **sched_list, unsigned int num_sched_list)
 
int drm_sched_job_init (struct drm_sched_job *job, struct drm_sched_entity *entity, u32 credits, void *owner, u64 drm_client_id)
 
void drm_sched_job_arm (struct drm_sched_job *job)
 
void drm_sched_entity_push_job (struct drm_sched_job *sched_job)
 
int drm_sched_job_add_dependency (struct drm_sched_job *job, struct dma_fence *fence)
 
int drm_sched_job_add_syncobj_dependency (struct drm_sched_job *job, struct drm_file *file, u32 handle, u32 point)
 
int drm_sched_job_add_resv_dependencies (struct drm_sched_job *job, struct dma_resv *resv, enum dma_resv_usage usage)
 
int drm_sched_job_add_implicit_dependencies (struct drm_sched_job *job, struct drm_gem_object *obj, bool write)
 
bool drm_sched_job_has_dependency (struct drm_sched_job *job, struct dma_fence *fence)
 
void drm_sched_job_cleanup (struct drm_sched_job *job)
 
void drm_sched_increase_karma (struct drm_sched_job *bad)
 
bool drm_sched_job_is_signaled (struct drm_sched_job *job)
 
int drm_sched_entity_init (struct drm_sched_entity *entity, enum drm_sched_priority priority, struct drm_gpu_scheduler **sched_list, unsigned int num_sched_list, atomic_t *guilty)
 
long drm_sched_entity_flush (struct drm_sched_entity *entity, long timeout)
 
void drm_sched_entity_kill (struct drm_sched_entity *entity)
 
void drm_sched_entity_fini (struct drm_sched_entity *entity)
 
void drm_sched_entity_destroy (struct drm_sched_entity *entity)
 
void drm_sched_entity_set_priority (struct drm_sched_entity *entity, enum drm_sched_priority priority)
 
int drm_sched_entity_error (struct drm_sched_entity *entity)
 
void drm_sched_entity_modify_sched (struct drm_sched_entity *entity, struct drm_gpu_scheduler **sched_list, unsigned int num_sched_list)
 
 DEFINE_CLASS (drm_sched_pending_job_iter, struct drm_sched_pending_job_iter, __drm_sched_pending_job_iter_end(_T), __drm_sched_pending_job_iter_begin(__sched), struct drm_gpu_scheduler *__sched)
 

Macro Definition Documentation

◆ class_drm_sched_pending_job_iter_is_conditional

#define class_drm_sched_pending_job_iter_is_conditional   false

◆ DRM_SCHED_FENCE_DONT_PIPELINE

#define DRM_SCHED_FENCE_DONT_PIPELINE   DMA_FENCE_FLAG_USER_BITS

DRM_SCHED_FENCE_DONT_PIPELINE - Prevent dependency pipelining

Setting this flag on a scheduler fence prevents pipelining of jobs depending on this fence. In other words we always insert a full CPU round trip before dependent jobs are pushed to the hw queue.

◆ DRM_SCHED_FENCE_FLAG_HAS_DEADLINE_BIT

#define DRM_SCHED_FENCE_FLAG_HAS_DEADLINE_BIT   (DMA_FENCE_FLAG_USER_BITS + 1)

DRM_SCHED_FENCE_FLAG_HAS_DEADLINE_BIT - A fence deadline hint has been set

Because we could have a deadline hint can be set before the backing hw fence is created, we need to keep track of whether a deadline has already been set.

◆ drm_sched_for_each_pending_job

#define drm_sched_for_each_pending_job (   __job,
  __sched,
  __entity 
)
Value:
list_for_each_entry((__job), &(__sched)->pending_list, list) \
for_each_if(!(__entity) || (__job)->entity == (__entity))
XEProcessList * list
Definition main.cpp:27
#define scoped_guard(name, args...)
Definition cleanup.h:353
#define __sched
Definition compiler.h:132
Definition gpu_scheduler.h:744

drm_sched_for_each_pending_job() - Iterator for each pending job in scheduler @__job: Current pending job being iterated over @__sched: DRM scheduler to iterate over pending jobs @__entity: DRM scheduler entity to filter jobs, NULL indicates no filter

Iterator for each pending job in scheduler, filtering on an entity, and enforcing scheduler is fully stopped

◆ MAX_WAIT_SCHED_ENTITY_Q_EMPTY

#define MAX_WAIT_SCHED_ENTITY_Q_EMPTY   msecs_to_jiffies(1000)

Enumeration Type Documentation

◆ drm_gpu_sched_stat

enum drm_gpu_sched_stat - the scheduler's status

@DRM_GPU_SCHED_STAT_NONE: Reserved. Do not use. @DRM_GPU_SCHED_STAT_RESET: The GPU hung and successfully reset. @DRM_GPU_SCHED_STAT_ENODEV: Error: Device is not available anymore. @DRM_GPU_SCHED_STAT_NO_HANG: Contrary to scheduler's assumption, the GPU did not hang and is still running.

Enumerator
DRM_GPU_SCHED_STAT_NONE 
DRM_GPU_SCHED_STAT_RESET 
DRM_GPU_SCHED_STAT_ENODEV 
DRM_GPU_SCHED_STAT_NO_HANG 

◆ drm_sched_priority

Enumerator
DRM_SCHED_PRIORITY_INVALID 
DRM_SCHED_PRIORITY_KERNEL 
DRM_SCHED_PRIORITY_HIGH 
DRM_SCHED_PRIORITY_NORMAL 
DRM_SCHED_PRIORITY_LOW 
DRM_SCHED_PRIORITY_COUNT 

Function Documentation

◆ DECLARE_EWMA()

DECLARE_EWMA ( drm_sched_avgtime  ,
6  ,
4   
)

◆ DEFINE_CLASS()

DEFINE_CLASS ( drm_sched_pending_job_iter  ,
struct drm_sched_pending_job_iter  ,
__drm_sched_pending_job_iter_end(_T)  ,
__drm_sched_pending_job_iter_begin(__sched)  ,
struct drm_gpu_scheduler *  __sched 
)

◆ drm_sched_entity_destroy()

void drm_sched_entity_destroy ( struct drm_sched_entity *  entity)

◆ drm_sched_entity_error()

int drm_sched_entity_error ( struct drm_sched_entity *  entity)

◆ drm_sched_entity_fini()

void drm_sched_entity_fini ( struct drm_sched_entity *  entity)

◆ drm_sched_entity_flush()

long drm_sched_entity_flush ( struct drm_sched_entity *  entity,
long  timeout 
)

◆ drm_sched_entity_init()

int drm_sched_entity_init ( struct drm_sched_entity *  entity,
enum drm_sched_priority  priority,
struct drm_gpu_scheduler **  sched_list,
unsigned int  num_sched_list,
atomic_t *  guilty 
)

◆ drm_sched_entity_kill()

void drm_sched_entity_kill ( struct drm_sched_entity *  entity)

◆ drm_sched_entity_modify_sched()

void drm_sched_entity_modify_sched ( struct drm_sched_entity *  entity,
struct drm_gpu_scheduler **  sched_list,
unsigned int  num_sched_list 
)

◆ drm_sched_entity_push_job()

void drm_sched_entity_push_job ( struct drm_sched_job *  sched_job)

◆ drm_sched_entity_set_priority()

void drm_sched_entity_set_priority ( struct drm_sched_entity *  entity,
enum drm_sched_priority  priority 
)

◆ drm_sched_fault()

void drm_sched_fault ( struct drm_gpu_scheduler *  sched)

◆ drm_sched_fini()

void drm_sched_fini ( struct drm_gpu_scheduler *  sched)

◆ drm_sched_increase_karma()

void drm_sched_increase_karma ( struct drm_sched_job *  bad)

◆ drm_sched_init()

int drm_sched_init ( struct drm_gpu_scheduler *  sched,
const struct drm_sched_init_args *  args 
)

◆ drm_sched_is_stopped()

bool drm_sched_is_stopped ( struct drm_gpu_scheduler *  sched)

◆ drm_sched_job_add_dependency()

int drm_sched_job_add_dependency ( struct drm_sched_job *  job,
struct dma_fence *  fence 
)

◆ drm_sched_job_add_implicit_dependencies()

int drm_sched_job_add_implicit_dependencies ( struct drm_sched_job *  job,
struct drm_gem_object *  obj,
bool  write 
)

◆ drm_sched_job_add_resv_dependencies()

int drm_sched_job_add_resv_dependencies ( struct drm_sched_job *  job,
struct dma_resv *  resv,
enum dma_resv_usage  usage 
)

◆ drm_sched_job_add_syncobj_dependency()

int drm_sched_job_add_syncobj_dependency ( struct drm_sched_job *  job,
struct drm_file *  file,
u32  handle,
u32  point 
)

◆ drm_sched_job_arm()

void drm_sched_job_arm ( struct drm_sched_job *  job)

◆ drm_sched_job_cleanup()

void drm_sched_job_cleanup ( struct drm_sched_job *  job)

◆ drm_sched_job_has_dependency()

bool drm_sched_job_has_dependency ( struct drm_sched_job *  job,
struct dma_fence *  fence 
)

◆ drm_sched_job_init()

int drm_sched_job_init ( struct drm_sched_job *  job,
struct drm_sched_entity *  entity,
u32  credits,
void *  owner,
u64  drm_client_id 
)

◆ drm_sched_job_is_signaled()

bool drm_sched_job_is_signaled ( struct drm_sched_job *  job)

◆ drm_sched_pick_best()

struct drm_gpu_scheduler * drm_sched_pick_best ( struct drm_gpu_scheduler **  sched_list,
unsigned int  num_sched_list 
)

◆ drm_sched_resubmit_jobs()

void drm_sched_resubmit_jobs ( struct drm_gpu_scheduler *  sched)

◆ drm_sched_resume_timeout()

void drm_sched_resume_timeout ( struct drm_gpu_scheduler *  sched,
unsigned long  remaining 
)

◆ drm_sched_start()

void drm_sched_start ( struct drm_gpu_scheduler *  sched,
int  errno 
)

◆ drm_sched_stop()

void drm_sched_stop ( struct drm_gpu_scheduler *  sched,
struct drm_sched_job *  bad 
)

◆ drm_sched_suspend_timeout()

unsigned long drm_sched_suspend_timeout ( struct drm_gpu_scheduler *  sched)

◆ drm_sched_tdr_queue_imm()

void drm_sched_tdr_queue_imm ( struct drm_gpu_scheduler *  sched)

◆ drm_sched_wqueue_ready()

bool drm_sched_wqueue_ready ( struct drm_gpu_scheduler *  sched)

◆ drm_sched_wqueue_start()

void drm_sched_wqueue_start ( struct drm_gpu_scheduler *  sched)

◆ drm_sched_wqueue_stop()

void drm_sched_wqueue_stop ( struct drm_gpu_scheduler *  sched)

◆ to_drm_sched_fence()

struct drm_sched_fence * to_drm_sched_fence ( struct dma_fence *  f)