Skip to contentSkip to conversation

drm/amdgpu: fix byte/dword unit mismatch in coredump IB dump

PATCH In review Sunil Khatri 3 participants 4 messages Aug 27 – Aug 31

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

PATCH 1/1 drm/amdgpu: fix byte/dword unit mismatch in coredump IB dump

In amdgpu_devcoredump_print_ibs(), the NO_CPU_ACCESS VRAM path passed cursor.start/4 and cursor.size/4 to amdgpu_device_mm_access(), but that function's pos/size parameters are byte offsets/lengths (confirmed by amdgpu_ttm_vram_mm_access() and leading to wrong size calculation.

Similarly with that change the off index needs to be calculated based on dword since that is a u32 type.

Fixes 7b15fc2d1f1a ("drm/amdgpu: dump job ibs in the devcoredump")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +3 -3
index 76771ad30c41..2d3fb87af00a 100644
@@ -297,10 +297,10 @@ amdgpu_devcoredump_print_ibs(struct drm_printer *p,
 			amdgpu_res_first(abo->tbo.resource, offset,
 					 coredump->ibs[i].ib_size_dw * 4, &cursor);
 			while (cursor.remaining) {
-				amdgpu_device_mm_access(adev, cursor.start / 4,
-							&ib_content[off], cursor.size / 4,
+				amdgpu_device_mm_access(adev, cursor.start,
+							&ib_content[off], cursor.size,
 							false);
-				off += cursor.size;
+				off += cursor.size / 4;
 				amdgpu_res_next(&cursor, cursor.size);
 			}
 			emit_content = true;
Signature · 1 line
2.34.1
#1 lore raw

+ pierre-eric

Quoted 32 lines · Sunil Khatri

In amdgpu_devcoredump_print_ibs(), the NO_CPU_ACCESS VRAM path passed cursor.start/4 and cursor.size/4 to amdgpu_device_mm_access(), but that function's pos/size parameters are byte offsets/lengths (confirmed by amdgpu_ttm_vram_mm_access() and leading to wrong size calculation.

Similarly with that change the off index needs to be calculated based on dword since that is a u32 type.

Fixes 7b15fc2d1f1a ("drm/amdgpu: dump job ibs in the devcoredump")
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +3 -3
index 76771ad30c41..2d3fb87af00a 100644
@@ -297,10 +297,10 @@ amdgpu_devcoredump_print_ibs(struct drm_printer *p,
  			amdgpu_res_first(abo->tbo.resource, offset,
  					 coredump->ibs[i].ib_size_dw * 4, &cursor);
  			while (cursor.remaining) {
-				amdgpu_device_mm_access(adev, cursor.start / 4,
-							&ib_content[off], cursor.size / 4,
+				amdgpu_device_mm_access(adev, cursor.start,
+							&ib_content[off], cursor.size,
  							false);
-				off += cursor.size;
+				off += cursor.size / 4;
  				amdgpu_res_next(&cursor, cursor.size);
  			}
  			emit_content = true;
#2 lore raw

Ping for review please.

Quoted 36 lines · Sunil

+ pierre-eric

Quoted 33 lines · Sunil Khatri

In amdgpu_devcoredump_print_ibs(), the NO_CPU_ACCESS VRAM path passed cursor.start/4 and cursor.size/4 to amdgpu_device_mm_access(), but that function's pos/size parameters are byte offsets/lengths (confirmed by amdgpu_ttm_vram_mm_access() and leading to wrong size calculation.

Similarly with that change the off index needs to be calculated based on dword since that is a u32 type.

Fixes 7b15fc2d1f1a ("drm/amdgpu: dump job ibs in the devcoredump")

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 6 +++---

  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +3 -3
index 76771ad30c41..2d3fb87af00a 100644
@@ -297,10 +297,10 @@ amdgpu_devcoredump_print_ibs(struct drm_printer 
 *p,
               amdgpu_res_first(abo->tbo.resource, offset,
                        coredump->ibs[i].ib_size_dw * 4, &cursor);
               while (cursor.remaining) {
-                amdgpu_device_mm_access(adev, cursor.start / 4,
-                            &ib_content[off], cursor.size / 4,
+                amdgpu_device_mm_access(adev, cursor.start,
+                            &ib_content[off], cursor.size,
                               false);
-                off += cursor.size;
+                off += cursor.size / 4;
                   amdgpu_res_next(&cursor, cursor.size);
               }

              emit_content = true;

#3 lore raw

LGTM, Reviewed-by  Vitaly Prosyak <[email protected]>

Quoted 40 lines · Sunil

Ping for review please.

Quoted 37 lines · Sunil

+ pierre-eric

Quoted 34 lines · Sunil Khatri

In amdgpu_devcoredump_print_ibs(), the NO_CPU_ACCESS VRAM path passed cursor.start/4 and cursor.size/4 to amdgpu_device_mm_access(), but that function's pos/size parameters are byte offsets/lengths (confirmed by amdgpu_ttm_vram_mm_access() and leading to wrong size calculation.

Similarly with that change the off index needs to be calculated based on dword since that is a u32 type.

Fixes 7b15fc2d1f1a ("drm/amdgpu: dump job ibs in the devcoredump")

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 6 +++---

  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +3 -3
index 76771ad30c41..2d3fb87af00a 100644
@@ -297,10 +297,10 @@ amdgpu_devcoredump_print_ibs(struct drm_printer 
 *p,
               amdgpu_res_first(abo->tbo.resource, offset,
                        coredump->ibs[i].ib_size_dw * 4, &cursor);
               while (cursor.remaining) {
-                amdgpu_device_mm_access(adev, cursor.start / 4,
-                            &ib_content[off], cursor.size / 4,
+                amdgpu_device_mm_access(adev, cursor.start,
+                            &ib_content[off], cursor.size,
                               false);
-                off += cursor.size;
+                off += cursor.size / 4;
                   amdgpu_res_next(&cursor, cursor.size);
               }

              emit_content = true;