dsp-kernel: Adding locks while printing debug data

Add locking mechanism while printing file map and cma map in print
debug data.

Change-Id: I36484d763b56ec88413ca9394c08ff30d85e664a
Signed-off-by: Ansa Ahmed <quic_ansa@quicinc.com>
This commit is contained in:
Ansa Ahmed
2024-05-21 15:58:20 +05:30
parent cbac754e8e
commit d028daccf5

View File

@@ -7716,6 +7716,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
@@ -7797,19 +7818,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, &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);
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) {
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");
@@ -7846,7 +7865,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 -