qcacld-3.0: Remove cds_ssr_protect/unprotect

cds_ssr_protect/unprotect is obsolete. Remove them, replacing any
remaining call sites with qdf_op_protect/unprotect.

Change-Id: Ib8e1fc1e16785dfe3c5f8273e4ad8d5d6ecdb6e6
CRs-Fixed: 2418454
This commit is contained in:
Dustin Brown 2019-03-18 14:00:16 -07:00 • committed by nshrivas
commit 3fdaaf61ad
8 changed files with 72 additions and 284 deletions

View file

@ -1340,12 +1340,7 @@ static void __policy_mgr_check_sta_ap_concurrent_ch_intf(void *data)
uint8_t operating_channel[MAX_NUMBER_OF_CONC_CONNECTIONS];
uint8_t vdev_id[MAX_NUMBER_OF_CONC_CONNECTIONS];
if (qdf_is_module_state_transitioning()) {
policy_mgr_err("Module transition in progress");
goto end;
}
work_info = (struct sta_ap_intf_check_work_ctx *) data;
work_info = data;
if (!work_info) {
policy_mgr_err("Invalid work_info");
goto end;
@ -1426,9 +1421,14 @@ end:
void policy_mgr_check_sta_ap_concurrent_ch_intf(void *data)
{
qdf_ssr_protect(__func__);
struct qdf_op_sync *op_sync;
if (qdf_op_protect(&op_sync))
return;
__policy_mgr_check_sta_ap_concurrent_ch_intf(data);
qdf_ssr_unprotect(__func__);
qdf_op_unprotect(op_sync);
}
static bool policy_mgr_valid_sta_channel_check(struct wlan_objmgr_psoc *psoc,

View file

@ -778,16 +778,6 @@ static void __wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
return;
}
if (qdf_is_module_state_transitioning()) {
ipa_err_rl("Module transition in progress");
if (evt == IPA_RECEIVE) {
skb = (qdf_nbuf_t)data;
ipa_ctx->ipa_rx_internal_drop_count++;
dev_kfree_skb_any(skb);
}
return;
}
switch (evt) {
case IPA_RECEIVE:
skb = (qdf_nbuf_t) data;
@ -867,9 +857,23 @@ static void __wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
static void wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
unsigned long data)
{
qdf_ssr_protect(__func__);
struct qdf_op_sync *op_sync;
if (qdf_op_protect(&op_sync)) {
if (evt == IPA_RECEIVE) {
struct wlan_ipa_priv *ipa_ctx = priv;
qdf_nbuf_t skb = (qdf_nbuf_t)data;
ipa_ctx->ipa_rx_internal_drop_count++;
dev_kfree_skb_any(skb);
}
return;
}
__wlan_ipa_w2i_cb(priv, evt, data);
qdf_ssr_unprotect(__func__);
qdf_op_unprotect(op_sync);
}
/**
@ -894,13 +898,6 @@ static void __wlan_ipa_i2w_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
ipa_tx_desc = (qdf_ipa_rx_data_t *)data;
ipa_ctx = iface_context->ipa_ctx;
if (qdf_is_module_state_transitioning()) {
ipa_err_rl("Module transition in progress");
ipa_free_skb(ipa_tx_desc);
iface_context->stats.num_tx_drop++;
return;
}
if (evt != IPA_RECEIVE) {
ipa_err_rl("Event is not IPA_RECEIVE");
ipa_free_skb(ipa_tx_desc);
@ -961,9 +958,21 @@ static void __wlan_ipa_i2w_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
static void wlan_ipa_i2w_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
unsigned long data)
{
qdf_ssr_protect(__func__);
struct qdf_op_sync *op_sync;
if (qdf_op_protect(&op_sync)) {
qdf_ipa_rx_data_t *ipa_tx_desc = (qdf_ipa_rx_data_t *)data;
struct wlan_ipa_iface_context *iface_context = priv;
ipa_free_skb(ipa_tx_desc);
iface_context->stats.num_tx_drop++;
return;
}
__wlan_ipa_i2w_cb(priv, evt, data);
qdf_ssr_unprotect(__func__);
qdf_op_unprotect(op_sync);
}
QDF_STATUS wlan_ipa_suspend(struct wlan_ipa_priv *ipa_ctx)
@ -2854,11 +2863,6 @@ static void __wlan_ipa_uc_fw_op_event_handler(void *data)
(struct uc_op_work_struct *)data;
struct wlan_ipa_priv *ipa_ctx = gp_ipa;
if (qdf_is_module_state_transitioning()) {
ipa_err("Module transition in progress");
return;
}
msg = uc_op_work->msg;
uc_op_work->msg = NULL;
ipa_debug("posted msg %d", msg->op_code);
@ -2875,9 +2879,14 @@ static void __wlan_ipa_uc_fw_op_event_handler(void *data)
*/
static void wlan_ipa_uc_fw_op_event_handler(void *data)
{
qdf_ssr_protect(__func__);
struct qdf_op_sync *op_sync;
if (qdf_op_protect(&op_sync))
return;
__wlan_ipa_uc_fw_op_event_handler(data);
qdf_ssr_unprotect(__func__);
qdf_op_unprotect(op_sync);
}
/**

View file

@ -866,11 +866,6 @@ static void __wlan_ipa_wdi_meter_notifier_cb(qdf_ipa_wdi_meter_evt_type_t evt,
ipa_debug("event=%d", evt);
if (qdf_is_module_state_transitioning()) {
ipa_err_rl("Module transition in progress");
return;
}
iface_ctx = wlan_ipa_get_iface(ipa_ctx, QDF_STA_MODE);
if (!iface_ctx) {
ipa_err_rl("IPA uC share stats failed - no iface");
@ -957,9 +952,14 @@ static void __wlan_ipa_wdi_meter_notifier_cb(qdf_ipa_wdi_meter_evt_type_t evt,
void wlan_ipa_wdi_meter_notifier_cb(qdf_ipa_wdi_meter_evt_type_t evt,
void *data)
{
qdf_ssr_protect(__func__);
struct qdf_op_sync *op_sync;
if (qdf_op_protect(&op_sync))
return;
__wlan_ipa_wdi_meter_notifier_cb(evt, data);
qdf_ssr_unprotect(__func__);
qdf_op_unprotect(op_sync);
}
#endif /* FEATURE_METERING */

View file

@ -460,19 +460,8 @@ p_cds_sched_context get_cds_sched_ctxt(void);
void qdf_timer_module_init(void);
void qdf_timer_module_deinit(void);
void cds_ssr_protect_init(void);
void cds_ssr_protect(const char *caller_func);
void cds_ssr_unprotect(const char *caller_func);
bool cds_wait_for_external_threads_completion(const char *caller_func);
void cds_print_external_threads(void);
int cds_get_gfp_flags(void);
/**
* cds_return_external_threads_count() - return active external thread calls
*
* Return: total number of active extrenal threads in driver
*/
int cds_return_external_threads_count(void);
/**
* cds_shutdown_notifier_register() - Register for shutdown notification
* @cb : Call back to be called

View file

@ -194,7 +194,6 @@ QDF_STATUS cds_init(void)
qdf_register_self_recovery_callback(__cds_trigger_recovery);
qdf_register_fw_down_callback(cds_is_fw_down);
qdf_register_ssr_protect_callbacks(cds_ssr_protect, cds_ssr_unprotect);
qdf_register_recovering_state_query_callback(cds_is_driver_recovering);
return QDF_STATUS_SUCCESS;
@ -216,8 +215,8 @@ void cds_deinit(void)
QDF_BUG(gp_cds_context);
if (!gp_cds_context)
return;
qdf_register_recovering_state_query_callback(NULL);
qdf_register_ssr_protect_callbacks(NULL, NULL);
qdf_register_fw_down_callback(NULL);
qdf_register_self_recovery_callback(NULL);

View file

@ -39,31 +39,7 @@
#include <linux/sched/types.h>
#endif
/* Milli seconds to delay SSR thread when an Entry point is Active */
#define SSR_WAIT_SLEEP_TIME 200
/* MAX iteration count to wait for Entry point to exit before
* we proceed with SSR in WD Thread
*/
#define MAX_SSR_WAIT_ITERATIONS 100
#define MAX_SSR_PROTECT_LOG (16)
static atomic_t ssr_protect_entry_count;
/**
* struct ssr_protect - sub system restart(ssr) protection tracking table
* @func: Function which needs ssr protection
* @free: Flag to tell whether entry is free in table or not
* @pid: Process id which needs ssr protection
*/
struct ssr_protect {
const char *func;
bool free;
uint32_t pid;
};
static spinlock_t ssr_protect_lock;
static struct ssr_protect ssr_protect_log[MAX_SSR_PROTECT_LOG];
struct shutdown_notifier {
struct list_head list;
@ -78,7 +54,6 @@ enum notifier_state {
NOTIFIER_STATE_NOTIFYING,
} notifier_state;
static p_cds_sched_context gp_cds_sched_context;
#ifdef QCA_CONFIG_SMP
static int cds_ol_rx_thread(void *arg);
@ -374,9 +349,14 @@ static void __cds_cpu_hotplug_notify(uint32_t cpu, bool cpu_up)
*/
static void cds_cpu_hotplug_notify(uint32_t cpu, bool cpu_up)
{
cds_ssr_protect(__func__);
struct qdf_op_sync *op_sync;
if (qdf_op_protect(&op_sync))
return;
__cds_cpu_hotplug_notify(cpu, cpu_up);
cds_ssr_unprotect(__func__);
qdf_op_unprotect(op_sync);
}
static void cds_cpu_online_cb(void *context, uint32_t cpu)
@ -852,131 +832,10 @@ p_cds_sched_context get_cds_sched_ctxt(void)
*/
void cds_ssr_protect_init(void)
{
int i = 0;
spin_lock_init(&ssr_protect_lock);
while (i < MAX_SSR_PROTECT_LOG) {
ssr_protect_log[i].func = NULL;
ssr_protect_log[i].free = true;
ssr_protect_log[i].pid = 0;
i++;
}
INIT_LIST_HEAD(&shutdown_notifier_head);
}
/**
* cds_print_external_threads() - print external threads stuck in driver
*
* Return:
* void
*/
void cds_print_external_threads(void)
{
int i = 0;
unsigned long irq_flags;
spin_lock_irqsave(&ssr_protect_lock, irq_flags);
while (i < MAX_SSR_PROTECT_LOG) {
if (!ssr_protect_log[i].free) {
cds_err("PID %d is executing %s",
ssr_protect_log[i].pid,
ssr_protect_log[i].func);
}
i++;
}
spin_unlock_irqrestore(&ssr_protect_lock, irq_flags);
}
/**
* cds_ssr_protect() - start ssr protection
* @caller_func: name of calling function.
*
* This function is called to keep track of active driver entry points
*
* Return: none
*/
void cds_ssr_protect(const char *caller_func)
{
int count;
int i = 0;
bool status = false;
unsigned long irq_flags;
count = atomic_inc_return(&ssr_protect_entry_count);
spin_lock_irqsave(&ssr_protect_lock, irq_flags);
while (i < MAX_SSR_PROTECT_LOG) {
if (ssr_protect_log[i].free) {
ssr_protect_log[i].func = caller_func;
ssr_protect_log[i].free = false;
ssr_protect_log[i].pid = current->pid;
status = true;
break;
}
i++;
}
spin_unlock_irqrestore(&ssr_protect_lock, irq_flags);
/*
* Dump the protect log at intervals if count is consistently growing.
* Long running functions should tend to dominate the protect log, so
* hopefully, dumping at multiples of log size will prevent spamming the
* logs while telling us which calls are taking a long time to finish.
*/
if (count >= MAX_SSR_PROTECT_LOG && count % MAX_SSR_PROTECT_LOG == 0) {
cds_err("Protect Log overflow; Dumping contents:");
cds_print_external_threads();
}
if (!status)
cds_err("%s can not be protected; PID:%d, entry_count:%d",
caller_func, current->pid, count);
}
/**
* cds_ssr_unprotect() - stop ssr protection
* @caller_func: name of calling function.
*
* Return: none
*/
void cds_ssr_unprotect(const char *caller_func)
{
int count;
int i = 0;
bool status = false;
unsigned long irq_flags;
count = atomic_dec_return(&ssr_protect_entry_count);
spin_lock_irqsave(&ssr_protect_lock, irq_flags);
while (i < MAX_SSR_PROTECT_LOG) {
if (!ssr_protect_log[i].free) {
if ((ssr_protect_log[i].pid == current->pid) &&
!strcmp(ssr_protect_log[i].func, caller_func)) {
ssr_protect_log[i].func = NULL;
ssr_protect_log[i].free = true;
ssr_protect_log[i].pid = 0;
status = true;
break;
}
}
i++;
}
spin_unlock_irqrestore(&ssr_protect_lock, irq_flags);
if (!status)
cds_err("%s was not protected; PID:%d, entry_count:%d",
caller_func, current->pid, count);
}
/**
* cds_shutdown_notifier_register() - Register for shutdown notification
* @cb : Call back to be called
@ -1084,54 +943,6 @@ void cds_shutdown_notifier_call(void)
spin_unlock_irqrestore(&ssr_protect_lock, irq_flags);
}
/**
* cds_wait_for_external_threads_completion() - wait for external threads
* completion before proceeding further
* @caller_func: name of calling function.
*
* Return: true if there is no active entry points in driver
* false if there is at least one active entry in driver
*/
bool cds_wait_for_external_threads_completion(const char *caller_func)
{
int count = MAX_SSR_WAIT_ITERATIONS;
int r;
while (count) {
r = atomic_read(&ssr_protect_entry_count);
if (!r)
break;
if (--count) {
cds_err("Waiting for %d active entry points to exit",
r);
msleep(SSR_WAIT_SLEEP_TIME);
if (count & 0x1) {
cds_err("in middle of waiting for active entry points:");
cds_print_external_threads();
}
}
}
/* at least one external thread is executing */
if (!count) {
cds_err("Timed-out waiting for active entry points:");
cds_print_external_threads();
return false;
}
cds_info("Allowing SSR/Driver unload for %s", caller_func);
return true;
}
int cds_return_external_threads_count(void)
{
return atomic_read(&ssr_protect_entry_count);
}
/**
* cds_get_gfp_flags(): get GFP flags
*

View file

@ -571,9 +571,6 @@ static void __hdd_soc_remove(struct device *dev)
cds_set_driver_loaded(false);
cds_set_unload_in_progress(true);
if (!cds_wait_for_external_threads_completion(__func__))
hdd_warn("External threads are still active attempting driver unload anyway");
if (!hdd_wait_for_debugfs_threads_completion())
hdd_warn("Debugfs threads are still active attempting driver unload anyway");
@ -730,9 +727,6 @@ static void __hdd_soc_recovery_shutdown(void)
hdd_psoc_shutdown_notify(hdd_ctx);
if (!cds_wait_for_external_threads_completion(__func__))
hdd_err("Host is not ready for SSR, attempting anyway");
if (!hdd_wait_for_debugfs_threads_completion())
hdd_err("Debufs threads are still pending, attempting SSR anyway");

View file

@ -8002,11 +8002,15 @@ stop_work:
static void hdd_bus_bw_work_handler(void *context)
{
struct wiphy *wiphy = context;
struct hdd_context *hdd_ctx = context;
struct qdf_op_sync *op_sync;
cds_ssr_protect(__func__);
__hdd_bus_bw_work_handler(wiphy_priv(wiphy));
cds_ssr_unprotect(__func__);
if (qdf_op_protect(&op_sync))
return;
__hdd_bus_bw_work_handler(hdd_ctx);
qdf_op_unprotect(op_sync);
}
int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx)
@ -8018,7 +8022,7 @@ int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx)
spin_lock_init(&hdd_ctx->bus_bw_lock);
status = qdf_periodic_work_create(&hdd_ctx->bus_bw_work,
hdd_bus_bw_work_handler,
hdd_ctx->wiphy);
hdd_ctx);
hdd_exit();
@ -11275,7 +11279,6 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode)
QDF_STATUS qdf_status;
bool is_recovery_stop = cds_is_driver_recovering();
int ret = 0;
int active_threads;
int debugfs_threads;
struct target_psoc_info *tgt_hdl;
@ -11293,17 +11296,11 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode)
hdd_ctx->stop_modules_in_progress = true;
cds_set_module_stop_in_progress(true);
active_threads = cds_return_external_threads_count();
debugfs_threads = hdd_return_debugfs_threads_count();
if (active_threads > 0 || debugfs_threads > 0 ||
hdd_ctx->is_wiphy_suspended) {
hdd_warn("External threads %d, Debugfs threads %d, wiphy suspend %d",
active_threads, debugfs_threads,
hdd_ctx->is_wiphy_suspended);
if (active_threads)
cds_print_external_threads();
if (debugfs_threads > 0 || hdd_ctx->is_wiphy_suspended) {
hdd_warn("Debugfs threads %d, wiphy suspend %d",
debugfs_threads, hdd_ctx->is_wiphy_suspended);
if (IS_IDLE_STOP && !ftm_mode) {
mutex_unlock(&hdd_ctx->iface_change_lock);
@ -12880,7 +12877,6 @@ int hdd_init(void)
}
qdf_op_callbacks_register(__hdd_op_protect_cb, __hdd_op_unprotect_cb);
qdf_register_module_state_query_callback(hdd_state_query_cb);
wlan_init_bug_report_lock();
@ -13603,12 +13599,6 @@ static int hdd_driver_mode_change(enum QDF_GLOBAL_MODE mode)
if (errno)
goto trans_stop;
if (!cds_wait_for_external_threads_completion(__func__)) {
hdd_warn("External threads still active, cannot change mode");
errno = -EAGAIN;
goto trans_stop;
}
errno = __hdd_driver_mode_change(hdd_ctx, mode);
trans_stop:
@ -13803,10 +13793,6 @@ static void hdd_driver_unload(void)
cds_set_driver_loaded(false);
cds_set_unload_in_progress(true);
if (!cds_wait_for_external_threads_completion(__func__))
hdd_warn("External threads are still active attempting "
"driver unload anyway");
hdd_driver_mode_change_unregister();
pld_deinit();
wlan_hdd_state_ctrl_param_destroy();