From 0626a4da6c07f30da06dd6747e8cc290a60371d8 Mon Sep 17 00:00:00 2001 From: Vivek Date: Fri, 28 Sep 2018 19:09:48 +0530 Subject: [PATCH] qcacmn: Wait for scheduler buffers before we panic The scheduler can run out of buffers and we panic whenever this happens. However in the older code we wait until the failure count of getting scheduler buffers reaches a defined limit, thus making buffers available in due time and the panic was seen in rare cases, where failure count was exceeding the defined limit. With the qdf_flex_mem supprt added for scheduler, the wait to panic, when the failure count was removed and we panic when the first failure to get scheduler buffer is reached. This change adds to wait until the failure count reaches the limit and then panic. Change-Id: Ie8774830dc0cefdfccb1473216a9300609ab65bb CRs-Fixed: 2322049 --- scheduler/src/scheduler_core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scheduler/src/scheduler_core.c b/scheduler/src/scheduler_core.c index fca63056470f..a9412c74385a 100644 --- a/scheduler/src/scheduler_core.c +++ b/scheduler/src/scheduler_core.c @@ -116,6 +116,7 @@ static void scheduler_mq_deinit(struct scheduler_mq_type *msg_q) } static qdf_atomic_t __sched_queue_depth; +static qdf_atomic_t __sched_dup_fail_count; static QDF_STATUS scheduler_all_queues_init(struct scheduler_ctx *sched_ctx) { @@ -247,10 +248,15 @@ struct scheduler_msg *scheduler_core_msg_dup(struct scheduler_msg *msg) qdf_mem_copy(dup, msg, sizeof(*dup)); + qdf_atomic_set(&__sched_dup_fail_count, 0); + return dup; buffer_full: - QDF_DEBUG_PANIC("Scheduler buffer is full"); + if (qdf_atomic_inc_return(&__sched_dup_fail_count) > + SCHEDULER_WRAPPER_MAX_FAIL_COUNT) + QDF_DEBUG_PANIC("Scheduler buffer is full"); + dec_queue_count: qdf_atomic_dec(&__sched_queue_depth);