[Intel-gfx] [CI 2/4] drm/i915: Create/destroy VM (ppGTT) for use with contexts

Chris Wilson chris at chris-wilson.co.uk
Sat Mar 30 09:53:52 UTC 2019


Quoting Jordan Justen (2019-03-30 09:46:49)
> On 2019-03-22 02:23:23, Chris Wilson wrote:
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> > index 00dec72f6875..d0a56c8d0bb9 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_context.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> <snip>
> > +
> > +static int set_ppgtt(struct i915_gem_context *ctx,
> > +                    struct drm_i915_gem_context_param *args)
> > +{
> > +       struct drm_i915_file_private *file_priv = ctx->file_priv;
> > +       struct i915_hw_ppgtt *ppgtt, *old;
> > +       int err;
> > +
> > +       if (args->size)
> > +               return -EINVAL;
> > +
> > +       if (!ctx->ppgtt)
> > +               return -ENODEV;
> > +
> > +       if (upper_32_bits(args->value))
> > +               return -ENOENT;
> > +
> > +       err = mutex_lock_interruptible(&file_priv->vm_idr_lock);
> > +       if (err)
> > +               return err;
> > +
> > +       ppgtt = idr_find(&file_priv->vm_idr, args->value);
> 
> I tried using I915_CONTEXT_CREATE_EXT_SETPARAM with
> I915_CONTEXT_PARAM_VM, but this line was segfaulting (file_priv was
> NULL).

I put fpriv into struct create_ext for precisely this reason... Sigh.

> I think it was because in i915_gem_context_create_ioctl, we process
> the I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS flag before we call
> gem_context_register. (gem_context_register sets ctx->file_priv) If I
> move the gem_context_register call before the
> I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS handling, the segfault goes
> away.

We can't register before finish setting up the context (or else
userspace can see the context before we are ready). My bad, I thought I
had that covered in igt.
-Chris


More information about the Intel-gfx mailing list