summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajeev Kumar <rajekuma@qca.qualcomm.com>2014-11-24 14:21:15 -0800
committerAnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com>2014-11-25 14:29:35 +0530
commit775692a305bfafeaf107ca433e876c7abc26cc11 (patch)
tree2d7a2a74af6d7f33586fed547bbc88e201901a90
parent1fd1ee7609f770876acfabb17c6641713a9b1026 (diff)
qcacld: Fix race condition in MC thread stuck detect logic
1) vos_mq_post_message can be called from multiple contexts use atomic variable to avoid race conditions. 2) Increase VOS wrapper get failure count to avoid false detection Change-Id: Ia7489cf041f613833198f2820d79a83697906f01 CRs-fixed: 760528
-rw-r--r--CORE/VOSS/src/vos_api.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/CORE/VOSS/src/vos_api.c b/CORE/VOSS/src/vos_api.c
index 03a80faec410..bb539886f0ca 100644
--- a/CORE/VOSS/src/vos_api.c
+++ b/CORE/VOSS/src/vos_api.c
@@ -100,7 +100,7 @@
#define VOS_WDA_RESP_TIMEOUT WDA_STOP_TIMEOUT
/* Maximum number of vos message queue get wrapper failures to cause panic */
-#define VOS_WRAPPER_MAX_FAIL_COUNT (1000)
+#define VOS_WRAPPER_MAX_FAIL_COUNT (2000)
/*---------------------------------------------------------------------------
* Data definitions
@@ -108,6 +108,9 @@
static VosContextType gVosContext;
static pVosContextType gpVosContext;
+/* Debug variable to detect MC thread stuck */
+static atomic_t vos_wrapper_empty_count;
+
/*---------------------------------------------------------------------------
* Forward declaration
* ------------------------------------------------------------------------*/
@@ -1594,7 +1597,7 @@ VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
{
pVosMqType pTargetMq = NULL;
pVosMsgWrapper pMsgWrapper = NULL;
- static uint32_t debug_count = 0;
+ uint32_t debug_count;
if ((gpVosContext == NULL) || (pMsg == NULL))
{
@@ -1664,7 +1667,7 @@ VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq);
if (NULL == pMsgWrapper) {
- debug_count++;
+ debug_count = atomic_inc_return(&vos_wrapper_empty_count);
VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
"%s: VOS Core run out of message wrapper %d",
__func__, debug_count);
@@ -1676,7 +1679,7 @@ VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg )
return VOS_STATUS_E_RESOURCES;
}
- debug_count = 0;
+ atomic_set(&vos_wrapper_empty_count, 0);
/*
** Copy the message now