Skip to contentSkip to conversation

drm/amdgpu: Use the TGID for trace_amdgpu_vm_update_ptes

PATCH Applied Friedrich Vock 3 participants 6 messages Feb 2, 2023 – Feb 7, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Use the TGID for trace_amdgpu_vm_update_ptes

The pid field corresponds to the result of gettid() in userspace. However, userspace cannot reliably attribute PTE events to processes with just the thread id. This patch allows userspace to easily attribute PTE update events to specific processes by comparing this field with the result of getpid().

For attributing events to specific threads, the thread id is also contained in the common fields of each trace event.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +1 -1
index b5f3bba851db..01e42bdd8e4e 100644
@@ -974,7 +974,7 @@ int amdgpu_vm_ptes_update(struct amdgpu_vm_update_params *params,
 			trace_amdgpu_vm_update_ptes(params, frag_start, upd_end,
 						    min(nptes, 32u), dst, incr,
 						    upd_flags,
-						    vm->task_info.pid,
+						    vm->task_info.tgid,
 						    vm->immediate.fence_context);
 			amdgpu_vm_pte_update_flags(params, to_amdgpu_bo_vm(pt),
 						   cursor.level, pe_start, dst,

--
2.39.1

maintainer
#1 lore raw

Am 02.02.23 um 17:21 schrieb Friedrich Vock:

Quoted 10 lines

The pid field corresponds to the result of gettid() in userspace. However, userspace cannot reliably attribute PTE events to processes with just the thread id. This patch allows userspace to easily attribute PTE update events to specific processes by comparing this field with the result of getpid().

For attributing events to specific threads, the thread id is also contained in the common fields of each trace event.

Ah, yes that makes more sense. Reviewed-by: Christian König <[email protected]>

Alex do you pick this up or should I take care of it?

Thanks,
Christian.

Quoted 20 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +1 -2
index b5f3bba851db..01e42bdd8e4e 100644
@@ -974,7 +974,7 @@ int amdgpu_vm_ptes_update(struct amdgpu_vm_update_params *params,
  			trace_amdgpu_vm_update_ptes(params, frag_start, upd_end,
  						    min(nptes, 32u), dst, incr,
  						    upd_flags,
-						    vm->task_info.pid,
+						    vm->task_info.tgid,
  						    vm->immediate.fence_context);
  			amdgpu_vm_pte_update_flags(params, to_amdgpu_bo_vm(pt),
  						   cursor.level, pe_start, dst,
--

2.39.1

Applied
#2 lore raw

Applied. Thanks!

Alex

Quoted 44 lines · Christian König

Am 02.02.23 um 17:21 schrieb Friedrich Vock:

Quoted 10 lines

The pid field corresponds to the result of gettid() in userspace. However, userspace cannot reliably attribute PTE events to processes with just the thread id. This patch allows userspace to easily attribute PTE update events to specific processes by comparing this field with the result of getpid().

For attributing events to specific threads, the thread id is also contained in the common fields of each trace event.

Ah, yes that makes more sense. Reviewed-by: Christian König <[email protected]>

Alex do you pick this up or should I take care of it?

Thanks,
Christian.

Quoted 20 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +1 -2
index b5f3bba851db..01e42bdd8e4e 100644
@@ -974,7 +974,7 @@ int amdgpu_vm_ptes_update(struct amdgpu_vm_update_params *params,
                      trace_amdgpu_vm_update_ptes(params, frag_start, upd_end,
                                                  min(nptes, 32u), dst, incr,
                                                  upd_flags,
-                                                 vm->task_info.pid,
+                                                 vm->task_info.tgid,
                                                  vm->immediate.fence_context);
                      amdgpu_vm_pte_update_flags(params, to_amdgpu_bo_vm(pt),
                                                 cursor.level, pe_start, dst,
--

2.39.1

#3 lore raw

Hi,

thanks for applying the patch!

Do you think it'd also be possible to backport it to previous kernel versions or do you already plan to do that?
Since it is a one-liner bugfix it shouldn't be too hard to backport.

Thank you,
Friedrich Vock

Quoted 46 lines · Alex Deucher

Applied. Thanks!

Alex

Quoted 41 lines · Christian König

Am 02.02.23 um 17:21 schrieb Friedrich Vock:

Quoted 10 lines

The pid field corresponds to the result of gettid() in userspace. However, userspace cannot reliably attribute PTE events to processes with just the thread id. This patch allows userspace to easily attribute PTE update events to specific processes by comparing this field with the result of getpid().

For attributing events to specific threads, the thread id is also contained in the common fields of each trace event.

Ah, yes that makes more sense. Reviewed-by: Christian König <[email protected]>

Alex do you pick this up or should I take care of it?

Thanks,
Christian.

Quoted 20 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +1 -2
index b5f3bba851db..01e42bdd8e4e 100644
@@ -974,7 +974,7 @@ int amdgpu_vm_ptes_update(struct amdgpu_vm_update_params *params,
                       trace_amdgpu_vm_update_ptes(params, frag_start, upd_end,
                                                   min(nptes, 32u), dst, incr,
                                                   upd_flags,
-                                                 vm->task_info.pid,
+                                                 vm->task_info.tgid,
                                                   vm->immediate.fence_context);
                       amdgpu_vm_pte_update_flags(params, to_amdgpu_bo_vm(pt),
                                                  cursor.level, pe_start, dst,
--

2.39.1

maintainer
#4 lore raw

That sounds like a good idea to me as well.

If you think that a patch should be backported please add a "CC: [email protected]" tag to it before sending it out.

We can always remove it if we don't think a backport is appropriated, but maintainers seldom add it by themself.

Thanks,
Christian.

Am 07.02.23 um 00:09 schrieb Friedrich Vock:

Quoted 59 lines

Hi,

thanks for applying the patch!

Do you think it'd also be possible to backport it to previous kernel versions or do you already plan to do that?
Since it is a one-liner bugfix it shouldn't be too hard to backport.

Thank you,
Friedrich Vock

Quoted 47 lines · Alex Deucher

Applied.  Thanks!

Alex

Quoted 42 lines · Christian König

Am 02.02.23 um 17:21 schrieb Friedrich Vock:

Quoted 10 lines

The pid field corresponds to the result of gettid() in userspace. However, userspace cannot reliably attribute PTE events to processes with just the thread id. This patch allows userspace to easily attribute PTE update events to specific processes by comparing this field with the result of getpid().

For attributing events to specific threads, the thread id is also contained in the common fields of each trace event.

Ah, yes that makes more sense. Reviewed-by: Christian König <[email protected]>

Alex do you pick this up or should I take care of it?

Thanks,
Christian.

Quoted 21 lines

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 2 +-

   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +1 -1
index b5f3bba851db..01e42bdd8e4e 100644
@@ -974,7 +974,7 @@ int amdgpu_vm_ptes_update(struct 
 amdgpu_vm_update_params *params,
                        trace_amdgpu_vm_update_ptes(params, frag_start, upd_end,
 min(nptes, 32u), dst, incr,
 upd_flags,
- vm->task_info.pid,
+ vm->task_info.tgid,
 vm->immediate.fence_context);
                        amdgpu_vm_pte_update_flags(params, to_amdgpu_bo_vm(pt),

cursor.level, pe_start, dst,

Signature · 1 line
2.39.1
#5 lore raw

I'll add the stable CC. Thanks,

Alex

Quoted 77 lines · Christian König

That sounds like a good idea to me as well.

If you think that a patch should be backported please add a "CC:
[email protected]" tag to it before sending it out.

We can always remove it if we don't think a backport is appropriated, but maintainers seldom add it by themself.

Thanks,
Christian.

Am 07.02.23 um 00:09 schrieb Friedrich Vock:

Quoted 63 lines

Hi,

thanks for applying the patch!

Do you think it'd also be possible to backport it to previous kernel versions or do you already plan to do that?
Since it is a one-liner bugfix it shouldn't be too hard to backport.

Thank you,
Friedrich Vock

Quoted 51 lines · Alex Deucher

Applied. Thanks!

Alex

Quoted 45 lines · Christian König

Am 02.02.23 um 17:21 schrieb Friedrich Vock:

Quoted 10 lines

The pid field corresponds to the result of gettid() in userspace. However, userspace cannot reliably attribute PTE events to processes with just the thread id. This patch allows userspace to easily attribute PTE update events to specific processes by comparing this field with the result of getpid().

For attributing events to specific threads, the thread id is also contained in the common fields of each trace event.

Ah, yes that makes more sense. Reviewed-by: Christian König <[email protected]>

Alex do you pick this up or should I take care of it?

Thanks,
Christian.

Quoted 24 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +1 -1
index b5f3bba851db..01e42bdd8e4e 100644
@@ -974,7 +974,7 @@ int amdgpu_vm_ptes_update(struct
 amdgpu_vm_update_params *params,
                       trace_amdgpu_vm_update_ptes(params,
 frag_start, upd_end,
 min(nptes, 32u), dst, incr,
 upd_flags,
- vm->task_info.pid,
+ vm->task_info.tgid,
 vm->immediate.fence_context);

amdgpu_vm_pte_update_flags(params,
to_amdgpu_bo_vm(pt),
cursor.level, pe_start, dst,
--
2.39.1