drm/amdgpu: use CPU to update VM during GPU reset
Subsystems (2)
PATCH 1/2 drm/amdgpu: use CPU to update VM during GPU reset
drm sched is stopped and SDMA mode is not available, while CPU mode worked well in such a case.
Use case,amdgpu_do_asic_resetamdgpu_device_ip_late_initumsch_mm_late_initumsch_mm_testamdgpu_vm_init
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
@@ -2404,8 +2404,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, vm->is_compute_context = false; - vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode & -AMDGPU_VM_USE_CPU_FOR_GFX ); + vm->use_cpu_for_update = !!(amdgpu_in_reset (adev) || + adev->vm_manager.vm_update_mode &AMDGPU_VM_USE_CPU_FOR_GFX );DRM_DEBUG_DRIVER ("VM update mode is %s\n" , vm->use_cpu_for_update ?"CPU" :"SDMA" );
Signature · 1 line
2.25.1
[AMD Official Use Only - General]
Please ignore this one.
If user space calls amdgpu_vm_init between gpu reset start and end(driver doesn't prevent user space from doing that),
this will change VM update mode and affect user space. That's not expected.
Will find another way to solve this.
Regards,
Lang
Quoted 44 lines
-----Original Message-----
From: Yu, Lang <[email protected]>
Sent: Monday, March 25, 2024 1:36 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Yu, Lang <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: use CPU to update VM during GPU resetdrm sched is stopped and SDMA mode is not available, while CPU mode worked well in such a case.
Use case,
amdgpu_do_asic_resetamdgpu_device_ip_late_initumsch_mm_late_initumsch_mm_testamdgpu_vm_initSigned-off-by Lang Yu <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-1@@ -2404,8 +2404,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev,struct amdgpu_vm *vm, vm->is_compute_context = false; - vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode&
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-1- AMDGPU_VM_USE_CPU_FOR_GFX); + vm->use_cpu_for_update = !!(amdgpu_in_reset (adev) || + adev->vm_manager.vm_update_mode &
AMDGPU_VM_USE_CPU_FOR_GFX);DRM_DEBUG_DRIVER("VM update mode is %s\n",
vm->use_cpu_for_update? "CPU" : "SDMA");
--
2.25.1
Christian König
maintainerAm 25.03.24 um 06:35 schrieb Lang Yu:
Quoted 9 lines
drm sched is stopped and SDMA mode is not available, while CPU mode worked well in such a case.
Use case,
amdgpu_do_asic_resetamdgpu_device_ip_late_initumsch_mm_late_initumsch_mm_testamdgpu_vm_init
Well big NAK to that.
The VM updates should just be scheduled and applied as soon as the GPU reset is completed.
The problem is rather that a GPU reset should *never* create a VM to do a test. During GPU reset no memory allocation whatsoever is allowed.
That's why we only do IB and ring tests with a pre-allocated memory pool during a GPU reset.
If the umsch_mm_test abuses the VM tests like this then please remove that code immediately.
Regards,
Christian.
Quoted 21 lines
Signed-off-by Lang Yu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-2@@ -2404,8 +2404,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, vm->is_compute_context = false; - vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode & -AMDGPU_VM_USE_CPU_FOR_GFX ); + vm->use_cpu_for_update = !!(amdgpu_in_reset (adev) || + adev->vm_manager.vm_update_mode &AMDGPU_VM_USE_CPU_FOR_GFX );DRM_DEBUG_DRIVER ("VM update mode is %s\n" , vm->use_cpu_for_update ?"CPU" :"SDMA" );
[AMD Official Use Only - General]
Quoted 19 lines
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Friday, March 29, 2024 7:08 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: use CPU to update VM during GPU resetAm 25.03.24 um 06:35 schrieb Lang Yu:
Quoted 9 lines
drm sched is stopped and SDMA mode is not available, while CPU mode worked well in such a case.
Use case,
amdgpu_do_asic_resetamdgpu_device_ip_late_initumsch_mm_late_initumsch_mm_testamdgpu_vm_init
Quoted 7 lines
Well big NAK to that.
The VM updates should just be scheduled and applied as soon as the GPU reset is completed.
The problem is rather that a GPU reset should *never* create a VM to do a test. During GPU reset no memory allocation whatsoever is allowed.
But user space can still create a VM via open("/dev/dri/card0", ...) during GPU reset, driver doesn't prevent user space from doing that. So is this reasonable? Thanks.
Regards,
Lang
Quoted 35 lines
That's why we only do IB and ring tests with a pre-allocated memory pool during a GPU reset.
If the
umsch_mm_testabuses the VM tests like this then please remove that code immediately.Regards,
Christian.drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_init(struct amdgpu_device
Quoted 12 lines
Signed-off-by Lang Yu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0@@ -2404,8 +2404,8 @@ int amdgpu_vm_init(struct amdgpu_device*adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-1struct amdgpu_vm *vm, vm->is_compute_context = false; - vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode&
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-1- AMDGPU_VM_USE_CPU_FOR_GFX); + vm->use_cpu_for_update = !!(amdgpu_in_reset (adev) || + adev->vm_manager.vm_update_mode &
AMDGPU_VM_USE_CPU_FOR_GFX);Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0DRM_DEBUG_DRIVER ("VM update mode is %s\n" , vm->use_cpu_for_update ?"CPU" :"SDMA" );
Christian König
maintainerAm 02.04.24 um 10:47 schrieb Yu, Lang:
Quoted 22 lines
[AMD Official Use Only - General]
Quoted 20 lines
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Friday, March 29, 2024 7:08 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: use CPU to update VM during GPU resetAm 25.03.24 um 06:35 schrieb Lang Yu:
Quoted 9 lines
drm sched is stopped and SDMA mode is not available, while CPU mode worked well in such a case.
Use case,
amdgpu_do_asic_resetamdgpu_device_ip_late_initumsch_mm_late_initumsch_mm_testamdgpu_vm_initWell big NAK to that.
Quoted 7 lines
Quoted 5 lines
The VM updates should just be scheduled and applied as soon as the GPU reset is completed.
The problem is rather that a GPU reset should *never* create a VM to do a test. During GPU reset no memory allocation whatsoever is allowed.
But user space can still create a VM via
open("/dev/dri/card0", ...)during GPU reset, driver doesn't prevent user space from doing that. So is this reasonable? Thanks.
Yes the UMD can still create VMs during reset, but this is completely unproblematic since all submissions will wait till after the reset before they start executing.
This includes both VM updates as well as userspace submissions.
Regards,
Christian.
Quoted 37 lines
Regards,
LangQuoted 33 lines
That's why we only do IB and ring tests with a pre-allocated memory pool during a GPU reset.
If the
umsch_mm_testabuses the VM tests like this then please remove that code immediately.Regards,
Christian.drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_init(struct amdgpu_device
Quoted 11 lines
Signed-off-by Lang Yu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0@@ -2404,8 +2404,8 @@ int amdgpu_vm_init(struct amdgpu_device*adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-1struct amdgpu_vm *vm, vm->is_compute_context = false; - vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode&
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-1- AMDGPU_VM_USE_CPU_FOR_GFX); + vm->use_cpu_for_update = !!(amdgpu_in_reset (adev) || + adev->vm_manager.vm_update_mode &
AMDGPU_VM_USE_CPU_FOR_GFX);Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0DRM_DEBUG_DRIVER ("VM update mode is %s\n" , vm->use_cpu_for_update ?"CPU" :"SDMA" );