Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Decrement client count immediately on file close
@ 2024-09-18  8:11 Balasubramani Vivekanandan
  2024-09-18  9:39 ` Upadhyay, Tejas
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Balasubramani Vivekanandan @ 2024-09-18  8:11 UTC (permalink / raw)
  To: intel-xe
  Cc: Umesh Nerlige Ramappa, Niranjana Vishwanathapura, Lucas De Marchi,
	Balasubramani Vivekanandan

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@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


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

end of thread, other threads:[~2024-10-08  7:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-18  8:11 [PATCH] drm/xe: Decrement client count immediately on file close Balasubramani Vivekanandan
2024-09-18  9:39 ` Upadhyay, Tejas
2024-09-18 10:03   ` Vivekanandan, Balasubramani
2024-09-18 11:11     ` Upadhyay, Tejas
2024-09-18 20:43       ` Lucas De Marchi
2024-09-19  8:19         ` Vivekanandan, Balasubramani
2024-09-19 11:55           ` Lucas De Marchi
2024-10-08  7:44             ` Vivekanandan, Balasubramani
2024-09-18 11:54 ` ✓ CI.Patch_applied: success for " Patchwork
2024-09-18 11:54 ` ✓ CI.checkpatch: " Patchwork
2024-09-18 11:55 ` ✓ CI.KUnit: " Patchwork
2024-09-18 12:09 ` ✓ CI.Build: " Patchwork
2024-09-18 12:14 ` ✓ CI.Hooks: " Patchwork
2024-09-18 12:33 ` ✓ CI.checksparse: " Patchwork
2024-09-18 13:16 ` ✓ CI.BAT: " Patchwork
2024-09-18 17:47 ` ✗ CI.FULL: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox