mirror of
https://github.com/torvalds/linux.git
synced 2026-04-30 12:32:31 -04:00
drm/i915: Keep a per-engine request pool
Add a tiny per-engine request mempool so that we should always have a request available for powermanagement allocations from tricky contexts. This reserve is expected to be only used for kernel contexts when barriers must be emitted [almost] without fail. The main consumer for this reserved request is expected to be engine-pm, for which we know that there will always be at least the previous pm request that we can reuse under mempressure (so there should always be a spare request for engine_park()). This is an alternative to using a comparatively bulky mempool, which requires custom handling for both our reserved allocation requirement and to protect our TYPESAFE_BY_RCU slab cache. The advantage of mempool would be that it would allow us to keep a larger per-engine request pool. However, converting over to mempool is straightforward should the need arise. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-and-tested-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200402184037.21630-1-chris@chris-wilson.co.uk
This commit is contained in:
@@ -431,7 +431,14 @@ void intel_engines_free(struct intel_gt *gt)
|
||||
struct intel_engine_cs *engine;
|
||||
enum intel_engine_id id;
|
||||
|
||||
/* Free the requests! dma-resv keeps fences around for an eternity */
|
||||
rcu_barrier();
|
||||
|
||||
for_each_engine(engine, gt, id) {
|
||||
if (engine->request_pool)
|
||||
kmem_cache_free(i915_request_slab_cache(),
|
||||
engine->request_pool);
|
||||
|
||||
kfree(engine);
|
||||
gt->engine[id] = NULL;
|
||||
}
|
||||
|
||||
@@ -308,6 +308,9 @@ struct intel_engine_cs {
|
||||
struct list_head hold; /* ready requests, but on hold */
|
||||
} active;
|
||||
|
||||
/* keep a request in reserve for a [pm] barrier under oom */
|
||||
struct i915_request *request_pool;
|
||||
|
||||
struct llist_head barrier_tasks;
|
||||
|
||||
struct intel_context *kernel_context; /* pinned */
|
||||
|
||||
Reference in New Issue
Block a user