Commit 624ddd1be9fcd6fd30ce5563e87dfd27ab920a68

Authored by Ilija Hadzic
Committed by Greg Kroah-Hartman
1 parent 7530584f8c

drm/radeon: fix the crash in benchmark functions

commit 3f5e1b4f58b7b6480cccff4bf965436102db4346 upstream.

radeon_copy_dma and radeon_copy_blit must be called with
a valid reservation object. Otherwise a crash will be provoked.
We borrow the object from destination BO.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=88464

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 8 additions and 5 deletions Side-by-side Diff

drivers/gpu/drm/radeon/radeon_benchmark.c
... ... @@ -34,7 +34,8 @@
34 34  
35 35 static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size,
36 36 uint64_t saddr, uint64_t daddr,
37   - int flag, int n)
  37 + int flag, int n,
  38 + struct reservation_object *resv)
38 39 {
39 40 unsigned long start_jiffies;
40 41 unsigned long end_jiffies;
41 42  
... ... @@ -47,12 +48,12 @@
47 48 case RADEON_BENCHMARK_COPY_DMA:
48 49 fence = radeon_copy_dma(rdev, saddr, daddr,
49 50 size / RADEON_GPU_PAGE_SIZE,
50   - NULL);
  51 + resv);
51 52 break;
52 53 case RADEON_BENCHMARK_COPY_BLIT:
53 54 fence = radeon_copy_blit(rdev, saddr, daddr,
54 55 size / RADEON_GPU_PAGE_SIZE,
55   - NULL);
  56 + resv);
56 57 break;
57 58 default:
58 59 DRM_ERROR("Unknown copy method\n");
... ... @@ -120,7 +121,8 @@
120 121  
121 122 if (rdev->asic->copy.dma) {
122 123 time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
123   - RADEON_BENCHMARK_COPY_DMA, n);
  124 + RADEON_BENCHMARK_COPY_DMA, n,
  125 + dobj->tbo.resv);
124 126 if (time < 0)
125 127 goto out_cleanup;
126 128 if (time > 0)
... ... @@ -130,7 +132,8 @@
130 132  
131 133 if (rdev->asic->copy.blit) {
132 134 time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
133   - RADEON_BENCHMARK_COPY_BLIT, n);
  135 + RADEON_BENCHMARK_COPY_BLIT, n,
  136 + dobj->tbo.resv);
134 137 if (time < 0)
135 138 goto out_cleanup;
136 139 if (time > 0)