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>
#include "backtrace.h"
#include "eh_unwind.h"
#include "dwarf_unwind.h"
+#include "hrt.h"
static inline int
is_thumb_mode(struct pt_regs *regs)
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;
}
#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;
unsigned long curr_sp;
unsigned long curr_fp;
unsigned long curr_pc;
+
+ struct quadd_hrt_ctx *hrt;
};
struct quadd_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);
cpu_ctx->active_thread.pid = -1;
cpu_ctx->active_thread.tgid = -1;
+ cpu_ctx->cc.hrt = &hrt;
+
init_hrtimer(cpu_ctx);
}
struct quadd_hrt_ctx {
struct quadd_cpu_context * __percpu cpu_ctx;
+
u64 sample_period;
+ unsigned long low_addr;
struct quadd_ctx *quadd_ctx;
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);
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;
#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 */
#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
#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
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)