]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
misc: tegra-profiler: add lower bound of memory
authorIgor Nabirushkin <inabirushkin@nvidia.com>
Wed, 5 Nov 2014 17:10:43 +0000 (21:10 +0400)
committerWinnie Hsu <whsu@nvidia.com>
Fri, 30 Jan 2015 06:04:06 +0000 (22:04 -0800)
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>
drivers/misc/tegra-profiler/backtrace.c
drivers/misc/tegra-profiler/backtrace.h
drivers/misc/tegra-profiler/hrt.c
drivers/misc/tegra-profiler/hrt.h
drivers/misc/tegra-profiler/main.c
drivers/misc/tegra-profiler/version.h
include/linux/tegra_profiler.h

index e9f01471a594682dbdc6d1ad3cae12665737d4b9..5c03114ee7509ddf4974ddc8fd5c6281f60d2221 100644 (file)
@@ -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;
        }
index 2334804365490c424b726a6e408c1824a279749a..3046ac60fdb591991140a55bc215f88ba5299cf9 100644 (file)
@@ -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;
index e781147367c9cdea76ef97e731cb5e7fbf784c0e..1850f3f8003c71fbcfb90ca5eb37601e96a4c7d6 100644 (file)
@@ -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);
        }
 
index baff679550e1158721dd43e15592a6c14c6c47de..47662fbf76829518a01353c203e148ce3909a68d 100644 (file)
@@ -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;
 
index ff4bdd18375f3c8157f27e17bac7ad746f41f390..1e967a419befa4b15c188570a7a0e8d997bf89dc 100644 (file)
@@ -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;
index e6238bb56a7aac86ba41548235e7c103b0b5c0bb..1c12e5afb604cb7afc69f8421941186c871c4379 100644 (file)
@@ -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 */
index affbec553a699ce12d520f438012221835363143..ad62d9a8e91829e4f7e25889c180942f1fb0c380 100644 (file)
@@ -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)