summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Nabirushkin <inabirushkin@nvidia.com>2014-01-27 13:38:05 +0400
committerRiham Haidar <rhaidar@nvidia.com>2014-02-19 16:09:43 -0800
commitfdacad01cbe61baf0d3fec310f80fe09f7062077 (patch)
tree6d3043c05e1476955670425aa1890cd042eede5e
parenta9ba97327795942c221dccd49209a399fb1c3c34 (diff)
misc: tegra-profiler: add user_mode flag
Tegra Profiler: add user_mode flag into mmap sample Bug 1447904 Change-Id: Ieba1025abac78b2682c0445e608fd0137dbe2379 Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com> Reviewed-on: http://git-master/r/365901 (cherry picked from commit bbbdb78281524c75706d6b4162182a514355a1a0) Reviewed-on: http://git-master/r/368217 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/comm.c4
-rw-r--r--drivers/misc/tegra-profiler/hrt.c5
-rw-r--r--drivers/misc/tegra-profiler/mmap.c32
-rw-r--r--drivers/misc/tegra-profiler/mmap.h2
-rw-r--r--drivers/misc/tegra-profiler/version.h2
-rw-r--r--include/linux/tegra_profiler.h5
6 files changed, 32 insertions, 18 deletions
diff --git a/drivers/misc/tegra-profiler/comm.c b/drivers/misc/tegra-profiler/comm.c
index ed2540c21166..98f17a228305 100644
--- a/drivers/misc/tegra-profiler/comm.c
+++ b/drivers/misc/tegra-profiler/comm.c
@@ -290,8 +290,10 @@ static ssize_t read_sample(char __user *buffer, size_t max_length)
break;
case QUADD_RECORD_TYPE_MMAP:
+ length_extra = sizeof(u64);
+
if (record.mmap.filename_length > 0) {
- length_extra = record.mmap.filename_length;
+ length_extra += record.mmap.filename_length;
} else {
pr_err("Error: filename is empty\n");
goto out;
diff --git a/drivers/misc/tegra-profiler/hrt.c b/drivers/misc/tegra-profiler/hrt.c
index 638d08d4fab1..c6e7bc477b91 100644
--- a/drivers/misc/tegra-profiler/hrt.c
+++ b/drivers/misc/tegra-profiler/hrt.c
@@ -465,13 +465,16 @@ void __quadd_task_sched_out(struct task_struct *prev,
void __quadd_event_mmap(struct vm_area_struct *vma)
{
+ struct quadd_parameters *param;
+
if (likely(!hrt.active))
return;
if (!is_profile_process(current))
return;
- quadd_process_mmap(vma);
+ param = &hrt.quadd_ctx->param;
+ quadd_process_mmap(vma, param->pids[0]);
}
EXPORT_SYMBOL(__quadd_event_mmap);
diff --git a/drivers/misc/tegra-profiler/mmap.c b/drivers/misc/tegra-profiler/mmap.c
index 81abf36c7145..cb513bfa7a80 100644
--- a/drivers/misc/tegra-profiler/mmap.c
+++ b/drivers/misc/tegra-profiler/mmap.c
@@ -30,10 +30,11 @@
static void
put_mmap_sample(struct quadd_mmap_data *s, char *filename,
- size_t length)
+ size_t length, unsigned long pgoff)
{
struct quadd_record_data r;
- struct quadd_iovec vec;
+ struct quadd_iovec vec[2];
+ u64 pgoff_val = pgoff << PAGE_SHIFT;
r.magic = QUADD_RECORD_MAGIC;
r.record_type = QUADD_RECORD_TYPE_MMAP;
@@ -41,16 +42,19 @@ put_mmap_sample(struct quadd_mmap_data *s, char *filename,
memcpy(&r.mmap, s, sizeof(*s));
r.mmap.filename_length = length;
- vec.base = filename;
- vec.len = length;
+ vec[0].base = &pgoff_val;
+ vec[0].len = sizeof(pgoff_val);
- pr_debug("MMAP: pid: %u, file_name: '%s', addr: %#llx - %#llx, len: %llx, pgoff: %#x\n",
- s->pid, filename, s->addr, s->addr + s->len, s->len, s->pgoff);
+ vec[1].base = filename;
+ vec[1].len = length;
- quadd_put_sample(&r, &vec, 1);
+ pr_debug("MMAP: pid: %u, file_name: '%s', addr: %#llx - %#llx, len: %llx, pgoff: %#lx\n",
+ s->pid, filename, s->addr, s->addr + s->len, s->len, pgoff);
+
+ quadd_put_sample(&r, vec, ARRAY_SIZE(vec));
}
-void quadd_process_mmap(struct vm_area_struct *vma)
+void quadd_process_mmap(struct vm_area_struct *vma, pid_t pid)
{
struct file *vm_file;
struct path *path;
@@ -81,14 +85,16 @@ void quadd_process_mmap(struct vm_area_struct *vma)
if (strstr(file_name, " (deleted)"))
goto out;
+ sample.pid = pid;
+ sample.user_mode = 1;
+
sample.addr = vma->vm_start;
sample.len = vma->vm_end - vma->vm_start;
- sample.pgoff = vma->vm_pgoff;
length = strlen(file_name) + 1;
length_aligned = ALIGN(length, sizeof(u64));
- put_mmap_sample(&sample, file_name, length_aligned);
+ put_mmap_sample(&sample, file_name, length_aligned, vma->vm_pgoff);
out:
kfree(tmp_buf);
@@ -147,11 +153,13 @@ int quadd_get_current_mmap(pid_t pid)
length_aligned = ALIGN(length, sizeof(u64));
sample.pid = pid;
+ sample.user_mode = 1;
+
sample.addr = vma->vm_start;
sample.len = vma->vm_end - vma->vm_start;
- sample.pgoff = vma->vm_pgoff;
- put_mmap_sample(&sample, file_name, length_aligned);
+ put_mmap_sample(&sample, file_name, length_aligned,
+ vma->vm_pgoff);
}
kfree(tmp_buf);
diff --git a/drivers/misc/tegra-profiler/mmap.h b/drivers/misc/tegra-profiler/mmap.h
index 51c150058f0e..4928f939f16c 100644
--- a/drivers/misc/tegra-profiler/mmap.h
+++ b/drivers/misc/tegra-profiler/mmap.h
@@ -19,7 +19,7 @@
#include <linux/types.h>
-void quadd_process_mmap(struct vm_area_struct *vma);
+void quadd_process_mmap(struct vm_area_struct *vma, pid_t pid);
int quadd_get_current_mmap(pid_t pid);
#endif /* __QUADD_MMAP_H */
diff --git a/drivers/misc/tegra-profiler/version.h b/drivers/misc/tegra-profiler/version.h
index d4a6b60f8ceb..46643a29ccc1 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.46"
+#define QUADD_MODULE_VERSION "1.48"
#define QUADD_MODULE_BRANCH "Dev"
#endif /* __QUADD_VERSION_H */
diff --git a/include/linux/tegra_profiler.h b/include/linux/tegra_profiler.h
index fd9a2b63946e..15205e777550 100644
--- a/include/linux/tegra_profiler.h
+++ b/include/linux/tegra_profiler.h
@@ -19,7 +19,7 @@
#include <linux/ioctl.h>
-#define QUADD_SAMPLES_VERSION 19
+#define QUADD_SAMPLES_VERSION 20
#define QUADD_IO_VERSION 9
#define QUADD_IO_VERSION_DYNAMIC_RB 5
@@ -151,10 +151,11 @@ struct quadd_sample_data {
struct quadd_mmap_data {
u32 pid;
+
u64 addr;
u64 len;
- u32 pgoff;
+ u8 user_mode:1;
u16 filename_length;
};