summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-04-25 12:38:40 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-24 07:55:36 -0400
commit7d6d8a7ec3ccf9656194e862d4259076cb0a84e0 (patch)
tree6d6040211d179cb2db0f83a10625fc1b23e25623 /drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
parenta7e6a8cf51e567878ef2a78b184892755969223c (diff)
gpu: nvgpu: Use nvgpu_thread in FECS trace
Use nvgpu_thread for launching the FECS trace periodic poller thread. JIRA NVGPU-14 Change-Id: Idc53d85b96ae72a367dd1447bf18a8207b9886d6 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1469649 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Konsta Holtta <kholtta@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c29
1 files changed, 14 insertions, 15 deletions
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:
382static int gk20a_fecs_trace_periodic_polling(void *arg) 382static 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,
737static int gk20a_fecs_trace_enable(struct gk20a *g) 738static 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