summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohit Khanna <mkhannaqca@codeaurora.org>2016-07-26 13:02:07 -0700
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-07-28 15:35:03 +0530
commitb0886d6918f6bcb2f3a2356f4be2ee79286fbeed (patch)
treef9502d9eebe0758754343e99992deae5cacddcbd
parenta96c2c08ec2b9c8958f56324d2512c91b819203d (diff)
qcacld-3.0: Fix use of spinlock for pSchedContext->affinity_lock
In existing implementation, affinity lock is implemented as a spinlock. The set_cpus_allowed_ptr API under the spinlock can cause the processor to go to sleep. This is incorrect and causes a KERNEL bug when invoked. Correct the issue by replacing spinlock with a mutex. Change-Id: I844c19d18e6f71916592c4b35ff5f1a2b6cdbaa0 CRs-Fixed: 1046463
-rw-r--r--core/cds/inc/cds_sched.h2
-rw-r--r--core/cds/src/cds_sched.c14
2 files changed, 8 insertions, 8 deletions
diff --git a/core/cds/inc/cds_sched.h b/core/cds/inc/cds_sched.h
index 2b33ebb515ab..83cf40316412 100644
--- a/core/cds/inc/cds_sched.h
+++ b/core/cds/inc/cds_sched.h
@@ -203,7 +203,7 @@ typedef struct _cds_sched_context {
struct notifier_block *cpu_hot_plug_notifier;
/* affinity lock */
- spinlock_t affinity_lock;
+ struct mutex affinity_lock;
/* rx thread affinity cpu */
unsigned long rx_thread_cpu;
diff --git a/core/cds/src/cds_sched.c b/core/cds/src/cds_sched.c
index dadfbcdda4d8..d452b7ede1b2 100644
--- a/core/cds/src/cds_sched.c
+++ b/core/cds/src/cds_sched.c
@@ -270,15 +270,15 @@ int cds_sched_handle_cpu_hot_plug(void)
if (cds_is_load_or_unload_in_progress())
return 0;
- spin_lock_bh(&pSchedContext->affinity_lock);
+ mutex_lock(&pSchedContext->affinity_lock);
if (cds_sched_find_attach_cpu(pSchedContext,
pSchedContext->high_throughput_required)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: handle hot plug fail", __func__);
- spin_unlock_bh(&pSchedContext->affinity_lock);
+ mutex_unlock(&pSchedContext->affinity_lock);
return 1;
}
- spin_unlock_bh(&pSchedContext->affinity_lock);
+ mutex_unlock(&pSchedContext->affinity_lock);
return 0;
}
@@ -308,15 +308,15 @@ int cds_sched_handle_throughput_req(bool high_tput_required)
return 0;
}
- spin_lock_bh(&pSchedContext->affinity_lock);
+ mutex_lock(&pSchedContext->affinity_lock);
pSchedContext->high_throughput_required = high_tput_required;
if (cds_sched_find_attach_cpu(pSchedContext, high_tput_required)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: handle throughput req fail", __func__);
- spin_unlock_bh(&pSchedContext->affinity_lock);
+ mutex_unlock(&pSchedContext->affinity_lock);
return 1;
}
- spin_unlock_bh(&pSchedContext->affinity_lock);
+ mutex_unlock(&pSchedContext->affinity_lock);
return 0;
}
@@ -510,7 +510,7 @@ QDF_STATUS cds_sched_open(void *p_cds_context,
}
register_hotcpu_notifier(&cds_cpu_hotplug_notifier);
pSchedContext->cpu_hot_plug_notifier = &cds_cpu_hotplug_notifier;
- spin_lock_init(&pSchedContext->affinity_lock);
+ mutex_init(&pSchedContext->affinity_lock);
pSchedContext->high_throughput_required = false;
#endif
gp_cds_sched_context = pSchedContext;