summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeung-Woo Kim <sw0312.kim@samsung.com>2024-01-09 17:47:54 +0900
committerMarek Szyprowski <m.szyprowski@samsung.com>2024-11-04 23:37:16 +0100
commite71d1abc5e49e04363afa0126264d9403b058e5c (patch)
tree73a86e4a471dcc6dd7c6867286dbca5a48d6d90c
parent7eb352a67dbff0b2589617ef12f05d05ceb0058a (diff)
downloadlinux-thead-e71d1abc5e49e04363afa0126264d9403b058e5c.tar.gz
linux-thead-e71d1abc5e49e04363afa0126264d9403b058e5c.tar.bz2
linux-thead-e71d1abc5e49e04363afa0126264d9403b058e5c.zip
gpu: drm: img: Replace system work flush with img dedicated workqueue
To remove deprecated flush_scheduled_work() after the commit 20bdedafd2f6 ("workqueue: Warn attempt to flush system-wide workqueues."), add img dedicated unordered wq and queue/flush the wq instead of system work. Change-Id: I316b2858abf15e11d9ed40550a41f9494d421c87 Ref: 848a4e5c096d ("drm/i915: add a dedicated workqueue inside drm_i915_private") Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
-rw-r--r--drivers/gpu/drm/img-rogue/osfunc.c27
-rw-r--r--drivers/gpu/drm/img-rogue/pvr_fence.c4
-rw-r--r--drivers/gpu/drm/img-rogue/pvr_fence.h5
-rw-r--r--drivers/gpu/drm/img-rogue/services_kernel_client.h1
4 files changed, 35 insertions, 2 deletions
diff --git a/drivers/gpu/drm/img-rogue/osfunc.c b/drivers/gpu/drm/img-rogue/osfunc.c
index a319d60898e8..dffad1173421 100644
--- a/drivers/gpu/drm/img-rogue/osfunc.c
+++ b/drivers/gpu/drm/img-rogue/osfunc.c
@@ -558,6 +558,7 @@ IMG_UINT32 OSStringUINT32ToStr(IMG_CHAR *pszBuf, size_t uSize,
#if defined(SUPPORT_NATIVE_FENCE_SYNC) || defined(SUPPORT_BUFFER_SYNC)
static struct workqueue_struct *gpFenceStatusWq;
+static struct workqueue_struct *gpFenceUnorderedWq;
static PVRSRV_ERROR _NativeSyncInit(void)
{
@@ -569,11 +570,24 @@ static PVRSRV_ERROR _NativeSyncInit(void)
return PVRSRV_ERROR_INIT_FAILURE;
}
+ gpFenceUnorderedWq = create_workqueue("pvr_fence_unordered");
+ if (!gpFenceUnorderedWq)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "%s: Failed to create fence unordered workqueue",
+ __func__));
+ destroy_workqueue(gpFenceStatusWq);
+ gpFenceStatusWq = NULL;
+ return PVRSRV_ERROR_INIT_FAILURE;
+ }
+
return PVRSRV_OK;
}
static void _NativeSyncDeinit(void)
{
+ if (gpFenceUnorderedWq) {
+ destroy_workqueue(gpFenceUnorderedWq);
+ }
if (gpFenceStatusWq) {
destroy_workqueue(gpFenceStatusWq);
}
@@ -591,6 +605,19 @@ struct workqueue_struct *NativeSyncGetFenceStatusWq(void)
return gpFenceStatusWq;
}
+
+struct workqueue_struct *NativeSyncGetFenceUnorderedWq(void)
+{
+ if (!gpFenceUnorderedWq)
+ {
+#if defined(DEBUG)
+ PVR_ASSERT(gpFenceUnorderedWq);
+#endif
+ return NULL;
+ }
+
+ return gpFenceUnorderedWq;
+}
#endif
PVRSRV_ERROR OSInitEnvData(void)
diff --git a/drivers/gpu/drm/img-rogue/pvr_fence.c b/drivers/gpu/drm/img-rogue/pvr_fence.c
index e94522a647ae..e9cd85bfe902 100644
--- a/drivers/gpu/drm/img-rogue/pvr_fence.c
+++ b/drivers/gpu/drm/img-rogue/pvr_fence.c
@@ -501,12 +501,14 @@ static void pvr_fence_context_destroy_kref(struct kref *kref)
{
struct pvr_fence_context *fctx =
container_of(kref, struct pvr_fence_context, kref);
+ struct workqueue_struct *unordered_wq = NativeSyncGetFenceUnorderedWq();
PVR_FENCE_CTX_TRACE(fctx, "destroyed fence context (%s)\n", fctx->name);
trace_pvr_fence_context_destroy_kref(fctx);
- schedule_work(&fctx->destroy_work);
+ if (unordered_wq)
+ queue_work(unordered_wq, &fctx->destroy_work);
}
/**
diff --git a/drivers/gpu/drm/img-rogue/pvr_fence.h b/drivers/gpu/drm/img-rogue/pvr_fence.h
index 21870ba9113e..078039f33f18 100644
--- a/drivers/gpu/drm/img-rogue/pvr_fence.h
+++ b/drivers/gpu/drm/img-rogue/pvr_fence.h
@@ -190,11 +190,14 @@ u32 pvr_fence_dump_info_on_stalled_ufos(struct pvr_fence_context *fctx,
static inline void pvr_fence_cleanup(void)
{
+ struct workqueue_struct *unordered_wq = NativeSyncGetFenceUnorderedWq();
+
/*
* Ensure all PVR fence contexts have been destroyed, by flushing
* the global workqueue.
*/
- flush_scheduled_work();
+ if (unordered_wq)
+ flush_workqueue(unordered_wq);
}
#if defined(PVR_FENCE_DEBUG)
diff --git a/drivers/gpu/drm/img-rogue/services_kernel_client.h b/drivers/gpu/drm/img-rogue/services_kernel_client.h
index aaca47f1e6d6..96134e7b9e4a 100644
--- a/drivers/gpu/drm/img-rogue/services_kernel_client.h
+++ b/drivers/gpu/drm/img-rogue/services_kernel_client.h
@@ -286,6 +286,7 @@ struct _PVRSRV_DEVICE_NODE_ *SyncCheckpointGetAssociatedDevice(PSYNC_CHECKPOINT_
@Return struct workqueue_struct ptr on success, NULL otherwise.
*/ /**************************************************************************/
struct workqueue_struct *NativeSyncGetFenceStatusWq(void);
+struct workqueue_struct *NativeSyncGetFenceUnorderedWq(void);
#endif
#endif /* __SERVICES_KERNEL_CLIENT__ */