/*
* 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,
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)
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)
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)
s->type = QM_DEBUG_SAMPLE_TYPE_TIMER_CANCEL;
- quadd_put_sample(&record, NULL, 0);
+ quadd_put_sample_this_cpu(&record, NULL, 0);
}
void
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)
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)
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)
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 */
}
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;
atomic64_inc(&hrt.counter_samples);
}
+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)
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
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,
s->state = 0;
}
- quadd_put_sample(&record_data, vec, vec_idx);
+ quadd_put_sample_this_cpu(&record_data, vec, vec_idx);
}
static inline int
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);
return -EBUSY;
}
+ preempt_disable();
+
if (!atomic_cmpxchg(&ctx.started, 0, 1)) {
if (ctx.pmu) {
err = ctx.pmu->enable();
}
}
+ 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();
tegra_profiler_unlock();
}
+
+ preempt_enable();
}
static inline int is_event_supported(struct source_info *si, int event)
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];
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;
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;
#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 */