summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Nabirushkin <inabirushkin@nvidia.com>2015-03-16 18:08:36 +0400
committerWinnie Hsu <whsu@nvidia.com>2015-05-29 14:26:44 -0700
commite7ee0bf5d1229e6f7d507e8d8929860410f6a854 (patch)
treedb9e63b9a0a3064847b8293dec2e312a977e5b25
parente30edba528782364cfeb680d9719d1c0a6df4f28 (diff)
misc: tegra-profiler: add task states
* Add task states into sched samples. * Store task exit_state field. Bug 1624099 Change-Id: I4a25aa6c15b59da987688342478127dccc5c0a1c Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com> Reviewed-on: http://git-master/r/717839 (cherry picked from commit 9c512cace5ad5d8719a5a8df553cd313e41f4402) Reviewed-on: http://git-master/r/747753 GVS: Gerrit_Virtual_Submit Reviewed-by: Andrey Trachenko <atrachenko@nvidia.com> Reviewed-by: Winnie Hsu <whsu@nvidia.com>
-rw-r--r--drivers/misc/tegra-profiler/hrt.c14
-rw-r--r--drivers/misc/tegra-profiler/version.h2
-rw-r--r--include/linux/tegra_profiler.h8
3 files changed, 19 insertions, 5 deletions
diff --git a/drivers/misc/tegra-profiler/hrt.c b/drivers/misc/tegra-profiler/hrt.c
index 8081a03cd6b1..88a0d967e096 100644
--- a/drivers/misc/tegra-profiler/hrt.c
+++ b/drivers/misc/tegra-profiler/hrt.c
@@ -51,6 +51,11 @@ struct hrt_event_value {
u32 value;
};
+static inline u32 get_task_state(struct task_struct *task)
+{
+ return (u32)(task->state | task->exit_state);
+}
+
static enum hrtimer_restart hrtimer_handler(struct hrtimer *hrtimer)
{
struct pt_regs *regs;
@@ -231,8 +236,8 @@ put_sched_sample(struct task_struct *task, int is_sched_in)
s->reserved = 0;
- s->data[0] = 0;
- s->data[1] = 0;
+ s->data[QUADD_SCHED_IDX_TASK_STATE] = get_task_state(task);
+ s->data[QUADD_SCHED_IDX_RESERVED] = 0;
quadd_put_sample_this_cpu(&record, NULL, 0);
}
@@ -354,6 +359,9 @@ read_all_sources(struct pt_regs *regs, struct task_struct *task)
if (!task)
task = current;
+ if (task_is_dead(task))
+ return;
+
rcu_read_lock();
if (!task_nsproxy(task)) {
rcu_read_unlock();
@@ -458,7 +466,7 @@ read_all_sources(struct pt_regs *regs, struct task_struct *task)
vec[vec_idx].len = nr_positive_events * sizeof(events_extra[0]);
vec_idx++;
- state = task->state;
+ state = get_task_state(task);
if (state) {
s->state = 1;
vec[vec_idx].base = &state;
diff --git a/drivers/misc/tegra-profiler/version.h b/drivers/misc/tegra-profiler/version.h
index bf4c27597c4a..f956c1d40861 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.95"
+#define QUADD_MODULE_VERSION "1.96"
#define QUADD_MODULE_BRANCH "Dev"
#endif /* __QUADD_VERSION_H */
diff --git a/include/linux/tegra_profiler.h b/include/linux/tegra_profiler.h
index f8042dcbe88e..66d5bf240c74 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 31
+#define QUADD_SAMPLES_VERSION 32
#define QUADD_IO_VERSION 17
#define QUADD_IO_VERSION_DYNAMIC_RB 5
@@ -49,6 +49,7 @@
#define QUADD_SAMPLE_VERSION_HDR_UNW_METHOD 29
#define QUADD_SAMPLE_VERSION_HDR_ARCH_TIMER 30
#define QUADD_SAMPLE_VERSION_STACK_OFFSET 31
+#define QUADD_SAMPLE_VERSION_SCHED_TASK_STATE 32
#define QUADD_MMAP_HEADER_VERSION 1
@@ -267,6 +268,11 @@ struct quadd_additional_sample {
u16 extra_length;
};
+enum {
+ QUADD_SCHED_IDX_TASK_STATE = 0,
+ QUADD_SCHED_IDX_RESERVED,
+};
+
struct quadd_sched_data {
u32 pid;
u64 time;