drm/radeon: prevent crash in the ring space allocation
Subsystems (2)
PATCH 1/2 drm/radeon: prevent crash in the ring space allocation
From: Alex Deucher <[email protected]>
If the requested number of DWs on the ring is larger than the size of the ring itself, return an error.
In testing with large VM updates, we've seen crashes when we try and allocate more space on the ring than the total size of the ring without checking.
This prevents the crash but for large VM updates or bo moves of very large buffers, we will need to break the transaction down into multiple batches. I have patches to use IBs for the next kernel.
--- drivers/gpu/drm/radeon/radeon_ring.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_ring.c +3 -0
@@ -377,6 +377,9 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsi {int r; +/* make sure we aren't trying to allocate more space than there is on the ring */ +if (ndw > (ring->ring_size /4 )) +return -ENOMEM ;/* Align requested size with padding so unlock_commit can * pad safely */ ndw = (ndw + ring->align_mask) & ~ring->align_mask;
Signature · 1 line
1.7.7.5
PATCH 2/2 drm/radeon: switch back to the CP ring for VM PT updates
From: Alex Deucher <[email protected]>
For large VM page table updates, we can sometimes generate more packets than there is space on the ring. This happens more readily with the DMA ring since it is 64K (vs 1M for the CP). For now, switch back to the CP. For the next kernel, I have a patch to utilize IBs for VM PT updates which alleviates this problem.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=58354
--- drivers/gpu/drm/radeon/radeon_asic.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_asic.c +3 -3
@@ -1445,7 +1445,7 @@ static struct radeon_asic cayman_asic = { .vm = { .init = &cayman_vm_init, .fini = &cayman_vm_fini, - .pt_ring_index = R600_RING_TYPE_DMA_INDEX, + .pt_ring_index = RADEON_RING_TYPE_GFX_INDEX, .set_page = &cayman_vm_set_page, }, .ring = {
@@ -1572,7 +1572,7 @@ static struct radeon_asic trinity_asic = { .vm = { .init = &cayman_vm_init, .fini = &cayman_vm_fini, - .pt_ring_index = R600_RING_TYPE_DMA_INDEX, + .pt_ring_index = RADEON_RING_TYPE_GFX_INDEX, .set_page = &cayman_vm_set_page, }, .ring = {
@@ -1699,7 +1699,7 @@ static struct radeon_asic si_asic = { .vm = { .init = &si_vm_init, .fini = &si_vm_fini, - .pt_ring_index = R600_RING_TYPE_DMA_INDEX, + .pt_ring_index = RADEON_RING_TYPE_GFX_INDEX, .set_page = &si_vm_set_page, }, .ring = {
Signature · 1 line
1.7.7.5