Skip to content

Commit 91f1acb

Browse files
TaiJuWucfriedt
authored andcommitted
kernel: Add more debug info and thread checking in run queue
1. There are debug info within k_sched_unlock so we shoulld add same debug info to k_sched_lock. 2. The thread in run queue should be normal or metairq thread, we should check it is not dummy thread. Signed-off-by: TaiJu Wu <[email protected]>
1 parent 4da13b8 commit 91f1acb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/sched.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,15 @@ static ALWAYS_INLINE void *curr_cpu_runq(void)
7777
static ALWAYS_INLINE void runq_add(struct k_thread *thread)
7878
{
7979
__ASSERT_NO_MSG(!z_is_idle_thread_object(thread));
80+
__ASSERT_NO_MSG(!is_thread_dummy(thread));
8081

8182
_priq_run_add(thread_runq(thread), thread);
8283
}
8384

8485
static ALWAYS_INLINE void runq_remove(struct k_thread *thread)
8586
{
8687
__ASSERT_NO_MSG(!z_is_idle_thread_object(thread));
88+
__ASSERT_NO_MSG(!is_thread_dummy(thread));
8789

8890
_priq_run_remove(thread_runq(thread), thread);
8991
}
@@ -755,6 +757,9 @@ void z_reschedule_irqlock(uint32_t key)
755757

756758
void k_sched_lock(void)
757759
{
760+
LOG_DBG("scheduler locked (%p:%d)",
761+
_current, _current->base.sched_locked);
762+
758763
K_SPINLOCK(&_sched_spinlock) {
759764
SYS_PORT_TRACING_FUNC(k_thread, sched_lock);
760765

0 commit comments

Comments
 (0)