diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 0355847f68b0222e73fd6a32fbf21f5ca53987ac..8bc094fd2d80a5b2a47304537d936120830eb2ac 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -900,9 +900,11 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map, uint32_t flags) map->refs--; if (!map->refs) hlist_del_init(&map->hn); - spin_unlock(&me->hlock); - if (map->refs > 0) + if (map->refs > 0) { + spin_unlock(&me->hlock); return; + } + spin_unlock(&me->hlock); } else { if (map->refs) map->refs--; diff --git a/drivers/media/platform/msm/cvp/hfi_response_handler.c b/drivers/media/platform/msm/cvp/hfi_response_handler.c index 5d7d3ae877e907c131056f8871fd53a9e269e7dc..d1d835acf3b3d0d5110bd295d74e87be51bd9330 100644 --- a/drivers/media/platform/msm/cvp/hfi_response_handler.c +++ b/drivers/media/platform/msm/cvp/hfi_response_handler.c @@ -481,6 +481,7 @@ static int hfi_process_session_cvp_msg(u32 device_id, struct msm_cvp_inst *inst = NULL; struct msm_cvp_core *core; void *session_id; + int rc; if (!pkt) { dprintk(CVP_ERR, "%s: invalid param\n", __func__); @@ -515,8 +516,10 @@ static int hfi_process_session_cvp_msg(u32 device_id, msm_cvp_unmap_buf_cpu(inst, ktid); - return _deprecated_hfi_msg_process(device_id, + rc = _deprecated_hfi_msg_process(device_id, pkt, info, inst); + cvp_put_inst(inst); + return rc; } dprintk(CVP_ERR, "Invalid deprecate_bitmask %#x\n", inst->deprecate_bitmask); diff --git a/drivers/media/platform/msm/cvp/msm_cvp_core.c b/drivers/media/platform/msm/cvp/msm_cvp_core.c index f970d1df4b988ebf3b0841c7df3142915f34d6e0..67f710a2a88f11d1d7773f5ba694880b83f64c97 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_core.c +++ b/drivers/media/platform/msm/cvp/msm_cvp_core.c @@ -196,16 +196,16 @@ int msm_cvp_private(void *cvp_inst, unsigned int cmd, } EXPORT_SYMBOL(msm_cvp_private); -static bool msm_cvp_check_for_inst_overload(struct msm_cvp_core *core) +static bool msm_cvp_check_for_inst_overload(struct msm_cvp_core *core, + u32 *instance_count) { - u32 instance_count = 0; u32 secure_instance_count = 0; struct msm_cvp_inst *inst = NULL; bool overload = false; mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) { - instance_count++; + (*instance_count)++; /* This flag is not updated yet for the current instance */ if (inst->flags & CVP_SECURE) secure_instance_count++; @@ -214,7 +214,7 @@ static bool msm_cvp_check_for_inst_overload(struct msm_cvp_core *core) /* Instance count includes current instance as well. */ - if ((instance_count >= core->resources.max_inst_count) || + if ((*instance_count >= core->resources.max_inst_count) || (secure_instance_count >= core->resources.max_secure_inst_count)) overload = true; @@ -254,6 +254,7 @@ void *msm_cvp_open(int core_id, int session_type) struct msm_cvp_core *core = NULL; int rc = 0; int i = 0; + u32 instance_count = 0; if (core_id >= MSM_CVP_CORES_MAX || session_type >= MSM_CVP_MAX_DEVICES) { @@ -269,13 +270,15 @@ void *msm_cvp_open(int core_id, int session_type) } core->resources.max_inst_count = MAX_SUPPORTED_INSTANCES; - if (msm_cvp_check_for_inst_overload(core)) { + if (msm_cvp_check_for_inst_overload(core, &instance_count)) { dprintk(CVP_ERR, "Instance num reached Max, rejecting session"); mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) - dprintk(CVP_ERR, "inst %pK, cmd %d id %d\n", - inst, inst->cur_cmd_type, - hash32_ptr(inst->session)); + dprintk(CVP_ERR, + "%s inst stype %d %pK, cmd %d id %#x kref %#x\n", + inst->proc_name, inst->session_type, inst, + inst->cur_cmd_type, hash32_ptr(inst->session), + kref_read(&inst->kref)); mutex_unlock(&core->lock); return NULL; @@ -288,7 +291,10 @@ void *msm_cvp_open(int core_id, int session_type) goto err_invalid_core; } - pr_info(CVP_DBG_TAG "Opening cvp instance: %pK\n", "info", inst); + pr_info(CVP_DBG_TAG + "[%d, %d] %s Opening cvp instance: %pK type %d cnt %d\n", + "info", current->pid, current->tgid, current->comm, inst, + session_type, instance_count); mutex_init(&inst->sync_lock); mutex_init(&inst->lock); mutex_init(&inst->fence_lock); @@ -341,6 +347,7 @@ void *msm_cvp_open(int core_id, int session_type) inst->debugfs_root = msm_cvp_debugfs_init_inst(inst, core->debugfs_root); + strscpy(inst->proc_name, current->comm, 100); return inst; fail_init: _deinit_session_queue(inst); diff --git a/drivers/media/platform/msm/cvp/msm_cvp_internal.h b/drivers/media/platform/msm/cvp/msm_cvp_internal.h index 0a27a827be3e9bc7085bc0499eaabe4a699f5733..ef163d3e0b312f2b29c7787e80bd965d2be2c3f1 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_internal.h +++ b/drivers/media/platform/msm/cvp/msm_cvp_internal.h @@ -337,6 +337,7 @@ struct msm_cvp_inst { struct cvp_session_prop prop; u32 cur_cmd_type; struct mutex fence_lock; + char proc_name[100]; }; struct msm_cvp_fence_thread_data {