Re: [PATCH 3/3] drm/amdgpu: WARN when freeing kernel memory during suspend
On Wed, Nov 16, 2022 at 11:01 AM Christian König wrote: > > When buffers are freed during suspend there is no guarantee that > they can be re-allocated during resume. > > The PSP subsystem seems to be quite buggy regarding this, so add > a WARN_ON() to point out those bugs. > > Signed-off-by: Christian König Reviewed-by: Alex Deucher > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > index d0d53e83a318..063bf6f69918 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > @@ -428,6 +428,8 @@ void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 > *gpu_addr, > if (*bo == NULL) > return; > > + WARN_ON(amdgpu_ttm_adev((*bo)->tbo.bdev)->in_suspend); > + > if (likely(amdgpu_bo_reserve(*bo, true) == 0)) { > if (cpu_addr) > amdgpu_bo_kunmap(*bo); > -- > 2.34.1 >
Re: [PATCH 3/3] drm/amdgpu: WARN when freeing kernel memory during suspend
Hey Christian, very interesting idea! I've tested it alone (without patch 2) and was able to see the PSP code freeing buffers during suspend, leading to a resume failure later. Feel free to add my: Tested-by: Guilherme G. Piccoli Cheers, Guilherme
[PATCH 3/3] drm/amdgpu: WARN when freeing kernel memory during suspend
When buffers are freed during suspend there is no guarantee that they can be re-allocated during resume. The PSP subsystem seems to be quite buggy regarding this, so add a WARN_ON() to point out those bugs. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index d0d53e83a318..063bf6f69918 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -428,6 +428,8 @@ void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr, if (*bo == NULL) return; + WARN_ON(amdgpu_ttm_adev((*bo)->tbo.bdev)->in_suspend); + if (likely(amdgpu_bo_reserve(*bo, true) == 0)) { if (cpu_addr) amdgpu_bo_kunmap(*bo); -- 2.34.1