Yeah, that came to my mind as well.

But this is the only case where we would use the return value and not use cursor->pfn as criteria to abort.

So to be consistent I rather don't want to do this,
Christian.

Am 25.10.18 um 17:43 schrieb Zhu, Rex:

How about add a return value for the function amdgpu_vm_pt_next?

And change the code as:

     ret = amdgpu_vm_pt_next(adev, cursor);
-       while (amdgpu_vm_pt_descendant(adev, cursor));
+       if (!ret)
+               while (amdgpu_vm_pt_descendant(adev, cursor));

Best Regards

Rex

*From:* amd-gfx <amd-gfx-boun...@lists.freedesktop.org> *On Behalf Of *Zhu, Rex
*Sent:* Thursday, October 25, 2018 11:34 PM
*To:* Deucher, Alexander <alexander.deuc...@amd.com>; Christian König <ckoenig.leichtzumer...@gmail.com>; amd-gfx@lists.freedesktop.org
*Subject:* RE: [PATCH] drm/amdgpu: fix VM leaf walking

Patch is Tested-by:  Rex Zhu rex....@amd.com <mailto:rex....@amd.com>

Regards

Rex

*From:* amd-gfx <amd-gfx-boun...@lists.freedesktop.org <mailto:amd-gfx-boun...@lists.freedesktop.org>> *On Behalf Of *Deucher, Alexander
*Sent:* Thursday, October 25, 2018 11:08 PM
*To:* Christian König <ckoenig.leichtzumer...@gmail.com <mailto:ckoenig.leichtzumer...@gmail.com>>; amd-gfx@lists.freedesktop.org <mailto:amd-gfx@lists.freedesktop.org>
*Subject:* Re: [PATCH] drm/amdgpu: fix VM leaf walking

Acked-by: Alex Deucher <alexander.deuc...@amd.com <mailto:alexander.deuc...@amd.com>>

------------------------------------------------------------------------

*From:*amd-gfx <amd-gfx-boun...@lists.freedesktop.org <mailto:amd-gfx-boun...@lists.freedesktop.org>> on behalf of Christian König <ckoenig.leichtzumer...@gmail.com <mailto:ckoenig.leichtzumer...@gmail.com>>
*Sent:* Thursday, October 25, 2018 10:38 AM
*To:* amd-gfx@lists.freedesktop.org <mailto:amd-gfx@lists.freedesktop.org>
*Subject:* [PATCH] drm/amdgpu: fix VM leaf walking

Make sure we don't try to go down further after the leave walk already
ended. This fixes a crash with a new VM test.

Signed-off-by: Christian König <christian.koe...@amd.com <mailto:christian.koe...@amd.com>>
---
 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 db0cbf8d219d..352b30409060 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -542,7 +542,8 @@ static void amdgpu_vm_pt_next_leaf(struct amdgpu_device *adev,
                                    struct amdgpu_vm_pt_cursor *cursor)
 {
         amdgpu_vm_pt_next(adev, cursor);
-       while (amdgpu_vm_pt_descendant(adev, cursor));
+       if (cursor->pfn != ~0ll)
+               while (amdgpu_vm_pt_descendant(adev, cursor));
 }

 /**
--
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org <mailto:amd-gfx@lists.freedesktop.org>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to