All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: wait for eviction in ttm_bo_force_list_clean
@ 2016-06-22 12:16 Christian König
  2016-06-22 16:45 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Christian König @ 2016-06-22 12:16 UTC (permalink / raw)
  To: dri-devel

From: Christian König <christian.koenig@amd.com>

Now that we can pipeline evictions we need to wait for
them to finish when we cleanup a memory domain.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 5d93169..e340d0d6 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1287,6 +1287,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
 {
 	struct ttm_mem_type_manager *man = &bdev->man[mem_type];
 	struct ttm_bo_global *glob = bdev->glob;
+	struct fence *fence;
 	int ret;
 
 	/*
@@ -1307,6 +1308,23 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
 		spin_lock(&glob->lru_lock);
 	}
 	spin_unlock(&glob->lru_lock);
+
+	spin_lock(&man->move_lock);
+	fence = fence_get(man->move);
+	spin_unlock(&man->move_lock);
+
+	if (fence) {
+		ret = fence_wait(fence, false);
+		fence_put(fence);
+		if (ret) {
+			if (allow_errors) {
+				return ret;
+			} else {
+				pr_err("Cleanup eviction failed\n");
+			}
+		}
+	}
+
 	return 0;
 }
 
-- 
2.5.0

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/ttm: wait for eviction in ttm_bo_force_list_clean
  2016-06-22 12:16 [PATCH] drm/ttm: wait for eviction in ttm_bo_force_list_clean Christian König
@ 2016-06-22 16:45 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2016-06-22 16:45 UTC (permalink / raw)
  To: Christian König; +Cc: Maling list - DRI developers

On Wed, Jun 22, 2016 at 8:16 AM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> Now that we can pipeline evictions we need to wait for
> them to finish when we cleanup a memory domain.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/ttm/ttm_bo.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 5d93169..e340d0d6 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -1287,6 +1287,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
>  {
>         struct ttm_mem_type_manager *man = &bdev->man[mem_type];
>         struct ttm_bo_global *glob = bdev->glob;
> +       struct fence *fence;
>         int ret;
>
>         /*
> @@ -1307,6 +1308,23 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
>                 spin_lock(&glob->lru_lock);
>         }
>         spin_unlock(&glob->lru_lock);
> +
> +       spin_lock(&man->move_lock);
> +       fence = fence_get(man->move);
> +       spin_unlock(&man->move_lock);
> +
> +       if (fence) {
> +               ret = fence_wait(fence, false);
> +               fence_put(fence);
> +               if (ret) {
> +                       if (allow_errors) {
> +                               return ret;
> +                       } else {
> +                               pr_err("Cleanup eviction failed\n");
> +                       }
> +               }
> +       }
> +
>         return 0;
>  }
>
> --
> 2.5.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-22 16:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-22 12:16 [PATCH] drm/ttm: wait for eviction in ttm_bo_force_list_clean Christian König
2016-06-22 16:45 ` Alex Deucher

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.