Skip to contentSkip to conversation

drm/amdgpu: fix VM leaf walking

PATCH In review Christian König 4 participants 7 messages Oct 25, 2018 – Oct 29, 2018 5 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
index db0cbf8d219d..352b30409060 100644
@@ -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));
 }
 
 /**
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20181025143804.1698-1-christian.koenig-5C7GfCeVMHo@public.gmane.org

#2 lore raw

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Christian König <[email protected]>
Sent: Thursday, October 25, 2018 10:38 AM
To: [email protected]
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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
index db0cbf8d219d..352b30409060 100644
@@ -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 [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BN6PR12MB180949222B5967C8A2DD147DF7F70-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Acked-by Alex Deucher
#4 lore raw

Patch is Tested-by: Rex Zhu [email protected]<mailto:[email protected]>

Regards
Rex

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Deucher, Alexander
Sent: Thursday, October 25, 2018 11:08 PM
To: Christian König <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: fix VM leaf walking

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Christian König <[email protected]<mailto:[email protected]>>
Sent: Thursday, October 25, 2018 10:38 AM
To: [email protected]<mailto:[email protected]>
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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
index db0cbf8d219d..352b30409060 100644
@@ -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 [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BYAPR12MB2775292DA22A6D78872926DDFBF70-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Acked-by Alex Deucher
#6 lore raw

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-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Zhu, Rex
Sent: Thursday, October 25, 2018 11:34 PM
To: Deucher, Alexander <[email protected]>; Christian König <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: fix VM leaf walking

Patch is Tested-by: Rex Zhu [email protected]<mailto:[email protected]>

Regards
Rex

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> On Behalf Of Deucher, Alexander
Sent: Thursday, October 25, 2018 11:08 PM
To: Christian König <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix VM leaf walking

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Christian König <[email protected]<mailto:[email protected]>>
Sent: Thursday, October 25, 2018 10:38 AM
To: [email protected]<mailto:[email protected]>
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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
index db0cbf8d219d..352b30409060 100644
@@ -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 [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BYAPR12MB2775D822132203F5E206128EFBF70-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#8 lore raw

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:

Quoted 61 lines

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-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> *On Behalf Of *Zhu, Rex
*Sent:* Thursday, October 25, 2018 11:34 PM
*To:* Deucher, Alexander <[email protected]>; Christian König <[email protected]>; [email protected] *Subject:* RE: [PATCH] drm/amdgpu: fix VM leaf walking

Patch is Tested-by:  Rex Zhu [email protected] <mailto:[email protected]>

Regards

Rex

*From:* amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org <mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>> *On Behalf Of *Deucher, Alexander
*Sent:* Thursday, October 25, 2018 11:08 PM
*To:* Christian König <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> *Subject:* Re: [PATCH] drm/amdgpu: fix VM leaf walking

Acked-by Alex Deucher <[email protected] <mailto:[email protected]>>

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

*From:*amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org <mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>> on behalf of Christian König <[email protected] <mailto:[email protected]>> *Sent:* Thursday, October 25, 2018 10:38 AM
*To:* [email protected] <mailto:[email protected]>
*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 <[email protected] <mailto:[email protected]>>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
index db0cbf8d219d..352b30409060 100644
@@ -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));
  }
 
Quoted 9 lines

 /**

Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): c3a525d1-2537-f561-5bd1-5b862a0d3e3c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Acked-by Alex Deucher
#10 lore raw

That sounds reasonable.

Thanks.

Best Regards

Rex

________________________________
From: Christian König <[email protected]>
Sent: Friday, October 26, 2018 3:34 PM
To: Zhu, Rex; Deucher, Alexander; [email protected]
Subject: Re: [PATCH] drm/amdgpu: fix VM leaf walking

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-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org><mailto:[email protected]> On Behalf Of Zhu, Rex
Sent: Thursday, October 25, 2018 11:34 PM
To: Deucher, Alexander <[email protected]><mailto:[email protected]>; Christian König <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amdgpu: fix VM leaf walking

Patch is Tested-by: Rex Zhu [email protected]<mailto:[email protected]>

Regards

Rex

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> On Behalf Of Deucher, Alexander
Sent: Thursday, October 25, 2018 11:08 PM
To: Christian König <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix VM leaf walking

________________________________

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Christian König <[email protected]<mailto:[email protected]>>
Sent: Thursday, October 25, 2018 10:38 AM
To: [email protected]<mailto:[email protected]>
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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
index db0cbf8d219d..352b30409060 100644
@@ -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 [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Felix Kuehling
#11 lore raw
In reply to a message not in the archive
Quoted 4 lines · Christian König

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.

Regards,
  Felix

Quoted 9 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index db0cbf8d219d..352b30409060 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static void amdgpu_vm_pt_next_leaf(struct amdgpu_device *adev, · line 549

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
@@ -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));
 }
 
 /**

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx