Skip to content

Commit 624ddd1

Browse files
ihadzicgregkh
authored andcommitted
drm/radeon: fix the crash in benchmark functions
commit 3f5e1b4 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>
1 parent 7530584 commit 624ddd1

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎drivers/gpu/drm/radeon/radeon_benchmark.c‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434

3535
static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size,
3636
uint64_t saddr, uint64_t daddr,
37-
int flag, int n)
37+
int flag, int n,
38+
struct reservation_object *resv)
3839
{
3940
unsigned long start_jiffies;
4041
unsigned long end_jiffies;
@@ -47,12 +48,12 @@ static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size,
4748
case RADEON_BENCHMARK_COPY_DMA:
4849
fence = radeon_copy_dma(rdev, saddr, daddr,
4950
size / RADEON_GPU_PAGE_SIZE,
50-
NULL);
51+
resv);
5152
break;
5253
case RADEON_BENCHMARK_COPY_BLIT:
5354
fence = radeon_copy_blit(rdev, saddr, daddr,
5455
size / RADEON_GPU_PAGE_SIZE,
55-
NULL);
56+
resv);
5657
break;
5758
default:
5859
DRM_ERROR("Unknown copy method\n");
@@ -120,7 +121,8 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
120121

121122
if (rdev->asic->copy.dma) {
122123
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);
124126
if (time < 0)
125127
goto out_cleanup;
126128
if (time > 0)
@@ -130,7 +132,8 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
130132

131133
if (rdev->asic->copy.blit) {
132134
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);
134137
if (time < 0)
135138
goto out_cleanup;
136139
if (time > 0)

0 commit comments

Comments
 (0)