Skip to contentSkip to conversation

amdgpu: Fix always_valid bos multiple LRU insertions.

PATCH In review Bas Nieuwenhuizen 3 participants 5 messages Jan 31, 2018 – Feb 1, 2018 2 messages not in the archive

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

PATCH 1/1 amdgpu: Fix always_valid bos multiple LRU insertions.

If these bos are evicted and are in the validated list things blow up, so do not put them in there. Notably, that tries to add the bo to the LRU twice, which results in a BUG_ON in ttm_bo.c.

While for the bo_list an alternative would be to not allow always valid bos in there, that does not work for the user fence.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 6 ++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c      | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +4 -2
index 59089e027f4d8..95839d33af01d 100644
@@ -233,8 +233,10 @@ void amdgpu_bo_list_get_list(struct amdgpu_bo_list *list,
 	for (i = 0; i < list->num_entries; i++) {
 		unsigned priority = list->array[i].priority;
 
-		list_add_tail(&list->array[i].tv.head,
-			      &bucket[priority]);
+		if (!list->array[i].robj->parent)
+			list_add_tail(&list->array[i].tv.head,
+			              &bucket[priority]);
+
 		list->array[i].user_pages = NULL;
 	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
index f7fceb63413c9..cb3044258b352 100644
@@ -528,7 +528,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 	INIT_LIST_HEAD(&duplicates);
 	amdgpu_vm_get_pd_bo(&fpriv->vm, &p->validated, &p->vm_pd);
 
-	if (p->uf_entry.robj)
+	if (p->uf_entry.robj && !p->uf_entry.robj->parent)
 		list_add(&p->uf_entry.tv.head, &p->validated);
 
 	while (1) {
Signature · 6 lines
2.16.0.rc1.238.g530d649a79-goog

_______________________________________________
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): 20180131120710.238619-1-basni-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#2 lore raw

Am 31.01.2018 um 13:07 schrieb Bas Nieuwenhuizen:

Quoted 8 lines

If these bos are evicted and are in the validated list things blow up, so do not put them in there. Notably, that tries to add the bo to the LRU twice, which results in a BUG_ON in ttm_bo.c.

While for the bo_list an alternative would be to not allow always valid bos in there, that does not work for the user fence.

The subject line should be "drm/amdgpu: ....", but apart from that the patch is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

Quoted 29 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 6 ++++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c      | 2 +-
  2 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +4 -2
index 59089e027f4d8..95839d33af01d 100644
@@ -233,8 +233,10 @@ void amdgpu_bo_list_get_list(struct amdgpu_bo_list *list,
  	for (i = 0; i < list->num_entries; i++) {
  		unsigned priority = list->array[i].priority;
 
-		list_add_tail(&list->array[i].tv.head,
-			      &bucket[priority]);
+		if (!list->array[i].robj->parent)
+			list_add_tail(&list->array[i].tv.head,
+			              &bucket[priority]);
+
  		list->array[i].user_pages = NULL;
  	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
index f7fceb63413c9..cb3044258b352 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · line 534

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
@@ -528,7 +528,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
  	INIT_LIST_HEAD(&duplicates);
  	amdgpu_vm_get_pd_bo(&fpriv->vm, &p->validated, &p->vm_pd);
 
-	if (p->uf_entry.robj)
+	if (p->uf_entry.robj && !p->uf_entry.robj->parent)
  		list_add(&p->uf_entry.tv.head, &p->validated);
 
  	while (1) {

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

#3 lore raw

PATCH 1/1 drm/amdgpu: Fix always_valid bos multiple LRU insertions.

In reply to a message not in the archive

If these bos are evicted and are in the validated list things blow up, so do not put them in there. Notably, that tries to add the bo to the LRU twice, which results in a BUG_ON in ttm_bo.c.

While for the bo_list an alternative would be to not allow always valid bos in there, that does not work for the user fence.

---

Updated version for pushing, as I had the title prefix wrong as Christian pointed out.

 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 6 ++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c      | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +4 -2
index 59089e027f4d8..95839d33af01d 100644
@@ -233,8 +233,10 @@ void amdgpu_bo_list_get_list(struct amdgpu_bo_list *list,
 	for (i = 0; i < list->num_entries; i++) {
 		unsigned priority = list->array[i].priority;
 
-		list_add_tail(&list->array[i].tv.head,
-			      &bucket[priority]);
+		if (!list->array[i].robj->parent)
+			list_add_tail(&list->array[i].tv.head,
+			              &bucket[priority]);
+
 		list->array[i].user_pages = NULL;
 	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
index f7fceb63413c9..cb3044258b352 100644
@@ -528,7 +528,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 	INIT_LIST_HEAD(&duplicates);
 	amdgpu_vm_get_pd_bo(&fpriv->vm, &p->validated, &p->vm_pd);
 
-	if (p->uf_entry.robj)
+	if (p->uf_entry.robj && !p->uf_entry.robj->parent)
 		list_add(&p->uf_entry.tv.head, &p->validated);
 
 	while (1) {
Signature · 6 lines
2.16.0.rc1.238.g530d649a79-goog

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

PATCH 1/1 drm/amdgpu: Fix always_valid bos multiple LRU insertions.

In reply to a message not in the archive

If these bos are evicted and are in the validated list things blow up, so do not put them in there. Notably, that tries to add the bo to the LRU twice, which results in a BUG_ON in ttm_bo.c.

While for the bo_list an alternative would be to not allow always valid bos in there, that does not work for the user fence.

v2: Fixed whitespace issue pointed out by checkpatch.pl

---

Minor whitespace fix, sorry for the noise ...

 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 6 ++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c      | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +4 -2
index 59089e027f4d8..95839d33af01d 100644
@@ -233,8 +233,10 @@ void amdgpu_bo_list_get_list(struct amdgpu_bo_list *list,
 	for (i = 0; i < list->num_entries; i++) {
 		unsigned priority = list->array[i].priority;
 
-		list_add_tail(&list->array[i].tv.head,
-			      &bucket[priority]);
+		if (!list->array[i].robj->parent)
+			list_add_tail(&list->array[i].tv.head,
+				      &bucket[priority]);
+
 		list->array[i].user_pages = NULL;
 	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
index f7fceb63413c9..cb3044258b352 100644
@@ -528,7 +528,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 	INIT_LIST_HEAD(&duplicates);
 	amdgpu_vm_get_pd_bo(&fpriv->vm, &p->validated, &p->vm_pd);
 
-	if (p->uf_entry.robj)
+	if (p->uf_entry.robj && !p->uf_entry.robj->parent)
 		list_add(&p->uf_entry.tv.head, &p->validated);
 
 	while (1) {
Signature · 6 lines
2.16.0.rc1.238.g530d649a79-goog

_______________________________________________
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): 20180131125855.244898-1-basni-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

Applied
#6 lore raw

Re: [PATCH] drm/amdgpu: Fix always_valid bos multiple LRU insertions.

Quoted 5 lines · Bas Nieuwenhuizen

If these bos are evicted and are in the validated list things blow up, so do not put them in there. Notably, that tries to add the bo to the LRU twice, which results in a BUG_ON in ttm_bo.c.

Quoted 8 lines

While for the bo_list an alternative would be to not allow always valid bos in there, that does not work for the user fence.

v2: Fixed whitespace issue pointed out by checkpatch.pl

Applied. thanks!

Alex

Quoted 40 lines

---

Minor whitespace fix, sorry for the noise ...

 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 6 ++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c      | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +4 -2
index 59089e027f4d8..95839d33af01d 100644
@@ -233,8 +233,10 @@ void amdgpu_bo_list_get_list(struct amdgpu_bo_list *list,
        for (i = 0; i < list->num_entries; i++) {
                unsigned priority = list->array[i].priority;
 
-               list_add_tail(&list->array[i].tv.head,
-                             &bucket[priority]);
+               if (!list->array[i].robj->parent)
+                       list_add_tail(&list->array[i].tv.head,
+                                     &bucket[priority]);
+
                list->array[i].user_pages = NULL;
        }
 
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -2
index f7fceb63413c9..cb3044258b352 100644
@@ -528,7 +528,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
        INIT_LIST_HEAD(&duplicates);
        amdgpu_vm_get_pd_bo(&fpriv->vm, &p->validated, &p->vm_pd);
 
-       if (p->uf_entry.robj)
+       if (p->uf_entry.robj && !p->uf_entry.robj->parent)
                list_add(&p->uf_entry.tv.head, &p->validated);
 
        while (1) {
--

2.16.0.rc1.238.g530d649a79-goog

Quoted 4 lines

_______________________________________________
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