[Intel-gfx] [PATCH v3 1/5] drm/i915: Allow i915 to manage the vma offset nodes instead of drm core

Chris Wilson chris at chris-wilson.co.uk
Tue Oct 15 11:06:01 UTC 2019


Quoting Abdiel Janulgue (2019-10-15 09:37:20)
> @@ -312,6 +313,9 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf)
>                 list_add(&obj->userfault_link, &i915->ggtt.userfault_list);
>         mutex_unlock(&i915->ggtt.vm.mutex);
>  
> +       /* Track the mmo associated with the fenced vma */
> +       vma->mmo = priv;
> +
>         if (CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)
>                 intel_wakeref_auto(&i915->ggtt.userfault_wakeref,
>                                    msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND));
> @@ -358,28 +362,29 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf)
>         }
>  }
>  
> -void __i915_gem_object_release_mmap(struct drm_i915_gem_object *obj)
> +void __i915_gem_object_release_mmap_gtt(struct drm_i915_gem_object *obj)
>  {
>         struct i915_vma *vma;
> +       struct i915_mmap_offset *mmo;
>  
>         GEM_BUG_ON(!obj->userfault_count);
>  
>         obj->userfault_count = 0;
>         list_del(&obj->userfault_link);
> -       drm_vma_node_unmap(&obj->base.vma_node,
> -                          obj->base.dev->anon_inode->i_mapping);
> +
> +       mutex_lock(&obj->mmo_lock);
> +       list_for_each_entry(mmo, &obj->mmap_offsets, offset) {
> +               if (mmo->mmap_type == I915_MMAP_TYPE_GTT)
> +                       drm_vma_node_unmap(&mmo->vma_node,
> +                                          obj->base.dev->anon_inode->i_mapping);
> +       }
> +       mutex_unlock(&obj->mmo_lock);
>  
>         for_each_ggtt_vma(vma, obj)

Why not treat vma->mmo as part of the userfault it is?

>                 i915_vma_unset_userfault(vma);
-Chris


More information about the Intel-gfx mailing list