From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [PATCH v4 3/4] drm/xe: Take a ref to xe file when user creates a VM
Date: Thu, 18 Jul 2024 14:05:47 -0700 [thread overview]
Message-ID: <20240718210548.3580382-4-umesh.nerlige.ramappa@intel.com> (raw)
In-Reply-To: <20240718210548.3580382-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>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
drivers/gpu/drm/xe/xe_vm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index b6932cc98ff9..d9aadb8ec737 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -1674,6 +1674,10 @@ static void vm_destroy_work_func(struct work_struct *w)
trace_xe_vm_free(vm);
ttm_lru_bulk_move_fini(&xe->ttm, &vm->lru_bulk_move);
+
+ if (vm->xef)
+ xe_file_put(vm->xef);
+
kfree(vm);
}
@@ -1806,7 +1810,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
next prev parent reply other threads:[~2024-07-18 21:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 21:05 [PATCH v4 0/4] Have xe_vm and xe_exec_queue take references to xef Umesh Nerlige Ramappa
2024-07-18 21:05 ` [PATCH v4 1/4] drm/xe: Move part of xe_file cleanup to a helper Umesh Nerlige Ramappa
2024-07-18 21:05 ` [PATCH v4 2/4] drm/xe: Add ref counting for xe_file Umesh Nerlige Ramappa
2024-07-18 21:05 ` Umesh Nerlige Ramappa [this message]
2024-07-18 21:05 ` [PATCH v4 4/4] drm/xe: Fix use after free when client stats are captured Umesh Nerlige Ramappa
2024-07-22 19:00 ` Rodrigo Vivi
2024-07-23 22:11 ` Umesh Nerlige Ramappa
2024-08-08 20:06 ` Lucas De Marchi
2024-07-18 23:21 ` ✓ CI.Patch_applied: success for Have xe_vm and xe_exec_queue take references to xef (rev4) Patchwork
2024-07-18 23:22 ` ✓ CI.checkpatch: " Patchwork
2024-07-18 23:23 ` ✓ CI.KUnit: " Patchwork
2024-07-18 23:35 ` ✓ CI.Build: " Patchwork
2024-07-18 23:37 ` ✓ CI.Hooks: " Patchwork
2024-07-18 23:38 ` ✓ CI.checksparse: " Patchwork
2024-07-19 0:00 ` ✗ CI.BAT: failure " Patchwork
2024-07-19 7:16 ` [PATCH v4 0/4] Have xe_vm and xe_exec_queue take references to xef Matthew Brost
2024-07-19 7:47 ` Lucas De Marchi
2024-07-19 18:40 ` Umesh Nerlige Ramappa
2024-07-19 9:44 ` ✓ CI.FULL: success for Have xe_vm and xe_exec_queue take references to xef (rev4) 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=20240718210548.3580382-4-umesh.nerlige.ramappa@intel.com \
--to=umesh.nerlige.ramappa@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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