summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 38ab483)
raw | patch | inline | side by side (parent: 38ab483)
author | Buddy Liong <a0270631@ti.com> | |
Fri, 24 Jun 2016 18:53:32 +0000 (13:53 -0500) | ||
committer | Buddy Liong <a0270631@ti.com> | |
Mon, 2 Oct 2017 15:25:14 +0000 (10:25 -0500) |
When client is processing multiple requests for different
process task, IPC3.x doesn't provide the protection to synchronize
the request. This can potentially result in corruption in FC
as multiple requests can come at the same time.
As an example, when 2 clients are requesting codec_process and codec_delete
at the same time, at a very small window FC might think that there are still 2 clients but
somehow one of the alg gets deleted.
Adding the semaphore on the multiple requests (engine_open,
engine_close, codec_create, codec_control, codec_get_version, codec_process,
codec_delete, and dce_SrvDelNotification) to protect the client requests
to be synchronous.
There is no need to add semaphore for get_rporc_info() because the
function is only getting the statistical information from BIOS
utils component.
Change-Id: I80d2899cd6e3c5ac2392bf1fd79e7bcded07c52c
Signed-off-by: Buddy Liong <a0270631@ti.com>
process task, IPC3.x doesn't provide the protection to synchronize
the request. This can potentially result in corruption in FC
as multiple requests can come at the same time.
As an example, when 2 clients are requesting codec_process and codec_delete
at the same time, at a very small window FC might think that there are still 2 clients but
somehow one of the alg gets deleted.
Adding the semaphore on the multiple requests (engine_open,
engine_close, codec_create, codec_control, codec_get_version, codec_process,
codec_delete, and dce_SrvDelNotification) to protect the client requests
to be synchronous.
There is no need to add semaphore for get_rporc_info() because the
function is only getting the statistical information from BIOS
utils component.
Change-Id: I80d2899cd6e3c5ac2392bf1fd79e7bcded07c52c
Signed-off-by: Buddy Liong <a0270631@ti.com>
src/ti/framework/dce/dce.c | patch | blob | history |
index e816f1ea017cd388f1efcd9c9f2456b3dc6aa253..45709293ec93e931fbb62072516f4e29233b7337 100644 (file)
Uint32 num_params = MmRpc_NUM_PARAMETERS(size);
Int32 ret = 0;
+ Semaphore_pend(sync_process_sem, BIOS_WAIT_FOREVER);
+
DEBUG(">> engine_open");
if( num_params != 1 ) {
dce_inv(engine_open_msg);
eng_handle = Engine_open(engine_open_msg->name, engine_open_msg->engine_attrs, &engine_open_msg->error_code);
- DEBUG("<< engine=%08x, ec=%d", eng_handle, engine_open_msg->error_code);
mm_serv_id = MmServiceMgr_getId();
DEBUG("engine_open mm_serv_id 0x%x", mm_serv_id);
Engine_close(eng_handle);
eng_handle = NULL;
}
+
+ DEBUG("<< engine=%08x, ec=%d", eng_handle, engine_open_msg->error_code);
+
dce_clean(engine_open_msg);
+ Semaphore_post(sync_process_sem);
return ((Int32)eng_handle);
}
Uint32 mm_serv_id = 0;
Uint32 num_params = MmRpc_NUM_PARAMETERS(size);
+ Semaphore_pend(sync_process_sem, BIOS_WAIT_FOREVER);
+
+ DEBUG(">> engine_close %08x", eng_handle);
+
if( num_params != 1 ) {
ERROR("invalid number of params sent");
return (-1);
Engine_close(eng_handle);
DEBUG("<<");
+ Semaphore_post(sync_process_sem);
+
return (0);
}
#ifdef MEMORYSTATS_DEBUG
Memory_Stats stats;
#endif
- DEBUG(">> codec_create");
+
+ Semaphore_pend(sync_process_sem, BIOS_WAIT_FOREVER);
+
+ DEBUG(">> codec_create on engine %08x", engine);
if( num_params != 4 ) {
ERROR("invalid number of params sent");
ivahd_release();
mm_serv_id = MmServiceMgr_getId();
- DEBUG("codec_create codec_handle 0x%x mm_serv_id 0x%x", codec_handle, mm_serv_id);
ret = dce_register_codec(codec_id, mm_serv_id, (Uint32) codec_handle);
if( ret < 0 ) {
}
if ( codec_id == OMAP_DCE_VIDDEC3 ) {
- DEBUG("codec_create for VIDDEC3 codec_handle 0x%x", codec_handle);
+ DEBUG("codec_create for VIDDEC3 codec_handle 0x%x mm_serv_id 0x%x", codec_handle, mm_serv_id);
if ( ((VIDDEC3_Params*)static_params)->outputDataMode == IVIDEO_NUMROWS ) {
c = get_client_instance((Uint32) codec_handle);
int i;
}
}
} else if ( codec_id == OMAP_DCE_VIDENC2 ) {
- DEBUG("codec_create for VIDENC2 codec_handle 0x%x", codec_handle);
+ DEBUG("codec_create for VIDENC2 codec_handle 0x%x mm_serv_id 0x%x", codec_handle, mm_serv_id);
if ( ((VIDENC2_Params*)static_params)->inputDataMode == IVIDEO_NUMROWS ) {
c = get_client_instance((Uint32) codec_handle);
int i;
}
}
- DEBUG("<< codec_handle=%08x", codec_handle);
+ DEBUG("<< codec_handle=%08x on engine %08x", codec_handle, engine);
dce_clean(static_params);
dce_clean(codec_name);
+ Semaphore_post(sync_process_sem);
+
#ifdef MEMORYSTATS_DEBUG
Memory_getStats(NULL, &stats);
INFO("Total: %d\tFree: %d\tLargest: %d", stats.totalSize,
Uint32 num_params = MmRpc_NUM_PARAMETERS(size);
Int32 ret = 0;
+ Semaphore_pend(sync_process_sem, BIOS_WAIT_FOREVER);
- DEBUG(">> codec_control");
+ DEBUG(">> codec_control on codec_handle %08x", codec_handle);
if( num_params != 5 ) {
ERROR("invalid number of params sent");
ret = (uint32_t) codec_fxns[codec_id].control(codec_handle, cmd_id, dyn_params, status);
ivahd_release();
- DEBUG("<< result=%d", ret);
+ DEBUG("<< codec_control on codec_handle %08x result=%d", codec_handle, ret);
dce_clean(dyn_params);
dce_clean(status);
+ Semaphore_post(sync_process_sem);
+
return (ret);
}
void *version_buf = NULL;
Int32 ret = 0;
- DEBUG(">> codec_get_version");
+ Semaphore_pend(sync_process_sem, BIOS_WAIT_FOREVER);
+
+ DEBUG(">> codec_get_version on codec_handle %08x", codec_handle);
if( num_params != 4 ) {
ERROR("invalid number of params sent");
ret = (uint32_t) codec_fxns[codec_id].control(codec_handle, XDM_GETVERSION, dyn_params, status);
ivahd_release();
- DEBUG("<< result=%d", ret);
+ DEBUG("<< codec_get_version on codec_handle %08x result=%d", codec_handle, ret);
dce_clean(dyn_params);
dce_clean(status);
dce_clean(version_buf);
+ Semaphore_post(sync_process_sem);\
+
return (ret);
}
void *outArgs = (void *) payload[5].data;
Int32 ret = 0;
- DEBUG(">> codec_process");
+ Semaphore_pend(sync_process_sem, BIOS_WAIT_FOREVER);
+
+ DEBUG(">> codec_process codec=%p", codec);
if( num_params != 6 ) {
ERROR("invalid number of params sent");
return (-1);
}
- Semaphore_pend(sync_process_sem, BIOS_WAIT_FOREVER);
-
dce_inv(inBufs);
dce_inv(outBufs);
dce_inv(inArgs);
dce_inv(outArgs);
-
DEBUG(">> codec=%p, inBufs=%p, outBufs=%p, inArgs=%p, outArgs=%p codec_id=%d LOCK sync_process_sem 0x%x",
- codec, inBufs, outBufs, inArgs, outArgs, codec_id, sync_process_sem);
+ codec, inBufs, outBufs, inArgs, outArgs, codec_id, sync_process_sem);
#ifdef PSI_KPI
kpi_before_codec();
#ifdef PSI_KPI
kpi_after_codec();
#endif /*PSI_KPI*/
- DEBUG("<< ret=%d extendedError=%08x", ret, ((VIDDEC3_OutArgs *)outArgs)->extendedError);
+ DEBUG("<< codec=%p ret=%d extendedError=%08x", codec, ret, ((VIDDEC3_OutArgs *)outArgs)->extendedError);
dce_clean(inBufs);
dce_clean(outBufs);
dce_clean(inArgs);
dce_clean(outArgs);
- DEBUG("codec_process codec=%p POST sync_process_sem 0x%x", codec, sync_process_sem);
Semaphore_post(sync_process_sem);
return ((Int32)ret);
Memory_Stats stats;
#endif
+ Semaphore_pend(sync_process_sem, BIOS_WAIT_FOREVER);
+
DEBUG(">> codec_delete on codec 0x%x", codec);
if( num_params != 2 ) {
stats.totalFreeSize, stats.largestFreeSize);
#endif
- DEBUG("<<");
+ DEBUG("<< codec_delete");
+
+ Semaphore_post(sync_process_sem);
#ifdef PSI_KPI
kpi_comp_deinit((void*)codec);
int i;
uint32_t mm_serv_id = 0;
+ Semaphore_pend(sync_process_sem, BIOS_WAIT_FOREVER);
+
DEBUG("dce_SrvDelNotification: cleanup existing codec and engine\n");
mm_serv_id = MmServiceMgr_getId();
}
}
DEBUG("dce_SrvDelNotification: COMPLETE exit function \n");
+
+ Semaphore_post(sync_process_sem);
}
Void dceCallback_SrvDelNotification(Void)