diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-03-08 20:08:50 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-03-30 15:36:09 -0400 |
commit | 24e1c7e0a729158be36d63b821550d206a8a0436 (patch) | |
tree | cf26c850cc63957f63f3e8f97914268839d8e0de /drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | |
parent | 7010bf88399ea81b2b35844f738baac19dc5a441 (diff) |
gpu: nvgpu: Use new kmem API functions (misc)
Use the new kmem API functions in misc gk20a code. Some additional
modifications were also made:
o Add a struct gk20a pointer to gk20a_fence to enable proper
kmem free usage.
o Add gk20a pointer to alloc_session() in dbg_gpu_gk20a.c to
use kmem API for allocating a session.
o Plumb a gk20a pointer through the fence creation and deletion.
o Use statically allocated buffers for names in file creation.
Bug 1799159
Bug 1823380
Change-Id: I3678080e3ffa1f9bcf6934e3f4819a1bc531689b
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1318323
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index da2421d9..dbf67c71 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | |||
@@ -23,6 +23,9 @@ | |||
23 | #include <linux/debugfs.h> | 23 | #include <linux/debugfs.h> |
24 | #include <linux/log2.h> | 24 | #include <linux/log2.h> |
25 | #include <uapi/linux/nvgpu.h> | 25 | #include <uapi/linux/nvgpu.h> |
26 | |||
27 | #include <nvgpu/kmem.h> | ||
28 | |||
26 | #include "ctxsw_trace_gk20a.h" | 29 | #include "ctxsw_trace_gk20a.h" |
27 | #include "fecs_trace_gk20a.h" | 30 | #include "fecs_trace_gk20a.h" |
28 | #include "gk20a.h" | 31 | #include "gk20a.h" |
@@ -151,7 +154,7 @@ static int gk20a_fecs_trace_hash_add(struct gk20a *g, u32 context_ptr, pid_t pid | |||
151 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_ctxsw, | 154 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_ctxsw, |
152 | "adding hash entry context_ptr=%x -> pid=%d", context_ptr, pid); | 155 | "adding hash entry context_ptr=%x -> pid=%d", context_ptr, pid); |
153 | 156 | ||
154 | he = kzalloc(sizeof(*he), GFP_KERNEL); | 157 | he = nvgpu_kzalloc(g, sizeof(*he)); |
155 | if (unlikely(!he)) { | 158 | if (unlikely(!he)) { |
156 | gk20a_warn(dev_from_gk20a(g), | 159 | gk20a_warn(dev_from_gk20a(g), |
157 | "can't alloc new hash entry for context_ptr=%x pid=%d", | 160 | "can't alloc new hash entry for context_ptr=%x pid=%d", |
@@ -184,7 +187,7 @@ static void gk20a_fecs_trace_hash_del(struct gk20a *g, u32 context_ptr) | |||
184 | gk20a_dbg(gpu_dbg_ctxsw, | 187 | gk20a_dbg(gpu_dbg_ctxsw, |
185 | "freed hash entry=%p context_ptr=%x", ent, | 188 | "freed hash entry=%p context_ptr=%x", ent, |
186 | ent->context_ptr); | 189 | ent->context_ptr); |
187 | kfree(ent); | 190 | nvgpu_kfree(g, ent); |
188 | break; | 191 | break; |
189 | } | 192 | } |
190 | } | 193 | } |
@@ -203,7 +206,7 @@ static void gk20a_fecs_trace_free_hash_table(struct gk20a *g) | |||
203 | nvgpu_mutex_acquire(&trace->hash_lock); | 206 | nvgpu_mutex_acquire(&trace->hash_lock); |
204 | hash_for_each_safe(trace->pid_hash_table, bkt, tmp, ent, node) { | 207 | hash_for_each_safe(trace->pid_hash_table, bkt, tmp, ent, node) { |
205 | hash_del(&ent->node); | 208 | hash_del(&ent->node); |
206 | kfree(ent); | 209 | nvgpu_kfree(g, ent); |
207 | } | 210 | } |
208 | nvgpu_mutex_release(&trace->hash_lock); | 211 | nvgpu_mutex_release(&trace->hash_lock); |
209 | 212 | ||
@@ -566,7 +569,7 @@ static int gk20a_fecs_trace_init(struct gk20a *g) | |||
566 | struct gk20a_fecs_trace *trace; | 569 | struct gk20a_fecs_trace *trace; |
567 | int err; | 570 | int err; |
568 | 571 | ||
569 | trace = kzalloc(sizeof(struct gk20a_fecs_trace), GFP_KERNEL); | 572 | trace = nvgpu_kzalloc(g, sizeof(struct gk20a_fecs_trace)); |
570 | if (!trace) { | 573 | if (!trace) { |
571 | gk20a_warn(dev_from_gk20a(g), "failed to allocate fecs_trace"); | 574 | gk20a_warn(dev_from_gk20a(g), "failed to allocate fecs_trace"); |
572 | return -ENOMEM; | 575 | return -ENOMEM; |
@@ -600,7 +603,7 @@ clean_hash_lock: | |||
600 | clean_poll_lock: | 603 | clean_poll_lock: |
601 | nvgpu_mutex_destroy(&trace->poll_lock); | 604 | nvgpu_mutex_destroy(&trace->poll_lock); |
602 | clean: | 605 | clean: |
603 | kfree(trace); | 606 | nvgpu_kfree(g, trace); |
604 | g->fecs_trace = NULL; | 607 | g->fecs_trace = NULL; |
605 | return err; | 608 | return err; |
606 | } | 609 | } |
@@ -712,7 +715,7 @@ static int gk20a_fecs_trace_deinit(struct gk20a *g) | |||
712 | nvgpu_mutex_destroy(&g->fecs_trace->hash_lock); | 715 | nvgpu_mutex_destroy(&g->fecs_trace->hash_lock); |
713 | nvgpu_mutex_destroy(&g->fecs_trace->poll_lock); | 716 | nvgpu_mutex_destroy(&g->fecs_trace->poll_lock); |
714 | 717 | ||
715 | kfree(g->fecs_trace); | 718 | nvgpu_kfree(g, g->fecs_trace); |
716 | g->fecs_trace = NULL; | 719 | g->fecs_trace = NULL; |
717 | return 0; | 720 | return 0; |
718 | } | 721 | } |