[Intel-gfx] [PATCH v3 08/13] drm/i915: Introduce a preempt context
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Fri Sep 29 07:23:05 UTC 2017
On Thu, 2017-09-28 at 20:39 +0100, Chris Wilson wrote:
> Add another perma-pinned context for using for preemption at any time.
> We cannot just reuse the existing kernel context, as first and foremost
> we need to ensure that we can preempt the kernel context itself, so
> require a distinct context id. Similar to the kernel context, we may
> want to interrupt execution and switch to the preempt context at any
> time, and so it needs to be permanently pinned and available.
>
> To compensate for yet another permanent allocation, we shrink the
> existing context and the new context by reducing their ringbuffer to the
> minimum.
>
> v2: Assert that we never allocate a request from the preemption context.
> v3: Limit perma-pin to engines that may preempt.
> v4: Onion cleanup for early driver death
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Reviewed-by: MichaĆ Winiarski <michal.winiarski at intel.com>
<SNIP>
> @@ -507,15 +546,10 @@ void i915_gem_contexts_lost(struct drm_i915_private *dev_priv)
>
> void i915_gem_contexts_fini(struct drm_i915_private *i915)
> {
> - struct i915_gem_context *ctx;
> -
> lockdep_assert_held(&i915->drm.struct_mutex);
>
> - /* Keep the context so that we can free it immediately ourselves */
> - ctx = i915_gem_context_get(fetch_and_zero(&i915->kernel_context));
> - GEM_BUG_ON(!i915_gem_context_is_kernel(ctx));
> - context_close(ctx);
> - i915_gem_context_free(ctx);
> + destroy_kernel_context(&i915->kernel_context);
> + destroy_kernel_context(&i915->preempt_context);
You first create kernel, then pre-empt, destroy should be in the
reverse order, really.
Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
More information about the Intel-gfx
mailing list