qcacmn: Add debug change to record timestamp

This change adds timestamp information for every memory
allocated and mapped for debugging purposes.

Change-Id: Iba8e720790b863ae11c528a02f5c32ea606560dd
CRs-Fixed: 2236213
This commit is contained in:
Rakshith Suresh Patkar
2018-05-15 12:44:39 +05:30
committed by nshrivas
parent c9b0931950
commit 81f4f19830

View File

@@ -85,6 +85,7 @@ static inline qdf_list_t *qdf_mem_dma_list(enum qdf_debug_domain domain)
* @size: size of the allocation in bytes * @size: size of the allocation in bytes
* @caller: Caller of the function for which memory is allocated * @caller: Caller of the function for which memory is allocated
* @header: a known value, used to detect out-of-bounds access * @header: a known value, used to detect out-of-bounds access
* @time: timestamp at which allocation was made
*/ */
struct qdf_mem_header { struct qdf_mem_header {
qdf_list_node_t node; qdf_list_node_t node;
@@ -95,6 +96,7 @@ struct qdf_mem_header {
uint32_t size; uint32_t size;
void *caller; void *caller;
uint64_t header; uint64_t header;
uint64_t time;
}; };
static uint64_t WLAN_MEM_HEADER = 0x6162636465666768; static uint64_t WLAN_MEM_HEADER = 0x6162636465666768;
@@ -154,6 +156,7 @@ static void qdf_mem_header_init(struct qdf_mem_header *header, qdf_size_t size,
header->size = size; header->size = size;
header->caller = caller; header->caller = caller;
header->header = WLAN_MEM_HEADER; header->header = WLAN_MEM_HEADER;
header->time = qdf_get_log_timestamp();
} }
enum qdf_mem_validation_bitmap { enum qdf_mem_validation_bitmap {
@@ -359,7 +362,7 @@ static int seq_printf_printer(void *priv, const char *fmt, ...)
* @size: the size of allocation * @size: the size of allocation
* @caller: Address of the caller function * @caller: Address of the caller function
* @count: how many allocations of same type * @count: how many allocations of same type
* * @time: timestamp at which allocation happened
*/ */
struct __qdf_mem_info { struct __qdf_mem_info {
char file[QDF_MEM_FILE_NAME_SIZE]; char file[QDF_MEM_FILE_NAME_SIZE];
@@ -367,6 +370,7 @@ struct __qdf_mem_info {
uint32_t size; uint32_t size;
void *caller; void *caller;
uint32_t count; uint32_t count;
uint64_t time;
}; };
/* /*
@@ -387,7 +391,8 @@ static void qdf_mem_domain_print_header(qdf_abstract_print print,
{ {
print(print_priv, print(print_priv,
"--------------------------------------------------------------"); "--------------------------------------------------------------");
print(print_priv, " count size total filename caller"); print(print_priv,
" count size total filename caller timestamp");
print(print_priv, print(print_priv,
"--------------------------------------------------------------"); "--------------------------------------------------------------");
} }
@@ -417,12 +422,13 @@ static void qdf_mem_meta_table_print(struct __qdf_mem_info *table,
break; break;
print(print_priv, print(print_priv,
"%6u x %5u = %7uB @ %s:%u %pS", "%6u x %5u = %7uB @ %s:%u %pS %llu",
table[i].count, table[i].count,
table[i].size, table[i].size,
table[i].count * table[i].size, table[i].count * table[i].size,
table[i].file, table[i].file,
table[i].line, table[i].caller); table[i].line, table[i].caller,
table[i].time);
len += qdf_scnprintf(debug_str + len, len += qdf_scnprintf(debug_str + len,
sizeof(debug_str) - len, sizeof(debug_str) - len,
" @ %s:%u %pS", " @ %s:%u %pS",
@@ -453,6 +459,7 @@ static bool qdf_mem_meta_table_insert(struct __qdf_mem_info *table,
table[i].size = meta->size; table[i].size = meta->size;
table[i].count = 1; table[i].count = 1;
table[i].caller = meta->caller; table[i].caller = meta->caller;
table[i].time = meta->time;
break; break;
} }