summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Nabirushkin <inabirushkin@nvidia.com>2013-09-07 11:36:23 +0400
committerRiham Haidar <rhaidar@nvidia.com>2013-09-19 12:58:52 -0700
commit3783ec25056b9a5a505c0bf6283517bad4c4c5aa (patch)
tree980d714a9ae74f1a7696fe103e0feafd85176f69
parenta9c77c9d1ce46670fbf1628023d531ec85b0b2ae (diff)
misc: tegra-profiler: fix incorrect names
Tegra Profiler: fix incorrect names of modules. mmap buffers are created for each core Bug 1364251 Bug 1312406 Change-Id: I09e9c9c09e77ab480f53e9b1601554677b2d20e0 Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com> Reviewed-on: http://git-master/r/272089 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Tested-by: Maxim Morin <mmorin@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r--drivers/misc/tegra-profiler/main.c5
-rw-r--r--drivers/misc/tegra-profiler/mmap.c51
-rw-r--r--drivers/misc/tegra-profiler/mmap.h6
-rw-r--r--drivers/misc/tegra-profiler/version.h4
4 files changed, 45 insertions, 21 deletions
diff --git a/drivers/misc/tegra-profiler/main.c b/drivers/misc/tegra-profiler/main.c
index dc46c6d4f5fa..7cc07627fa17 100644
--- a/drivers/misc/tegra-profiler/main.c
+++ b/drivers/misc/tegra-profiler/main.c
@@ -18,6 +18,7 @@
#include <linux/init.h>
#include <linux/module.h>
+#include <linux/err.h>
#include <linux/tegra_profiler.h>
@@ -428,9 +429,9 @@ static int __init quadd_module_init(void)
}
ctx.mmap = quadd_mmap_init(&ctx);
- if (!ctx.mmap) {
+ if (IS_ERR(ctx.mmap)) {
pr_err("error: MMAP init failed\n");
- return -ENODEV;
+ return PTR_ERR(ctx.mmap);
}
err = quadd_power_clk_init(&ctx);
diff --git a/drivers/misc/tegra-profiler/mmap.c b/drivers/misc/tegra-profiler/mmap.c
index a52b11f74cd2..370508b84f2b 100644
--- a/drivers/misc/tegra-profiler/mmap.c
+++ b/drivers/misc/tegra-profiler/mmap.c
@@ -21,6 +21,7 @@
#include <linux/crc32.h>
#include <linux/fs.h>
#include <linux/slab.h>
+#include <linux/err.h>
#include <linux/tegra_profiler.h>
@@ -103,14 +104,16 @@ char *quadd_get_mmap(struct quadd_cpu_context *cpu_ctx,
struct pt_regs *regs, struct quadd_mmap_data *sample,
unsigned int *extra_length)
{
+ u32 crc;
+ unsigned long ip;
+ int length, length_aligned;
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
struct file *vm_file;
struct path *path;
char *file_name = NULL;
- int length, length_aligned;
- u32 crc;
- unsigned long ip;
+ struct quadd_mmap_cpu_ctx *mm_cpu_ctx = this_cpu_ptr(mmap_ctx.cpu_ctx);
+ char *tmp_buf = mm_cpu_ctx->tmp_buf;
if (!mm) {
*extra_length = 0;
@@ -130,8 +133,10 @@ char *quadd_get_mmap(struct quadd_cpu_context *cpu_ctx,
path = &vm_file->f_path;
- file_name = d_path(path, mmap_ctx.tmp_buf, PATH_MAX);
- if (file_name) {
+ file_name = d_path(path, tmp_buf, PATH_MAX);
+ if (IS_ERR(file_name)) {
+ file_name = NULL;
+ } else {
sample->addr = vma->vm_start;
sample->len = vma->vm_end - vma->vm_start;
sample->pgoff =
@@ -184,29 +189,39 @@ char *quadd_get_mmap(struct quadd_cpu_context *cpu_ctx,
struct quadd_mmap_ctx *quadd_mmap_init(struct quadd_ctx *quadd_ctx)
{
+ int cpu_id;
u32 *hash;
char *tmp;
+ struct quadd_mmap_cpu_ctx *cpu_ctx;
mmap_ctx.quadd_ctx = quadd_ctx;
hash = kzalloc(QUADD_MMAP_SIZE_ARRAY * sizeof(unsigned int),
GFP_KERNEL);
if (!hash) {
- pr_err("Alloc error\n");
- return NULL;
+ pr_err("Failed to allocate mmap buffer\n");
+ return ERR_PTR(-ENOMEM);
}
mmap_ctx.hash_array = hash;
mmap_ctx.nr_hashes = 0;
spin_lock_init(&mmap_ctx.lock);
- tmp = kzalloc(PATH_MAX + sizeof(unsigned long long),
- GFP_KERNEL);
- if (!tmp) {
- pr_err("Alloc error\n");
- return NULL;
+ mmap_ctx.cpu_ctx = alloc_percpu(struct quadd_mmap_cpu_ctx);
+ if (!mmap_ctx.cpu_ctx)
+ return ERR_PTR(-ENOMEM);
+
+ for (cpu_id = 0; cpu_id < nr_cpu_ids; cpu_id++) {
+ cpu_ctx = per_cpu_ptr(mmap_ctx.cpu_ctx, cpu_id);
+
+ tmp = kzalloc(PATH_MAX + sizeof(unsigned long long),
+ GFP_KERNEL);
+ if (!tmp) {
+ pr_err("Failed to allocate mmap buffer\n");
+ return ERR_PTR(-ENOMEM);
+ }
+ cpu_ctx->tmp_buf = tmp;
}
- mmap_ctx.tmp_buf = tmp;
return &mmap_ctx;
}
@@ -222,15 +237,19 @@ void quadd_mmap_reset(void)
void quadd_mmap_deinit(void)
{
+ int cpu_id;
unsigned long flags;
+ struct quadd_mmap_cpu_ctx *cpu_ctx;
spin_lock_irqsave(&mmap_ctx.lock, flags);
-
kfree(mmap_ctx.hash_array);
mmap_ctx.hash_array = NULL;
- kfree(mmap_ctx.tmp_buf);
- mmap_ctx.tmp_buf = NULL;
+ for (cpu_id = 0; cpu_id < nr_cpu_ids; cpu_id++) {
+ cpu_ctx = per_cpu_ptr(mmap_ctx.cpu_ctx, cpu_id);
+ kfree(cpu_ctx->tmp_buf);
+ }
+ free_percpu(mmap_ctx.cpu_ctx);
spin_unlock_irqrestore(&mmap_ctx.lock, flags);
}
diff --git a/drivers/misc/tegra-profiler/mmap.h b/drivers/misc/tegra-profiler/mmap.h
index f12ec4d61ed5..dd750f956df9 100644
--- a/drivers/misc/tegra-profiler/mmap.h
+++ b/drivers/misc/tegra-profiler/mmap.h
@@ -25,12 +25,16 @@ struct quadd_mmap_data;
#define QUADD_MMAP_SIZE_ARRAY 4096
+struct quadd_mmap_cpu_ctx {
+ char *tmp_buf;
+};
+
struct quadd_mmap_ctx {
u32 *hash_array;
unsigned int nr_hashes;
spinlock_t lock;
- char *tmp_buf;
+ struct quadd_mmap_cpu_ctx * __percpu cpu_ctx;
struct quadd_ctx *quadd_ctx;
};
diff --git a/drivers/misc/tegra-profiler/version.h b/drivers/misc/tegra-profiler/version.h
index efaa135d15c9..c24895433449 100644
--- a/drivers/misc/tegra-profiler/version.h
+++ b/drivers/misc/tegra-profiler/version.h
@@ -18,7 +18,7 @@
#ifndef __QUADD_VERSION_H
#define __QUADD_VERSION_H
-#define QUADD_MODULE_VERSION "1.27"
-#define QUADD_MODULE_BRANCH "Blackrock2"
+#define QUADD_MODULE_VERSION "1.28"
+#define QUADD_MODULE_BRANCH "Dev"
#endif /* __QUADD_VERSION_H */