浏览代码

qcacmn: Add support to disable the panics in memory debug

Support to disable panics in qdf memory debug. This can be used when KASAN
or SLUB or SKB debug options are enabled

CRs-Fixed: 2580399
Change-Id: If8617a16d0b96279f0afef8299632662dea498bf
Shwetha G K 5 年之前
父节点
当前提交
9be8b1fe75
共有 3 个文件被更改,包括 19 次插入9 次删除
  1. 10 0
      qdf/linux/src/i_qdf_mem.h
  2. 7 7
      qdf/linux/src/qdf_mem.c
  3. 2 2
      qdf/linux/src/qdf_nbuf.c

+ 10 - 0
qdf/linux/src/i_qdf_mem.h

@@ -100,6 +100,16 @@ typedef struct __qdf_mempool_ctxt {
 
 #define __qdf_align(a, mask) ALIGN(a, mask)
 
+#ifdef DISABLE_MEMDEBUG_PANIC
+#define QDF_MEMDEBUG_PANIC(reason_fmt, args...) \
+	do { \
+		/* no-op */ \
+	} while (false)
+#else
+#define QDF_MEMDEBUG_PANIC(reason_fmt, args...) \
+	QDF_DEBUG_PANIC(reason_fmt, ## args)
+#endif
+
 /* typedef for dma_data_direction */
 typedef enum dma_data_direction __dma_data_direction;
 

+ 7 - 7
qdf/linux/src/qdf_mem.c

@@ -248,7 +248,7 @@ qdf_mem_header_assert_valid(struct qdf_mem_header *header,
 			qdf_debug_domain_name(header->domain), header->domain,
 			qdf_debug_domain_name(current_domain), current_domain);
 
-	QDF_DEBUG_PANIC("Fatal memory error detected @ %s:%d", func, line);
+	QDF_MEMDEBUG_PANIC("Fatal memory error detected @ %s:%d", func, line);
 }
 #endif /* MEMORY_DEBUG */
 
@@ -968,8 +968,8 @@ static void qdf_mem_domain_set_check_for_leaks(qdf_list_t *domains)
 		leak_count += qdf_mem_domain_check_for_leaks(i, domains + i);
 
 	if (leak_count)
-		QDF_DEBUG_PANIC("%u fatal memory leaks detected!",
-				leak_count);
+		QDF_MEMDEBUG_PANIC("%u fatal memory leaks detected!",
+				   leak_count);
 }
 
 /**
@@ -1071,8 +1071,8 @@ void qdf_mem_free_debug(void *ptr, const char *func, uint32_t line)
 		return;
 
 	if (qdf_unlikely((qdf_size_t)ptr <= sizeof(*header)))
-		QDF_DEBUG_PANIC("Failed to free invalid memory location %pK",
-				ptr);
+		QDF_MEMDEBUG_PANIC("Failed to free invalid memory location %pK",
+				   ptr);
 
 	qdf_talloc_assert_no_children_fl(ptr, func, line);
 
@@ -1110,8 +1110,8 @@ void qdf_mem_check_for_leaks(void)
 	leaks_count += qdf_mem_domain_check_for_leaks(current_domain, dma_list);
 
 	if (leaks_count)
-		QDF_DEBUG_PANIC("%u fatal memory leaks detected!",
-				leaks_count);
+		QDF_MEMDEBUG_PANIC("%u fatal memory leaks detected!",
+				   leaks_count);
 }
 
 /**

+ 2 - 2
qdf/linux/src/qdf_nbuf.c

@@ -794,8 +794,8 @@ static void qdf_nbuf_panic_on_free_if_mapped(qdf_nbuf_t nbuf,
 				&map_func, &map_line))
 		return;
 
-	QDF_DEBUG_PANIC("Nbuf freed @ %s:%u while mapped from %s:%u",
-			func, line, map_func, map_line);
+	QDF_MEMDEBUG_PANIC("Nbuf freed @ %s:%u while mapped from %s:%u",
+			   func, line, map_func, map_line);
 }
 #else
 static inline void qdf_nbuf_map_tracking_init(void)