mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
![Chris Wilson](/assets/img/avatar_default.png)
If we have multiple contexts of equal priority pending execution, activate a timer to demote the currently executing context in favour of the next in the queue when that timeslice expires. This enforces fairness between contexts (so long as they allow preemption -- forced preemption, in the future, will kick those who do not obey) and allows us to avoid userspace blocking forward progress with e.g. unbounded MI_SEMAPHORE_WAIT. For the starting point here, we use the jiffie as our timeslice so that we should be reasonably efficient wrt frequent CPU wakeups. Testcase: igt/gem_exec_scheduler/semaphore-resolve Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190620142052.19311-2-chris@chris-wilson.co.uk
74 lines
2.4 KiB
C
74 lines
2.4 KiB
C
/*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* Copyright © 2018 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _I915_SCHEDULER_TYPES_H_
|
|
#define _I915_SCHEDULER_TYPES_H_
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include "gt/intel_engine_types.h"
|
|
#include "i915_priolist_types.h"
|
|
|
|
struct drm_i915_private;
|
|
struct i915_request;
|
|
struct intel_engine_cs;
|
|
|
|
struct i915_sched_attr {
|
|
/**
|
|
* @priority: execution and service priority
|
|
*
|
|
* All clients are equal, but some are more equal than others!
|
|
*
|
|
* Requests from a context with a greater (more positive) value of
|
|
* @priority will be executed before those with a lower @priority
|
|
* value, forming a simple QoS.
|
|
*
|
|
* The &drm_i915_private.kernel_context is assigned the lowest priority.
|
|
*/
|
|
int priority;
|
|
};
|
|
|
|
/*
|
|
* "People assume that time is a strict progression of cause to effect, but
|
|
* actually, from a nonlinear, non-subjective viewpoint, it's more like a big
|
|
* ball of wibbly-wobbly, timey-wimey ... stuff." -The Doctor, 2015
|
|
*
|
|
* Requests exist in a complex web of interdependencies. Each request
|
|
* has to wait for some other request to complete before it is ready to be run
|
|
* (e.g. we have to wait until the pixels have been rendering into a texture
|
|
* before we can copy from it). We track the readiness of a request in terms
|
|
* of fences, but we also need to keep the dependency tree for the lifetime
|
|
* of the request (beyond the life of an individual fence). We use the tree
|
|
* at various points to reorder the requests whilst keeping the requests
|
|
* in order with respect to their various dependencies.
|
|
*
|
|
* There is no active component to the "scheduler". As we know the dependency
|
|
* DAG of each request, we are able to insert it into a sorted queue when it
|
|
* is ready, and are able to reorder its portion of the graph to accommodate
|
|
* dynamic priority changes.
|
|
*/
|
|
struct i915_sched_node {
|
|
struct list_head signalers_list; /* those before us, we depend upon */
|
|
struct list_head waiters_list; /* those after us, they depend upon us */
|
|
struct list_head link;
|
|
struct i915_sched_attr attr;
|
|
unsigned int flags;
|
|
#define I915_SCHED_HAS_SEMAPHORE_CHAIN BIT(0)
|
|
intel_engine_mask_t semaphores;
|
|
};
|
|
|
|
struct i915_dependency {
|
|
struct i915_sched_node *signaler;
|
|
struct i915_sched_node *waiter;
|
|
struct list_head signal_link;
|
|
struct list_head wait_link;
|
|
struct list_head dfs_link;
|
|
unsigned long flags;
|
|
#define I915_DEPENDENCY_ALLOC BIT(0)
|
|
#define I915_DEPENDENCY_EXTERNAL BIT(1)
|
|
};
|
|
|
|
#endif /* _I915_SCHEDULER_TYPES_H_ */
|