qcacmn: Migrate scheduler logging functions

Part of the scheduler component has been migrated to the new sched_*
logging wrappers, but part of it still remains to be ported. Finish
migrating all of the scheduler logging APIs.

Change-Id: I5065d849a1523d6c27d6c6a27b1ad4605036c3e6
CRs-Fixed: 2201038
This commit is contained in:
Dustin Brown
2018-03-06 11:33:05 -08:00
committed by nshrivas
parent 2a06b23e82
commit 3149adf58a
2 changed files with 130 additions and 138 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014-2017 The Linux Foundation. All rights reserved. * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -41,21 +41,19 @@
#define SCHEDULER_WRAPPER_MAX_FAIL_COUNT (SCHEDULER_CORE_MAX_MESSAGES * 3) #define SCHEDULER_WRAPPER_MAX_FAIL_COUNT (SCHEDULER_CORE_MAX_MESSAGES * 3)
#define SCHEDULER_WATCHDOG_TIMEOUT (10 * 1000) /* 10s */ #define SCHEDULER_WATCHDOG_TIMEOUT (10 * 1000) /* 10s */
#define sched_log(level, args...) \ #define __sched_log(level, format, args...) \
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, level, ## args) QDF_TRACE(QDF_MODULE_ID_SCHEDULER, level, FL(format), ## args)
#define sched_logfl(level, format, args...) \
sched_log(level, FL(format), ## args)
#define sched_fatal(format, args...) \ #define sched_fatal(format, args...) \
sched_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args) __sched_log(QDF_TRACE_LEVEL_FATAL, format, ## args)
#define sched_err(format, args...) \ #define sched_err(format, args...) \
sched_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args) __sched_log(QDF_TRACE_LEVEL_ERROR, format, ## args)
#define sched_warn(format, args...) \ #define sched_warn(format, args...) \
sched_logfl(QDF_TRACE_LEVEL_WARN, format, ## args) __sched_log(QDF_TRACE_LEVEL_WARN, format, ## args)
#define sched_info(format, args...) \ #define sched_info(format, args...) \
sched_logfl(QDF_TRACE_LEVEL_INFO, format, ## args) __sched_log(QDF_TRACE_LEVEL_INFO, format, ## args)
#define sched_debug(format, args...) \ #define sched_debug(format, args...) \
sched_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args) __sched_log(QDF_TRACE_LEVEL_DEBUG, format, ## args)
#define sched_enter() sched_debug("Enter") #define sched_enter() sched_debug("Enter")
#define sched_exit() sched_debug("Exit") #define sched_exit() sched_debug("Exit")

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014-2017 The Linux Foundation. All rights reserved. * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -51,17 +51,16 @@ struct scheduler_ctx *scheduler_get_context(void)
} }
static QDF_STATUS scheduler_all_queues_init( static QDF_STATUS scheduler_all_queues_init(struct scheduler_ctx *sched_ctx)
struct scheduler_ctx *sched_ctx)
{ {
QDF_STATUS status = QDF_STATUS_SUCCESS; QDF_STATUS status;
int i; int i;
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_DEBUG, FL("enter")); sched_enter();
if (!sched_ctx) { if (!sched_ctx) {
QDF_ASSERT(0); sched_err("sched_ctx is null");
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, QDF_DEBUG_PANIC();
"%s: Null params being passed", __func__);
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
@@ -69,45 +68,41 @@ static QDF_STATUS scheduler_all_queues_init(
if (QDF_STATUS_SUCCESS != status) if (QDF_STATUS_SUCCESS != status)
return status; return status;
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, sched_debug("free msg queue init complete");
QDF_TRACE_LEVEL_DEBUG, FL("free msg queue init complete"));
/* Initialize all message queues */ /* Initialize all message queues */
for (i = 0; i < SCHEDULER_NUMBER_OF_MSG_QUEUE; i++) { for (i = 0; i < SCHEDULER_NUMBER_OF_MSG_QUEUE; i++) {
status = scheduler_mq_init( status = scheduler_mq_init(&sched_ctx->queue_ctx.sch_msg_q[i]);
&sched_ctx->queue_ctx.sch_msg_q[i]);
if (QDF_STATUS_SUCCESS != status) if (QDF_STATUS_SUCCESS != status)
return status; return status;
} }
/* Initialize all qid to qidx mapping to invalid values */ /* Initialize all qid to qidx mapping to invalid values */
for (i = 0; i < QDF_MODULE_ID_MAX; i++) for (i = 0; i < QDF_MODULE_ID_MAX; i++)
sched_ctx->queue_ctx.scheduler_msg_qid_to_qidx[i] = sched_ctx->queue_ctx.scheduler_msg_qid_to_qidx[i] =
SCHEDULER_NUMBER_OF_MSG_QUEUE; SCHEDULER_NUMBER_OF_MSG_QUEUE;
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_DEBUG, FL("exit")); sched_exit();
return status; return status;
} }
static QDF_STATUS scheduler_all_queues_deinit( static QDF_STATUS scheduler_all_queues_deinit(struct scheduler_ctx *sched_ctx)
struct scheduler_ctx *sched_ctx)
{ {
QDF_STATUS status = QDF_STATUS_SUCCESS;
int i; int i;
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_DEBUG, FL("enter")); sched_enter();
if (!sched_ctx) { if (!sched_ctx) {
QDF_ASSERT(0); sched_err("sched_ctx is null");
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, QDF_DEBUG_PANIC();
"%s: Null params being passed", __func__);
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
scheduler_mq_deinit(&sched_ctx->queue_ctx.free_msg_q); scheduler_mq_deinit(&sched_ctx->queue_ctx.free_msg_q);
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, sched_debug("free msg queue inited");
QDF_TRACE_LEVEL_DEBUG, FL("free msg queue inited"));
/* De-Initialize all message queues */ /* De-Initialize all message queues */
for (i = 0; i < SCHEDULER_NUMBER_OF_MSG_QUEUE; i++) for (i = 0; i < SCHEDULER_NUMBER_OF_MSG_QUEUE; i++)
@@ -118,58 +113,68 @@ static QDF_STATUS scheduler_all_queues_deinit(
sched_ctx->queue_ctx.scheduler_msg_qid_to_qidx[i] = sched_ctx->queue_ctx.scheduler_msg_qid_to_qidx[i] =
SCHEDULER_NUMBER_OF_MSG_QUEUE; SCHEDULER_NUMBER_OF_MSG_QUEUE;
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_DEBUG, FL("exit")); sched_exit();
return status;
return QDF_STATUS_SUCCESS;
} }
QDF_STATUS scheduler_mq_init(struct scheduler_mq_type *msg_q) QDF_STATUS scheduler_mq_init(struct scheduler_mq_type *msg_q)
{ {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_DEBUG, FL("Enter")); sched_enter();
if (msg_q == NULL) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, if (!msg_q) {
"%s: NULL pointer passed", __func__); sched_err("msg_q is null");
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
/* Now initialize the lock */ /* Now initialize the lock */
qdf_spinlock_create(&msg_q->mq_lock); qdf_spinlock_create(&msg_q->mq_lock);
/* Now initialize the List data structure */ /* Now initialize the List data structure */
qdf_list_create(&msg_q->mq_list, SCHEDULER_CORE_MAX_MESSAGES); qdf_list_create(&msg_q->mq_list, SCHEDULER_CORE_MAX_MESSAGES);
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_DEBUG, FL("Exit"));
sched_exit();
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
void scheduler_mq_deinit(struct scheduler_mq_type *msg_q) void scheduler_mq_deinit(struct scheduler_mq_type *msg_q)
{ {
if (msg_q == NULL) { if (!msg_q)
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, sched_err("msg_q is null");
"%s: NULL pointer passed", __func__);
return;
}
} }
void scheduler_mq_put(struct scheduler_mq_type *msg_q, void scheduler_mq_put(struct scheduler_mq_type *msg_q,
struct scheduler_msg_wrapper *msg_wrapper) struct scheduler_msg_wrapper *msg_wrapper)
{ {
if (msg_q == NULL || msg_wrapper == NULL) { if (!msg_q) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, sched_err("msg_q is null");
"%s: NULL pointer passed", __func__);
return; return;
} }
if (!msg_wrapper) {
sched_err("msg_wrapper is null");
return;
}
qdf_spin_lock_irqsave(&msg_q->mq_lock); qdf_spin_lock_irqsave(&msg_q->mq_lock);
qdf_list_insert_back(&msg_q->mq_list, &msg_wrapper->msg_node); qdf_list_insert_back(&msg_q->mq_list, &msg_wrapper->msg_node);
qdf_spin_unlock_irqrestore(&msg_q->mq_lock); qdf_spin_unlock_irqrestore(&msg_q->mq_lock);
} }
void scheduler_mq_put_front(struct scheduler_mq_type *msg_q, void scheduler_mq_put_front(struct scheduler_mq_type *msg_q,
struct scheduler_msg_wrapper *msg_wrapper) struct scheduler_msg_wrapper *msg_wrapper)
{ {
if ((msg_q == NULL) || (msg_wrapper == NULL)) { if (!msg_q) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, sched_err("msg_q is null");
"%s: NULL pointer passed", __func__);
return; return;
} }
if (!msg_wrapper) {
sched_err("msg_wrapper is null");
return;
}
qdf_spin_lock_irqsave(&msg_q->mq_lock); qdf_spin_lock_irqsave(&msg_q->mq_lock);
qdf_list_insert_front(&msg_q->mq_list, &msg_wrapper->msg_node); qdf_list_insert_front(&msg_q->mq_list, &msg_wrapper->msg_node);
qdf_spin_unlock_irqrestore(&msg_q->mq_lock); qdf_spin_unlock_irqrestore(&msg_q->mq_lock);
@@ -180,16 +185,14 @@ struct scheduler_msg_wrapper *scheduler_mq_get(struct scheduler_mq_type *msg_q)
qdf_list_node_t *listptr; qdf_list_node_t *listptr;
struct scheduler_msg_wrapper *msg_wrapper = NULL; struct scheduler_msg_wrapper *msg_wrapper = NULL;
if (msg_q == NULL) { if (!msg_q) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, sched_err("msg_q is null");
"%s: NULL pointer passed", __func__);
return NULL; return NULL;
} }
qdf_spin_lock_irqsave(&msg_q->mq_lock); qdf_spin_lock_irqsave(&msg_q->mq_lock);
if (qdf_list_empty(&msg_q->mq_list)) { if (qdf_list_empty(&msg_q->mq_list)) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_WARN, sched_warn("Scheduler Message Queue is empty");
"%s: Scheduler Message Queue is empty", __func__);
} else { } else {
listptr = msg_q->mq_list.anchor.next; listptr = msg_q->mq_list.anchor.next;
msg_wrapper = (struct scheduler_msg_wrapper *) msg_wrapper = (struct scheduler_msg_wrapper *)
@@ -199,22 +202,23 @@ struct scheduler_msg_wrapper *scheduler_mq_get(struct scheduler_mq_type *msg_q)
qdf_list_remove_node(&msg_q->mq_list, listptr); qdf_list_remove_node(&msg_q->mq_list, listptr);
} }
qdf_spin_unlock_irqrestore(&msg_q->mq_lock); qdf_spin_unlock_irqrestore(&msg_q->mq_lock);
return msg_wrapper;
return msg_wrapper;
} }
bool scheduler_is_mq_empty(struct scheduler_mq_type *msg_q) bool scheduler_is_mq_empty(struct scheduler_mq_type *msg_q)
{ {
bool is_empty = false; bool is_empty;
if (msg_q == NULL) { if (!msg_q) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, sched_err("msg_q is null");
"%s: NULL pointer passed", __func__); return true;
return QDF_STATUS_E_FAILURE;
} }
qdf_spin_lock_irqsave(&msg_q->mq_lock); qdf_spin_lock_irqsave(&msg_q->mq_lock);
is_empty = qdf_list_empty(&msg_q->mq_list) ? true : false; is_empty = qdf_list_empty(&msg_q->mq_list);
qdf_spin_unlock_irqrestore(&msg_q->mq_lock); qdf_spin_unlock_irqrestore(&msg_q->mq_lock);
return is_empty; return is_empty;
} }
@@ -225,26 +229,25 @@ QDF_STATUS scheduler_queues_deinit(struct scheduler_ctx *sched_ctx)
QDF_STATUS scheduler_queues_init(struct scheduler_ctx *sched_ctx) QDF_STATUS scheduler_queues_init(struct scheduler_ctx *sched_ctx)
{ {
QDF_STATUS status = QDF_STATUS_E_FAILURE; QDF_STATUS status;
int i; int i;
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_DEBUG, FL("Enter")); sched_enter();
if (!sched_ctx) { if (!sched_ctx) {
QDF_ASSERT(0); sched_err("sched_ctx is null");
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, QDF_DEBUG_PANIC();
"%s: Null params being passed", __func__);
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
status = scheduler_all_queues_init(sched_ctx); status = scheduler_all_queues_init(sched_ctx);
if (QDF_STATUS_SUCCESS != status) { if (QDF_STATUS_SUCCESS != status) {
scheduler_all_queues_deinit(sched_ctx); scheduler_all_queues_deinit(sched_ctx);
QDF_ASSERT(0); sched_err("Failed to initialize the msg queues");
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_FATAL,
FL("Failed to initialize the msg queues"));
return status; return status;
} }
QDF_TRACE(QDF_MODULE_ID_SCHEDULER,
QDF_TRACE_LEVEL_DEBUG, FL("Queue init passed")); sched_debug("Queue init passed");
for (i = 0; i < SCHEDULER_CORE_MAX_MESSAGES; i++) { for (i = 0; i < SCHEDULER_CORE_MAX_MESSAGES; i++) {
(sched_ctx->queue_ctx.msg_wrappers[i]).msg_buf = (sched_ctx->queue_ctx.msg_wrappers[i]).msg_buf =
@@ -254,25 +257,24 @@ QDF_STATUS scheduler_queues_init(struct scheduler_ctx *sched_ctx)
scheduler_mq_put(&sched_ctx->queue_ctx.free_msg_q, scheduler_mq_put(&sched_ctx->queue_ctx.free_msg_q,
&(sched_ctx->queue_ctx.msg_wrappers[i])); &(sched_ctx->queue_ctx.msg_wrappers[i]));
} }
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_DEBUG, FL("Exit"));
return status; sched_exit();
return QDF_STATUS_SUCCESS;
} }
static void scheduler_core_return_msg(struct scheduler_ctx *sch_ctx, static void scheduler_core_return_msg(struct scheduler_ctx *sch_ctx,
struct scheduler_msg_wrapper *msg_wrapper) struct scheduler_msg_wrapper *msg_wrapper)
{ {
if (!sch_ctx) { if (!sch_ctx) {
QDF_ASSERT(0); sched_err("sch_ctx is null");
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, QDF_DEBUG_PANIC();
"%s: gp_cds_context != p_cds_context", __func__);
return; return;
} }
QDF_ASSERT(NULL != msg_wrapper); QDF_ASSERT(msg_wrapper);
if (!msg_wrapper) {
if (msg_wrapper == NULL) { sched_err("msg_wrapper is null");
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR,
FL("msg_wrapper == NULL in function"));
return; return;
} }
@@ -287,13 +289,12 @@ static void scheduler_thread_process_queues(struct scheduler_ctx *sch_ctx,
bool *shutdown) bool *shutdown)
{ {
int i; int i;
QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; QDF_STATUS status;
struct scheduler_msg_wrapper *msg_wrapper = NULL; struct scheduler_msg_wrapper *msg_wrapper;
if (!sch_ctx) { if (!sch_ctx) {
QDF_ASSERT(0); sched_err("sch_ctx is null");
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, QDF_DEBUG_PANIC();
FL("sch_ctx null"));
return; return;
} }
@@ -303,11 +304,9 @@ static void scheduler_thread_process_queues(struct scheduler_ctx *sch_ctx,
/* Check if MC needs to shutdown */ /* Check if MC needs to shutdown */
if (qdf_atomic_test_bit(MC_SHUTDOWN_EVENT_MASK, if (qdf_atomic_test_bit(MC_SHUTDOWN_EVENT_MASK,
&sch_ctx->sch_event_flag)) { &sch_ctx->sch_event_flag)) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, sched_info("scheduler thread signaled to shutdown");
QDF_TRACE_LEVEL_ERROR,
"%s: scheduler thread signaled to shutdown",
__func__);
*shutdown = true; *shutdown = true;
/* Check for any Suspend Indication */ /* Check for any Suspend Indication */
if (qdf_atomic_test_and_clear_bit(MC_SUSPEND_EVENT_MASK, if (qdf_atomic_test_and_clear_bit(MC_SUSPEND_EVENT_MASK,
&sch_ctx->sch_event_flag)) { &sch_ctx->sch_event_flag)) {
@@ -315,22 +314,24 @@ static void scheduler_thread_process_queues(struct scheduler_ctx *sch_ctx,
if (gp_sched_ctx->hdd_callback) if (gp_sched_ctx->hdd_callback)
gp_sched_ctx->hdd_callback(); gp_sched_ctx->hdd_callback();
} }
break; break;
} }
if (scheduler_is_mq_empty(&sch_ctx->queue_ctx.sch_msg_q[i])) { if (scheduler_is_mq_empty(&sch_ctx->queue_ctx.sch_msg_q[i])) {
/* check next queue */ /* check next queue */
i++; i++;
continue; continue;
} }
msg_wrapper = msg_wrapper =
scheduler_mq_get(&sch_ctx->queue_ctx.sch_msg_q[i]); scheduler_mq_get(&sch_ctx->queue_ctx.sch_msg_q[i]);
if (msg_wrapper == NULL) { if (!msg_wrapper) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, sched_err("msg_wrapper is NULL");
QDF_TRACE_LEVEL_ERROR,
"%s: msg_wrapper is NULL", __func__);
QDF_ASSERT(0); QDF_ASSERT(0);
return; return;
} }
if (sch_ctx->queue_ctx.scheduler_msg_process_fn[i]) { if (sch_ctx->queue_ctx.scheduler_msg_process_fn[i]) {
struct scheduler_msg *msg = msg_wrapper->msg_buf; struct scheduler_msg *msg = msg_wrapper->msg_buf;
@@ -338,24 +339,24 @@ static void scheduler_thread_process_queues(struct scheduler_ctx *sch_ctx,
sch_ctx->watchdog_callback = msg->callback; sch_ctx->watchdog_callback = msg->callback;
qdf_timer_start(&sch_ctx->watchdog_timer, qdf_timer_start(&sch_ctx->watchdog_timer,
SCHEDULER_WATCHDOG_TIMEOUT); SCHEDULER_WATCHDOG_TIMEOUT);
qdf_status = sch_ctx->queue_ctx. status = sch_ctx->queue_ctx.
scheduler_msg_process_fn[i](msg); scheduler_msg_process_fn[i](msg);
qdf_timer_stop(&sch_ctx->watchdog_timer); qdf_timer_stop(&sch_ctx->watchdog_timer);
if (QDF_IS_STATUS_ERROR(qdf_status)) { if (QDF_IS_STATUS_ERROR(status))
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, sched_err("Failed processing Qid[%d] message",
QDF_TRACE_LEVEL_ERROR, sch_ctx->queue_ctx.sch_msg_q[i].qid);
FL("Failed processing Qid[%d] message"),
sch_ctx->queue_ctx.sch_msg_q[i].qid);
}
/* return message to the Core */ /* return message to the Core */
scheduler_core_return_msg(sch_ctx, msg_wrapper); scheduler_core_return_msg(sch_ctx, msg_wrapper);
} }
/* start again with highest priority queue at index 0 */ /* start again with highest priority queue at index 0 */
i = 0; i = 0;
continue; continue;
} }
/* Check for any Suspend Indication */ /* Check for any Suspend Indication */
if (qdf_atomic_test_and_clear_bit(MC_SUSPEND_EVENT_MASK, if (qdf_atomic_test_and_clear_bit(MC_SUSPEND_EVENT_MASK,
&sch_ctx->sch_event_flag)) { &sch_ctx->sch_event_flag)) {
@@ -378,10 +379,9 @@ int scheduler_thread(void *arg)
int retWaitStatus = 0; int retWaitStatus = 0;
bool shutdown = false; bool shutdown = false;
if (arg == NULL) { if (!arg) {
QDF_ASSERT(0); sched_err("arg is null");
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, QDF_DEBUG_PANIC();
"%s: Bad Args passed", __func__);
return 0; return 0;
} }
qdf_set_user_nice(current, -2); qdf_set_user_nice(current, -2);
@@ -390,9 +390,8 @@ int scheduler_thread(void *arg)
* has been created * has been created
*/ */
qdf_event_set(&sch_ctx->sch_start_event); qdf_event_set(&sch_ctx->sch_start_event);
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_DEBUG, sched_debug("scheduler thread %d (%s) starting up",
"%s: scheduler_thread %d (%s) starting up", __func__, current->pid, current->pid, current->comm);
current->comm);
while (!shutdown) { while (!shutdown) {
/* This implements the execution model algorithm */ /* This implements the execution model algorithm */
@@ -404,17 +403,16 @@ int scheduler_thread(void *arg)
&sch_ctx->sch_event_flag)); &sch_ctx->sch_event_flag));
if (retWaitStatus == -ERESTARTSYS) { if (retWaitStatus == -ERESTARTSYS) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, sched_err("wait_event_interruptible returned -ERESTARTSYS");
"%s: wait_event_interruptible returned -ERESTARTSYS", QDF_DEBUG_PANIC();
__func__);
QDF_BUG(0);
} }
qdf_atomic_clear_bit(MC_POST_EVENT_MASK, &sch_ctx->sch_event_flag); qdf_atomic_clear_bit(MC_POST_EVENT_MASK, &sch_ctx->sch_event_flag);
scheduler_thread_process_queues(sch_ctx, &shutdown); scheduler_thread_process_queues(sch_ctx, &shutdown);
} }
/* If we get here the MC thread must exit */
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, /* If we get here the scheduler thread must exit */
"%s: Scheduler thread exiting!!!!", __func__); sched_info("Scheduler thread exiting");
qdf_event_set(&sch_ctx->sch_shutdown); qdf_event_set(&sch_ctx->sch_shutdown);
qdf_exit_thread(QDF_STATUS_SUCCESS); qdf_exit_thread(QDF_STATUS_SUCCESS);
@@ -423,42 +421,38 @@ int scheduler_thread(void *arg)
void scheduler_cleanup_queues(struct scheduler_ctx *sch_ctx, int idx) void scheduler_cleanup_queues(struct scheduler_ctx *sch_ctx, int idx)
{ {
struct scheduler_msg_wrapper *msg_wrapper = NULL; struct scheduler_msg_wrapper *msg_wrapper;
QDF_STATUS (*scheduler_flush_callback) (struct scheduler_msg *); QDF_STATUS (*scheduler_flush_callback) (struct scheduler_msg *);
if (!sch_ctx) { if (!sch_ctx) {
QDF_ASSERT(0); sched_err("sch_ctx is null");
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, QDF_DEBUG_PANIC();
"%s: Null params being passed", __func__);
return; return;
} }
while ((msg_wrapper = while ((msg_wrapper =
scheduler_mq_get(&sch_ctx->queue_ctx.sch_msg_q[idx]))) { scheduler_mq_get(&sch_ctx->queue_ctx.sch_msg_q[idx]))) {
if (msg_wrapper->msg_buf != NULL) { if (msg_wrapper->msg_buf) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_INFO, sched_info("Freeing MC WMA MSG message type %d",
"%s: Freeing MC WMA MSG message type %d", msg_wrapper->msg_buf->type);
__func__, msg_wrapper->msg_buf->type);
if (msg_wrapper->msg_buf->flush_callback) { if (msg_wrapper->msg_buf->flush_callback) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, sched_debug("Flush callback called for type-%x",
QDF_TRACE_LEVEL_DEBUG, msg_wrapper->msg_buf->type);
"%s: Flush callback called for type-%x",
__func__, msg_wrapper->msg_buf->type);
scheduler_flush_callback = scheduler_flush_callback =
msg_wrapper->msg_buf->flush_callback; msg_wrapper->msg_buf->flush_callback;
scheduler_flush_callback(msg_wrapper->msg_buf); scheduler_flush_callback(msg_wrapper->msg_buf);
} else if (msg_wrapper->msg_buf->bodyptr) { } else if (msg_wrapper->msg_buf->bodyptr) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, sched_debug("noflush cb given for type-%x",
QDF_TRACE_LEVEL_DEBUG, msg_wrapper->msg_buf->type);
"%s: noflush cb given for type-%x", qdf_mem_free(msg_wrapper->msg_buf->bodyptr);
__func__, msg_wrapper->msg_buf->type);
qdf_mem_free(
(void *)msg_wrapper->msg_buf->bodyptr);
} }
msg_wrapper->msg_buf->bodyptr = NULL; msg_wrapper->msg_buf->bodyptr = NULL;
msg_wrapper->msg_buf->bodyval = 0; msg_wrapper->msg_buf->bodyval = 0;
msg_wrapper->msg_buf->type = 0; msg_wrapper->msg_buf->type = 0;
} }
scheduler_core_return_msg(sch_ctx, msg_wrapper); scheduler_core_return_msg(sch_ctx, msg_wrapper);
} }
} }