[PATCH] Update VM function point when VM state changed.

Deucher, Alexander Alexander.Deucher at amd.com
Wed Aug 14 15:08:30 UTC 2019


Please also include a patch description so we understand why this change is needed.

Alex
________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Christian K?nig <ckoenig.leichtzumerken at gmail.com>
Sent: Wednesday, August 14, 2019 11:06 AM
To: Ba, Gang <Gang.Ba at amd.com>; amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Ba, Gang <Gang.Ba at amd.com>
Subject: Re: [PATCH] Update VM function point when VM state changed.

Am 14.08.19 um 17:01 schrieb Gang Ba:
> Change-Id: Ibcfada560a00c9aeebfd922ae48de920e44a5866
> Signed-off-by: Gang Ba <gaba at amd.com>

Good catch, but there is a problem below.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index c1baf3d..72dd434 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -2862,6 +2862,12 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
>        WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
>                  "CPU update of VM recommended only for large BAR system\n");
>
> +     if (vm->use_cpu_for_update)
> +             vm->update_funcs = &amdgpu_vm_cpu_funcs;
> +     else
> +             vm->update_funcs = &amdgpu_vm_sdma_funcs;
> +     vm->last_update = NULL;

You can't just set last_update to NULL or your would leak the memory the
fence occupies. So this needs to be:

dma_fence_put(vm->last_update);
vm->last_update = NULL;

Regards,
Christian.

> +
>        if (vm->pasid) {
>                unsigned long flags;
>

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20190814/8b7e99a3/attachment-0001.html>


More information about the amd-gfx mailing list