From 2535c81c6c916f9f2e1224e17e80d240df569e49 Mon Sep 17 00:00:00 2001 From: Bharat Nihalani Date: Fri, 16 Jun 2017 12:43:47 +0530 Subject: gpu: nvgpu: use usleep_range instead of msleep msleep is not recommended for (1ms - 20ms). So use usleep_range instead to have a more deterministic sleep time. Also fix the print for target_ref_count that could either be 2 or 1 based on whether GPU rail-gating is enabled or not. Bug 200294536 Change-Id: I26c9ed8a1badc84db5efa89347a227e6b46f603c Signed-off-by: Bharat Nihalani Reviewed-on: http://git-master/r/1500409 Reviewed-on: http://git-master/r/1503628 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom Reviewed-by: Automatic_Commit_Validation_User --- drivers/gpu/nvgpu/common/linux/module.c | 6 +++--- drivers/gpu/nvgpu/common/pmu/pmu.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index 80c516a6..7c7cc714 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c @@ -337,12 +337,12 @@ int __gk20a_do_idle(struct gk20a *g, bool force_reset) /* check and wait until GPU is idle (with a timeout) */ do { - nvgpu_msleep(1); + nvgpu_usleep_range(1000, 1100); ref_cnt = atomic_read(&dev->power.usage_count); } while (ref_cnt != target_ref_cnt && !nvgpu_timeout_expired(&timeout)); if (ref_cnt != target_ref_cnt) { - nvgpu_err(g, "failed to idle - refcount %d != 1", + nvgpu_err(g, "failed to idle - refcount %d != target_ref_cnt", ref_cnt); goto fail_drop_usage_count; } @@ -367,7 +367,7 @@ int __gk20a_do_idle(struct gk20a *g, bool force_reset) /* check in loop if GPU is railgated or not */ do { - nvgpu_msleep(1); + nvgpu_usleep_range(1000, 1100); is_railgated = platform->is_railgated(dev); } while (!is_railgated && !nvgpu_timeout_expired(&timeout)); diff --git a/drivers/gpu/nvgpu/common/pmu/pmu.c b/drivers/gpu/nvgpu/common/pmu/pmu.c index 15b57988..35422e0d 100644 --- a/drivers/gpu/nvgpu/common/pmu/pmu.c +++ b/drivers/gpu/nvgpu/common/pmu/pmu.c @@ -357,7 +357,7 @@ static int nvgpu_pg_init_task(void *arg) } while (!nvgpu_thread_should_stop(&pg_init->state_task)) - nvgpu_msleep(5); + nvgpu_usleep_range(5000, 5100); nvgpu_log_fn(g, "thread exit"); -- cgit v1.2.2