mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: fix race condition with poweroff
When gpu rail-gating is enabled, it is possible that both rail gating code and system shudown can start executing gk20a_pm_prepare_poweroff() in parallel. To synchronize this execution, protect gk20a_pm_prepare_poweroff() with a mutex lock. Bug 200168805 Change-Id: I19536a43ed20c3e82b32c316922dc3e19e3f59bb Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-on: http://git-master/r/999548 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
committed by
Terje Bergstrom
parent
5cb995c751
commit
9e02111a76
@@ -669,6 +669,7 @@ static int gk20a_init_support(struct platform_device *dev)
|
||||
mutex_init(&g->dbg_sessions_lock);
|
||||
mutex_init(&g->client_lock);
|
||||
mutex_init(&g->ch_wdt_lock);
|
||||
mutex_init(&g->poweroff_lock);
|
||||
|
||||
mutex_init(&g->interleave_lock);
|
||||
g->num_interleaved_channels = 0;
|
||||
@@ -689,17 +690,19 @@ static int gk20a_pm_prepare_poweroff(struct device *dev)
|
||||
|
||||
gk20a_dbg_fn("");
|
||||
|
||||
gk20a_scale_suspend(pdev);
|
||||
mutex_lock(&g->poweroff_lock);
|
||||
|
||||
if (!g->power_on)
|
||||
return 0;
|
||||
goto done;
|
||||
|
||||
gk20a_scale_suspend(pdev);
|
||||
|
||||
/* cancel any pending cde work */
|
||||
gk20a_cde_suspend(g);
|
||||
|
||||
ret = gk20a_channel_suspend(g);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto done;
|
||||
|
||||
/* disable elpg before gr or fifo suspend */
|
||||
ret |= gk20a_pmu_destroy(g);
|
||||
@@ -723,6 +726,9 @@ static int gk20a_pm_prepare_poweroff(struct device *dev)
|
||||
/* Stop CPU from accessing the GPU registers. */
|
||||
gk20a_lockout_registers(g);
|
||||
|
||||
done:
|
||||
mutex_unlock(&g->poweroff_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -521,6 +521,8 @@ struct gk20a {
|
||||
|
||||
struct mutex ch_wdt_lock;
|
||||
|
||||
struct mutex poweroff_lock;
|
||||
|
||||
/* Channel priorities */
|
||||
u32 timeslice_low_priority_us;
|
||||
u32 timeslice_medium_priority_us;
|
||||
|
||||
Reference in New Issue
Block a user