From e04e73c580976445880283552535199a70a80ea4 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Mon, 23 Nov 2015 14:17:56 -0800 Subject: gpu: nvgpu: Immediate channel release When closing channel, disable and preempt it immediately instead of waiting for it to finish all work. Bug 1683059 Change-Id: Ia5f5fc6a072dc3ddb1e9bf63534814ff0a60b5b4 Signed-off-by: Terje Bergstrom Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/836746 --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 25 +++---------------------- drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 4 +--- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 6 +----- drivers/gpu/nvgpu/vgpu/gr_vgpu.c | 6 +----- 4 files changed, 6 insertions(+), 35 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 98c8760e..cd05691a 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -453,26 +453,10 @@ int gk20a_wait_channel_idle(struct channel_gk20a *ch) return 0; } -void gk20a_disable_channel(struct channel_gk20a *ch, - bool finish, - unsigned long finish_timeout) +void gk20a_disable_channel(struct channel_gk20a *ch) { - gk20a_dbg_fn(""); - - if (finish) { - int err = gk20a_channel_finish(ch, finish_timeout); - WARN_ON(err); - } - - /* disable the channel from hw and increment syncpoints */ gk20a_channel_abort(ch); - - gk20a_wait_channel_idle(ch); - - /* preempt the channel */ ch->g->ops.fifo.preempt_channel(ch->g, ch->hw_chid); - - /* remove channel from runlist */ channel_gk20a_update_runlist(ch, false); } @@ -769,9 +753,8 @@ static void gk20a_free_channel(struct channel_gk20a *ch) trace_gk20a_free_channel(ch->hw_chid); - /* prevent new kickoffs */ - ch->has_timedout = true; - wmb(); + /* abort channel and remove from runlist */ + gk20a_disable_channel(ch); /* wait until there's only our ref to the channel */ gk20a_wait_until_counter_is_N( @@ -830,8 +813,6 @@ static void gk20a_free_channel(struct channel_gk20a *ch) gk20a_dbg_info("freeing bound channel context, timeout=%ld", timeout); - gk20a_disable_channel(ch, !ch->has_timedout, timeout); - gk20a_free_error_notifiers(ch); /* release channel ctx */ diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index d3428788..cb8ffa95 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h @@ -194,9 +194,7 @@ void gk20a_channel_close(struct channel_gk20a *ch); bool gk20a_channel_update_and_check_timeout(struct channel_gk20a *ch, u32 timeout_delta_ms); -void gk20a_disable_channel(struct channel_gk20a *ch, - bool wait_for_finish, - unsigned long finish_timeout); +void gk20a_disable_channel(struct channel_gk20a *ch); void gk20a_channel_abort(struct channel_gk20a *ch); int gk20a_channel_finish(struct channel_gk20a *ch, unsigned long timeout); void gk20a_set_error_notifier(struct channel_gk20a *ch, __u32 error); diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 34ad1771..ca44cf21 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -2815,8 +2815,6 @@ out: int gk20a_free_obj_ctx(struct channel_gk20a *c, struct nvgpu_free_obj_ctx_args *args) { - unsigned long timeout = gk20a_get_gr_idle_timeout(c->g); - gk20a_dbg_fn(""); if (c->num_objects == 0) @@ -2826,9 +2824,7 @@ int gk20a_free_obj_ctx(struct channel_gk20a *c, if (c->num_objects == 0) { c->first_init = false; - gk20a_disable_channel(c, - !c->has_timedout, - timeout); + gk20a_disable_channel(c); gr_gk20a_free_channel_patch_ctx(c); } diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c index a4ec5254..d8da6f3f 100644 --- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c @@ -527,8 +527,6 @@ out: static int vgpu_gr_free_obj_ctx(struct channel_gk20a *c, struct nvgpu_free_obj_ctx_args *args) { - unsigned long timeout = gk20a_get_gr_idle_timeout(c->g); - gk20a_dbg_fn(""); if (c->num_objects == 0) @@ -538,9 +536,7 @@ static int vgpu_gr_free_obj_ctx(struct channel_gk20a *c, if (c->num_objects == 0) { c->first_init = false; - gk20a_disable_channel(c, - !c->has_timedout, - timeout); + gk20a_disable_channel(c); } return 0; -- cgit v1.2.2