Переглянути джерело

Merge "dsp-kernel: Adding locks while printing debug data"

qctecmdr 1 рік тому
батько
коміт
f2961aceca
1 змінених файлів з 30 додано та 12 видалено
  1. 30 12
      dsp/adsprpc.c

+ 30 - 12
dsp/adsprpc.c

@@ -7693,6 +7693,27 @@ static void fastrpc_print_fastrpcbuf(struct fastrpc_buf *buf, void *buffer)
 			buf->flags, buf->type, buf->in_use);
 }
 
+/*
+ *  fastrpc_print_map : Print fastrpc_map structure parameter.
+ *  @args1: structure fastrpc_map, map whose details needs
+ *			to because printed.
+ *  @args1: buffer for storing the string consisting details
+ */
+static void fastrpc_print_map(struct fastrpc_mmap *map, void *buffer)
+{
+	scnprintf(buffer +
+			strlen(buffer),
+			MINI_DUMP_DBG_SIZE -
+			strlen(buffer),
+			fastrpc_mmap_params,
+			map->fd,
+			map->flags, map->buf,
+			map->phys, map->size,
+			map->va, map->raddr,
+			map->len, map->refs,
+			map->secure);
+}
+
 /*
  *  fastrpc_print_debug_data : Print debug structure variable in CMA memory.
  *  Input cid: Channel id
@@ -7774,19 +7795,17 @@ static void  fastrpc_print_debug_data(int cid)
 					MINI_DUMP_DBG_SIZE -
 					strlen(mini_dump_buff),
 					"\nSession Maps\n");
+			hlist_for_each_entry_safe(map, n, &me->maps, hn) {
+				fastrpc_print_map(map, mini_dump_buff);
+			}
+			spin_unlock_irqrestore(&me->hlock, irq_flags);
+			mutex_lock(&fl->map_mutex);
 			hlist_for_each_entry_safe(map, n, &fl->maps, hn) {
-				scnprintf(mini_dump_buff +
-						strlen(mini_dump_buff),
-						MINI_DUMP_DBG_SIZE -
-						strlen(mini_dump_buff),
-						fastrpc_mmap_params,
-						map->fd,
-						map->flags, map->buf,
-						map->phys, map->size,
-						map->va, map->raddr,
-						map->len, map->refs,
-						map->secure);
+				fastrpc_print_map(map, mini_dump_buff);
 			}
+			mutex_unlock(&fl->map_mutex);
+			spin_lock_irqsave(&me->hlock, irq_flags);
+			spin_lock(&fl->hlock);
 			scnprintf(mini_dump_buff + strlen(mini_dump_buff),
 					MINI_DUMP_DBG_SIZE - strlen(mini_dump_buff),
 					"\ncached_bufs\n");
@@ -7823,7 +7842,6 @@ static void  fastrpc_print_debug_data(int cid)
 					"\nfl->secsctx->smmu.cb : %d\n",
 					fl->secsctx->smmu.cb);
 			}
-			spin_lock(&fl->hlock);
 			scnprintf(mini_dump_buff +
 					strlen(mini_dump_buff),
 					MINI_DUMP_DBG_SIZE -