summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Nabirushkin <inabirushkin@nvidia.com>2014-01-27 14:08:51 +0400
committerRiham Haidar <rhaidar@nvidia.com>2014-02-19 16:09:44 -0800
commitfab87becbedfe9e508f0273f013cda526193b782 (patch)
treea46de39aeac588dc69ca3bf2c6d49752f4acaa97
parentfdacad01cbe61baf0d3fec310f80fe09f7062077 (diff)
misc: tegra-profiler: reduce size of sample
Tegra Profiler: reduce size of sample magic number was removed Bug 1447839 Change-Id: I14a23f668eab575add872daa35f27653eff643ff Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com> Reviewed-on: http://git-master/r/365904 (cherry picked from commit dbd2e0e3392861eeffff087b577cda0fa501a36b) Reviewed-on: http://git-master/r/368218 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Tested-by: Maxim Morin <mmorin@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r--drivers/misc/tegra-profiler/comm.c19
-rw-r--r--drivers/misc/tegra-profiler/hrt.c2
-rw-r--r--drivers/misc/tegra-profiler/ma.c1
-rw-r--r--drivers/misc/tegra-profiler/mmap.c1
-rw-r--r--drivers/misc/tegra-profiler/power_clk.c1
-rw-r--r--drivers/misc/tegra-profiler/version.h2
-rw-r--r--include/linux/tegra_profiler.h6
7 files changed, 10 insertions, 22 deletions
diff --git a/drivers/misc/tegra-profiler/comm.c b/drivers/misc/tegra-profiler/comm.c
index 98f17a228305..e94bcbf1c831 100644
--- a/drivers/misc/tegra-profiler/comm.c
+++ b/drivers/misc/tegra-profiler/comm.c
@@ -267,23 +267,18 @@ static ssize_t read_sample(char __user *buffer, size_t max_length)
goto out;
}
- if (rb->fill_count < sizeof(struct quadd_record_data))
+ if (rb->fill_count < sizeof(record))
goto out;
- if (!rb_read(rb, (char *)&record, sizeof(struct quadd_record_data)))
+ if (!rb_read(rb, (char *)&record, sizeof(record)))
goto out;
- if (record.magic != QUADD_RECORD_MAGIC) {
- pr_err("Error: bad magic: %#x\n", record.magic);
- goto out;
- }
-
switch (record.record_type) {
case QUADD_RECORD_TYPE_SAMPLE:
sample = &record.sample;
length_extra = sample->callchain_nr * sizeof(quadd_bt_addr_t);
- nr_events = __sw_hweight32(record.sample.events_flags);
+ nr_events = __sw_hweight32(sample->events_flags);
length_extra += nr_events * sizeof(u32);
length_extra += sample->state ? sizeof(u32) : 0;
@@ -324,8 +319,8 @@ static ssize_t read_sample(char __user *buffer, size_t max_length)
goto out;
}
- if (sizeof(struct quadd_record_data) + length_extra > max_length) {
- retval = rb_read_undo(rb, sizeof(struct quadd_record_data));
+ if (sizeof(record) + length_extra > max_length) {
+ retval = rb_read_undo(rb, sizeof(record));
if (retval < 0)
goto out;
@@ -336,7 +331,7 @@ static ssize_t read_sample(char __user *buffer, size_t max_length)
if (length_extra > rb->fill_count)
goto out;
- if (copy_to_user(buffer, &record, sizeof(struct quadd_record_data)))
+ if (copy_to_user(buffer, &record, sizeof(record)))
goto out_fault_error;
if (length_extra > 0) {
@@ -347,7 +342,7 @@ static ssize_t read_sample(char __user *buffer, size_t max_length)
}
spin_unlock_irqrestore(&rb->lock, flags);
- return sizeof(struct quadd_record_data) + length_extra;
+ return sizeof(record) + length_extra;
out_fault_error:
retval = -EFAULT;
diff --git a/drivers/misc/tegra-profiler/hrt.c b/drivers/misc/tegra-profiler/hrt.c
index c6e7bc477b91..ff631a68d698 100644
--- a/drivers/misc/tegra-profiler/hrt.c
+++ b/drivers/misc/tegra-profiler/hrt.c
@@ -113,7 +113,6 @@ static void put_header(void)
struct quadd_event_source_interface *pmu = ctx->pmu;
struct quadd_event_source_interface *pl310 = ctx->pl310;
- record.magic = QUADD_RECORD_MAGIC;
record.record_type = QUADD_RECORD_TYPE_HEADER;
hdr->magic = QUADD_HEADER_MAGIC;
@@ -306,7 +305,6 @@ read_all_sources(struct pt_regs *regs, struct task_struct *task)
}
s->callchain_nr = bt_size;
- record_data.magic = QUADD_RECORD_MAGIC;
record_data.record_type = QUADD_RECORD_TYPE_SAMPLE;
s->events_flags = 0;
diff --git a/drivers/misc/tegra-profiler/ma.c b/drivers/misc/tegra-profiler/ma.c
index a1422cc98445..391331af05c8 100644
--- a/drivers/misc/tegra-profiler/ma.c
+++ b/drivers/misc/tegra-profiler/ma.c
@@ -37,7 +37,6 @@ static void make_sample(struct quadd_hrt_ctx *hrt_ctx,
struct quadd_ma_data *ma = &record.ma;
struct quadd_comm_data_interface *comm = hrt_ctx->quadd_ctx->comm;
- record.magic = QUADD_RECORD_MAGIC;
record.record_type = QUADD_RECORD_TYPE_MA;
ma->pid = pid;
diff --git a/drivers/misc/tegra-profiler/mmap.c b/drivers/misc/tegra-profiler/mmap.c
index cb513bfa7a80..9e7c776a6b9e 100644
--- a/drivers/misc/tegra-profiler/mmap.c
+++ b/drivers/misc/tegra-profiler/mmap.c
@@ -36,7 +36,6 @@ put_mmap_sample(struct quadd_mmap_data *s, char *filename,
struct quadd_iovec vec[2];
u64 pgoff_val = pgoff << PAGE_SHIFT;
- r.magic = QUADD_RECORD_MAGIC;
r.record_type = QUADD_RECORD_TYPE_MMAP;
memcpy(&r.mmap, s, sizeof(*s));
diff --git a/drivers/misc/tegra-profiler/power_clk.c b/drivers/misc/tegra-profiler/power_clk.c
index 261cf87c79b1..d928acaa4ae7 100644
--- a/drivers/misc/tegra-profiler/power_clk.c
+++ b/drivers/misc/tegra-profiler/power_clk.c
@@ -162,7 +162,6 @@ static void make_sample(void)
struct quadd_power_rate_data *power_rate = &record.power_rate;
struct quadd_comm_data_interface *comm = power_ctx.quadd_ctx->comm;
- record.magic = QUADD_RECORD_MAGIC;
record.record_type = QUADD_RECORD_TYPE_POWER_RATE;
power_rate->time = quadd_get_time();
diff --git a/drivers/misc/tegra-profiler/version.h b/drivers/misc/tegra-profiler/version.h
index 46643a29ccc1..97d0a51f90d5 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.48"
+#define QUADD_MODULE_VERSION "1.51"
#define QUADD_MODULE_BRANCH "Dev"
#endif /* __QUADD_VERSION_H */
diff --git a/include/linux/tegra_profiler.h b/include/linux/tegra_profiler.h
index 15205e777550..9a7299e457ed 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 20
+#define QUADD_SAMPLES_VERSION 21
#define QUADD_IO_VERSION 9
#define QUADD_IO_VERSION_DYNAMIC_RB 5
@@ -236,12 +236,10 @@ struct quadd_header_data {
u16 extra_length;
};
-#define QUADD_RECORD_MAGIC 0x335577aa
-
struct quadd_record_data {
- u32 magic; /* temporary, it will be removed later */
u8 record_type;
+ /* sample: it should be the biggest size */
union {
struct quadd_sample_data sample;
struct quadd_mmap_data mmap;