summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2018-01-19 08:06:50 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-01-22 11:29:05 -0500
commitf6d898656a6d7c197aa27ee53f5f0151fb6dfcf5 (patch)
tree2a36814ea2b763fd23be67583e9d9000892136bc
parent3ccf5c85fbc329cc5a72b86f83379d7a151a1f5a (diff)
gpu: nvgpu: note railgate_allowed in do_idle
The idling and unidling of deterministic channels in the do_idle/do_unidle path assume that each deterministic channel holds a power reference. This is no longer the case if railgating has been allowed for a channel via the deterministic options ioctl which also causes the channel to drop the power ref that it holds otherwise during its lifetime. All this is happening inside the deterministic_busy rwsem, which also guards the ioctl changing those deterministic option states. Bug 200327089 Change-Id: I9ce312bbaa459b3cf4a7541fa369186b78c3afdc Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1642310 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 64266fe5..371793ef 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -2006,11 +2006,13 @@ void gk20a_channel_deterministic_idle(struct gk20a *g)
2006 if (!gk20a_channel_get(ch)) 2006 if (!gk20a_channel_get(ch))
2007 continue; 2007 continue;
2008 2008
2009 if (ch->deterministic) { 2009 if (ch->deterministic && !ch->deterministic_railgate_allowed) {
2010 /* 2010 /*
2011 * Drop the power ref taken when setting deterministic 2011 * Drop the power ref taken when setting deterministic
2012 * flag. deterministic_unidle will put this and the 2012 * flag. deterministic_unidle will put this and the
2013 * channel ref back. 2013 * channel ref back. If railgate is allowed separately
2014 * for this channel, the power ref has already been put
2015 * away.
2014 * 2016 *
2015 * Hold the channel ref: it must not get freed in 2017 * Hold the channel ref: it must not get freed in
2016 * between. A race could otherwise result in lost 2018 * between. A race could otherwise result in lost
@@ -2045,7 +2047,7 @@ void gk20a_channel_deterministic_unidle(struct gk20a *g)
2045 * Deterministic state changes inside deterministic_busy lock, 2047 * Deterministic state changes inside deterministic_busy lock,
2046 * which we took in deterministic_idle. 2048 * which we took in deterministic_idle.
2047 */ 2049 */
2048 if (ch->deterministic) { 2050 if (ch->deterministic && !ch->deterministic_railgate_allowed) {
2049 if (gk20a_busy(g)) 2051 if (gk20a_busy(g))
2050 nvgpu_err(g, "cannot busy() again!"); 2052 nvgpu_err(g, "cannot busy() again!");
2051 /* Took this in idle() */ 2053 /* Took this in idle() */