[PATCH 2/3] drm/amdgpu: add some extra VM error handling
zhoucm1
david1.zhou at amd.com
Tue May 16 02:39:26 UTC 2017
On 2017年05月15日 19:57, Christian König wrote:
> From: Christian König <christian.koenig at amd.com>
>
> If updating the PDs fails we now invalidate all entries to try again later.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
Reviewed-by: Chunming Zhou <david1.zhou at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 34 +++++++++++++++++++++++++++++++++-
> 1 file changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 344f943..b877f9f3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1105,6 +1105,32 @@ static int amdgpu_vm_update_level(struct amdgpu_device *adev,
> }
>
> /*
> + * amdgpu_vm_invalidate_level - mark all PD levels as invalid
> + *
> + * @parent: parent PD
> + *
> + * Mark all PD level as invalid after an error.
> + */
> +static void amdgpu_vm_invalidate_level(struct amdgpu_vm_pt *parent)
> +{
> + unsigned pt_idx;
> +
> + /*
> + * Recurse into the subdirectories. This recursion is harmless because
> + * we only have a maximum of 5 layers.
> + */
> + for (pt_idx = 0; pt_idx <= parent->last_entry_used; ++pt_idx) {
> + struct amdgpu_vm_pt *entry = &parent->entries[pt_idx];
> +
> + if (!entry->bo)
> + continue;
> +
> + entry->addr = ~0ULL;
> + amdgpu_vm_invalidate_level(entry);
> + }
> +}
> +
> +/*
> * amdgpu_vm_update_directories - make sure that all directories are valid
> *
> * @adev: amdgpu_device pointer
> @@ -1116,7 +1142,13 @@ static int amdgpu_vm_update_level(struct amdgpu_device *adev,
> int amdgpu_vm_update_directories(struct amdgpu_device *adev,
> struct amdgpu_vm *vm)
> {
> - return amdgpu_vm_update_level(adev, vm, &vm->root, 0);
> + int r;
> +
> + r = amdgpu_vm_update_level(adev, vm, &vm->root, 0);
> + if (r)
> + amdgpu_vm_invalidate_level(&vm->root);
> +
> + return r;
> }
>
> /**
More information about the amd-gfx
mailing list