dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thomas@shipmail.org>
To: "Christian König" <deathsimple@vodafone.de>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/ttm: fix adding foreign BOs to the LRU during init
Date: Sat, 9 Jan 2016 08:05:43 +0100	[thread overview]
Message-ID: <5690B147.5070409@shipmail.org> (raw)
In-Reply-To: <1452260518-2716-1-git-send-email-deathsimple@vodafone.de>

Hi!

I might be misunderderstanding the use-case here, but IIRC the
discussion with TTM vs imported / exported buffer objects is that a
buffer object needs to be marked NO_EVICT in TTM before it's exported
and an imported object should never end up on a LRU list in TTM because
TTM wouldn't know how to evict it.

/Thomas
 

On 01/08/2016 02:41 PM, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
>
> If we import a BO with an eternal reservation object we don't
> reserve/unreserve it. So we never add it to the LRU causing a possible
> deny of service.
>
> 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);
>  



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-01-09  7:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 13:41 [PATCH] drm/ttm: fix adding foreign BOs to the LRU during init Christian König
2016-01-09  7:05 ` Thomas Hellstrom [this message]
2016-01-09 10:46   ` Christian König
2016-01-10 15:10     ` Thomas Hellstrom
2016-01-11  3:38       ` zhoucm1
2016-01-11 12:39       ` Christian König
2016-01-11 13:00         ` Thomas Hellstrom
2016-01-11 14:38           ` Christian König
2016-01-11 14:55             ` Daniel Vetter
2016-01-11 15:54               ` Christian König
2016-01-11 19:37                 ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5690B147.5070409@shipmail.org \
    --to=thomas@shipmail.org \
    --cc=deathsimple@vodafone.de \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox