Commit ecf2cb59 authored by Maxim Adelman's avatar Maxim Adelman Committed by Anas Nashif
Browse files

kernel shell, stacks shell commands: iterate unlocked on SMP



call k_thread_foreach_unlocked to avoid assertions caused
by calling shell_print while holding a global lock

Signed-off-by: default avatarMaxim Adelman <imax@meta.com>
parent fbb6cd1a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -164,7 +164,12 @@ static int cmd_kernel_threads(const struct shell *sh,

	shell_print(sh, "Scheduler: %u since last call", sys_clock_elapsed());
	shell_print(sh, "Threads:");

#ifdef CONFIG_SMP
	k_thread_foreach_unlocked(shell_tdata_dump, (void *)sh);
#else
	k_thread_foreach(shell_tdata_dump, (void *)sh);
#endif
	return 0;
}

@@ -208,7 +213,11 @@ static int cmd_kernel_stacks(const struct shell *sh,

	memset(pad, ' ', MAX((THREAD_MAX_NAM_LEN - strlen("IRQ 00")), 1));

#ifdef CONFIG_SMP
	k_thread_foreach_unlocked(shell_stack_dump, (void *)sh);
#else
	k_thread_foreach(shell_stack_dump, (void *)sh);
#endif

	/* Placeholder logic for interrupt stack until we have better
	 * kernel support, including dumping arch-specific exception-related