[PATCH v2 1/2] drm/amdgpu: Fix a bug on flag table_freed

Christian König ckoenig.leichtzumerken at gmail.com
Tue Jun 1 07:02:02 UTC 2021



Am 01.06.21 um 02:06 schrieb Eric Huang:
> table_freed will be always true when mapping a memory with size
> bigger than 2MB. The problem is page table's entries are always
> existed, but existing mapping depends on page talbe's bo, so
> using a check of page table's bo existed will resolve the issue.
>
> Signed-off-by: Eric Huang <jinhuieric.huang at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com> for this one.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 539c117906cc..2c20bba7dc1a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1582,9 +1582,12 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params,
>   			 * completely covered by the range and so potentially still in use.
>   			 */
>   			while (cursor.pfn < frag_start) {
> -				amdgpu_vm_free_pts(adev, params->vm, &cursor);
> +				/* Make sure previous mapping is freed */
> +				if (cursor.entry->base.bo) {
> +					params->table_freed = true;
> +					amdgpu_vm_free_pts(adev, params->vm, &cursor);
> +				}
>   				amdgpu_vm_pt_next(adev, &cursor);
> -				params->table_freed = true;
>   			}
>   
>   		} else if (frag >= shift) {



More information about the amd-gfx mailing list