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 | |
| 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
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_cfg.h | 10 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg.c | 13 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg80211.c | 9 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_main.c | 1 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_p2p.c | 8 | ||||
| -rw-r--r-- | CORE/MAC/inc/aniGlobal.h | 33 | ||||
| -rw-r--r-- | CORE/MAC/src/pe/lim/limUtils.c | 8 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/wma.c | 7 | ||||
| -rw-r--r-- | CORE/SME/inc/csrApi.h | 1 | ||||
| -rw-r--r-- | CORE/SME/inc/csrInternal.h | 1 | ||||
| -rw-r--r-- | CORE/SME/src/csr/csrApiRoam.c | 12 | ||||
| -rw-r--r-- | CORE/SME/src/sme_common/sme_Api.c | 46 | ||||
| -rw-r--r-- | CORE/SVC/inc/wlan_logging_sock_svc.h | 6 | ||||
| -rw-r--r-- | CORE/SVC/src/logging/wlan_logging_sock_svc.c | 45 | ||||
| -rw-r--r-- | CORE/VOSS/inc/vos_api.h | 12 | ||||
| -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 |
18 files changed, 318 insertions, 58 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_cfg.h b/CORE/HDD/inc/wlan_hdd_cfg.h index db5f75c00179..1a4e887cebd2 100644 --- a/CORE/HDD/inc/wlan_hdd_cfg.h +++ b/CORE/HDD/inc/wlan_hdd_cfg.h @@ -1048,6 +1048,15 @@ enum #define CFG_FT_RESOURCE_REQ_DEFAULT (0) #endif +/* + * Enable/Disable to initiate BUG report in case of fatal event + * Default: Enable + */ +#define CFG_ENABLE_FATAL_EVENT_TRIGGER "gEnableFatalEvent" +#define CFG_ENABLE_FATAL_EVENT_TRIGGER_MIN (0) +#define CFG_ENABLE_FATAL_EVENT_TRIGGER_MAX (1) +#define CFG_ENABLE_FATAL_EVENT_TRIGGER_DEFAULT (1) + #define CFG_TELE_BCN_TRANS_LI_NAME "telescopicBeaconTransListenInterval" #define CFG_TELE_BCN_TRANS_LI_MIN ( 0 ) #define CFG_TELE_BCN_TRANS_LI_MAX ( 7 ) @@ -4275,6 +4284,7 @@ typedef struct uint16_t sap_tx_leakage_threshold; bool ignore_peer_ht_opmode; bool mib_stats_enabled; + bool enable_fatal_event; } hdd_config_t; #ifdef WLAN_FEATURE_MBSSID diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c index c14d83d6d86b..9305b2dea214 100644 --- a/CORE/HDD/src/wlan_hdd_cfg.c +++ b/CORE/HDD/src/wlan_hdd_cfg.c @@ -4296,6 +4296,13 @@ REG_TABLE_ENTRY g_registry_table[] = CFG_FIRST_SCAN_BUCKET_THRESHOLD_MIN, CFG_FIRST_SCAN_BUCKET_THRESHOLD_MAX), + REG_VARIABLE(CFG_ENABLE_FATAL_EVENT_TRIGGER, WLAN_PARAM_Integer, + hdd_config_t, enable_fatal_event, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_ENABLE_FATAL_EVENT_TRIGGER_DEFAULT, + CFG_ENABLE_FATAL_EVENT_TRIGGER_MIN, + CFG_ENABLE_FATAL_EVENT_TRIGGER_MAX), + REG_VARIABLE(CFG_ENABLE_GO_CTS2SELF_FOR_STA, WLAN_PARAM_Integer, hdd_config_t, enable_go_cts2self_for_sta, @@ -5058,6 +5065,9 @@ void print_hdd_cfg(hdd_context_t *pHddCtx) pHddCtx->cfg_ini->mdns_resp_type_srv_target); #endif VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, + "Name = [gEnableFatalEvent] Value = [%u] ", + pHddCtx->cfg_ini->enable_fatal_event); + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableDumpCollect] Value = [%u]", pHddCtx->cfg_ini->is_ramdump_enabled); @@ -6972,7 +6982,8 @@ VOS_STATUS hdd_set_sme_config( hdd_context_t *pHddCtx ) vos_set_multicast_logging(pHddCtx->cfg_ini->multicast_host_fw_msgs); hdd_set_fine_time_meas_cap(pHddCtx, smeConfig); - + smeConfig->csrConfig.enable_fatal_event = + pConfig->enable_fatal_event; smeConfig->csrConfig.sendDeauthBeforeCon = pConfig->sendDeauthBeforeCon; smeConfig->csrConfig.ignorePeerErpInfo = pConfig->ignorePeerErpInfo; halStatus = sme_UpdateConfig( pHddCtx->hHal, smeConfig); diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index f0be38d23406..298b3554b155 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -8990,7 +8990,8 @@ static int __wlan_hdd_cfg80211_wifi_logger_get_ring_data(struct wiphy *wiphy, ret = vos_flush_logs(WLAN_LOG_TYPE_NON_FATAL, WLAN_LOG_INDICATOR_FRAMEWORK, - WLAN_LOG_REASON_CODE_UNUSED); + WLAN_LOG_REASON_CODE_UNUSED, + true); if (VOS_STATUS_SUCCESS != ret) { hddLog(LOGE, FL("Failed to trigger bug report")); return -EINVAL; @@ -21069,7 +21070,11 @@ static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, "%s: Unloading/Loading in Progress. Ignore!!!", __func__); return -EAGAIN; } - + if (rc <= 0) + vos_flush_logs(WLAN_LOG_TYPE_FATAL, + WLAN_LOG_INDICATOR_HOST_DRIVER, + WLAN_LOG_REASON_HDD_TIME_OUT, + true); pAdapter->mgmtTxCompletionStatus = FALSE; wlan_hdd_tdls_check_bmps(pAdapter); return -EINVAL; diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index 89b7e1fb03a2..9cff44a02a5c 100644 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -14048,6 +14048,7 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc) hddLog(VOS_TRACE_LEVEL_INFO, "Setting configuredMcastBcastFilter: %d", pHddCtx->cfg_ini->mcastBcastFilterSetting); + vos_set_fatal_event(pHddCtx->cfg_ini->enable_fatal_event); if (false == hdd_is_5g_supported(pHddCtx)) { //5Ghz is not supported. diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c index 794e071cedb9..8a6a493c1eae 100644 --- a/CORE/HDD/src/wlan_hdd_p2p.c +++ b/CORE/HDD/src/wlan_hdd_p2p.c @@ -341,6 +341,10 @@ void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter) hddLog( LOGE, "%s: timeout waiting for remain on channel ready indication", __func__); + vos_flush_logs(WLAN_LOG_TYPE_FATAL, + WLAN_LOG_INDICATOR_HOST_DRIVER, + WLAN_LOG_REASON_HDD_TIME_OUT, + true); } INIT_COMPLETION(pAdapter->cancel_rem_on_chan_var); @@ -1271,6 +1275,10 @@ int __wlan_hdd_cfg80211_cancel_remain_on_channel( struct wiphy *wiphy, "%s: LOGP in Progress. Ignore!!!", __func__); return -EAGAIN; } + vos_flush_logs(WLAN_LOG_TYPE_FATAL, + WLAN_LOG_INDICATOR_HOST_DRIVER, + WLAN_LOG_REASON_HDD_TIME_OUT, + true); } INIT_COMPLETION(pAdapter->cancel_rem_on_chan_var); /* Issue abort remain on chan request to sme. diff --git a/CORE/MAC/inc/aniGlobal.h b/CORE/MAC/inc/aniGlobal.h index 2ebe7c97868b..5d6080c6c188 100644 --- a/CORE/MAC/inc/aniGlobal.h +++ b/CORE/MAC/inc/aniGlobal.h @@ -181,6 +181,7 @@ enum log_event_type { * @WLAN_LOG_INDICATOR_FRAMEWORK: Framework triggers bug report * @WLAN_LOG_INDICATOR_HOST_DRIVER: Host driver triggers bug report * @WLAN_LOG_INDICATOR_FIRMWARE: FW initiates bug report + * @WLAN_LOG_INDICATOR_HOST_ONLY: Host triggers fatal event bug report * * Enum indicating the module that triggered the bug report */ @@ -189,52 +190,52 @@ enum log_event_indicator { WLAN_LOG_INDICATOR_FRAMEWORK, WLAN_LOG_INDICATOR_HOST_DRIVER, WLAN_LOG_INDICATOR_FIRMWARE, + WLAN_LOG_INDICATOR_HOST_ONLY, }; /** * enum log_event_host_reason_code - Reason code for bug report * @WLAN_LOG_REASON_CODE_UNUSED: Unused - * @WLAN_LOG_REASON_COMMAND_UNSUCCESSFUL: Command response status from FW - * is error * @WLAN_LOG_REASON_ROAM_FAIL: Driver initiated roam has failed * @WLAN_LOG_REASON_THREAD_STUCK: Monitor Health of host threads and report * fatal event if some thread is stuck * @WLAN_LOG_REASON_DATA_STALL: Unable to send/receive data due to low resource * scenario for a prolonged period * @WLAN_LOG_REASON_SME_COMMAND_STUCK: SME command is stuck in SME active queue - * @WLAN_LOG_REASON_ZERO_SCAN_RESULTS: Full scan resulted in zero scan results * @WLAN_LOG_REASON_QUEUE_FULL: Defer queue becomes full for a prolonged period * @WLAN_LOG_REASON_POWER_COLLAPSE_FAIL: Unable to allow apps power collapse * for a prolonged period - * @WLAN_LOG_REASON_SSR_FAIL: Unable to gracefully complete SSR - * @WLAN_LOG_REASON_DISCONNECT_FAIL: Disconnect from Supplicant is not - * successful - * @WLAN_LOG_REASON_CLEAN_UP_FAIL: Clean up of TDLS or Pre-Auth Sessions - * not successful * @WLAN_LOG_REASON_MALLOC_FAIL: Memory allocation Fails * @WLAN_LOG_REASON_VOS_MSG_UNDER_RUN: VOS Core runs out of message wrapper - * @WLAN_LOG_REASON_MSG_POST_FAIL: Unable to post msg - * + * @WLAN_LOG_REASON_IOCTL: Initiated by IOCTL + * @WLAN_LOG_REASON_CODE_FRAMEWORK: Initiated by framework + * @WLAN_LOG_REASON_DEL_BSS_STA_FAIL: DEL BSS/STA rsp is failure + * @WLAN_LOG_REASON_ADD_BSS_STA_FAIL: ADD BSS/STA rsp is failure + * @WLAN_LOG_REASON_HDD_TIME_OUT: Wait for event Timeout in HDD layer + * @WLAN_LOG_REASON_MGMT_FRAME_TIMEOUT:Management frame timedout + @WLAN_LOG_REASON_SME_OUT_OF_CMD_BUFL sme out of cmd buffer * This enum contains the different reason codes for bug report */ enum log_event_host_reason_code { WLAN_LOG_REASON_CODE_UNUSED, - WLAN_LOG_REASON_COMMAND_UNSUCCESSFUL, WLAN_LOG_REASON_ROAM_FAIL, WLAN_LOG_REASON_THREAD_STUCK, WLAN_LOG_REASON_DATA_STALL, WLAN_LOG_REASON_SME_COMMAND_STUCK, - WLAN_LOG_REASON_ZERO_SCAN_RESULTS, WLAN_LOG_REASON_QUEUE_FULL, WLAN_LOG_REASON_POWER_COLLAPSE_FAIL, - WLAN_LOG_REASON_SSR_FAIL, - WLAN_LOG_REASON_DISCONNECT_FAIL, - WLAN_LOG_REASON_CLEAN_UP_FAIL, WLAN_LOG_REASON_MALLOC_FAIL, WLAN_LOG_REASON_VOS_MSG_UNDER_RUN, - WLAN_LOG_REASON_MSG_POST_FAIL, + WLAN_LOG_REASON_IOCTL, + WLAN_LOG_REASON_CODE_FRAMEWORK, + WLAN_LOG_REASON_DEL_BSS_STA_FAIL, + WLAN_LOG_REASON_ADD_BSS_STA_FAIL, + WLAN_LOG_REASON_HDD_TIME_OUT, + WLAN_LOG_REASON_MGMT_FRAME_TIMEOUT, + WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF, }; + /** * enum userspace_log_level - Log level at userspace * @LOG_LEVEL_NO_COLLECTION: verbose_level 0 corresponds to no collection diff --git a/CORE/MAC/src/pe/lim/limUtils.c b/CORE/MAC/src/pe/lim/limUtils.c index 1dca07340d39..67e8b625a2a3 100644 --- a/CORE/MAC/src/pe/lim/limUtils.c +++ b/CORE/MAC/src/pe/lim/limUtils.c @@ -1033,7 +1033,13 @@ tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg) { if(!(pMac->lim.deferredMsgCnt & 0xF)) { - PELOGE(limLog(pMac, LOGE, FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"), limMsg->type, ++pMac->lim.deferredMsgCnt);) + limLog(pMac, LOGE, + FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"), + limMsg->type, ++pMac->lim.deferredMsgCnt); + vos_flush_logs(WLAN_LOG_TYPE_NON_FATAL, + WLAN_LOG_INDICATOR_HOST_DRIVER, + WLAN_LOG_REASON_QUEUE_FULL, + true); } else { diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index 9d1e8c390331..ea837e94c395 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -32926,9 +32926,14 @@ VOS_STATUS WDA_TxPacket(void *wma_context, void *tx_frame, u_int16_t frmLen, */ if (wma_handle->max_mgmt_tx_fail_count && mgmt_downld_fail_count == - wma_handle->max_mgmt_tx_fail_count) + wma_handle->max_mgmt_tx_fail_count) { + vos_flush_logs(WLAN_LOG_TYPE_FATAL, + WLAN_LOG_INDICATOR_HOST_DRIVER, + WLAN_LOG_REASON_MGMT_FRAME_TIMEOUT, + true); wmi_crash_inject(wma_handle->wmi_handle, RECOVERY_SIM_ASSERT, 0); + } } else { mgmt_downld_fail_count = 0; if ((vos_timer_get_system_time() - time_snapshot) >= diff --git a/CORE/SME/inc/csrApi.h b/CORE/SME/inc/csrApi.h index 2538f309339a..601f78808bc8 100644 --- a/CORE/SME/inc/csrApi.h +++ b/CORE/SME/inc/csrApi.h @@ -1298,6 +1298,7 @@ typedef struct tagCsrConfigParam tANI_BOOLEAN sendDeauthBeforeCon; v_U16_t pkt_err_disconn_th; int8_t first_scan_bucket_threshold; + bool enable_fatal_event; }tCsrConfigParam; //Tush diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h index f4c0aabcbec9..dd248846f107 100644 --- a/CORE/SME/inc/csrInternal.h +++ b/CORE/SME/inc/csrInternal.h @@ -710,6 +710,7 @@ typedef struct tagCsrConfig tANI_BOOLEAN ignorePeerErpInfo; bool ignore_peer_ht_opmode; v_U16_t pkt_err_disconn_th; + bool enable_fatal_event; }tCsrConfig; typedef struct tagCsrChannelPowerInfo diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c index 5f255785d806..bdaa318249cd 100644 --- a/CORE/SME/src/csr/csrApiRoam.c +++ b/CORE/SME/src/csr/csrApiRoam.c @@ -2044,6 +2044,8 @@ eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pPa pMac->enable_dot11p = pParam->enable_dot11p; pMac->roam.configParam.sendDeauthBeforeCon = pParam->sendDeauthBeforeCon; + pMac->roam.configParam.enable_fatal_event = + pParam->enable_fatal_event; } return status; @@ -2216,6 +2218,8 @@ eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) pMac->roam.configParam.sendDeauthBeforeCon; pParam->first_scan_bucket_threshold = pMac->first_scan_bucket_threshold; + pParam->enable_fatal_event = + pMac->roam.configParam.enable_fatal_event; status = eHAL_STATUS_SUCCESS; } return (status); @@ -8664,8 +8668,14 @@ static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSm * to call csrRoamComplete() with state as CsrJoinFailure */ else { - smsLog( pMac, LOGW, "CSR SmeReassocReq failed with statusCode= 0x%08X [%d]", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); + smsLog( pMac, LOGW, + FL("CSR SmeReassocReq failed with statusCode= 0x%08X [%d]"), + pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); result = eCsrReassocFailure; + vos_flush_logs(WLAN_LOG_TYPE_FATAL, + WLAN_LOG_INDICATOR_HOST_DRIVER, + WLAN_LOG_REASON_ROAM_FAIL, + true); #if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || \ defined(FEATURE_WLAN_LFR) if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == pSmeJoinRsp->statusCode) || diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c index b987e9ff9cb8..af16ec6e8a04 100644 --- a/CORE/SME/src/sme_common/sme_Api.c +++ b/CORE/SME/src/sme_common/sme_Api.c @@ -500,7 +500,15 @@ tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac ) csrLLUnlock(&pMac->roam.roamCmdPendingList); /* panic with out-of-command */ - VOS_BUG(0); + if (pMac->roam.configParam.enable_fatal_event) { + vos_flush_logs(WLAN_LOG_TYPE_FATAL, + WLAN_LOG_INDICATOR_HOST_DRIVER, + WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF, + false); + } else { + /* Trigger SSR */ + vos_wlanRestart(); + } } /* memset to zero */ @@ -13893,18 +13901,42 @@ void sme_SaveActiveCmdStats(tHalHandle hHal) { void activeListCmdTimeoutHandle(void *userData) { - if (NULL == userData) + tHalHandle hal = (tHalHandle) userData; + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + + if (NULL == mac_ctx) { + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, + "%s: pMac is null", __func__); return; + } + /* Return if no cmd pending in active list as + * in this case we should not be here. + */ + if (0 == csrLLCount(&mac_ctx->sme.smeCmdActiveList)) + return; + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Active List command timeout Cmd List Count %d", __func__, - csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) ); - smeGetCommandQStatus((tHalHandle) userData); + csrLLCount(&mac_ctx->sme.smeCmdActiveList) ); + smeGetCommandQStatus(hal); + + if (mac_ctx->roam.configParam.enable_fatal_event) { + vos_flush_logs(WLAN_LOG_TYPE_FATAL, + WLAN_LOG_INDICATOR_HOST_DRIVER, + WLAN_LOG_REASON_SME_COMMAND_STUCK, + false); + } else { + vosTraceDumpAll(mac_ctx, 0, 0, 500, 0); + } - if (((tpAniSirGlobal)userData)->sme.enableSelfRecovery) { - sme_SaveActiveCmdStats((tHalHandle)userData); + if (mac_ctx->sme.enableSelfRecovery) { + sme_SaveActiveCmdStats(hal); vos_trigger_recovery(); } else { - VOS_BUG(0); + if (!mac_ctx->roam.configParam.enable_fatal_event && + !(vos_is_load_unload_in_progress(VOS_MODULE_ID_SME, NULL) || + vos_is_logp_in_progress(VOS_MODULE_ID_SME, NULL))) + vos_wlanRestart(); } } diff --git a/CORE/SVC/inc/wlan_logging_sock_svc.h b/CORE/SVC/inc/wlan_logging_sock_svc.h index aee9974289d9..1a26d854f184 100644 --- a/CORE/SVC/inc/wlan_logging_sock_svc.h +++ b/CORE/SVC/inc/wlan_logging_sock_svc.h @@ -48,6 +48,7 @@ int wlan_log_to_user(VOS_TRACE_LEVEL log_level, char *to_be_sent, int length); void wlan_logging_set_per_pkt_stats(void); void wlan_logging_set_log_level(void); void wlan_logging_set_fw_flush_complete(void); +void wlan_flush_host_logs_for_fatal(void); #else static inline void wlan_logging_set_per_pkt_stats(void) { @@ -61,6 +62,11 @@ static inline void wlan_logging_set_fw_flush_complete(void) { return; } +static inline void wlan_flush_host_logs_for_fatal(void) +{ + return; +} + #endif /* WLAN_LOGGING_SOCK_SVC_ENABLE */ #ifdef FEATURE_WLAN_DIAG_SUPPORT void wlan_report_log_completion(uint32_t is_fatal, diff --git a/CORE/SVC/src/logging/wlan_logging_sock_svc.c b/CORE/SVC/src/logging/wlan_logging_sock_svc.c index dda6024feb42..c9c8b830b8fd 100644 --- a/CORE/SVC/src/logging/wlan_logging_sock_svc.c +++ b/CORE/SVC/src/logging/wlan_logging_sock_svc.c @@ -703,15 +703,18 @@ void wlan_report_log_completion(uint32_t is_fatal, */ void send_flush_completion_to_user(void) { - uint32_t is_fatal, indicator, reason_code; + uint32_t is_fatal, indicator, reason_code, is_ssr_needed; - vos_get_log_completion(&is_fatal, &indicator, &reason_code); + vos_get_log_and_reset_completion(&is_fatal, &indicator, &reason_code, + &is_ssr_needed); /* Error on purpose, so that it will get logged in the kmsg */ LOGGING_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: Sending flush done to userspace", __func__); wlan_report_log_completion(is_fatal, indicator, reason_code); + if (is_ssr_needed) + vos_wlanRestart(); } /** @@ -724,6 +727,7 @@ static int wlan_logging_thread(void *Arg) { int ret_wait_status = 0; int ret = 0; + unsigned long flags; set_user_nice(current, -2); @@ -759,6 +763,10 @@ static int wlan_logging_thread(void *Arg) if (-ENOMEM == ret) { msleep(200); } + if (WLAN_LOG_INDICATOR_HOST_ONLY == + vos_get_log_indicator()) { + send_flush_completion_to_user(); + } } if (test_and_clear_bit(HOST_LOG_PER_PKT_STATS, @@ -781,6 +789,12 @@ static int wlan_logging_thread(void *Arg) send_flush_completion_to_user(); } else { gwlan_logging.is_flush_complete = true; + /* Flush all current host logs*/ + spin_lock_irqsave(&gwlan_logging.spin_lock, + flags); + wlan_queue_logmsg_for_app(); + spin_unlock_irqrestore(&gwlan_logging.spin_lock, + flags); set_bit(HOST_LOG_DRIVER_MSG, &gwlan_logging.eventFlag); set_bit(HOST_LOG_PER_PKT_STATS, @@ -1073,7 +1087,8 @@ void wlan_logging_set_log_level(void) */ void wlan_logging_set_fw_flush_complete(void) { - if (gwlan_logging.is_active == false) + if (gwlan_logging.is_active == false || + !vos_is_fatal_event_enabled()) return; set_bit(HOST_LOG_FW_FLUSH_COMPLETE, &gwlan_logging.eventFlag); @@ -1439,4 +1454,28 @@ void wlan_register_txrx_packetdump(void) gtx_count = 0; grx_count = 0; } + +/** + * wlan_flush_host_logs_for_fatal() - Flush host logs + * + * This function is used to send signal to the logger thread to + * Flush the host logs + * + * Return: None + */ +void wlan_flush_host_logs_for_fatal(void) +{ + unsigned long flags; + + if (vos_is_log_report_in_progress()) { + pr_info("%s:flush all host logs Setting HOST_LOG_POST_MASK\n", + __func__); + spin_lock_irqsave(&gwlan_logging.spin_lock, flags); + wlan_queue_logmsg_for_app(); + spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags); + set_bit(HOST_LOG_DRIVER_MSG, &gwlan_logging.eventFlag); + wake_up_interruptible(&gwlan_logging.wait_queue); + } +} + #endif /* WLAN_LOGGING_SOCK_SVC_ENABLE */ diff --git a/CORE/VOSS/inc/vos_api.h b/CORE/VOSS/inc/vos_api.h index 68ad5d249046..e9ee25e740c9 100644 --- a/CORE/VOSS/inc/vos_api.h +++ b/CORE/VOSS/inc/vos_api.h @@ -354,16 +354,22 @@ uint8_t vos_is_multicast_logging(void); VOS_STATUS vos_set_log_completion(uint32_t is_fatal, uint32_t type, uint32_t sub_type); -void vos_get_log_completion(uint32_t *is_fatal, +void vos_get_log_and_reset_completion(uint32_t *is_fatal, uint32_t *type, - uint32_t *sub_type); + uint32_t *sub_type, + uint32_t *is_ssr_needed); bool vos_is_log_report_in_progress(void); +bool vos_is_fatal_event_enabled(void); +uint32_t vos_get_log_indicator(void); void vos_init_log_completion(void); void vos_deinit_log_completion(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); +void vos_wlan_flush_host_logs_for_fatal(void); void vos_logging_set_fw_flush_complete(void); void vos_probe_threads(void); +void vos_set_fatal_event(bool value); void vos_pkt_stats_to_logger_thread(void *pl_hdr, void *pkt_dump, void *data); #endif // if !defined __VOS_API_H 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; |
