gpu: nvgpu: Use nvgpu_thread for channel worker

Use nvgpu_thread for channel worker.

JIRA NVGPU-14

Change-Id: Idcb93d3096de06a1569dc3ea69890745b5805d67
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1472870
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
This commit is contained in:
Terje Bergstrom
2017-04-25 09:00:47 -07:00
committed by Varun Colbert
parent fc95237cf0
commit c43c3f9c2f
2 changed files with 12 additions and 9 deletions

View File

@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/kthread.h>
#include <trace/events/gk20a.h>
#include <linux/dma-buf.h>
@@ -1780,7 +1779,7 @@ static int gk20a_channel_poll_worker(void *arg)
gk20a_dbg_fn("");
start_wait = jiffies;
while (!kthread_should_stop()) {
while (!nvgpu_thread_should_stop(&worker->poll_task)) {
bool got_events;
got_events = wait_event_timeout(
@@ -1804,26 +1803,29 @@ static int gk20a_channel_poll_worker(void *arg)
*/
int nvgpu_channel_worker_init(struct gk20a *g)
{
struct task_struct *task;
int err;
char thread_name[64];
atomic_set(&g->channel_worker.put, 0);
init_waitqueue_head(&g->channel_worker.wq);
nvgpu_init_list_node(&g->channel_worker.items);
nvgpu_spinlock_init(&g->channel_worker.items_lock);
task = kthread_run(gk20a_channel_poll_worker, g,
snprintf(thread_name, sizeof(thread_name),
"nvgpu_channel_poll_%s", g->name);
if (IS_ERR(task)) {
err = nvgpu_thread_create(&g->channel_worker.poll_task, g,
gk20a_channel_poll_worker, thread_name);
if (err) {
nvgpu_err(g, "failed to start channel poller thread");
return PTR_ERR(task);
return err;
}
g->channel_worker.poll_task = task;
return 0;
}
void nvgpu_channel_worker_deinit(struct gk20a *g)
{
kthread_stop(g->channel_worker.poll_task);
nvgpu_thread_stop(&g->channel_worker.poll_task);
}
/**

View File

@@ -32,6 +32,7 @@ struct dbg_profiler_object_data;
#include <linux/sched.h>
#include <nvgpu/lock.h>
#include <nvgpu/thread.h>
#include <linux/irqreturn.h>
#include <linux/version.h>
#include <linux/cdev.h>
@@ -1142,7 +1143,7 @@ struct gk20a {
wait_queue_head_t sw_irq_nonstall_last_handled_wq;
struct gk20a_channel_worker {
struct task_struct *poll_task;
struct nvgpu_thread poll_task;
atomic_t put;
wait_queue_head_t wq;
struct nvgpu_list_node items;