diff options
| author | Gupta, Kapil <kapgupta@qti.qualcomm.com> | 2016-02-22 15:01:30 +0530 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2016-03-01 14:44:47 +0530 |
| commit | 14e2216b3dbff64d8e8401b07fecb1d25c512b4e (patch) | |
| tree | 594ffb40479a161cf784d2fd4614d45c52fd134e /CORE/VOSS/src | |
| parent | 5d16de7ed14ec2d4306aedf93f8c7d21f41f4119 (diff) | |
qcacld-2.0: Add scenario based BUG report
prima to qcacld-2.0 propagation
Change to initiate BUG report in case of fatal event
Add INI support to Enable/Disable it.
The fatal event handled are as below:
- Roaming failed after successfull preauth.
- MC thread is Stucked for 15 sec.
- Sme command timeout.
- PE defer queue is full.
- VOS run out of message wrapper.
- Management tx timeout.
- HDD level wait for event timeout.
Change-Id: I46fb96e1d90f4ab6df2b9f343a0bfc75cb89a417
CRs-Fixed: 912560
Diffstat (limited to 'CORE/VOSS/src')
| -rw-r--r-- | CORE/VOSS/src/vos_api.c | 138 | ||||
| -rw-r--r-- | CORE/VOSS/src/vos_sched.c | 25 | ||||
| -rw-r--r-- | CORE/VOSS/src/vos_sched.h | 1 |
3 files changed, 141 insertions, 23 deletions
diff --git a/CORE/VOSS/src/vos_api.c b/CORE/VOSS/src/vos_api.c index f9377494bfa3..cb00d683dd74 100644 --- a/CORE/VOSS/src/vos_api.c +++ b/CORE/VOSS/src/vos_api.c @@ -1885,16 +1885,19 @@ VOS_STATUS vos_mq_post_message_by_priority(VOS_MQ_ID msgQueueId, if (NULL == pMsgWrapper) { debug_count = atomic_inc_return(&vos_wrapper_empty_count); - if (1 == debug_count) + if (1 == debug_count) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: VOS Core run out of message wrapper %d", __func__, debug_count); - + vos_flush_logs(WLAN_LOG_TYPE_FATAL, + WLAN_LOG_INDICATOR_HOST_ONLY, + WLAN_LOG_REASON_VOS_MSG_UNDER_RUN, + true); + } if (VOS_WRAPPER_MAX_FAIL_COUNT == debug_count) { - VOS_BUG(0); + vos_wlanRestart(); } - - return VOS_STATUS_E_RESOURCES; + return VOS_STATUS_E_RESOURCES; } atomic_set(&vos_wrapper_empty_count, 0); @@ -2674,18 +2677,21 @@ VOS_STATUS vos_set_log_completion(uint32_t is_fatal, } /** - * vos_get_log_completion() - Get the logging related params + * vos_get_log_and_reset_completion() - Get and reset the logging + * related params * @is_fatal: Indicates if the event triggering bug report is fatal or not * @indicator: Source which trigerred the bug report * @reason_code: Reason for triggering bug report + * @ssr_needed: Indicates if SSR is required or not * * This function is used to get the logging related parameters * * Return: None */ -void vos_get_log_completion(uint32_t *is_fatal, +void vos_get_log_and_reset_completion(uint32_t *is_fatal, uint32_t *indicator, - uint32_t *reason_code) + uint32_t *reason_code, + uint32_t *is_ssr_needed) { VosContextType *vos_context; @@ -2700,7 +2706,19 @@ void vos_get_log_completion(uint32_t *is_fatal, *is_fatal = vos_context->log_complete.is_fatal; *indicator = vos_context->log_complete.indicator; *reason_code = vos_context->log_complete.reason_code; + + if ((WLAN_LOG_INDICATOR_HOST_DRIVER == *indicator) && + ((WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF == *reason_code) || + (WLAN_LOG_REASON_SME_COMMAND_STUCK == *reason_code))) + *is_ssr_needed = true; + else + *is_ssr_needed = false; + + /* reset */ + vos_context->log_complete.indicator = WLAN_LOG_INDICATOR_UNUSED; + vos_context->log_complete.is_fatal = WLAN_LOG_TYPE_NON_FATAL; vos_context->log_complete.is_report_in_progress = false; + vos_context->log_complete.reason_code = WLAN_LOG_REASON_CODE_UNUSED; vos_spin_lock_release(&vos_context->bug_report_lock); } @@ -2723,12 +2741,70 @@ bool vos_is_log_report_in_progress(void) } return vos_context->log_complete.is_report_in_progress; } +/** + * vos_is_fatal_event_enabled() - Return if fatal event is enabled + * + * Return true if fatal event is enabled is in progress. + */ +bool vos_is_fatal_event_enabled(void) +{ + VosContextType *vos_context = + vos_get_global_context(VOS_MODULE_ID_SYS, NULL); + + if (!vos_context) { + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, + "%s: Global VOS context is Null", __func__); + return false; + } + + return vos_context->enable_fatal_event; +} + +/** + * vos_get_log_indicator() - Get the log flush indicator + * + * This function is used to get the log flush indicator + * + * Return: log indicator + */ +uint32_t vos_get_log_indicator(void) +{ + VosContextType *vos_context; + uint32_t indicator; + + vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); + if (!vos_context) { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "%s: vos context is Invalid", __func__); + return WLAN_LOG_INDICATOR_UNUSED; + } + + vos_spin_lock_acquire(&vos_context->bug_report_lock); + indicator = vos_context->log_complete.indicator; + vos_spin_lock_release(&vos_context->bug_report_lock); + return indicator; +} + +/** + * vos_wlan_flush_host_logs_for_fatal() - Wrapper to flush host logs + * + * This function is used to send signal to the logger thread to + * flush the host logs. + * + * Return: None + * + */ +void vos_wlan_flush_host_logs_for_fatal(void) +{ + wlan_flush_host_logs_for_fatal(); +} /** * vos_flush_logs() - Report fatal event to userspace * @is_fatal: Indicates if the event triggering bug report is fatal or not * @indicator: Source which trigerred the bug report * @reason_code: Reason for triggering bug report + * @dump_vos_trace: If vos trace are needed in logs. * * This function sets the log related params and send the WMI command to the * FW to flush its logs. On receiving the flush completion event from the FW @@ -2738,11 +2814,11 @@ bool vos_is_log_report_in_progress(void) */ VOS_STATUS vos_flush_logs(uint32_t is_fatal, uint32_t indicator, - uint32_t reason_code) + uint32_t reason_code, + bool dump_vos_trace) { uint32_t ret; VOS_STATUS status; - VosContextType *vos_context; vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); @@ -2752,8 +2828,21 @@ VOS_STATUS vos_flush_logs(uint32_t is_fatal, return eHAL_STATUS_FAILURE; } + if (!vos_context->enable_fatal_event) { + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, + "%s: Fatal event not enabled", __func__); + return eHAL_STATUS_FAILURE; + } + if (vos_context->is_unload_in_progress || + vos_context->is_load_in_progress || + vos_context->isLogpInProgress) { + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, + "%s: un/Load/SSR in progress", __func__); + return eHAL_STATUS_FAILURE; + } + if (vos_is_log_report_in_progress() == true) { - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Bug report already in progress - dropping! type:%d, indicator=%d reason_code=%d", __func__, is_fatal, indicator, reason_code); return VOS_STATUS_E_FAILURE; @@ -2766,10 +2855,17 @@ VOS_STATUS vos_flush_logs(uint32_t is_fatal, return VOS_STATUS_E_FAILURE; } - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Triggering bug report: type:%d, indicator=%d reason_code=%d", __func__, is_fatal, indicator, reason_code); + if (dump_vos_trace) + vosTraceDumpAll(vos_context->pMACContext, 0, 0, 500, 0); + + if (WLAN_LOG_INDICATOR_HOST_ONLY == indicator) { + vos_wlan_flush_host_logs_for_fatal(); + return VOS_STATUS_SUCCESS; + } ret = vos_send_flush_logs_cmd_to_fw(vos_context->pMACContext); if (0 != ret) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, @@ -2796,6 +2892,23 @@ void vos_logging_set_fw_flush_complete(void) } /** + * vos_set_fatal_event() - set fatal event status + * @value: pending statue to set + * + * Return: None + */ +void vos_set_fatal_event(bool value) +{ + if (gpVosContext == NULL) { + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, + "%s: global voss context is NULL", __func__); + return; + } + + gpVosContext->enable_fatal_event = value; +} + +/** * vos_probe_threads() - VOS API to post messages * to all the threads to detect if they are active or not * @@ -2814,7 +2927,6 @@ void vos_probe_threads(void) FL("Unable to post SYS_MSG_ID_MC_THR_PROBE message to MC thread")); } } - /** * vos_pkt_stats_to_logger_thread() - send pktstats to user * @pl_hdr: Pointer to pl_hdr diff --git a/CORE/VOSS/src/vos_sched.c b/CORE/VOSS/src/vos_sched.c index 6be4fb33d6c7..575f0a9390a4 100644 --- a/CORE/VOSS/src/vos_sched.c +++ b/CORE/VOSS/src/vos_sched.c @@ -77,7 +77,6 @@ /* Timer value for detecting thread stuck issues */ #define THREAD_STUCK_TIMER_VAL 5000 /* 5 seconds */ -#define THREAD_STUCK_COUNT 3 static atomic_t ssr_protect_entry_count; @@ -988,16 +987,19 @@ static void vos_wd_detect_thread_stuck(void) spin_lock_irqsave(&gpVosWatchdogContext->thread_stuck_lock, flags); - if ((gpVosWatchdogContext->mc_thread_stuck_count - == THREAD_STUCK_COUNT)) { + if (gpVosWatchdogContext->mc_thread_stuck_count) { spin_unlock_irqrestore(&gpVosWatchdogContext->thread_stuck_lock, flags); - hddLog(LOGE, FL("%s: Thread Stuck!!! MC Count %d "), - __func__, + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, + "%s: Thread Stuck!!! MC Count %d", __func__, gpVosWatchdogContext->mc_thread_stuck_count); - vos_wlanRestart(); - return; + vos_flush_logs(WLAN_LOG_TYPE_FATAL, + WLAN_LOG_INDICATOR_HOST_ONLY, + WLAN_LOG_REASON_THREAD_STUCK, + true); + spin_lock_irqsave(&gpVosWatchdogContext->thread_stuck_lock, + flags); } /* Increment the thread stuck count for all threads */ @@ -1089,14 +1091,17 @@ VosWDThread /* Initialize the timer to detect thread stuck issues */ if (vos_timer_init(&gpVosWatchdogContext->thread_stuck_timer, VOS_TIMER_TYPE_SW, vos_wd_detect_thread_stuck_cb, NULL)) { - hddLog(LOGE, FL("Unable to initialize thread stuck timer")); + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, + "Unable to initialize thread stuck timer"); } else { if (VOS_STATUS_SUCCESS != vos_timer_start(&gpVosWatchdogContext->thread_stuck_timer, THREAD_STUCK_TIMER_VAL)) - hddLog(LOGE, FL("Unable to start thread stuck timer")); + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, + "Unable to start thread stuck timer"); else - hddLog(LOGE, FL("Successfully started thread stuck timer")); + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, + "Successfully started thread stuck timer"); } /* diff --git a/CORE/VOSS/src/vos_sched.h b/CORE/VOSS/src/vos_sched.h index 75fac75312f0..cdf53cbc0cec 100644 --- a/CORE/VOSS/src/vos_sched.h +++ b/CORE/VOSS/src/vos_sched.h @@ -398,6 +398,7 @@ typedef struct _VosContextType vos_spin_lock_t bug_report_lock; bool crash_indication_pending; + bool enable_fatal_event; } VosContextType, *pVosContextType; |
