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 <bnihalani@nvidia.com>
Reviewed-on: http://git-master/r/1500409
Reviewed-on: http://git-master/r/1503628
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
This commit is contained in:
Bharat Nihalani
2017-06-16 12:43:47 +05:30
committed by mobile promotions
parent 8dc75c1725
commit 2535c81c6c
2 changed files with 4 additions and 4 deletions

View File

@@ -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));

View File

@@ -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");