drm-intel-collector - update
Subsystems (2)
cover drm-intel-collector - update
This is another drm-intel-collector updated notice:
http://cgit.freedesktop.org/~vivijim/drm-intel/log/?h=drm-intel-collector
Here goes the update list in order for better reviewers assignment:
Patch drm/i915: Bring UP Power Wells before disabling RC6. - Reviewer:
Patch drm/i915: dma_buf_vunmap is presumed not to fail, don't let it - Reviewer:
Patch drm/i915: Add support for stealing purgable stolen pages - Reviewer:
Overall Process:
drm-intel-collector - review request
1. Daniel pushs drm-intel-testing (every 2 weeks)
2. I rebase drm-intel-collector onto drm-intel-testing
3. Add Reviewer: tag with voluntered reviewers. If you don't believe you should be assigned on a particular patch please don't get mad just tell you wont review or volunteer someone else.
4. I resubmit remaining patches for review without picking any new (drm-intel-collector - review request)
drm-intel-collector - updated
5. One week later I collect all simple (1-2) patches that wasn't yet reviewed and not queued by Daniel from one testing update until another.
6. Request automated QA's PRTS automated i-g-t tests comparing drm-intel-testing x drm-intel-collector
7. If tests are ok I send the update notification or the patches as a series to intel-gfx mailing list for better tracking and to be reviewed. (drm-intel-collector - updated)
8. Let me know volunteers for review new patches and also let me know if I've picked any patch that I shouldn't.
There are some reasons that some patches can be left behind:
1. Your patch didn't applied cleanly and I couldn't easily solve the conflicts.
2. Kernel didn't compiled with your patch.
3. I simply missed it. If you believe this is the case please warn me.
Please help me to get these patches reviewed and queued by Daniel.
Also, please let me know if you have further ideas how to improve this process.
Thanks in advance,
Rodrigo.
Chris Wilson (2):
drm/i915: dma_buf_vunmap is presumed not to fail, don't let it drm/i915: Add support for stealing purgable stolen pages
Deepak S (1):
drm/i915: Bring UP Power Wells before disabling RC6.
drivers/gpu/drm/i915/i915_gem_dmabuf.c | 6 +- drivers/gpu/drm/i915/i915_gem_stolen.c | 119 ++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/intel_pm.c | 6 ++ 3 files changed, 115 insertions(+), 16 deletions(-)
Signature · 1 line
1.8.5.3
PATCH 1/3 drm/i915: Bring UP Power Wells before disabling RC6.
From: Deepak S <[email protected]>
We need do forcewake before Disabling RC6, This is what the BIOS expects while going into suspend.
v2: updated commit message. (Daniel)
--- drivers/gpu/drm/i915/intel_pm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +6 -0
@@ -3187,8 +3187,14 @@ static void valleyview_disable_rps(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; +/* we're doing forcewake before Disabling RC6, +* This what the BIOS expects when going into suspend */ +gen6_gt_force_wake_get (dev_priv,FORCEWAKE_ALL ); +I915_WRITE (GEN6_RC_CONTROL ,0 ); +gen6_gt_force_wake_put (dev_priv,FORCEWAKE_ALL ); +gen6_disable_rps_interrupts (dev);if (dev_priv->vlv_pctx) {
Signature · 1 line
1.8.5.3
PATCH 2/3 drm/i915: dma_buf_vunmap is presumed not to fail, don't let it
In reply to Rodrigo ViviFrom: Chris Wilson <[email protected]>
Since dma_buf_vunmap() procedes blithely on ignorant of whether the driver failed to actually unmap the backing storage for the dma-buf, we need to make a best-effort to do so. This involves not allowing ourselves to be susceptible to signals causing us to leak the storage.
This should have been detectable with the current i-g-t as a misplaced signal should have left the pages pinned upon freeing the object where we have a warning in place.
--- drivers/gpu/drm/i915/i915_gem_dmabuf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_gem_dmabuf.c +1 -5
@@ -161,12 +161,8 @@ static void i915_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr) {struct drm_i915_gem_object *obj =dma_buf_to_obj (dma_buf);struct drm_device *dev = obj->base.dev; -int ret; - - ret =i915_mutex_lock_interruptible (dev); -if (ret) -return ; +mutex_lock (&dev->struct_mutex);if (--obj->vmapping_count ==0 ) {vunmap (obj->dma_buf_vmapping); obj->dma_buf_vmapping =NULL ;
Signature · 1 line
1.8.5.3
PATCH 3/3 drm/i915: Add support for stealing purgable stolen pages
In reply to Rodrigo ViviFrom: Chris Wilson <[email protected]>
If we run out of stolen memory when trying to allocate an object, see if we can reap enough purgeable objects to free up enough contiguous free space for the allocation. This is in principle very much like evicting objects to free up enough contiguous space in the vma when binding a new object - and you will be forgiven for thinking that the code looks very similar.
At the moment, we do not allow userspace to allocate objects in stolen, so there is neither the memory pressure to trigger stolen eviction nor any purgeable objects inside the stolen arena. However, this will change in the near future, and so better management and defragmentation of stolen memory will become a real issue.
--- drivers/gpu/drm/i915/i915_gem_stolen.c | 119 ++++++++++++++++++++++++++++++--- 1 file changed, 108 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +108 -11
@@ -329,18 +329,25 @@ cleanup:return NULL ; } -struct drm_i915_gem_object * -i915_gem_object_create_stolen (struct drm_device *dev,u32 size) +static bool mark_free (struct drm_i915_gem_object *obj,struct list_head *unwind) +{ +if (obj->stolen ==NULL ) +return false; + +if (obj->madv !=I915_MADV_DONTNEED ) +return false; + +list_add (&obj->obj_exec_link, unwind); +return drm_mm_scan_add_block (obj->stolen); +} + +static struct drm_mm_node *stolen_alloc (struct drm_i915_private *dev_priv,u32 size) { -struct drm_i915_private *dev_priv = dev->dev_private; -struct drm_i915_gem_object *obj;struct drm_mm_node *stolen; +struct drm_i915_gem_object *obj; +struct list_head unwind, evict;int ret; -if (!drm_mm_initialized (&dev_priv->mm.stolen)) -return NULL ; - -DRM_DEBUG_KMS ("creating stolen object: size=%x\n" , size);if (size ==0 )return NULL ;
@@ -350,11 +357,101 @@ i915_gem_object_create_stolen(struct drm_device *dev, u32 size) ret =drm_mm_insert_node (&dev_priv->mm.stolen, stolen, size,4096 ,DRM_MM_SEARCH_DEFAULT ); -if (ret) { -kfree (stolen); -return NULL ; +if (ret ==0 ) +return stolen; + +/* No more stolen memory available, or too fragmented. +* Try evicting purgeable objects and search again. +*/ + +drm_mm_init_scan (&dev_priv->mm.stolen, size,4096 ,0 ); +INIT_LIST_HEAD (&unwind); + +list_for_each_entry (obj, &dev_priv->mm.unbound_list, global_list) +if (mark_free (obj, &unwind)) + goto found; + +list_for_each_entry (obj, &dev_priv->mm.bound_list, global_list) +if (mark_free (obj, &unwind)) + goto found; + +found: +INIT_LIST_HEAD (&evict); +while (!list_empty (&unwind)) { + obj =list_first_entry (&unwind, + struct drm_i915_gem_object, + obj_exec_link); +list_del_init (&obj->obj_exec_link); + +if (drm_mm_scan_remove_block (obj->stolen)) { +list_add (&obj->obj_exec_link, &evict); +drm_gem_object_reference (&obj->base); + } } + ret =0 ; +while (!list_empty (&evict)) { + obj =list_first_entry (&evict, + struct drm_i915_gem_object, + obj_exec_link); +list_del_init (&obj->obj_exec_link); + +if (ret ==0 ) { +struct i915_vma *vma, *vma_next; + +list_for_each_entry_safe (vma, vma_next, + &obj->vma_list, + vma_link) +if (i915_vma_unbind (vma)) +break ; + +/* Stolen pins its pages to prevent the +* normal shrinker from processing stolen +* objects. +*/ +i915_gem_object_unpin_pages (obj); + + ret =i915_gem_object_put_pages (obj); +if (ret ==0 ) { + obj->madv = __I915_MADV_PURGED; + +kfree (obj->stolen); + obj->stolen =NULL ; + }else +i915_gem_object_pin_pages (obj); + } + +drm_gem_object_unreference (&obj->base); + } + +if (ret ==0 ) + ret =drm_mm_insert_node (&dev_priv->mm.stolen, stolen, size, +4096 ,DRM_MM_SEARCH_DEFAULT ); +if (ret ==0 ) +return stolen; + +kfree (stolen); +return NULL ; +} + +struct drm_i915_gem_object * +i915_gem_object_create_stolen (struct drm_device *dev,u32 size) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_i915_gem_object *obj; +struct drm_mm_node *stolen; + +lockdep_assert_held (&dev->struct_mutex); + +if (!drm_mm_initialized (&dev_priv->mm.stolen)) +return NULL ; + +DRM_DEBUG_KMS ("creating stolen object: size=%x\n" , size); + + stolen =stolen_alloc (dev_priv, size); +if (stolen ==NULL ) +return NULL ; + obj =_i915_gem_object_create_stolen (dev, stolen);if (obj)return obj;
Signature · 1 line
1.8.5.3