[Intel-gfx] [PATCH 06/50] drm/i915: s/intel_ring_buffer/intel_engine

Mateo Lozano, Oscar oscar.mateo at intel.com
Mon May 19 18:33:37 CEST 2014


> -----Original Message-----
> From: Volkin, Bradley D
> Sent: Monday, May 19, 2014 5:24 PM
> To: Mateo Lozano, Oscar
> Cc: Daniel Vetter; intel-gfx at lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH 06/50] drm/i915:
> s/intel_ring_buffer/intel_engine
> 
> On Mon, May 19, 2014 at 09:12:26AM -0700, Mateo Lozano, Oscar wrote:
> > BTW: do you want me to kill private_default_ctx as well? It doesn´t look very
> useful...
> 
> Isn't private_default_ctx the one that's actually used when userspace specifies
> DEFAULT_CONTEXT_ID?

What I see is a normal idr_find:

struct i915_hw_context *
i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id)
{
	struct i915_hw_context *ctx;

	ctx = (struct i915_hw_context *)idr_find(&file_priv->context_idr, id);
	if (!ctx)
		return ERR_PTR(-ENOENT);

	return ctx;
}

I think Chris has almost killed it off completely:

commit 691e6415c891b8b2b082a120b896b443531c4d45
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Apr 9 09:07:36 2014 +0100

    drm/i915: Always use kref tracking for all contexts.
    
    If we always initialize kref for the context, even if we are using fake
    contexts for hangstats when there is no hw support, we can forgo the
    dance to dereference the ctx->obj and inspect whether we are permitted
    to use kref inside i915_gem_context_reference() and _unreference().
    
    My ulterior motive here is to improve the debugging of a use-after-free
    of ctx->obj. This patch avoids the dereference here and instead forces
    the assertion checks associated with kref.
    
    v2: Refactor the fake contexts to being even more like the real
    contexts, so that there is much less duplicated and special case code.
    
    v3: Tweaks.
    v4: Tweaks, minor.



More information about the Intel-gfx mailing list