From: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
To: <dri-devel@lists.freedesktop.org>, <christian.koenig@amd.com>,
<tursulin@igalia.com>, <simona.vetter@ffwll.ch>,
<robdclark@gmail.com>, <alexander.deucher@amd.com>,
<amd-gfx@lists.freedesktop.org>
Cc: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Subject: [PATCH v3 4/6] drm/amdgpu: alloc and init vm::task_info from first submit
Date: Fri, 20 Sep 2024 11:06:46 +0200 [thread overview]
Message-ID: <20240920090920.1342694-5-pierre-eric.pelloux-prayer@amd.com> (raw)
In-Reply-To: <20240920090920.1342694-1-pierre-eric.pelloux-prayer@amd.com>
This will allow to use flexible array to store the process name and
other information.
This also means that process name will be determined once and for all,
instead of at each submit.
Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index e20d19ae01b2..690676cab022 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2331,7 +2331,7 @@ amdgpu_vm_get_task_info_vm(struct amdgpu_vm *vm)
{
struct amdgpu_task_info *ti = NULL;
- if (vm) {
+ if (vm && vm->task_info) {
ti = vm->task_info;
kref_get(&vm->task_info->refcount);
}
@@ -2372,8 +2372,12 @@ static int amdgpu_vm_create_task_info(struct amdgpu_vm *vm)
*/
void amdgpu_vm_set_task_info(struct amdgpu_vm *vm)
{
- if (!vm->task_info)
- return;
+ if (!vm->task_info) {
+ if (amdgpu_vm_create_task_info(vm))
+ return;
+
+ get_task_comm(vm->task_info->process_name, current->group_leader);
+ }
if (vm->task_info->pid == current->pid)
return;
@@ -2385,7 +2389,6 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm)
return;
vm->task_info->tgid = current->group_leader->pid;
- get_task_comm(vm->task_info->process_name, current->group_leader);
}
/**
@@ -2482,7 +2485,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
if (r)
goto error_free_root;
- r = amdgpu_vm_create_task_info(vm);
if (r)
DRM_DEBUG("Failed to create task info for VM\n");
@@ -2608,7 +2610,8 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
root = amdgpu_bo_ref(vm->root.bo);
amdgpu_bo_reserve(root, true);
- amdgpu_vm_put_task_info(vm->task_info);
+ if (vm->task_info)
+ amdgpu_vm_put_task_info(vm->task_info);
amdgpu_vm_set_pasid(adev, vm, 0);
dma_fence_wait(vm->last_unlocked, false);
dma_fence_put(vm->last_unlocked);
--
2.40.1
next prev parent reply other threads:[~2024-09-20 9:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-20 9:06 [PATCH v3 0/6] DRM_SET_NAME ioctl Pierre-Eric Pelloux-Prayer
2024-09-20 9:06 ` [PATCH v3 1/6] drm: add " Pierre-Eric Pelloux-Prayer
2024-09-23 10:06 ` Tvrtko Ursulin
2024-09-24 8:22 ` Pierre-Eric Pelloux-Prayer
2024-09-24 8:38 ` Tvrtko Ursulin
2024-09-23 10:28 ` Dmitry Osipenko
2024-09-23 11:03 ` Dmitry Osipenko
2024-09-23 16:29 ` Pierre-Eric Pelloux-Prayer
2024-09-23 18:09 ` Dmitry Osipenko
2024-09-23 18:18 ` Dmitry Osipenko
2024-09-24 23:28 ` Dmitry Osipenko
2024-09-20 9:06 ` [PATCH v3 2/6] drm: use drm_file name in fdinfo Pierre-Eric Pelloux-Prayer
2024-09-20 9:06 ` [PATCH v3 3/6] drm/amdgpu: delay the use of amdgpu_vm_set_task_info Pierre-Eric Pelloux-Prayer
2024-09-23 10:25 ` Tvrtko Ursulin
2024-09-24 8:23 ` Christian König
2024-09-24 8:43 ` Tvrtko Ursulin
2024-09-24 10:01 ` Pierre-Eric Pelloux-Prayer
2024-09-20 9:06 ` Pierre-Eric Pelloux-Prayer [this message]
2024-09-23 10:58 ` [PATCH v3 4/6] drm/amdgpu: alloc and init vm::task_info from first submit Tvrtko Ursulin
2024-09-24 7:21 ` Pierre-Eric Pelloux-Prayer
2024-09-20 9:06 ` [PATCH v3 5/6] drm/amdgpu: make process_name a flexible array Pierre-Eric Pelloux-Prayer
2024-09-20 9:06 ` [PATCH v3 6/6] drm/amdgpu: use drm_file::name in task_info::process_desc Pierre-Eric Pelloux-Prayer
2024-09-20 12:08 ` Christian König
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=20240920090920.1342694-5-pierre-eric.pelloux-prayer@amd.com \
--to=pierre-eric.pelloux-prayer@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=robdclark@gmail.com \
--cc=simona.vetter@ffwll.ch \
--cc=tursulin@igalia.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