From 24e1c7e0a729158be36d63b821550d206a8a0436 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 8 Mar 2017 17:08:50 -0800 Subject: 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 Reviewed-on: http://git-master/r/1318323 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c') 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 @@ #include #include #include + +#include + #include "ctxsw_trace_gk20a.h" #include "fecs_trace_gk20a.h" #include "gk20a.h" @@ -151,7 +154,7 @@ static int gk20a_fecs_trace_hash_add(struct gk20a *g, u32 context_ptr, pid_t pid gk20a_dbg(gpu_dbg_fn | gpu_dbg_ctxsw, "adding hash entry context_ptr=%x -> pid=%d", context_ptr, pid); - he = kzalloc(sizeof(*he), GFP_KERNEL); + he = nvgpu_kzalloc(g, sizeof(*he)); if (unlikely(!he)) { gk20a_warn(dev_from_gk20a(g), "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) gk20a_dbg(gpu_dbg_ctxsw, "freed hash entry=%p context_ptr=%x", ent, ent->context_ptr); - kfree(ent); + nvgpu_kfree(g, ent); break; } } @@ -203,7 +206,7 @@ static void gk20a_fecs_trace_free_hash_table(struct gk20a *g) nvgpu_mutex_acquire(&trace->hash_lock); hash_for_each_safe(trace->pid_hash_table, bkt, tmp, ent, node) { hash_del(&ent->node); - kfree(ent); + nvgpu_kfree(g, ent); } nvgpu_mutex_release(&trace->hash_lock); @@ -566,7 +569,7 @@ static int gk20a_fecs_trace_init(struct gk20a *g) struct gk20a_fecs_trace *trace; int err; - trace = kzalloc(sizeof(struct gk20a_fecs_trace), GFP_KERNEL); + trace = nvgpu_kzalloc(g, sizeof(struct gk20a_fecs_trace)); if (!trace) { gk20a_warn(dev_from_gk20a(g), "failed to allocate fecs_trace"); return -ENOMEM; @@ -600,7 +603,7 @@ clean_hash_lock: clean_poll_lock: nvgpu_mutex_destroy(&trace->poll_lock); clean: - kfree(trace); + nvgpu_kfree(g, trace); g->fecs_trace = NULL; return err; } @@ -712,7 +715,7 @@ static int gk20a_fecs_trace_deinit(struct gk20a *g) nvgpu_mutex_destroy(&g->fecs_trace->hash_lock); nvgpu_mutex_destroy(&g->fecs_trace->poll_lock); - kfree(g->fecs_trace); + nvgpu_kfree(g, g->fecs_trace); g->fecs_trace = NULL; return 0; } -- cgit v1.2.2