Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/radeon: fix the crash in benchmark functions

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

Cc: stable@vger.kernel.org
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>

authored by

Ilija Hadzic and committed by
Alex Deucher
3f5e1b4f a124d068

+8 -5
+8 -5
drivers/gpu/drm/radeon/radeon_benchmark.c
··· 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; ··· 48 47 case RADEON_BENCHMARK_COPY_DMA: 49 48 fence = radeon_copy_dma(rdev, saddr, daddr, 50 49 size / RADEON_GPU_PAGE_SIZE, 51 - NULL); 50 + resv); 52 51 break; 53 52 case RADEON_BENCHMARK_COPY_BLIT: 54 53 fence = radeon_copy_blit(rdev, saddr, daddr, 55 54 size / RADEON_GPU_PAGE_SIZE, 56 - NULL); 55 + resv); 57 56 break; 58 57 default: 59 58 DRM_ERROR("Unknown copy method\n"); ··· 121 120 122 121 if (rdev->asic->copy.dma) { 123 122 time = radeon_benchmark_do_move(rdev, size, saddr, daddr, 124 - RADEON_BENCHMARK_COPY_DMA, n); 123 + RADEON_BENCHMARK_COPY_DMA, n, 124 + dobj->tbo.resv); 125 125 if (time < 0) 126 126 goto out_cleanup; 127 127 if (time > 0) ··· 132 130 133 131 if (rdev->asic->copy.blit) { 134 132 time = radeon_benchmark_do_move(rdev, size, saddr, daddr, 135 - RADEON_BENCHMARK_COPY_BLIT, n); 133 + RADEON_BENCHMARK_COPY_BLIT, n, 134 + dobj->tbo.resv); 136 135 if (time < 0) 137 136 goto out_cleanup; 138 137 if (time > 0)