Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: intel-xe@lists.freedesktop.org, matthew.brost@intel.com,
	lucas.demarchi@intel.com
Subject: [PATCH 4/5] drm/xe: Take a ref to xe file when user creates a VM
Date: Mon,  8 Jul 2024 13:21:02 -0700	[thread overview]
Message-ID: <20240708202103.3347869-5-umesh.nerlige.ramappa@intel.com> (raw)
In-Reply-To: <20240708202103.3347869-1-umesh.nerlige.ramappa@intel.com>

Take a reference to xef when user creates the VM and put the reference
when user destroys the VM.

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 0c764647a552..67b4c2467b78 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -1611,6 +1611,9 @@ static void vm_destroy_work_func(struct work_struct *w)
 		XE_WARN_ON(vm->pt_root[id]);
 
 	trace_xe_vm_free(vm);
+
+	if (vm->xef)
+		xe_file_put(vm->xef);
 	kfree(vm);
 }
 
@@ -1926,7 +1929,7 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
 	}
 
 	args->vm_id = id;
-	vm->xef = xef;
+	vm->xef = xe_file_get(xef);
 
 	/* Record BO memory for VM pagetable created against client */
 	for_each_tile(tile, xe, id)
-- 
2.38.1


  parent reply	other threads:[~2024-07-08 20:21 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-08 20:20 [PATCH 0/5] Have xe_vm and xe_exec_queue take references to xef Umesh Nerlige Ramappa
2024-07-08 20:20 ` [PATCH 1/5] drm/xe: Move part of xe_file cleanup to a helper Umesh Nerlige Ramappa
2024-07-08 21:21   ` Matthew Brost
2024-07-08 22:12     ` Umesh Nerlige Ramappa
2024-07-08 22:18       ` Matthew Brost
2024-07-08 20:21 ` [PATCH 2/5] drm/xe: Add ref counting for xe_file Umesh Nerlige Ramappa
2024-07-08 21:23   ` Matthew Brost
2024-07-08 22:15     ` Umesh Nerlige Ramappa
2024-07-08 22:19       ` Matthew Brost
2024-07-08 23:00     ` Umesh Nerlige Ramappa
2024-07-08 22:52   ` Lucas De Marchi
2024-07-08 23:26     ` Umesh Nerlige Ramappa
2024-07-09  0:28       ` Matthew Brost
2024-07-09 15:11         ` Lucas De Marchi
2024-07-09 16:37           ` Umesh Nerlige Ramappa
2024-07-09 20:37             ` Matthew Brost
2024-07-11 13:46               ` Lucas De Marchi
2024-07-08 20:21 ` [PATCH 3/5] drm/xe: Take a reference to xe file when user creates exec_queue Umesh Nerlige Ramappa
2024-07-08 21:25   ` Matthew Brost
2024-07-08 20:21 ` Umesh Nerlige Ramappa [this message]
2024-07-08 21:32   ` [PATCH 4/5] drm/xe: Take a ref to xe file when user creates a VM Matthew Brost
2024-07-08 20:21 ` [PATCH 5/5] Revert "drm/xe: Do not access xe file when updating exec queue run_ticks" Umesh Nerlige Ramappa
2024-07-08 21:33   ` Matthew Brost
2024-07-08 20:26 ` ✓ CI.Patch_applied: success for Have xe_vm and xe_exec_queue take references to xef Patchwork
2024-07-08 20:27 ` ✓ CI.checkpatch: " Patchwork
2024-07-08 20:28 ` ✓ CI.KUnit: " Patchwork
2024-07-08 20:40 ` ✓ CI.Build: " Patchwork
2024-07-08 20:42 ` ✓ CI.Hooks: " Patchwork
2024-07-08 20:43 ` ✓ CI.checksparse: " Patchwork
2024-07-08 21:16 ` ✗ CI.BAT: failure " Patchwork
2024-07-08 21:37 ` [PATCH 0/5] " Lucas De Marchi
2024-07-09  1:07 ` ✗ CI.FULL: failure for " 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=20240708202103.3347869-5-umesh.nerlige.ramappa@intel.com \
    --to=umesh.nerlige.ramappa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.brost@intel.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