From 29533f2ca16d09d03792b75b7161a0425927236c Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Tue, 24 Jul 2018 13:11:56 -0700 Subject: [PATCH] qcacld-3.0: Check for vdev/pdev leaks during SSR Currently, all resource leaks are skipped during the SSR reinit stage. However, recently added vdev and pdev leak checks apply equally as well to SSR reinit. During SSR do as many resource leak checks as possible, while retaining the entire set for normal use cases. Change-Id: I33248a9fb0fbacddf9ea8682ff984290712c29d3 CRs-Fixed: 2284384 --- core/hdd/src/wlan_hdd_main.c | 20 ++++++++++++-------- core/hdd/src/wlan_hdd_power.c | 2 -- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index baedd17d6abc..49bfe65c2975 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2703,6 +2703,7 @@ static void hdd_nan_register_callbacks(struct hdd_context *hdd_ctx) /** * hdd_check_for_leaks() - Perform runtime memory leak checks * @hdd_ctx: the global HDD context + * @is_ssr: true if SSR is in progress * * This API triggers runtime memory leak detection. This feature enforces the * policy that any memory allocated at runtime must also be released at runtime. @@ -2714,12 +2715,17 @@ static void hdd_nan_register_callbacks(struct hdd_context *hdd_ctx) * * Return: None */ -static void hdd_check_for_leaks(struct hdd_context *hdd_ctx) +static void hdd_check_for_leaks(struct hdd_context *hdd_ctx, bool is_ssr) { /* DO NOT REMOVE these checks; for false positives, read above first */ wlan_objmgr_psoc_check_for_vdev_leaks(hdd_ctx->hdd_psoc); wlan_objmgr_psoc_check_for_pdev_leaks(hdd_ctx->hdd_psoc); + + /* many adapter resources are not freed by design during SSR */ + if (is_ssr) + return; + qdf_mc_timer_check_for_leaks(); qdf_nbuf_map_check_for_leaks(); qdf_mem_check_for_leaks(); @@ -2727,7 +2733,8 @@ static void hdd_check_for_leaks(struct hdd_context *hdd_ctx) #define hdd_debug_domain_set(domain) qdf_debug_domain_set(domain) #else -static inline void hdd_check_for_leaks(struct hdd_context *hdd_ctx) { } +static inline void hdd_check_for_leaks(struct hdd_context *hdd_ctx, bool is_ssr) +{ } #define hdd_debug_domain_set(domain) #endif /* CONFIG_LEAK_DETECTION */ @@ -2980,9 +2987,8 @@ release_lock: qdf_mem_free(hdd_ctx->target_hw_name); hdd_ctx->target_hw_name = NULL; } - /* many adapter resources are not freed by design in SSR case */ - if (!reinit) - hdd_check_for_leaks(hdd_ctx); + + hdd_check_for_leaks(hdd_ctx, reinit); hdd_debug_domain_set(QDF_DEBUG_DOMAIN_INIT); hdd_exit(); @@ -10923,9 +10929,7 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode) ret); } - /* many adapter resources are not freed by design in SSR case */ - if (!is_recovery_stop) - hdd_check_for_leaks(hdd_ctx); + hdd_check_for_leaks(hdd_ctx, is_recovery_stop); hdd_debug_domain_set(QDF_DEBUG_DOMAIN_INIT); /* Once the firmware sequence is completed reset this flag */ diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 37155465ed41..dd1430a293af 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1246,8 +1246,6 @@ QDF_STATUS hdd_wlan_shutdown(void) hdd_lpass_notify_stop(hdd_ctx); - wlan_objmgr_print_ref_all_objects_per_psoc(hdd_ctx->hdd_psoc); - hdd_info("WLAN driver shutdown complete"); return QDF_STATUS_SUCCESS;