From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: kraxel@redhat.com, airlied@redhat.com, alexander.deucher@amd.com,
zack.rusin@broadcom.com, bcm-kernel-feedback-list@broadcom.com,
virtualization@lists.linux.dev, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: [PATCH 3/7] drm/vmwgfx: start to phase out ttm_exec
Date: Thu, 14 Nov 2024 16:30:16 +0100 [thread overview]
Message-ID: <20241114153020.6209-4-christian.koenig@amd.com> (raw)
In-Reply-To: <20241114153020.6209-1-christian.koenig@amd.com>
Start switching over vmwgfx to drm_exec as well. Replacing some
unnecessary complex calls with just just single BO dma_resv locking.
No intentional functional change, but only compile tested for now.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 49 ++++++++----------------
1 file changed, 16 insertions(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index a73af8a355fb..793293b59d43 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -517,7 +517,7 @@ static int
vmw_resource_check_buffer(struct ww_acquire_ctx *ticket,
struct vmw_resource *res,
bool interruptible,
- struct ttm_validate_buffer *val_buf)
+ struct ttm_buffer_object **bo)
{
struct ttm_operation_ctx ctx = { true, false };
struct list_head val_list;
@@ -532,10 +532,12 @@ vmw_resource_check_buffer(struct ww_acquire_ctx *ticket,
INIT_LIST_HEAD(&val_list);
ttm_bo_get(&res->guest_memory_bo->tbo);
- val_buf->bo = &res->guest_memory_bo->tbo;
- val_buf->num_shared = 0;
- list_add_tail(&val_buf->head, &val_list);
- ret = ttm_eu_reserve_buffers(ticket, &val_list, interruptible, NULL);
+
+ *bo = &res->guest_memory_bo->tbo;
+ if (ticket)
+ ww_acquire_init(ticket, &reservation_ww_class);
+
+ ret = ttm_bo_reserve(*bo, interruptible, (ticket == NULL), ticket);
if (unlikely(ret != 0))
goto out_no_reserve;
@@ -555,10 +557,11 @@ vmw_resource_check_buffer(struct ww_acquire_ctx *ticket,
return 0;
out_no_validate:
- ttm_eu_backoff_reservation(ticket, &val_list);
+ dma_resv_unlock((*bo)->base.resv);
+ if (ticket)
+ ww_acquire_fini(ticket);
out_no_reserve:
- ttm_bo_put(val_buf->bo);
- val_buf->bo = NULL;
+ ttm_bo_put(*bo);
if (guest_memory_dirty)
vmw_user_bo_unref(&res->guest_memory_bo);
@@ -600,29 +603,6 @@ int vmw_resource_reserve(struct vmw_resource *res, bool interruptible,
return 0;
}
-/**
- * vmw_resource_backoff_reservation - Unreserve and unreference a
- * guest memory buffer
- *.
- * @ticket: The ww acquire ctx used for reservation.
- * @val_buf: Guest memory buffer information.
- */
-static void
-vmw_resource_backoff_reservation(struct ww_acquire_ctx *ticket,
- struct ttm_validate_buffer *val_buf)
-{
- struct list_head val_list;
-
- if (likely(val_buf->bo == NULL))
- return;
-
- INIT_LIST_HEAD(&val_list);
- list_add_tail(&val_buf->head, &val_list);
- ttm_eu_backoff_reservation(ticket, &val_list);
- ttm_bo_put(val_buf->bo);
- val_buf->bo = NULL;
-}
-
/**
* vmw_resource_do_evict - Evict a resource, and transfer its data
* to a backup buffer.
@@ -642,7 +622,7 @@ static int vmw_resource_do_evict(struct ww_acquire_ctx *ticket,
val_buf.bo = NULL;
val_buf.num_shared = 0;
- ret = vmw_resource_check_buffer(ticket, res, interruptible, &val_buf);
+ ret = vmw_resource_check_buffer(ticket, res, interruptible, &val_buf.bo);
if (unlikely(ret != 0))
return ret;
@@ -657,7 +637,10 @@ static int vmw_resource_do_evict(struct ww_acquire_ctx *ticket,
res->guest_memory_dirty = true;
res->res_dirty = false;
out_no_unbind:
- vmw_resource_backoff_reservation(ticket, &val_buf);
+ dma_resv_unlock(val_buf.bo->base.resv);
+ if (ticket)
+ ww_acquire_fini(ticket);
+ ttm_bo_put(val_buf.bo);
return ret;
}
--
2.34.1
next prev parent reply other threads:[~2024-11-14 15:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 15:30 Switch remaining drivers over to drm_exec Christian König
2024-11-14 15:30 ` [PATCH 1/7] drm/radeon: switch over to drm_exec v2 Christian König
2024-11-14 20:50 ` Alex Deucher
2024-11-14 15:30 ` [PATCH 2/7] drm/qxl: switch to using " Christian König
2024-11-14 20:53 ` Alex Deucher
2024-11-14 15:30 ` Christian König [this message]
2024-11-17 7:12 ` [PATCH 3/7] drm/vmwgfx: start to phase out ttm_exec kernel test robot
2024-11-14 15:30 ` [PATCH 4/7] drm/vmwgfx: use the new drm_exec object Christian König
2024-11-17 9:15 ` kernel test robot
2024-11-14 15:30 ` [PATCH 5/7] drm/vmwgfx: replace ttm_validate_buffer with separate struct Christian König
2024-11-14 15:30 ` [PATCH 6/7] drm/xe: drop unused component dependencies Christian König
2024-11-14 17:31 ` Lucas De Marchi
2024-11-14 15:30 ` [PATCH 7/7] drm/ttm: remove ttm_execbug_util Christian König
2024-11-14 16:47 ` ✓ CI.Patch_applied: success for series starting with [1/7] drm/radeon: switch over to drm_exec v2 Patchwork
2024-11-14 16:48 ` ✗ CI.checkpatch: warning " Patchwork
2024-11-14 16:50 ` ✓ CI.KUnit: success " Patchwork
2024-11-14 17:06 ` ✓ CI.Build: " Patchwork
2024-11-14 17:08 ` ✓ CI.Hooks: " Patchwork
2024-11-14 17:10 ` ✗ CI.checksparse: warning " Patchwork
2024-11-14 17:36 ` ✓ CI.BAT: success " Patchwork
2024-11-15 9:53 ` ✗ CI.FULL: failure " Patchwork
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=20241114153020.6209-4-christian.koenig@amd.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=airlied@redhat.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=kraxel@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=zack.rusin@broadcom.com \
/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