From 7680fd689ecf7d11bf2dfdba41dc2f33cde2bbe7 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Tue, 16 May 2017 13:47:58 +0300 Subject: gpu: nvgpu: hold power ref for deterministic channels To support deterministic channels even with platforms where railgating is supported, have each deterministic-marked channel hold a power reference during their lifetime, and skip taking power refs for jobs in submit path for those. Previously, railgating blocked deterministic submits in general because of gk20a_busy()/gk20a_idle() calls in submit path possibly taking time and more significantly because the gpu may need turning on which takes a nondeterministic and long amount of time. As an exception, gk20a_do_idle() can still block deterministic submits until gk20a_do_unidle() is called. Add a rwsem to guard this. VPR resize needs do_idle, which conflicts with deterministic channels' requirement to keep the GPU on. This is documented in the ioctl header now. Make NVGPU_GPU_FLAGS_SUPPORT_DETERMINISTIC_SUBMIT_NO_JOBTRACKING always set in the gpu characteristics now that it's supported. The only thing left now blocking NVGPU_GPU_FLAGS_SUPPORT_DETERMINISTIC_SUBMIT_FULL is the sync framework. Make the channel debug dump show which channels are deterministic. Bug 200291300 Jira NVGPU-70 Change-Id: I47b6f3a8517cd6e4255f6ca2855e3dd912e4f5f3 Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/1483038 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/driver_common.c | 1 + drivers/gpu/nvgpu/common/linux/module.c | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index bd9a4e77..a00880ed 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c @@ -39,6 +39,7 @@ static void nvgpu_init_vars(struct gk20a *g) gk20a_init_gr(g); init_rwsem(&g->busy_lock); + init_rwsem(&g->deterministic_busy); nvgpu_spinlock_init(&g->mc_enable_lock); diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index 34a0ded6..cbad3993 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c @@ -298,6 +298,12 @@ int __gk20a_do_idle(struct device *dev, bool force_reset) bool is_railgated; int err = 0; + /* + * Hold back deterministic submits and changes to deterministic + * channels - this must be outside the power busy locks. + */ + gk20a_channel_deterministic_idle(g); + /* acquire busy lock to block other busy() calls */ down_write(&g->busy_lock); @@ -403,6 +409,7 @@ fail_drop_usage_count: fail_timeout: nvgpu_mutex_release(&platform->railgate_lock); up_write(&g->busy_lock); + gk20a_channel_deterministic_unidle(g); return -EBUSY; } @@ -456,6 +463,8 @@ int __gk20a_do_unidle(struct device *dev) nvgpu_mutex_release(&platform->railgate_lock); up_write(&g->busy_lock); + gk20a_channel_deterministic_unidle(g); + return 0; } -- cgit v1.2.2