Properly suspend/resume sub-allocator
Subsystems (2)
cover Properly suspend/resume sub-allocator
From: Alex Deucher <[email protected]>
This patch set is a bit of a heavy hammer, but I'm
not sure it's worth the effort to create separate suspend functions for all sub-allocator
users that basically just calls radeon_sa_bo_manager_suspend() and fix up all the sub allocator init functions to call radeon_sa_bo_manager_start() since all we are really avoiding is the allocation of sub-allocator bo. Additionally in the VM case, we have to tear down all the VMs on suspend since the physical addresses of various buffers may have changed on resume.
The first patch fixes suspend and resume on cards with VM in use.
The second patches doesn't fix any bugs that I know of, but the current code seems wrong to me unless I'm missing something.
Alex Deucher (2):
drm/radeon: fix S/R on VM systems (cayman/TN/SI) drm/radeon: tear down the IB pool on suspend
drivers/gpu/drm/radeon/evergreen.c | 1 + drivers/gpu/drm/radeon/ni.c | 2 ++ drivers/gpu/drm/radeon/r100.c | 1 + drivers/gpu/drm/radeon/r300.c | 1 + drivers/gpu/drm/radeon/r420.c | 1 + drivers/gpu/drm/radeon/r600.c | 1 + drivers/gpu/drm/radeon/rs400.c | 1 + drivers/gpu/drm/radeon/rs600.c | 1 + drivers/gpu/drm/radeon/rs690.c | 1 + drivers/gpu/drm/radeon/rv515.c | 1 + drivers/gpu/drm/radeon/rv770.c | 1 + drivers/gpu/drm/radeon/si.c | 2 ++ 12 files changed, 14 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.7.5
PATCH 1/2 drm/radeon: fix S/R on VM systems (cayman/TN/SI)
From: Alex Deucher <[email protected]>
We weren't properly tearing down the VM sub-alloctor on suspend leading to bogus VM PTs on resume.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=60439
--- drivers/gpu/drm/radeon/ni.c | 1 + drivers/gpu/drm/radeon/si.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/ni.c +1 -0
@@ -1780,6 +1780,7 @@ int cayman_resume(struct radeon_device *rdev)int cayman_suspend (struct radeon_device *rdev) {r600_audio_fini (rdev); +radeon_vm_manager_fini (rdev);cayman_cp_enable (rdev, false);cayman_dma_stop (rdev);evergreen_irq_suspend (rdev);
drivers/gpu/drm/radeon/si.c +1 -0
@@ -4469,6 +4469,7 @@ int si_resume(struct radeon_device *rdev)int si_suspend (struct radeon_device *rdev) { +radeon_vm_manager_fini (rdev);si_cp_enable (rdev, false);cayman_dma_stop (rdev);si_irq_suspend (rdev);
Signature · 1 line
1.7.7.5
Re: [PATCH 1/2] drm/radeon: fix S/R on VM systems (cayman/TN/SI)
Am 11.03.2013 22:06, schrieb [email protected]:
Quoted 11 lines
From: Alex Deucher <[email protected]>
We weren't properly tearing down the VM sub-alloctor on suspend leading to bogus VM PTs on resume.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=60439Tested-by Dmitry Cherkasov <[email protected]>Signed-off-by Alex Deucher <[email protected]>
I'm still wondering how I missed that. Anyway, I have a NAK on the other patch, but this one is:
Christian.
Quoted 29 lines
--- drivers/gpu/drm/radeon/ni.c | 1 + drivers/gpu/drm/radeon/si.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)drivers/gpu/drm/radeon/ni.c +1
-0@@ -1780,6 +1780,7 @@ int cayman_resume(struct radeon_device *rdev)int cayman_suspend (struct radeon_device *rdev) {r600_audio_fini (rdev); +radeon_vm_manager_fini (rdev);cayman_cp_enable (rdev, false);cayman_dma_stop (rdev);evergreen_irq_suspend (rdev);drivers/gpu/drm/radeon/si.c +1
-0@@ -4469,6 +4469,7 @@ int si_resume(struct radeon_device *rdev)int si_suspend (struct radeon_device *rdev) { +radeon_vm_manager_fini (rdev);si_cp_enable (rdev, false);cayman_dma_stop (rdev);si_irq_suspend (rdev);
PATCH 2/2 drm/radeon: tear down the IB pool on suspend
In reply to [email protected]From: Alex Deucher <[email protected]>
Otherwise we may end up with stale MC addresses
after resume.
--- drivers/gpu/drm/radeon/evergreen.c | 1 + drivers/gpu/drm/radeon/ni.c | 1 + drivers/gpu/drm/radeon/r100.c | 1 + drivers/gpu/drm/radeon/r300.c | 1 + drivers/gpu/drm/radeon/r420.c | 1 + drivers/gpu/drm/radeon/r600.c | 1 + drivers/gpu/drm/radeon/rs400.c | 1 + drivers/gpu/drm/radeon/rs600.c | 1 + drivers/gpu/drm/radeon/rs690.c | 1 + drivers/gpu/drm/radeon/rv515.c | 1 + drivers/gpu/drm/radeon/rv770.c | 1 + drivers/gpu/drm/radeon/si.c | 1 + 12 files changed, 12 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/evergreen.c +1 -0
@@ -3720,6 +3720,7 @@ int evergreen_suspend(struct radeon_device *rdev)r600_dma_stop (rdev);evergreen_irq_suspend (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);evergreen_pcie_gart_disable (rdev);return 0 ;
drivers/gpu/drm/radeon/ni.c +1 -0
@@ -1785,6 +1785,7 @@ int cayman_suspend(struct radeon_device *rdev)cayman_dma_stop (rdev);evergreen_irq_suspend (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);cayman_pcie_gart_disable (rdev);return 0 ; }
drivers/gpu/drm/radeon/r100.c +1 -0
@@ -3892,6 +3892,7 @@ int r100_suspend(struct radeon_device *rdev) {r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);r100_irq_disable (rdev);if (rdev->flags &RADEON_IS_PCI )r100_pci_gart_disable (rdev);
drivers/gpu/drm/radeon/r300.c +1 -0
@@ -1436,6 +1436,7 @@ int r300_suspend(struct radeon_device *rdev) {r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);r100_irq_disable (rdev);if (rdev->flags &RADEON_IS_PCIE )rv370_pcie_gart_disable (rdev);
drivers/gpu/drm/radeon/r420.c +1 -0
@@ -325,6 +325,7 @@ int r420_suspend(struct radeon_device *rdev)r420_cp_errata_fini (rdev);r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);r100_irq_disable (rdev);if (rdev->flags &RADEON_IS_PCIE )rv370_pcie_gart_disable (rdev);
drivers/gpu/drm/radeon/r600.c +1 -0
@@ -3031,6 +3031,7 @@ int r600_suspend(struct radeon_device *rdev)r600_dma_stop (rdev);r600_irq_suspend (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);r600_pcie_gart_disable (rdev);return 0 ;
drivers/gpu/drm/radeon/rs400.c +1 -0
@@ -470,6 +470,7 @@ int rs400_suspend(struct radeon_device *rdev) {r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);r100_irq_disable (rdev);rs400_gart_disable (rdev);return 0 ;
drivers/gpu/drm/radeon/rs600.c +1 -0
@@ -945,6 +945,7 @@ int rs600_suspend(struct radeon_device *rdev)r600_audio_fini (rdev);r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);rs600_irq_disable (rdev);rs600_gart_disable (rdev);return 0 ;
drivers/gpu/drm/radeon/rs690.c +1 -0
@@ -686,6 +686,7 @@ int rs690_suspend(struct radeon_device *rdev)r600_audio_fini (rdev);r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);rs600_irq_disable (rdev);rs400_gart_disable (rdev);return 0 ;
drivers/gpu/drm/radeon/rv515.c +1 -0
@@ -530,6 +530,7 @@ int rv515_suspend(struct radeon_device *rdev) {r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);rs600_irq_disable (rdev);if (rdev->flags &RADEON_IS_PCIE )rv370_pcie_gart_disable (rdev);
drivers/gpu/drm/radeon/rv770.c +1 -0
@@ -1119,6 +1119,7 @@ int rv770_suspend(struct radeon_device *rdev)r600_dma_stop (rdev);r600_irq_suspend (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);rv770_pcie_gart_disable (rdev);return 0 ;
drivers/gpu/drm/radeon/si.c +1 -0
@@ -4474,6 +4474,7 @@ int si_suspend(struct radeon_device *rdev)cayman_dma_stop (rdev);si_irq_suspend (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);si_pcie_gart_disable (rdev);return 0 ; }
Signature · 1 line
1.7.7.5
Re: [PATCH 2/2] drm/radeon: tear down the IB pool on suspend
NAK! I removed this on purpose some time ago, the IB pool is in GART memory, which essential is system memory.
So we don't need to unlock/unpin the IB pool on suspend.
Ontop of this it is quite dangerous to do so in a case of a GPU reset, cause then there still might be IBs in the fly and if you call radeon_ib_fini all of the addresses stitched together so far become invalid because of the unlock/unpin/free of the sa bo.
Christian.
Am 11.03.2013 22:06, schrieb [email protected]:
Quoted 166 lines
From: Alex Deucher <[email protected]>
Otherwise we may end up with stale MC addresses
after resume.Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/radeon/evergreen.c | 1 + drivers/gpu/drm/radeon/ni.c | 1 + drivers/gpu/drm/radeon/r100.c | 1 + drivers/gpu/drm/radeon/r300.c | 1 + drivers/gpu/drm/radeon/r420.c | 1 + drivers/gpu/drm/radeon/r600.c | 1 + drivers/gpu/drm/radeon/rs400.c | 1 + drivers/gpu/drm/radeon/rs600.c | 1 + drivers/gpu/drm/radeon/rs690.c | 1 + drivers/gpu/drm/radeon/rv515.c | 1 + drivers/gpu/drm/radeon/rv770.c | 1 + drivers/gpu/drm/radeon/si.c | 1 + 12 files changed, 12 insertions(+), 0 deletions(-)drivers/gpu/drm/radeon/evergreen.c +1
-0@@ -3720,6 +3720,7 @@ int evergreen_suspend(struct radeon_device *rdev)r600_dma_stop (rdev);evergreen_irq_suspend (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);evergreen_pcie_gart_disable (rdev);return 0 ;drivers/gpu/drm/radeon/ni.c +1
-0@@ -1785,6 +1785,7 @@ int cayman_suspend(struct radeon_device *rdev)cayman_dma_stop (rdev);evergreen_irq_suspend (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);cayman_pcie_gart_disable (rdev);return 0 ; }drivers/gpu/drm/radeon/r100.c +1
-0@@ -3892,6 +3892,7 @@ int r100_suspend(struct radeon_device *rdev) {r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);r100_irq_disable (rdev);if (rdev->flags &RADEON_IS_PCI )r100_pci_gart_disable (rdev);drivers/gpu/drm/radeon/r300.c +1
-0@@ -1436,6 +1436,7 @@ int r300_suspend(struct radeon_device *rdev) {r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);r100_irq_disable (rdev);if (rdev->flags &RADEON_IS_PCIE )rv370_pcie_gart_disable (rdev);drivers/gpu/drm/radeon/r420.c +1
-0@@ -325,6 +325,7 @@ int r420_suspend(struct radeon_device *rdev)r420_cp_errata_fini (rdev);r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);r100_irq_disable (rdev);if (rdev->flags &RADEON_IS_PCIE )rv370_pcie_gart_disable (rdev);drivers/gpu/drm/radeon/r600.c +1
-0@@ -3031,6 +3031,7 @@ int r600_suspend(struct radeon_device *rdev)r600_dma_stop (rdev);r600_irq_suspend (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);r600_pcie_gart_disable (rdev);return 0 ;drivers/gpu/drm/radeon/rs400.c +1
-0@@ -470,6 +470,7 @@ int rs400_suspend(struct radeon_device *rdev) {r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);r100_irq_disable (rdev);rs400_gart_disable (rdev);return 0 ;drivers/gpu/drm/radeon/rs600.c +1
-0@@ -945,6 +945,7 @@ int rs600_suspend(struct radeon_device *rdev)r600_audio_fini (rdev);r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);rs600_irq_disable (rdev);rs600_gart_disable (rdev);return 0 ;drivers/gpu/drm/radeon/rs690.c +1
-0@@ -686,6 +686,7 @@ int rs690_suspend(struct radeon_device *rdev)r600_audio_fini (rdev);r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);rs600_irq_disable (rdev);rs400_gart_disable (rdev);return 0 ;drivers/gpu/drm/radeon/rv515.c +1
-0@@ -530,6 +530,7 @@ int rv515_suspend(struct radeon_device *rdev) {r100_cp_disable (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);rs600_irq_disable (rdev);if (rdev->flags &RADEON_IS_PCIE )rv370_pcie_gart_disable (rdev);drivers/gpu/drm/radeon/rv770.c +1
-0@@ -1119,6 +1119,7 @@ int rv770_suspend(struct radeon_device *rdev)r600_dma_stop (rdev);r600_irq_suspend (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);rv770_pcie_gart_disable (rdev);return 0 ;drivers/gpu/drm/radeon/si.c +1
-0@@ -4474,6 +4474,7 @@ int si_suspend(struct radeon_device *rdev)cayman_dma_stop (rdev);si_irq_suspend (rdev);radeon_wb_disable (rdev); +radeon_ib_pool_fini (rdev);si_pcie_gart_disable (rdev);return 0 ; }