Message ID | 1452522922-2614-1-git-send-email-deathsimple@vodafone.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
LGTM, minor nitpick below. Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> On 01/11/2016 03:35 PM, Christian König wrote: > From: Christian König <christian.koenig@amd.com> > > If we import a BO with an external reservation object we don't > reserve/unreserve it. So we never add it to the LRU causing a possible > deny of service. s/deny/denial/ > > v2: fix typo in commit message > > Signed-off-by: Christian König <christian.koenig@amd.com> > --- > drivers/gpu/drm/ttm/ttm_bo.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c > index 745e996..a98a5d5 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo.c > +++ b/drivers/gpu/drm/ttm/ttm_bo.c > @@ -1170,9 +1170,15 @@ int ttm_bo_init(struct ttm_bo_device *bdev, > if (likely(!ret)) > ret = ttm_bo_validate(bo, placement, interruptible, false); > > - if (!resv) > + if (!resv) { > ttm_bo_unreserve(bo); > > + } else if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { > + spin_lock(&bo->glob->lru_lock); > + ttm_bo_add_to_lru(bo); > + spin_unlock(&bo->glob->lru_lock); > + } > + > if (unlikely(ret)) > ttm_bo_unref(&bo); >
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 745e996..a98a5d5 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1170,9 +1170,15 @@ int ttm_bo_init(struct ttm_bo_device *bdev, if (likely(!ret)) ret = ttm_bo_validate(bo, placement, interruptible, false); - if (!resv) + if (!resv) { ttm_bo_unreserve(bo); + } else if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { + spin_lock(&bo->glob->lru_lock); + ttm_bo_add_to_lru(bo); + spin_unlock(&bo->glob->lru_lock); + } + if (unlikely(ret)) ttm_bo_unref(&bo);