* [PATCH] drm/i915: Add a few more sanity checks for stolen handling @ 2016-11-17 15:58 Chris Wilson 2016-11-17 18:15 ` ✓ Fi.CI.BAT: success for " Patchwork 2016-11-17 18:25 ` [PATCH] " Matthew Auld 0 siblings, 2 replies; 3+ messages in thread From: Chris Wilson @ 2016-11-17 15:58 UTC (permalink / raw) To: intel-gfx We should never be called via obj->ops->release() on anything other than a fully formed stolen object, so raise that to an assert. In the process tidy up a comment and variable no longer used outside of a conditional BUG. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- drivers/gpu/drm/i915/i915_gem_stolen.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 9b182ed93f3e..5bc9f699fdd2 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -513,11 +513,10 @@ i915_pages_create_for_stolen(struct drm_device *dev, u32 offset, u32 size) { struct drm_i915_private *dev_priv = to_i915(dev); - struct i915_ggtt *ggtt = &dev_priv->ggtt; struct sg_table *st; struct scatterlist *sg; - GEM_BUG_ON(offset > ggtt->stolen_size - size); + GEM_BUG_ON(offset > dev_priv->ggtt.stolen_size - size); /* We hide that we have no struct page backing our stolen object * by wrapping the contiguous physical allocation with a fake @@ -554,7 +553,7 @@ i915_gem_object_get_pages_stolen(struct drm_i915_gem_object *obj) static void i915_gem_object_put_pages_stolen(struct drm_i915_gem_object *obj, struct sg_table *pages) { - /* Should only be called during free */ + /* Should only be called from i915_gem_object_release_stolen() */ sg_free_table(pages); kfree(pages); } @@ -563,15 +562,16 @@ static void i915_gem_object_release_stolen(struct drm_i915_gem_object *obj) { struct drm_i915_private *dev_priv = to_i915(obj->base.dev); + struct drm_mm_node *stolen = fetch_and_zero(&obj->stolen); + + GEM_BUG_ON(!stolen); __i915_gem_object_unpin_pages(obj); - if (obj->stolen) { - i915_gem_stolen_remove_node(dev_priv, obj->stolen); - kfree(obj->stolen); - obj->stolen = NULL; - } + i915_gem_stolen_remove_node(dev_priv, stolen); + kfree(stolen); } + static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = { .get_pages = i915_gem_object_get_pages_stolen, .put_pages = i915_gem_object_put_pages_stolen, -- 2.10.2 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 3+ messages in thread
* ✓ Fi.CI.BAT: success for drm/i915: Add a few more sanity checks for stolen handling 2016-11-17 15:58 [PATCH] drm/i915: Add a few more sanity checks for stolen handling Chris Wilson @ 2016-11-17 18:15 ` Patchwork 2016-11-17 18:25 ` [PATCH] " Matthew Auld 1 sibling, 0 replies; 3+ messages in thread From: Patchwork @ 2016-11-17 18:15 UTC (permalink / raw) To: Chris Wilson; +Cc: intel-gfx == Series Details == Series: drm/i915: Add a few more sanity checks for stolen handling URL : https://patchwork.freedesktop.org/series/15507/ State : success == Summary == Series 15507v1 drm/i915: Add a few more sanity checks for stolen handling https://patchwork.freedesktop.org/api/1.0/series/15507/revisions/1/mbox/ Test drv_module_reload_basic: dmesg-warn -> PASS (fi-skl-6770hq) fi-bdw-5557u total:244 pass:229 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:244 pass:204 dwarn:0 dfail:0 fail:0 skip:40 fi-bxt-t5700 total:244 pass:216 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-j1900 total:244 pass:216 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-n2820 total:244 pass:212 dwarn:0 dfail:0 fail:0 skip:32 fi-hsw-4770 total:244 pass:224 dwarn:0 dfail:0 fail:0 skip:20 fi-hsw-4770r total:244 pass:224 dwarn:0 dfail:0 fail:0 skip:20 fi-ilk-650 total:244 pass:191 dwarn:0 dfail:0 fail:0 skip:53 fi-ivb-3520m total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-ivb-3770 total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-7200u total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-skl-6260u total:244 pass:230 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:244 pass:223 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6700k total:244 pass:222 dwarn:1 dfail:0 fail:0 skip:21 fi-skl-6770hq total:244 pass:230 dwarn:0 dfail:0 fail:0 skip:14 fi-snb-2520m total:244 pass:212 dwarn:0 dfail:0 fail:0 skip:32 fi-snb-2600 total:244 pass:211 dwarn:0 dfail:0 fail:0 skip:33 4f5493e90cc50f1c6391c4f389f7a79c8fe52355 drm-intel-nightly: 2016y-11m-17d-15h-37m-59s UTC integration manifest 18c4faf drm/i915: Add a few more sanity checks for stolen handling == Logs == For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3040/ _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/i915: Add a few more sanity checks for stolen handling 2016-11-17 15:58 [PATCH] drm/i915: Add a few more sanity checks for stolen handling Chris Wilson 2016-11-17 18:15 ` ✓ Fi.CI.BAT: success for " Patchwork @ 2016-11-17 18:25 ` Matthew Auld 1 sibling, 0 replies; 3+ messages in thread From: Matthew Auld @ 2016-11-17 18:25 UTC (permalink / raw) To: Chris Wilson; +Cc: Intel Graphics Development On 17 November 2016 at 15:58, Chris Wilson <chris@chris-wilson.co.uk> wrote: > We should never be called via obj->ops->release() on anything other than > a fully formed stolen object, so raise that to an assert. In the process > tidy up a comment and variable no longer used outside of a conditional > BUG. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Matthew Auld <matthew.auld@intel.com> _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-17 18:26 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-11-17 15:58 [PATCH] drm/i915: Add a few more sanity checks for stolen handling Chris Wilson 2016-11-17 18:15 ` ✓ Fi.CI.BAT: success for " Patchwork 2016-11-17 18:25 ` [PATCH] " Matthew Auld
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).