diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 29 |
2 files changed, 14 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c index 50bcbe51..ceee1ae9 100644 --- a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c | |||
@@ -12,7 +12,6 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <asm/barrier.h> | 14 | #include <asm/barrier.h> |
15 | #include <linux/kthread.h> | ||
16 | #include <linux/wait.h> | 15 | #include <linux/wait.h> |
17 | #include <linux/ktime.h> | 16 | #include <linux/ktime.h> |
18 | #include <linux/uaccess.h> | 17 | #include <linux/uaccess.h> |
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index 84083f4b..4589b83e 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | |||
@@ -12,7 +12,6 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <asm/barrier.h> | 14 | #include <asm/barrier.h> |
15 | #include <linux/kthread.h> | ||
16 | #ifdef CONFIG_DEBUG_FS | 15 | #ifdef CONFIG_DEBUG_FS |
17 | #include <linux/debugfs.h> | 16 | #include <linux/debugfs.h> |
18 | #endif | 17 | #endif |
@@ -22,6 +21,7 @@ | |||
22 | #include <nvgpu/bug.h> | 21 | #include <nvgpu/bug.h> |
23 | #include <nvgpu/hashtable.h> | 22 | #include <nvgpu/hashtable.h> |
24 | #include <nvgpu/circ_buf.h> | 23 | #include <nvgpu/circ_buf.h> |
24 | #include <nvgpu/thread.h> | ||
25 | 25 | ||
26 | #include "ctxsw_trace_gk20a.h" | 26 | #include "ctxsw_trace_gk20a.h" |
27 | #include "fecs_trace_gk20a.h" | 27 | #include "fecs_trace_gk20a.h" |
@@ -65,7 +65,7 @@ struct gk20a_fecs_trace { | |||
65 | DECLARE_HASHTABLE(pid_hash_table, GK20A_FECS_TRACE_HASH_BITS); | 65 | DECLARE_HASHTABLE(pid_hash_table, GK20A_FECS_TRACE_HASH_BITS); |
66 | struct nvgpu_mutex hash_lock; | 66 | struct nvgpu_mutex hash_lock; |
67 | struct nvgpu_mutex poll_lock; | 67 | struct nvgpu_mutex poll_lock; |
68 | struct task_struct *poll_task; | 68 | struct nvgpu_thread poll_task; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | #ifdef CONFIG_GK20A_CTXSW_TRACE | 71 | #ifdef CONFIG_GK20A_CTXSW_TRACE |
@@ -382,10 +382,11 @@ done: | |||
382 | static int gk20a_fecs_trace_periodic_polling(void *arg) | 382 | static int gk20a_fecs_trace_periodic_polling(void *arg) |
383 | { | 383 | { |
384 | struct gk20a *g = (struct gk20a *)arg; | 384 | struct gk20a *g = (struct gk20a *)arg; |
385 | struct gk20a_fecs_trace *trace = g->fecs_trace; | ||
385 | 386 | ||
386 | pr_info("%s: running\n", __func__); | 387 | pr_info("%s: running\n", __func__); |
387 | 388 | ||
388 | while (!kthread_should_stop()) { | 389 | while (!nvgpu_thread_should_stop(&trace->poll_task)) { |
389 | 390 | ||
390 | nvgpu_usleep_range(GK20A_FECS_TRACE_FRAME_PERIOD_US, | 391 | nvgpu_usleep_range(GK20A_FECS_TRACE_FRAME_PERIOD_US, |
391 | GK20A_FECS_TRACE_FRAME_PERIOD_US * 2); | 392 | GK20A_FECS_TRACE_FRAME_PERIOD_US * 2); |
@@ -708,7 +709,7 @@ static int gk20a_fecs_trace_deinit(struct gk20a *g) | |||
708 | struct gk20a_fecs_trace *trace = g->fecs_trace; | 709 | struct gk20a_fecs_trace *trace = g->fecs_trace; |
709 | 710 | ||
710 | gk20a_fecs_trace_debugfs_cleanup(g); | 711 | gk20a_fecs_trace_debugfs_cleanup(g); |
711 | kthread_stop(trace->poll_task); | 712 | nvgpu_thread_stop(&trace->poll_task); |
712 | gk20a_fecs_trace_free_ring(g); | 713 | gk20a_fecs_trace_free_ring(g); |
713 | gk20a_fecs_trace_free_hash_table(g); | 714 | gk20a_fecs_trace_free_hash_table(g); |
714 | 715 | ||
@@ -737,13 +738,13 @@ static int gk20a_gr_max_entries(struct gk20a *g, | |||
737 | static int gk20a_fecs_trace_enable(struct gk20a *g) | 738 | static int gk20a_fecs_trace_enable(struct gk20a *g) |
738 | { | 739 | { |
739 | struct gk20a_fecs_trace *trace = g->fecs_trace; | 740 | struct gk20a_fecs_trace *trace = g->fecs_trace; |
740 | struct task_struct *task; | ||
741 | int write; | 741 | int write; |
742 | int err = 0; | ||
742 | 743 | ||
743 | if (!trace) | 744 | if (!trace) |
744 | return -EINVAL; | 745 | return -EINVAL; |
745 | 746 | ||
746 | if (trace->poll_task) | 747 | if (nvgpu_thread_is_running(&trace->poll_task)) |
747 | return 0; | 748 | return 0; |
748 | 749 | ||
749 | /* drop data in hw buffer */ | 750 | /* drop data in hw buffer */ |
@@ -752,13 +753,13 @@ static int gk20a_fecs_trace_enable(struct gk20a *g) | |||
752 | write = gk20a_fecs_trace_get_write_index(g); | 753 | write = gk20a_fecs_trace_get_write_index(g); |
753 | gk20a_fecs_trace_set_read_index(g, write); | 754 | gk20a_fecs_trace_set_read_index(g, write); |
754 | 755 | ||
755 | task = kthread_run(gk20a_fecs_trace_periodic_polling, g, __func__); | 756 | err = nvgpu_thread_create(&trace->poll_task, g, |
756 | if (unlikely(IS_ERR(task))) { | 757 | gk20a_fecs_trace_periodic_polling, __func__); |
758 | if (err) { | ||
757 | nvgpu_warn(g, | 759 | nvgpu_warn(g, |
758 | "failed to create FECS polling task"); | 760 | "failed to create FECS polling task"); |
759 | return PTR_ERR(task); | 761 | return err; |
760 | } | 762 | } |
761 | trace->poll_task = task; | ||
762 | 763 | ||
763 | return 0; | 764 | return 0; |
764 | } | 765 | } |
@@ -767,10 +768,8 @@ static int gk20a_fecs_trace_disable(struct gk20a *g) | |||
767 | { | 768 | { |
768 | struct gk20a_fecs_trace *trace = g->fecs_trace; | 769 | struct gk20a_fecs_trace *trace = g->fecs_trace; |
769 | 770 | ||
770 | if (trace->poll_task) { | 771 | if (nvgpu_thread_is_running(&trace->poll_task)) |
771 | kthread_stop(trace->poll_task); | 772 | nvgpu_thread_stop(&trace->poll_task); |
772 | trace->poll_task = NULL; | ||
773 | } | ||
774 | 773 | ||
775 | return -EPERM; | 774 | return -EPERM; |
776 | } | 775 | } |
@@ -779,7 +778,7 @@ static bool gk20a_fecs_trace_is_enabled(struct gk20a *g) | |||
779 | { | 778 | { |
780 | struct gk20a_fecs_trace *trace = g->fecs_trace; | 779 | struct gk20a_fecs_trace *trace = g->fecs_trace; |
781 | 780 | ||
782 | return (trace && trace->poll_task); | 781 | return (trace && nvgpu_thread_is_running(&trace->poll_task)); |
783 | } | 782 | } |
784 | 783 | ||
785 | 784 | ||