diff options
author | Igor Nabirushkin <inabirushkin@nvidia.com> | 2014-11-05 21:10:43 +0400 |
---|---|---|
committer | Winnie Hsu <whsu@nvidia.com> | 2015-01-29 22:04:06 -0800 |
commit | 7bfbc9fa064adf129312e1f37e60ec5f8d17e9ee (patch) | |
tree | f6f78ed2346ad26fe7bb6ecc0d194a2aefedeee9 | |
parent | cd2cd13dc3161d4b3362c2a94dc2442d7e1631fa (diff) |
misc: tegra-profiler: add lower bound of memory
Tegra Profiler: add lower bound of memory for unwinding.
Bug 1574379
Bug 1598009
Change-Id: Ia3c412caa0c2adfe603c08b3916bd57f3ea14255
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/594457
(cherry picked from commit e94dc4b70c045322c27d83fbe56a3c9690258443)
Reviewed-on: http://git-master/r/672029
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
-rw-r--r-- | drivers/misc/tegra-profiler/backtrace.c | 5 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/backtrace.h | 4 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/hrt.c | 4 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/hrt.h | 2 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/main.c | 8 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/version.h | 2 | ||||
-rw-r--r-- | include/linux/tegra_profiler.h | 4 |
7 files changed, 23 insertions, 6 deletions
diff --git a/drivers/misc/tegra-profiler/backtrace.c b/drivers/misc/tegra-profiler/backtrace.c index e9f01471a594..5c03114ee750 100644 --- a/drivers/misc/tegra-profiler/backtrace.c +++ b/drivers/misc/tegra-profiler/backtrace.c @@ -26,6 +26,7 @@ #include "backtrace.h" #include "eh_unwind.h" #include "dwarf_unwind.h" +#include "hrt.h" static inline int is_thumb_mode(struct pt_regs *regs) @@ -92,7 +93,9 @@ int quadd_callchain_store(struct quadd_callchain *cc, unsigned long ip, unsigned int type) { - if (!validate_pc_addr(ip, sizeof(unsigned long))) { + unsigned long low_addr = cc->hrt->low_addr; + + if (ip < low_addr || !validate_pc_addr(ip, sizeof(unsigned long))) { cc->unw_rc = QUADD_URC_PC_INCORRECT; return 0; } diff --git a/drivers/misc/tegra-profiler/backtrace.h b/drivers/misc/tegra-profiler/backtrace.h index 233480436549..3046ac60fdb5 100644 --- a/drivers/misc/tegra-profiler/backtrace.h +++ b/drivers/misc/tegra-profiler/backtrace.h @@ -25,6 +25,8 @@ #define QUADD_UNW_TYPES_SIZE \ DIV_ROUND_UP(QUADD_MAX_STACK_DEPTH * 4, sizeof(u32) * BITS_PER_BYTE) +struct quadd_hrt_ctx; + struct quadd_callchain { int nr; @@ -43,6 +45,8 @@ struct quadd_callchain { unsigned long curr_sp; unsigned long curr_fp; unsigned long curr_pc; + + struct quadd_hrt_ctx *hrt; }; struct quadd_ctx; diff --git a/drivers/misc/tegra-profiler/hrt.c b/drivers/misc/tegra-profiler/hrt.c index e781147367c9..1850f3f8003c 100644 --- a/drivers/misc/tegra-profiler/hrt.c +++ b/drivers/misc/tegra-profiler/hrt.c @@ -720,7 +720,7 @@ struct quadd_hrt_ctx *quadd_hrt_init(struct quadd_ctx *ctx) if (!hrt.cpu_ctx) return ERR_PTR(-ENOMEM); - for (cpu_id = 0; cpu_id < nr_cpu_ids; cpu_id++) { + for_each_possible_cpu(cpu_id) { cpu_ctx = per_cpu_ptr(hrt.cpu_ctx, cpu_id); atomic_set(&cpu_ctx->nr_active, 0); @@ -728,6 +728,8 @@ struct quadd_hrt_ctx *quadd_hrt_init(struct quadd_ctx *ctx) cpu_ctx->active_thread.pid = -1; cpu_ctx->active_thread.tgid = -1; + cpu_ctx->cc.hrt = &hrt; + init_hrtimer(cpu_ctx); } diff --git a/drivers/misc/tegra-profiler/hrt.h b/drivers/misc/tegra-profiler/hrt.h index baff679550e1..47662fbf7682 100644 --- a/drivers/misc/tegra-profiler/hrt.h +++ b/drivers/misc/tegra-profiler/hrt.h @@ -43,7 +43,9 @@ struct timecounter; struct quadd_hrt_ctx { struct quadd_cpu_context * __percpu cpu_ctx; + u64 sample_period; + unsigned long low_addr; struct quadd_ctx *quadd_ctx; diff --git a/drivers/misc/tegra-profiler/main.c b/drivers/misc/tegra-profiler/main.c index ff4bdd18375f..1e967a419bef 100644 --- a/drivers/misc/tegra-profiler/main.c +++ b/drivers/misc/tegra-profiler/main.c @@ -167,13 +167,13 @@ validate_freq(unsigned int freq) static int set_parameters(struct quadd_parameters *p, uid_t *debug_app_uid) { - int i, err; + int i, err, uid = 0; int pmu_events_id[QUADD_MAX_COUNTERS]; int pl310_events_id; int nr_pmu = 0, nr_pl310 = 0; - int uid = 0; struct task_struct *task; unsigned int extra; + u64 *low_addr_p; if (!validate_freq(p->freq)) { pr_err("%s: incorrect frequency: %u\n", __func__, p->freq); @@ -297,6 +297,10 @@ set_parameters(struct quadd_parameters *p, uid_t *debug_app_uid) if (extra & QUADD_PARAM_EXTRA_BT_MIXED) pr_info("unwinding: mixed mode\n"); + low_addr_p = (u64 *)&p->reserved[QUADD_PARAM_IDX_BT_LOWER_BOUND]; + ctx.hrt->low_addr = (unsigned long)*low_addr_p; + pr_info("bt lower bound: %#lx\n", ctx.hrt->low_addr); + err = quadd_unwind_start(task); if (err) return err; diff --git a/drivers/misc/tegra-profiler/version.h b/drivers/misc/tegra-profiler/version.h index e6238bb56a7a..1c12e5afb604 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.82" +#define QUADD_MODULE_VERSION "1.83" #define QUADD_MODULE_BRANCH "Dev" #endif /* __QUADD_VERSION_H */ diff --git a/include/linux/tegra_profiler.h b/include/linux/tegra_profiler.h index affbec553a69..ad62d9a8e918 100644 --- a/include/linux/tegra_profiler.h +++ b/include/linux/tegra_profiler.h @@ -20,7 +20,7 @@ #include <linux/ioctl.h> #define QUADD_SAMPLES_VERSION 30 -#define QUADD_IO_VERSION 14 +#define QUADD_IO_VERSION 15 #define QUADD_IO_VERSION_DYNAMIC_RB 5 #define QUADD_IO_VERSION_RB_MAX_FILL_COUNT 6 @@ -32,6 +32,7 @@ #define QUADD_IO_VERSION_EXTABLES_MMAP 12 #define QUADD_IO_VERSION_ARCH_TIMER_OPT 13 #define QUADD_IO_VERSION_DATA_MMAP 14 +#define QUADD_IO_VERSION_BT_LOWER_BOUND 15 #define QUADD_SAMPLE_VERSION_THUMB_MODE_FLAG 17 #define QUADD_SAMPLE_VERSION_GROUP_SAMPLES 18 @@ -345,6 +346,7 @@ struct quadd_record_data { enum { QUADD_PARAM_IDX_SIZE_OF_RB = 0, QUADD_PARAM_IDX_EXTRA = 1, + QUADD_PARAM_IDX_BT_LOWER_BOUND = 2, }; #define QUADD_PARAM_EXTRA_GET_MMAP (1 << 0) |