summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/tegra-profiler/debug.c18
-rw-r--r--drivers/misc/tegra-profiler/hrt.c21
-rw-r--r--drivers/misc/tegra-profiler/hrt.h8
-rw-r--r--drivers/misc/tegra-profiler/main.c17
-rw-r--r--drivers/misc/tegra-profiler/mmap.c4
-rw-r--r--drivers/misc/tegra-profiler/version.h2
6 files changed, 42 insertions, 28 deletions
diff --git a/drivers/misc/tegra-profiler/debug.c b/drivers/misc/tegra-profiler/debug.c
index b7acd9499934..50c3d1d6c041 100644
--- a/drivers/misc/tegra-profiler/debug.c
+++ b/drivers/misc/tegra-profiler/debug.c
@@ -1,7 +1,7 @@
/*
* drivers/misc/tegra-profiler/debug.c
*
- * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -68,7 +68,7 @@ void qm_debug_handler_sample(struct pt_regs *regs)
s->type = QM_DEBUG_SAMPLE_TYPE_TIMER_HANDLE;
- quadd_put_sample(&record, NULL, 0);
+ quadd_put_sample_this_cpu(&record, NULL, 0);
}
void qm_debug_timer_forward(struct pt_regs *regs, u64 period)
@@ -80,7 +80,7 @@ void qm_debug_timer_forward(struct pt_regs *regs, u64 period)
s->type = QM_DEBUG_SAMPLE_TYPE_TIMER_FORWARD;
- quadd_put_sample(&record, NULL, 0);
+ quadd_put_sample_this_cpu(&record, NULL, 0);
}
void qm_debug_timer_start(struct pt_regs *regs, u64 period)
@@ -92,7 +92,7 @@ void qm_debug_timer_start(struct pt_regs *regs, u64 period)
s->type = QM_DEBUG_SAMPLE_TYPE_TIMER_START;
- quadd_put_sample(&record, NULL, 0);
+ quadd_put_sample_this_cpu(&record, NULL, 0);
}
void qm_debug_timer_cancel(void)
@@ -104,7 +104,7 @@ void qm_debug_timer_cancel(void)
s->type = QM_DEBUG_SAMPLE_TYPE_TIMER_CANCEL;
- quadd_put_sample(&record, NULL, 0);
+ quadd_put_sample_this_cpu(&record, NULL, 0);
}
void
@@ -124,7 +124,7 @@ qm_debug_task_sched_in(pid_t prev_pid, pid_t current_pid, int prev_nr_active)
vec.base = &prev_nr_active;
vec.len = s->extra_length = sizeof(prev_nr_active);
- quadd_put_sample(&record, &vec, 1);
+ quadd_put_sample_this_cpu(&record, &vec, 1);
}
void qm_debug_read_counter(int event_id, u32 prev_val, u32 val)
@@ -143,7 +143,7 @@ void qm_debug_read_counter(int event_id, u32 prev_val, u32 val)
vec.base = &val;
vec.len = s->extra_length = sizeof(val);
- quadd_put_sample(&record, &vec, 1);
+ quadd_put_sample_this_cpu(&record, &vec, 1);
}
void qm_debug_start_source(int source_type)
@@ -156,7 +156,7 @@ void qm_debug_start_source(int source_type)
s->type = QM_DEBUG_SAMPLE_TYPE_SOURCE_START;
s->extra_value[0] = source_type;
- quadd_put_sample(&record, NULL, 0);
+ quadd_put_sample_this_cpu(&record, NULL, 0);
}
void qm_debug_stop_source(int source_type)
@@ -169,7 +169,7 @@ void qm_debug_stop_source(int source_type)
s->type = QM_DEBUG_SAMPLE_TYPE_SOURCE_STOP;
s->extra_value[0] = source_type;
- quadd_put_sample(&record, NULL, 0);
+ quadd_put_sample_this_cpu(&record, NULL, 0);
}
#endif /* QM_DEBUG_SAMPLES_ENABLE */
diff --git a/drivers/misc/tegra-profiler/hrt.c b/drivers/misc/tegra-profiler/hrt.c
index b7bd00c795ac..8081a03cd6b1 100644
--- a/drivers/misc/tegra-profiler/hrt.c
+++ b/drivers/misc/tegra-profiler/hrt.c
@@ -120,9 +120,9 @@ u64 quadd_get_time(void)
}
static void
-put_sample_cpu(struct quadd_record_data *data,
- struct quadd_iovec *vec,
- int vec_count, int cpu_id)
+__put_sample(struct quadd_record_data *data,
+ struct quadd_iovec *vec,
+ int vec_count, int cpu_id)
{
ssize_t err;
struct quadd_comm_data_interface *comm = hrt.quadd_ctx->comm;
@@ -135,10 +135,17 @@ put_sample_cpu(struct quadd_record_data *data,
}
void
+quadd_put_sample_this_cpu(struct quadd_record_data *data,
+ struct quadd_iovec *vec, int vec_count)
+{
+ __put_sample(data, vec, vec_count, -1);
+}
+
+void
quadd_put_sample(struct quadd_record_data *data,
struct quadd_iovec *vec, int vec_count)
{
- put_sample_cpu(data, vec, vec_count, -1);
+ __put_sample(data, vec, vec_count, 0);
}
static void put_header(void)
@@ -202,7 +209,7 @@ static void put_header(void)
vec.len = nr_events * sizeof(events[0]);
for_each_possible_cpu(cpu_id)
- put_sample_cpu(&record, &vec, 1, cpu_id);
+ __put_sample(&record, &vec, 1, cpu_id);
}
static void
@@ -227,7 +234,7 @@ put_sched_sample(struct task_struct *task, int is_sched_in)
s->data[0] = 0;
s->data[1] = 0;
- quadd_put_sample(&record, NULL, 0);
+ quadd_put_sample_this_cpu(&record, NULL, 0);
}
static int get_sample_data(struct quadd_sample_data *sample,
@@ -461,7 +468,7 @@ read_all_sources(struct pt_regs *regs, struct task_struct *task)
s->state = 0;
}
- quadd_put_sample(&record_data, vec, vec_idx);
+ quadd_put_sample_this_cpu(&record_data, vec, vec_idx);
}
static inline int
diff --git a/drivers/misc/tegra-profiler/hrt.h b/drivers/misc/tegra-profiler/hrt.h
index 9fd9c97d238a..172e2f1719dd 100644
--- a/drivers/misc/tegra-profiler/hrt.h
+++ b/drivers/misc/tegra-profiler/hrt.h
@@ -83,8 +83,12 @@ void quadd_hrt_deinit(void);
int quadd_hrt_start(void);
void quadd_hrt_stop(void);
-void quadd_put_sample(struct quadd_record_data *data,
- struct quadd_iovec *vec, int vec_count);
+void
+quadd_put_sample_cur_cpu(struct quadd_record_data *data,
+ struct quadd_iovec *vec, int vec_count);
+void
+quadd_put_sample(struct quadd_record_data *data,
+ struct quadd_iovec *vec, int vec_count);
void quadd_hrt_get_state(struct quadd_module_state *state);
u64 quadd_get_time(void);
diff --git a/drivers/misc/tegra-profiler/main.c b/drivers/misc/tegra-profiler/main.c
index f0116af49035..0f1237fe57f4 100644
--- a/drivers/misc/tegra-profiler/main.c
+++ b/drivers/misc/tegra-profiler/main.c
@@ -85,6 +85,8 @@ static int start(void)
return -EBUSY;
}
+ preempt_disable();
+
if (!atomic_cmpxchg(&ctx.started, 0, 1)) {
if (ctx.pmu) {
err = ctx.pmu->enable();
@@ -117,16 +119,21 @@ static int start(void)
}
}
+ preempt_enable();
return 0;
errout:
atomic_set(&ctx.started, 0);
tegra_profiler_unlock();
+ preempt_enable();
+
return err;
}
static void stop(void)
{
+ preempt_disable();
+
if (atomic_cmpxchg(&ctx.started, 1, 0)) {
quadd_hrt_stop();
@@ -143,6 +150,8 @@ static void stop(void)
tegra_profiler_unlock();
}
+
+ preempt_enable();
}
static inline int is_event_supported(struct source_info *si, int event)
@@ -180,13 +189,7 @@ set_parameters(struct quadd_parameters *p, uid_t *debug_app_uid)
return -EINVAL;
}
- ctx.param.freq = p->freq;
- ctx.param.ma_freq = p->ma_freq;
- ctx.param.backtrace = p->backtrace;
- ctx.param.use_freq = p->use_freq;
- ctx.param.system_wide = p->system_wide;
- ctx.param.power_rate_freq = p->power_rate_freq;
- ctx.param.debug_samples = p->debug_samples;
+ ctx.param = *p;
for (i = 0; i < ARRAY_SIZE(p->reserved); i++)
ctx.param.reserved[i] = p->reserved[i];
diff --git a/drivers/misc/tegra-profiler/mmap.c b/drivers/misc/tegra-profiler/mmap.c
index 9e3e05f305a5..2347047d9873 100644
--- a/drivers/misc/tegra-profiler/mmap.c
+++ b/drivers/misc/tegra-profiler/mmap.c
@@ -76,7 +76,7 @@ void quadd_process_mmap(struct vm_area_struct *vma, pid_t pid)
if (!(vma->vm_flags & VM_EXEC))
return;
- tmp_buf = kzalloc(PATH_MAX + sizeof(u64), GFP_KERNEL);
+ tmp_buf = kzalloc(PATH_MAX + sizeof(u64), GFP_ATOMIC);
if (!tmp_buf)
return;
@@ -164,7 +164,7 @@ int quadd_get_current_mmap(pid_t pid)
pr_info("Get mapped memory objects\n");
- tmp_buf = kzalloc(PATH_MAX + sizeof(u64), GFP_KERNEL);
+ tmp_buf = kzalloc(PATH_MAX + sizeof(u64), GFP_ATOMIC);
if (!tmp_buf)
return -ENOMEM;
diff --git a/drivers/misc/tegra-profiler/version.h b/drivers/misc/tegra-profiler/version.h
index c96c50756d37..7b3fc20f6334 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.87"
+#define QUADD_MODULE_VERSION "1.88"
#define QUADD_MODULE_BRANCH "Dev"
#endif /* __QUADD_VERSION_H */