Skip to contentSkip to conversation

Update VM function point when VM state changed.

PATCH In review Gang Ba 3 participants 3 messages Aug 14, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Gang Ba

author
#0 lore raw

PATCH 1/1 Update VM function point when VM state changed.

Change-Id Ibcfada560a00c9aeebfd922ae48de920e44a5866
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6 -0
index c1baf3d..72dd434 100644
@@ -2862,6 +2862,12 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
 	WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
 		  "CPU update of VM recommended only for large BAR system\n");
 
+	if (vm->use_cpu_for_update)
+		vm->update_funcs = &amdgpu_vm_cpu_funcs;
+	else
+		vm->update_funcs = &amdgpu_vm_sdma_funcs;
+	vm->last_update = NULL;
+
 	if (vm->pasid) {
 		unsigned long flags;
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1565794853-25275-1-git-send-email-gaba-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 14.08.19 um 17:01 schrieb Gang Ba:

Quoted 2 lines
Change-Id Ibcfada560a00c9aeebfd922ae48de920e44a5866

Good catch, but there is a problem below.

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index c1baf3d..72dd434 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns · line 2869

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -0
@@ -2862,6 +2862,12 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
  	WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
  		  "CPU update of VM recommended only for large BAR system\n");
 
+	if (vm->use_cpu_for_update)
+		vm->update_funcs = &amdgpu_vm_cpu_funcs;
+	else
+		vm->update_funcs = &amdgpu_vm_sdma_funcs;
+	vm->last_update = NULL;

You can't just set last_update to NULL or your would leak the memory the fence occupies. So this needs to be:

dma_fence_put(vm->last_update);
vm->last_update = NULL;

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns · line 2873

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -0
+
  	if (vm->pasid) {
  		unsigned long flags;
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): d21d6399-fe1d-72b1-167a-c117c2a34a6b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

Please also include a patch description so we understand why this change is needed.

Alex
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Christian K?nig <[email protected]>
Sent: Wednesday, August 14, 2019 11:06 AM
To: Ba, Gang <[email protected]>; [email protected] <[email protected]>
Cc: Ba, Gang <[email protected]>
Subject: Re: [PATCH] Update VM function point when VM state changed.

Am 14.08.19 um 17:01 schrieb Gang Ba:

Quoted 2 lines
Change-Id Ibcfada560a00c9aeebfd922ae48de920e44a5866

Good catch, but there is a problem below.

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index c1baf3d..72dd434 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns · line 2869

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -0
@@ -2862,6 +2862,12 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
       WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
                 "CPU update of VM recommended only for large BAR system\n");
 
+     if (vm->use_cpu_for_update)
+             vm->update_funcs = &amdgpu_vm_cpu_funcs;
+     else
+             vm->update_funcs = &amdgpu_vm_sdma_funcs;
+     vm->last_update = NULL;

You can't just set last_update to NULL or your would leak the memory the fence occupies. So this needs to be:

dma_fence_put(vm->last_update);
vm->last_update = NULL;

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns · line 2873

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -0
+
       if (vm->pasid) {
               unsigned long flags;
 

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx