[Intel-gfx] [PATCH] drm/i915: Only close vma we open

Andi Shyti andi at etezian.org
Fri Apr 24 10:26:02 UTC 2020


On Fri, Apr 24, 2020 at 11:22:13AM +0100, Chris Wilson wrote:
> Quoting Andi Shyti (2020-04-24 11:16:17)
> > Hi Chris,
> > 
> > On Wed, Apr 22, 2020 at 08:05:58PM +0100, Chris Wilson wrote:
> > > The history of i915_vma_close() is confusing, as is its use. As the
> > > lifetime of the i915_vma is currently bounded by the object it is
> > > attached to, we needed a means of identify when a vma was no longer in
> > > use by userspace (via the user's fd). This is further complicated by
> > > that only ppgtt vma should be closed at the user's behest, as the ggtt
> > > were always shared.
> > > 
> > > Now that we attach the vma to a lut on the user's context, the open
> > > count does indicate how many unique and open context/vm are referencing
> > > this vma from the user. As such, we can and should just use the
> > > open_count to track when the vma is still in use by userspace.
> > > 
> > > It's a poor man's replacement for reference counting.
> > > 
> > > Closes: https://gitlab.freedesktop.org/drm/intel/issues/1193
> > > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > 
> > [...]
> > 
> > > @@ -1777,21 +1737,20 @@ int i915_gem_huge_page_mock_selftests(void)
> > >       if (!i915_vm_is_4lvl(&ppgtt->vm)) {
> > >               pr_err("failed to create 48b PPGTT\n");
> > >               err = -EINVAL;
> > > -             goto out_close;
> > > +             goto out_put;
> > >       }
> > >  
> > >       /* If we were ever hit this then it's time to mock the 64K scratch */
> > >       if (!i915_vm_has_scratch_64K(&ppgtt->vm)) {
> > >               pr_err("PPGTT missing 64K scratch page\n");
> > >               err = -EINVAL;
> > > -             goto out_close;
> > > +             goto out_put;
> > >       }
> > >  
> > >       err = i915_subtests(tests, ppgtt);
> > >  
> > > -out_close:
> > > +out_put:
> > >       i915_vm_put(&ppgtt->vm);
> > 
> > Did anything change here?
> 
> Oh, diff says no :)
> 
> By this point I was doing search and replace and given up caring.

just to be more specific, in case the message was not understood :)

Reviewed-by: Andi Shyti <andi.shyti at intel.com>

Andi


More information about the Intel-gfx mailing list