Skip to contentSkip to conversation

drm/amdgpu: add user queue vm identifier

PATCH In review Prike Liang 2 participants 8 messages Apr 28, 2025 – May 7, 2025

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

PATCH 1/2 drm/amdgpu: add user queue vm identifier

Add a user queue vm identifier for each userqueue
kms opt accessing.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c    | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h    | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +4 -0
index 451890ee3fb7..845051816af6 100644
@@ -319,6 +319,8 @@ amdgpu_userq_destroy(struct drm_file *filp, int queue_id)
 	pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
 	pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
 
+	fpriv->vm.is_userq_context = false;
+
 	return r;
 }
 
@@ -361,6 +363,8 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
 		return -EINVAL;
 	}
 
+	fpriv->vm.is_userq_context = true;
+
 	r = amdgpu_userq_priority_permit(filp, priority);
 	if (r)
 		return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index 3911c78f8282..5e075e8f0ca3 100644
@@ -2560,7 +2560,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	ttm_lru_bulk_move_init(&vm->lru_bulk_move);
 
 	vm->is_compute_context = false;
-
+	vm->is_userq_context = false;
 	vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
 				    AMDGPU_VM_USE_CPU_FOR_GFX);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1 -1
index f3ad687125ad..1e3c0f85c98e 100644
@@ -422,7 +422,7 @@ struct amdgpu_vm {
 	struct ttm_lru_bulk_move lru_bulk_move;
 	/* Flag to indicate if VM is used for compute */
 	bool			is_compute_context;
-
+	bool			is_userq_context;
 	/* Memory partition number, -1 means any partition */
 	int8_t			mem_id;
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 drm/amdgpu: log the user queue object PRT mapping

This patch will log the user queue buffer PRT mapping, and this will help on checking the user queue PRT functional status.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +4 -0
index 30022123b0bf..7992a97f8745 100644
@@ -903,6 +903,10 @@ int amdgpu_vm_ptes_update(struct amdgpu_vm_update_params *params,
 						    upd_flags,
 						    vm->task_info ? vm->task_info->tgid : 0,
 						    vm->immediate.fence_context);
+			if (upd_flags | AMDGPU_PTE_PRT_FLAG(adev)) {
+				if (params->vm->is_userq_context)
+					dev_dbg_ratelimited(adev->dev, "The kgd user queue PRT map is functional\n");
+			}
 			amdgpu_vm_pte_update_flags(params, to_amdgpu_bo_vm(pt),
 						   cursor.level, pe_start, dst,
 						   nptes, incr, upd_flags);
Signature · 1 line
2.34.1
#2 lore raw

RE: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

[Public]

Soft ping for this series.

Regards,
Prike

Quoted 38 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Monday, April 28, 2025 2:29 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

This patch will log the user queue buffer PRT mapping, and this will help on checking the user queue PRT functional status.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +4 -0
index 30022123b0bf..7992a97f8745 100644
@@ -903,6 +903,10 @@ int amdgpu_vm_ptes_update(struct
 amdgpu_vm_update_params *params,
                                                  upd_flags,
                                                  vm->task_info ? vm->task_info-
 >tgid : 0,
                                                  vm->immediate.fence_context);
+                     if (upd_flags | AMDGPU_PTE_PRT_FLAG(adev)) {
+                             if (params->vm->is_userq_context)
+                                     dev_dbg_ratelimited(adev->dev, "The kgd
 user queue PRT map is functional\n");
+                     }

amdgpu_vm_pte_update_flags(params,
to_amdgpu_bo_vm(pt),
cursor.level, pe_start, dst, nptes, incr, upd_flags);
--
2.34.1

#3 lore raw

RE: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

[Public]

Any feedback?

Regards,
Prike

Quoted 51 lines

-----Original Message-----
From: Liang, Prike
Sent: Wednesday, April 30, 2025 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

Soft ping for this series.

Regards,
Prike

Quoted 38 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Monday, April 28, 2025 2:29 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

This patch will log the user queue buffer PRT mapping, and this will help on checking the user queue PRT functional status.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +4 -0
index 30022123b0bf..7992a97f8745 100644
@@ -903,6 +903,10 @@ int amdgpu_vm_ptes_update(struct
 amdgpu_vm_update_params *params,
                                                upd_flags,
                                                vm->task_info ? vm->task_info-
 >tgid : 0,
                                                vm->immediate.fence_context);
+                   if (upd_flags | AMDGPU_PTE_PRT_FLAG(adev)) {
+                           if (params->vm->is_userq_context)
+                                   dev_dbg_ratelimited(adev->dev, "The kgd
 user queue PRT map is functional\n");
+                   }

amdgpu_vm_pte_update_flags(params,
to_amdgpu_bo_vm(pt),
cursor.level, pe_start, dst, nptes, incr, upd_flags);
--
2.34.1

maintainer
#4 lore raw

Re: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

Quoted 3 lines · Prike

[Public]

Any feedback?

Sorry totally missed that. We already have a trace point for all page table updates.

If you want to only see the PRT updates you can potentially enable that as a filter.

I can try to come up with the necessary commands for that if you want.

Regards,
Christian.

Quoted 56 lines

Regards,
Prike

Quoted 51 lines

-----Original Message-----
From: Liang, Prike
Sent: Wednesday, April 30, 2025 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

Soft ping for this series.

Regards,
Prike

Quoted 38 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Monday, April 28, 2025 2:29 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

This patch will log the user queue buffer PRT mapping, and this will help on checking the user queue PRT functional status.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +4 -0
index 30022123b0bf..7992a97f8745 100644
@@ -903,6 +903,10 @@ int amdgpu_vm_ptes_update(struct
 amdgpu_vm_update_params *params,
                                                upd_flags,
                                                vm->task_info ? vm->task_info-
 > tgid : 0,
                                                vm->immediate.fence_context);
+                   if (upd_flags | AMDGPU_PTE_PRT_FLAG(adev)) {
+                           if (params->vm->is_userq_context)
+                                   dev_dbg_ratelimited(adev->dev, "The kgd
 user queue PRT map is functional\n");
+                   }

amdgpu_vm_pte_update_flags(params,
to_amdgpu_bo_vm(pt),
cursor.level, pe_start, dst, nptes, incr, upd_flags);
--
2.34.1

#5 lore raw

RE: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

[Public]

Quoted 10 lines

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, May 6, 2025 10:09 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

Quoted 2 lines · Prike

[Public]

Quoted 8 lines
Quoted 1 line

Any feedback?

Sorry totally missed that. We already have a trace point for all page table updates.

If you want to only see the PRT updates you can potentially enable that as a filter.

I can try to come up with the necessary commands for that if you want.

Yes, we can check the PRT mappings by checking the trace point at amdgpu_vm_set_ptes() or amdgpu_vm_update_ptes(), but it requires further parsing the PTE flag and PTE update owner. Anyway, it's ok to confirm the user queue PRT mapping by checking the trace point, and I will drop the patch sets.

Thanks,
Prike

Quoted 67 lines

Regards,
Christian.

Quoted 63 lines

Regards,
Prike

Quoted 58 lines

-----Original Message-----
From: Liang, Prike
Sent: Wednesday, April 30, 2025 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

Soft ping for this series.

Regards,
Prike

Quoted 44 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Monday, April 28, 2025 2:29 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

This patch will log the user queue buffer PRT mapping, and this will help on checking the user queue PRT functional status.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +0 -0
index 30022123b0bf..7992a97f8745 100644
@@ -903,6 +903,10 @@ int amdgpu_vm_ptes_update(struct
 amdgpu_vm_update_params *params,
                                                upd_flags,
                                                vm->task_info ?

vm->task_info-

Quoted 1 line

tgid : 0,

vm->immediate.fence_context);

drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +4 -0
+                   if (upd_flags | AMDGPU_PTE_PRT_FLAG(adev)) {
+                           if (params->vm->is_userq_context)
+                                   dev_dbg_ratelimited(adev->dev,
+ "The kgd

user queue PRT map is functional\n");
+ }
amdgpu_vm_pte_update_flags(params,
to_amdgpu_bo_vm(pt),
cursor.level, pe_start, dst, nptes, incr,
upd_flags);
--
2.34.1

maintainer
#6 lore raw

Re: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

Quoted 15 lines · Prike

[Public]

Quoted 13 lines

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, May 6, 2025 10:09 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

Quoted 3 lines · Prike

[Public]

Any feedback?

Quoted 7 lines
Quoted 5 lines

Sorry totally missed that. We already have a trace point for all page table updates.

If you want to only see the PRT updates you can potentially enable that as a filter.

I can try to come up with the necessary commands for that if you want.

Yes, we can check the PRT mappings by checking the trace point at amdgpu_vm_set_ptes() or amdgpu_vm_update_ptes(), but it requires further parsing the PTE flag and PTE update owner. Anyway, it's ok to confirm the user queue PRT mapping by checking the trace point, and I will drop the patch sets.

The trace points have build in filter functionality and you can also use the RMV tool to visualize what is going on in the address space: https://gpuopen.com/rmv/

Regards,
Christian.

Quoted 71 lines

Thanks,
Prike

Quoted 67 lines

Regards,
Christian.

Quoted 63 lines

Regards,
Prike

Quoted 58 lines

-----Original Message-----
From: Liang, Prike
Sent: Wednesday, April 30, 2025 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

Soft ping for this series.

Regards,
Prike

Quoted 44 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Monday, April 28, 2025 2:29 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

This patch will log the user queue buffer PRT mapping, and this will help on checking the user queue PRT functional status.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +0 -0
index 30022123b0bf..7992a97f8745 100644
@@ -903,6 +903,10 @@ int amdgpu_vm_ptes_update(struct
 amdgpu_vm_update_params *params,
                                                upd_flags,
                                                vm->task_info ?

vm->task_info-

Quoted 1 line

tgid : 0,

vm->immediate.fence_context);

drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +4 -0
+                   if (upd_flags | AMDGPU_PTE_PRT_FLAG(adev)) {
+                           if (params->vm->is_userq_context)
+                                   dev_dbg_ratelimited(adev->dev,
+ "The kgd

user queue PRT map is functional\n");
+ }
amdgpu_vm_pte_update_flags(params,
to_amdgpu_bo_vm(pt),
cursor.level, pe_start, dst, nptes, incr,
upd_flags);
--
2.34.1

#7 lore raw

RE: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

[Public]

Quoted 30 lines

From: Koenig, Christian <[email protected]>
Sent: Wednesday, May 7, 2025 4:36 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

Quoted 17 lines · Prike

[Public]

Quoted 15 lines

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, May 6, 2025 10:09 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

Quoted 3 lines · Prike

[Public]

Any feedback?

Sorry totally missed that. We already have a trace point for all page table

updates.

Quoted 2 lines
Quoted 2 lines

If you want to only see the PRT updates you can potentially enable that as a

filter.

Quoted 2 lines
Quoted 2 lines

I can try to come up with the necessary commands for that if you want.

Quoted 8 lines
Quoted 1 line

Yes, we can check the PRT mappings by checking the trace point at

amdgpu_vm_set_ptes() or amdgpu_vm_update_ptes(), but it requires further parsing the PTE flag and PTE update owner.

Quoted 1 line

Anyway, it's ok to confirm the user queue PRT mapping by checking the trace

point, and I will drop the patch sets.

The trace points have build in filter functionality and you can also use the RMV tool to visualize what is going on in the address space: https://gpuopen.com/rmv/

Thanks, I will try it out.

Quoted 74 lines

Regards,
Christian.

Quoted 71 lines

Thanks,
Prike

Quoted 67 lines

Regards,
Christian.

Quoted 63 lines

Regards,
Prike

Quoted 58 lines

-----Original Message-----
From: Liang, Prike
Sent: Wednesday, April 30, 2025 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

Soft ping for this series.

Regards,
Prike

Quoted 44 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Monday, April 28, 2025 2:29 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: log the user queue object PRT mapping

This patch will log the user queue buffer PRT mapping, and this will help on checking the user queue PRT functional status.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +0 -0
index 30022123b0bf..7992a97f8745 100644
@@ -903,6 +903,10 @@ int amdgpu_vm_ptes_update(struct
 amdgpu_vm_update_params *params,
                                                upd_flags,
                                                vm->task_info ?

vm->task_info-

Quoted 1 line

tgid : 0,

vm->immediate.fence_context);

drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +4 -0
+                   if (upd_flags | AMDGPU_PTE_PRT_FLAG(adev)) {
+                           if (params->vm->is_userq_context)
+                                   dev_dbg_ratelimited(adev->dev,
+ "The kgd

user queue PRT map is functional\n");
+ }
amdgpu_vm_pte_update_flags(params,
to_amdgpu_bo_vm(pt),
cursor.level, pe_start, dst, nptes, incr,
upd_flags);
--
2.34.1