[PATCH] drm/xe: Decrement client count immediately on file close
Balasubramani Vivekanandan
balasubramani.vivekanandan at intel.com
Wed Sep 18 08:11:50 UTC 2024
Decrement the client count immediately on file close. It is not required
to be deferred to the resource cleanup function. Otherwise there will be
a small time window, where there will be a non-zero client count even
after closing all open file handles.
This affects ccs_mode(xe_compute) igt tests as these tests try to change
the ccs_mode immediately after closing all file handles, but the driver
rejects the ccs_mode change request as it sees a non-zero client count.
Fixes: ce8c161cbad4 ("drm/xe: Add ref counting for xe_file")
Signed-off-by: Balasubramani Vivekanandan <balasubramani.vivekanandan at intel.com>
---
drivers/gpu/drm/xe/xe_device.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 4d3c794f134c..3bccea6212ff 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -107,17 +107,12 @@ static int xe_file_open(struct drm_device *dev, struct drm_file *file)
static void xe_file_destroy(struct kref *ref)
{
struct xe_file *xef = container_of(ref, struct xe_file, refcount);
- struct xe_device *xe = xef->xe;
xa_destroy(&xef->exec_queue.xa);
mutex_destroy(&xef->exec_queue.lock);
xa_destroy(&xef->vm.xa);
mutex_destroy(&xef->vm.lock);
- spin_lock(&xe->clients.lock);
- xe->clients.count--;
- spin_unlock(&xe->clients.lock);
-
xe_drm_client_put(xef->client);
kfree(xef->process_name);
kfree(xef);
@@ -178,6 +173,10 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file)
xe_file_put(xef);
+ spin_lock(&xe->clients.lock);
+ xe->clients.count--;
+ spin_unlock(&xe->clients.lock);
+
xe_pm_runtime_put(xe);
}
--
2.34.1
More information about the Intel-xe
mailing list