Skip to contentSkip to conversation

drm/nouveau: fix dma syncing for loops

PATCH In review Dave Airlie 2 participants 2 messages Mar 8, 2021 – Mar 9, 2021

Subsystems (3)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 drm/nouveau: fix dma syncing for loops

From: Dave Airlie <[email protected]>

The index variable should only be increased in one place.

Noticed this while trying to track down another oops.

Fixes f295c8cfec83 ("drm/nouveau: fix dma syncing warning with debugging on.")
---
 drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +2 -2
index 2375711877cf..4f693843def5 100644
@@ -556,7 +556,7 @@ nouveau_bo_sync_for_device(struct nouveau_bo *nvbo)
 	if (nvbo->force_coherent)
 		return;
 
-	for (i = 0; i < ttm_dma->num_pages; ++i) {
+	for (i = 0; i < ttm_dma->num_pages;) {
 		struct page *p = ttm_dma->pages[i];
 		size_t num_pages = 1;
 
@@ -587,7 +587,7 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo *nvbo)
 	if (nvbo->force_coherent)
 		return;
 
-	for (i = 0; i < ttm_dma->num_pages; ++i) {
+	for (i = 0; i < ttm_dma->num_pages;) {
 		struct page *p = ttm_dma->pages[i];
 		size_t num_pages = 1;
 
Signature · 6 lines
2.27.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Dave Airlie
Sent: Sunday, March 7, 2021 8:49 PM
To: [email protected]
Cc: [email protected]
Subject: [PATCH] drm/nouveau: fix dma syncing for loops

From: Dave Airlie <[email protected]>

The index variable should only be increased in one place.

Noticed this while trying to track down another oops.

Fixes f295c8cfec83 ("drm/nouveau: fix dma syncing warning with debugging

on.")

---
drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +0 -0
index 2375711877cf..4f693843def5 100644

drivers/gpu/drm/nouveau/nouveau_bo.c nouveau_bo_sync_for_device(struct nouveau_bo · line 560

Quoted 6 lines
drivers/gpu/drm/nouveau/nouveau_bo.c +1 -1
@@ -556,7 +556,7 @@ nouveau_bo_sync_for_device(struct nouveau_bo
 *nvbo)
 	if (nvbo->force_coherent)
 		return;
 
-	for (i = 0; i < ttm_dma->num_pages; ++i) {
+	for (i = 0; i < ttm_dma->num_pages;) {

This took a bit to see how the increment worked.

Would calling it out with a comment be out of line?

With or without the comment:

M

Quoted 16 lines
drivers/gpu/drm/nouveau/nouveau_bo.c +1 -2
 		struct page *p = ttm_dma->pages[i];
 		size_t num_pages = 1;
@@ -587,7 +587,7 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo
 *nvbo)
 	if (nvbo->force_coherent)
 		return;
 
-	for (i = 0; i < ttm_dma->num_pages; ++i) {
+	for (i = 0; i < ttm_dma->num_pages;) {
 		struct page *p = ttm_dma->pages[i];
 		size_t num_pages = 1;
 
--

2.27.0

Quoted 4 lines

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

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