All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple@vodafone.de>
To: "Michel Dänzer" <michel@daenzer.net>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: Don't move pinned BOs
Date: Mon, 28 Mar 2016 16:33:17 +0200	[thread overview]
Message-ID: <56F940AD.7080101@vodafone.de> (raw)
In-Reply-To: <1459137182-7888-1-git-send-email-michel@daenzer.net>

Am 28.03.2016 um 05:53 schrieb Michel Dänzer:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> The purpose of pinning is to prevent a buffer from moving.
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Tested-by: Rex Zhu <Rex.Zhu@amd.com>
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

Well, that should not happen (at least when all the code for disallowing 
pinning into invisible VRAM works correctly).

But I would say better save than sorry, so this patch and the radeon 
version is Reviewed-by: Christian König <christian.koenig@amd.com>

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 6 ++++++
>   2 files changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 151a2d4..56d1458 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -608,6 +608,10 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>   	if ((offset + size) <= adev->mc.visible_vram_size)
>   		return 0;
>   
> +	/* Can't move a pinned BO to visible VRAM */
> +	if (abo->pin_count > 0)
> +		return -EINVAL;
> +
>   	/* hurrah the memory is not visible ! */
>   	amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM);
>   	lpfn =	adev->mc.visible_vram_size >> PAGE_SHIFT;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 0f42b1a..9d3341d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -384,9 +384,15 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo,
>   			struct ttm_mem_reg *new_mem)
>   {
>   	struct amdgpu_device *adev;
> +	struct amdgpu_bo *abo;
>   	struct ttm_mem_reg *old_mem = &bo->mem;
>   	int r;
>   
> +	/* Can't move a pinned BO */
> +	abo = container_of(bo, struct amdgpu_bo, tbo);
> +	if (WARN_ON_ONCE(abo->pin_count > 0))
> +		return -EINVAL;
> +
>   	adev = amdgpu_get_adev(bo->bdev);
>   	if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
>   		amdgpu_move_null(bo, new_mem);

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

  reply	other threads:[~2016-03-28 14:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-28  3:53 [PATCH] drm/amdgpu: Don't move pinned BOs Michel Dänzer
2016-03-28 14:33 ` Christian König [this message]
2016-03-28 15:56   ` Alex Deucher

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=56F940AD.7080101@vodafone.de \
    --to=deathsimple@vodafone.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=michel@daenzer.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.