diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/pmu/pmu.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/thread.h | 9 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/thread.c | 9 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/posix/thread.c | 5 |
4 files changed, 24 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/pmu/pmu.c b/drivers/gpu/nvgpu/common/pmu/pmu.c index 9bcfa14e..f86dc2c2 100644 --- a/drivers/gpu/nvgpu/common/pmu/pmu.c +++ b/drivers/gpu/nvgpu/common/pmu/pmu.c | |||
@@ -171,6 +171,8 @@ void nvgpu_kill_task_pg_init(struct gk20a *g) | |||
171 | nvgpu_udelay(2); | 171 | nvgpu_udelay(2); |
172 | } while (nvgpu_timeout_expired_msg(&timeout, | 172 | } while (nvgpu_timeout_expired_msg(&timeout, |
173 | "timeout - waiting PMU state machine thread stop") == 0); | 173 | "timeout - waiting PMU state machine thread stop") == 0); |
174 | } else { | ||
175 | nvgpu_thread_join(&pmu->pg_init.state_task); | ||
174 | } | 176 | } |
175 | } | 177 | } |
176 | 178 | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/thread.h b/drivers/gpu/nvgpu/include/nvgpu/thread.h index b113f972..eac06ef1 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/thread.h +++ b/drivers/gpu/nvgpu/include/nvgpu/thread.h | |||
@@ -80,4 +80,13 @@ bool nvgpu_thread_should_stop(struct nvgpu_thread *thread); | |||
80 | */ | 80 | */ |
81 | bool nvgpu_thread_is_running(struct nvgpu_thread *thread); | 81 | bool nvgpu_thread_is_running(struct nvgpu_thread *thread); |
82 | 82 | ||
83 | /** | ||
84 | * nvgpu_thread_join - join a thread to reclaim resources | ||
85 | * after it has exited | ||
86 | * | ||
87 | * @thread - thread to join | ||
88 | * | ||
89 | */ | ||
90 | void nvgpu_thread_join(struct nvgpu_thread *thread); | ||
91 | |||
83 | #endif /* NVGPU_THREAD_H */ | 92 | #endif /* NVGPU_THREAD_H */ |
diff --git a/drivers/gpu/nvgpu/os/linux/thread.c b/drivers/gpu/nvgpu/os/linux/thread.c index 92c556f2..c56bff6b 100644 --- a/drivers/gpu/nvgpu/os/linux/thread.c +++ b/drivers/gpu/nvgpu/os/linux/thread.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/kthread.h> | 17 | #include <linux/kthread.h> |
18 | 18 | ||
19 | #include <nvgpu/thread.h> | 19 | #include <nvgpu/thread.h> |
20 | #include <nvgpu/timers.h> | ||
20 | 21 | ||
21 | int nvgpu_thread_proxy(void *threaddata) | 22 | int nvgpu_thread_proxy(void *threaddata) |
22 | { | 23 | { |
@@ -61,3 +62,9 @@ bool nvgpu_thread_is_running(struct nvgpu_thread *thread) | |||
61 | { | 62 | { |
62 | return ACCESS_ONCE(thread->running); | 63 | return ACCESS_ONCE(thread->running); |
63 | }; | 64 | }; |
65 | |||
66 | void nvgpu_thread_join(struct nvgpu_thread *thread) | ||
67 | { | ||
68 | while (ACCESS_ONCE(thread->running)) | ||
69 | nvgpu_msleep(10); | ||
70 | }; | ||
diff --git a/drivers/gpu/nvgpu/os/posix/thread.c b/drivers/gpu/nvgpu/os/posix/thread.c index d9476523..6fdce134 100644 --- a/drivers/gpu/nvgpu/os/posix/thread.c +++ b/drivers/gpu/nvgpu/os/posix/thread.c | |||
@@ -94,3 +94,8 @@ bool nvgpu_thread_is_running(struct nvgpu_thread *thread) | |||
94 | { | 94 | { |
95 | return thread->running; | 95 | return thread->running; |
96 | } | 96 | } |
97 | |||
98 | void nvgpu_thread_join(struct nvgpu_thread *thread) | ||
99 | { | ||
100 | (void) pthread_join(thread->thread, NULL); | ||
101 | } | ||