summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2019-09-05 07:14:29 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2019-11-21 12:24:11 -0500
commitdd70aa47dbaa218f5fbafe26477d7cf17f094d21 (patch)
tree69aa80fc19e9737ef188b2817a6f7d89000744a3
parent0bdffbed34df2e35f1df305173cd19eeb5582305 (diff)
gpu: nvgpu: fix gk20a_busy_noresume and gk20a_idle_nosuspend
gk20a_idle can still race with gk20a_busy_noresume as the following pm_runtime's functions can run concurrently. i.e. pm_runtime_suspend and pm_runtime_get_noresume. pm_runtime_get_noresume simply increments the refcount without first acquiring the pm_runtime's power_lock. This can be resolved by the use of pm_runtime_get_if_in_use which acquires a the power lock of PM runtime. This prevents a potential use of register after power_off in the l2_ops ioctl path. We still call pm_runtime_get_noresume even if pm_runtime_get_if_in_use returns <= 0. This helps in the following ways. 1) The signature of the function gk20a_busy_noresume remains same w.r.t QNX code 2) Any calls to gk20a_busy_noresume() in the driver is followed by a check to g->power_on. When pm_runtime_get_if_in_use() returns <=0, g->power_on is false and would immediately call gk20a_suspend_noidle() thus keeping the original 'intent' of the gk20a_busy_noresume intact. Bug 200507468 Change-Id: Id46bf2124047bb0e9a299fda57441e425195468f Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2180787 Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/os/linux/module.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c
index 7653f607..18345ada 100644
--- a/drivers/gpu/nvgpu/os/linux/module.c
+++ b/drivers/gpu/nvgpu/os/linux/module.c
@@ -107,7 +107,10 @@ struct device_node *nvgpu_get_node(struct gk20a *g)
107 107
108void gk20a_busy_noresume(struct gk20a *g) 108void gk20a_busy_noresume(struct gk20a *g)
109{ 109{
110 pm_runtime_get_noresume(dev_from_gk20a(g)); 110 int ret = pm_runtime_get_if_in_use(dev_from_gk20a(g));
111
112 if (ret <= 0)
113 pm_runtime_get_noresume(dev_from_gk20a(g));
111} 114}
112 115
113/* 116/*