Commit d3c2a245 authored by Maxim Adelman's avatar Maxim Adelman Committed by Chris Friedt
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>
(cherry picked from commit ecf2cb59)
parent 10086910
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -140,7 +140,12 @@ static int cmd_kernel_threads(const struct shell *shell,

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

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

@@ -184,7 +189,12 @@ static int cmd_kernel_stacks(const struct shell *shell,

	ARG_UNUSED(argc);
	ARG_UNUSED(argv);

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

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