drm/radeon: disable any GPU activity after unrecovered lockup
Subsystems (4)
PATCH 1/1 drm/radeon: disable any GPU activity after unrecovered lockup
From: Jerome Glisse <[email protected]>
After unrecovered GPU lockup avoid any GPU activities to avoid things like kernel segfault and alike to happen in any of the path that assume hw is working.
--- drivers/gpu/drm/radeon/radeon_device.c | 9 ++++--- drivers/gpu/drm/radeon/radeon_object.c | 7 ++++++ drivers/gpu/drm/radeon/radeon_ttm.c | 41 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/ttm/ttm_tt.c | 1 + 4 files changed, 55 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_device.c +6 -3
@@ -993,16 +993,19 @@ int radeon_gpu_reset(struct radeon_device *rdev)/* block TTM */ resched =ttm_bo_lock_delayed_workqueue (&rdev->mman.bdev);radeon_suspend (rdev); + rdev->accel_working = false; r =radeon_asic_reset (rdev);if (!r) {dev_info (rdev->dev,"GPU reset succeed\n" );radeon_resume (rdev); -radeon_restore_bios_scratch_regs (rdev); -drm_helper_resume_force_mode (rdev->ddev); -ttm_bo_unlock_delayed_workqueue (&rdev->mman.bdev, resched); } +/* no matter what restore video mode */ +radeon_restore_bios_scratch_regs (rdev); +drm_helper_resume_force_mode (rdev->ddev); +ttm_bo_unlock_delayed_workqueue (&rdev->mman.bdev, resched); +if (r) {/* bad news, how to tell it to userspace ? */ dev_info (rdev->dev,"GPU reset failed\n" );
drivers/gpu/drm/radeon/radeon_object.c +7 -0
@@ -89,6 +89,13 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) rbo->placement.lpfn =0 ; rbo->placement.placement = rbo->placements; rbo->placement.busy_placement = rbo->placements; +if (!rbo->rdev->accel_working) { +/* for new bo to system ram when GPU is not working */ + rbo->placements[c++] =TTM_PL_MASK_CACHING |TTM_PL_FLAG_SYSTEM ; + rbo->placement.num_placement = c; + rbo->placement.num_busy_placement = c; +return ; + }if (domain &RADEON_GEM_DOMAIN_VRAM ) rbo->placements[c++] =TTM_PL_FLAG_WC |TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_VRAM ;
drivers/gpu/drm/radeon/radeon_ttm.c +41 -0
65 lines not on this page · raw message
drivers/gpu/drm/ttm/ttm_tt.c +1 -0
@@ -181,6 +181,7 @@ void ttm_tt_destroy(struct ttm_tt *ttm) ttm->swap_storage =NULL ; ttm->func->destroy (ttm); } +EXPORT_SYMBOL (ttm_tt_destroy); int ttm_tt_init(struct ttm_tt *ttm, struct ttm_bo_device *bdev, unsigned long size, uint32_t page_flags,
Signature · 1 line
1.7.10.2
Quoted 5 lines · On Die, 2012-06-26 at 17:04 -0400, [email protected] wrote:
From: Jerome Glisse <[email protected]>
After unrecovered GPU lockup avoid any GPU activities to avoid things like kernel segfault and alike to happen in any of the path that assume hw is working.
Has the patch been tested and confirmed to actually fix such a problem?
drivers/gpu/drm/radeon/radeon_device.c int radeon_gpu_reset(struct radeon_device *rdev) · line 1007
Quoted 13 lines
drivers/gpu/drm/radeon/radeon_device.c +4
-3r =radeon_asic_reset (rdev);if (!r) {dev_info (rdev->dev,"GPU reset succeed\n" );radeon_resume (rdev); -radeon_restore_bios_scratch_regs (rdev); -drm_helper_resume_force_mode (rdev->ddev); -ttm_bo_unlock_delayed_workqueue (&rdev->mman.bdev, resched); } +/* no matter what restore video mode */ +radeon_restore_bios_scratch_regs (rdev); +drm_helper_resume_force_mode (rdev->ddev); +ttm_bo_unlock_delayed_workqueue (&rdev->mman.bdev, resched);
Maybe this should be in a separate patch.
drivers/gpu/drm/radeon/radeon_ttm.c static int radeon_bo_move(struct ttm_buffer_object *bo, · line 424
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_ttm.c +4
-0@@ -399,6 +418,14 @@ static int radeon_bo_move(struct ttm_buffer_object *bo,radeon_move_null (bo, new_mem);return 0 ; } +if (!rdev->accel_working) { +/* when accel is not working GPU is in broken state just +* do nothing for any ttm operation to avoid making the +* situation worst than it's
'worse than it is', same in the following two hunks.
Signature · 2 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer
Quoted 8 lines · Michel Dänzer
Quoted 5 lines · On Die, 2012-06-26 at 17:04 -0400, [email protected] wrote:
From: Jerome Glisse <[email protected]>
After unrecovered GPU lockup avoid any GPU activities to avoid things like kernel segfault and alike to happen in any of the path that assume hw is working.
Has the patch been tested and confirmed to actually fix such a problem?
Yes it has been tested i dont send untested patch to ml.
Quoted 11 lines
Quoted 11 lines
r =
radeon_asic_reset(rdev);
if (!r) {
dev_info(rdev->dev, "GPU reset succeed\n");radeon_resume(rdev);
-radeon_restore_bios_scratch_regs(rdev);
-drm_helper_resume_force_mode(rdev->ddev);
-ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); }
Quoted 6 lines
Quoted 4 lines
+ /* no matter what restore video mode */
+radeon_restore_bios_scratch_regs(rdev);
+drm_helper_resume_force_mode(rdev->ddev);
+ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);Maybe this should be in a separate patch.
Idea is to send this patch to stable thus having one patch that have it all.
Quoted 13 lines
drivers/gpu/drm/radeon/radeon_ttm.c static int radeon_bo_move(struct ttm_buffer_object *bo, · line 424
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_ttm.c +4
-0@@ -399,6 +418,14 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, radeon_move_null(bo, new_mem); return 0; } + if (!rdev->accel_working) { + /* when accel is not working GPU is in broken state just +* do nothing for any ttm operation to avoid making the +* situation worst than it's 'worse than it is', same in the following two hunks.
Cheers,
Jerome
Quoted 11 lines · Jerome Glisse
Quoted 8 lines · Michel Dänzer
Quoted 5 lines · On Die, 2012-06-26 at 17:04 -0400, [email protected] wrote:
From: Jerome Glisse <[email protected]>
After unrecovered GPU lockup avoid any GPU activities to avoid things like kernel segfault and alike to happen in any of the path that assume hw is working.
Has the patch been tested and confirmed to actually fix such a problem?
Yes it has been tested i dont send untested patch to ml.
I didn't expect (or mean to suggest) otherwise. I think I misread the related IRC conversation from last night: I thought you basically whipped up this patch in response to a report of such problems. But on re-reading now, I guess you wrote this patch a while ago and are just sending it now in response to the report on IRC.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
r = radeon_asic_reset(rdev); if (!r) { dev_info(rdev->dev, "GPU reset succeed\n"); radeon_resume(rdev);drivers/gpu/drm/radeon/radeon_device.c +0
-3-radeon_restore_bios_scratch_regs (rdev); -drm_helper_resume_force_mode (rdev->ddev); -ttm_bo_unlock_delayed_workqueue (&rdev->mman.bdev, resched); }
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/radeon/radeon_device.c int radeon_gpu_reset(struct radeon_device *rdev) · line 1007
Quoted 4 lines
drivers/gpu/drm/radeon/radeon_device.c +4
-0+/* no matter what restore video mode */ +radeon_restore_bios_scratch_regs (rdev); +drm_helper_resume_force_mode (rdev->ddev); +ttm_bo_unlock_delayed_workqueue (&rdev->mman.bdev, resched);Maybe this should be in a separate patch.
Idea is to send this patch to stable thus having one patch that have it all.
That doesn't make sense. Either the changes belong into a single patch (but then the commit log should describe all of them) or not. They can be sent to stable[0] either way.
[0] Actually, patches with Cc: stable are picked up automagically once they hit mainline, there's no point in sending them there directly.
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_ttm.c static int radeon_bo_move(struct ttm_buffer_object *bo, · line 424
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_ttm.c +4
-0@@ -399,6 +418,14 @@ static int radeon_bo_move(struct ttm_buffer_object *bo,radeon_move_null (bo, new_mem);return 0 ; } +if (!rdev->accel_working) { +/* when accel is not working GPU is in broken state just +* do nothing for any ttm operation to avoid making the +* situation worst than it's 'worse than it is', same in the following two hunks.
Are you gonna fix these typos?
Signature · 2 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer