[PATCH] drm/amdgpu: fix max_entries calculation
Pan, Xinhui
Xinhui.Pan at amd.com
Wed Sep 2 13:02:39 UTC 2020
> 2020年9月2日 20:05,Christian König <ckoenig.leichtzumerken at gmail.com> 写道:
>
> Calculate the correct value for max_entries or we might run after the
> page_address array.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> Fixes: 1e691e244487 drm/amdgpu: stop allocating dummy GTT nodes
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 8bc2253939be..8aa9584c184f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1697,7 +1697,8 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
> AMDGPU_GPU_PAGES_IN_CPU_PAGE;
> } else {
> addr = 0;
> - max_entries = S64_MAX;
> + max_entries = ((mapping->last - mapping->start) >>
> + AMDGPU_GPU_PAGE_SHIFT) + 1;
should it be like below?
max_entries = (mapping->last - mapping->start + 1 - pfn) * AMDGPU_GPU_PAGES_IN_CPU_PAGE;
last and start are already pfns. why still >> AMDGPU_GPU_PAGE_SHIFT? Am I missing something?
> }
>
> if (pages_addr) {
> --
> 2.17.1
>
More information about the amd-gfx
mailing list