diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2017-06-14 08:11:58 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-06-19 11:35:03 -0400 |
commit | d84d7f8694562628e1ab41fd09d08b68f59e0b30 (patch) | |
tree | b0e4982e083c3f388e370011cd5582b472cfa869 | |
parent | 679ba3ca9b8adc6445be3a8d17d32a5863c14126 (diff) |
gpu: nvgpu: use timeout API in ch poll worker
Instead of using raw jiffies, use milliseconds and the nvgpu timeout
API. The COND_WAIT API uses also just milliseconds.
Jira NVGPU-83
Change-Id: I21b5e0880f0b6aa02856d7c207be97861e423b6b
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/1502999
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.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 90202fd7..645183ba 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -1823,28 +1823,29 @@ static int gk20a_channel_poll_worker(void *arg) | |||
1823 | { | 1823 | { |
1824 | struct gk20a *g = (struct gk20a *)arg; | 1824 | struct gk20a *g = (struct gk20a *)arg; |
1825 | struct gk20a_channel_worker *worker = &g->channel_worker; | 1825 | struct gk20a_channel_worker *worker = &g->channel_worker; |
1826 | unsigned long start_wait; | 1826 | unsigned long watchdog_interval = 100; /* milliseconds */ |
1827 | /* event timeout for also polling the watchdog */ | 1827 | struct nvgpu_timeout timeout; |
1828 | unsigned long timeout = msecs_to_jiffies(100); | ||
1829 | int get = 0; | 1828 | int get = 0; |
1830 | 1829 | ||
1831 | gk20a_dbg_fn(""); | 1830 | gk20a_dbg_fn(""); |
1832 | 1831 | ||
1833 | start_wait = jiffies; | 1832 | nvgpu_timeout_init(g, &timeout, watchdog_interval, |
1833 | NVGPU_TIMER_CPU_TIMER); | ||
1834 | while (!nvgpu_thread_should_stop(&worker->poll_task)) { | 1834 | while (!nvgpu_thread_should_stop(&worker->poll_task)) { |
1835 | int ret; | 1835 | int ret; |
1836 | 1836 | ||
1837 | ret = NVGPU_COND_WAIT( | 1837 | ret = NVGPU_COND_WAIT( |
1838 | &worker->wq, | 1838 | &worker->wq, |
1839 | __gk20a_channel_worker_pending(g, get), | 1839 | __gk20a_channel_worker_pending(g, get), |
1840 | jiffies_to_msecs(timeout)) > 0; | 1840 | watchdog_interval) > 0; |
1841 | 1841 | ||
1842 | if (ret == 0) | 1842 | if (ret == 0) |
1843 | gk20a_channel_worker_process(g, &get); | 1843 | gk20a_channel_worker_process(g, &get); |
1844 | 1844 | ||
1845 | if (jiffies - start_wait >= timeout) { | 1845 | if (nvgpu_timeout_peek_expired(&timeout)) { |
1846 | gk20a_channel_poll_timeouts(g); | 1846 | gk20a_channel_poll_timeouts(g); |
1847 | start_wait = jiffies; | 1847 | nvgpu_timeout_init(g, &timeout, watchdog_interval, |
1848 | NVGPU_TIMER_CPU_TIMER); | ||
1848 | } | 1849 | } |
1849 | } | 1850 | } |
1850 | return 0; | 1851 | return 0; |