misc: tegra-profiler: add thumb flag into samples
Igor Nabirushkin [Tue, 24 Sep 2013 13:34:09 +0000 (17:34 +0400)]
Tegra Profiler misc driver: thumb mode flag was
added into samples

Bug 1374335

Change-Id: If1a6b7e57071f6c9d645bc790e24cd1e3e405b6f
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/324082
(cherry picked from commit 293d786bcb5211333e269f61d8d23e286ee3c28b)
Reviewed-on: http://git-master/r/340012
Reviewed-by: Harry Hong <hhong@nvidia.com>
Tested-by: Harry Hong <hhong@nvidia.com>

drivers/misc/tegra-profiler/debug.c
drivers/misc/tegra-profiler/hrt.c
drivers/misc/tegra-profiler/tegra.h
drivers/misc/tegra-profiler/version.h
include/linux/tegra_profiler.h

index e0270a3..fbe95b5 100644 (file)
@@ -42,7 +42,7 @@ init_sample(struct quadd_record_data *record, struct pt_regs *regs)
                record->cpu_mode = user_mode(regs) ?
                        QUADD_CPU_MODE_USER : QUADD_CPU_MODE_KERNEL;
 
-       s->cpu = quadd_get_processor_id();
+       s->cpu = quadd_get_processor_id(regs);
        s->pid = 0;
        s->time = quadd_get_time();
        s->timer_period = 0;
index f0a8b27..0066f3a 100644 (file)
@@ -203,7 +203,7 @@ static int get_sample_data(struct event_data *event,
        sample->event_id = event->event_id;
 
        sample->ip = instruction_pointer(regs);
-       sample->cpu = quadd_get_processor_id();
+       sample->cpu = quadd_get_processor_id(regs);
        sample->time = get_sample_time();
 
        if (prev_val <= val)
@@ -388,7 +388,7 @@ void __quadd_task_sched_in(struct task_struct *prev,
 /*
        if (__ratelimit(&ratelimit_state))
                pr_info("sch_in, cpu: %d, prev: %u (%u) \t--> curr: %u (%u)\n",
-                       quadd_get_processor_id(), (unsigned int)prev->pid,
+                       smp_processor_id(), (unsigned int)prev->pid,
                        (unsigned int)prev->tgid, (unsigned int)task->pid,
                        (unsigned int)task->tgid);
 */
@@ -424,11 +424,10 @@ void __quadd_task_sched_out(struct task_struct *prev,
 /*
        if (__ratelimit(&ratelimit_state))
                pr_info("sch_out: cpu: %d, prev: %u (%u) \t--> next: %u (%u)\n",
-                       quadd_get_processor_id(), (unsigned int)prev->pid,
+                       smp_processor_id(), (unsigned int)prev->pid,
                        (unsigned int)prev->tgid, (unsigned int)next->pid,
                        (unsigned int)next->tgid);
 */
-
        prev_flag = is_profile_process(prev->tgid);
 
        if (prev_flag) {
index 013c5ab..65cd6cd 100644 (file)
 #define __QUADD_TEGRA_H
 
 #include <linux/smp.h>
+#include <asm/ptrace.h>
 
 #ifdef CONFIG_TEGRA_CLUSTER_CONTROL
 #include <linux/io.h>
 #include <../../mach-tegra/pm.h>
 #endif
 
-static inline int quadd_get_processor_id(void)
+static inline int quadd_get_processor_id(struct pt_regs *regs)
 {
        int cpu_id = smp_processor_id();
 
 #ifdef CONFIG_TEGRA_CLUSTER_CONTROL
        if (is_lp_cluster())
-               cpu_id |= QM_TEGRA_POWER_CLUSTER_LP;
+               cpu_id |= QUADD_CPUMODE_TEGRA_POWER_CLUSTER_LP;
 #endif
 
+       if (thumb_mode(regs))
+               cpu_id |= QUADD_CPUMODE_THUMB;
+
        return cpu_id;
 }
 
index 91fade5..6b0f795 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef __QUADD_VERSION_H
 #define __QUADD_VERSION_H
 
-#define QUADD_MODULE_VERSION           "1.33"
+#define QUADD_MODULE_VERSION           "1.34"
 #define QUADD_MODULE_BRANCH            "Dev"
 
 #endif /* __QUADD_VERSION_H */
index 2efa9c1..823b05e 100644 (file)
 
 #include <linux/ioctl.h>
 
-#define QUADD_SAMPLES_VERSION  16
+#define QUADD_SAMPLES_VERSION  17
 #define QUADD_IO_VERSION       6
 
 #define QUADD_IO_VERSION_DYNAMIC_RB            5
 #define QUADD_IO_VERSION_RB_MAX_FILL_COUNT     6
 
+#define QUADD_SAMPLE_VERSION_THUMB_MODE_FLAG   17
+
 #define QUADD_MAX_COUNTERS     32
 #define QUADD_MAX_PROCESS      64
 
@@ -66,7 +68,8 @@
 
 #define QUADD_HRT_SCHED_IN_FUNC                "finish_task_switch"
 
-#define QM_TEGRA_POWER_CLUSTER_LP      (1 << 29) /* LP CPU */
+#define QUADD_CPUMODE_TEGRA_POWER_CLUSTER_LP   (1 << 29)       /* LP CPU */
+#define QUADD_CPUMODE_THUMB                    (1 << 30)       /* thumb mode */
 
 enum quadd_events_id {
        QUADD_EVENT_TYPE_CPU_CYCLES = 0,