Skip to content

Commit d3c2a24

Browse files
Maxim Adelmancfriedt
authored andcommitted
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: Maxim Adelman <[email protected]> (cherry picked from commit ecf2cb5)
1 parent 1008691 commit d3c2a24

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

subsys/shell/modules/kernel_service.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,12 @@ static int cmd_kernel_threads(const struct shell *shell,
140140

141141
shell_print(shell, "Scheduler: %u since last call", sys_clock_elapsed());
142142
shell_print(shell, "Threads:");
143+
144+
#ifdef CONFIG_SMP
145+
k_thread_foreach_unlocked(shell_tdata_dump, (void *)shell);
146+
#else
143147
k_thread_foreach(shell_tdata_dump, (void *)shell);
148+
#endif
144149
return 0;
145150
}
146151

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

185190
ARG_UNUSED(argc);
186191
ARG_UNUSED(argv);
192+
193+
#ifdef CONFIG_SMP
194+
k_thread_foreach_unlocked(shell_stack_dump, (void *)shell);
195+
#else
187196
k_thread_foreach(shell_stack_dump, (void *)shell);
197+
#endif
188198

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

0 commit comments

Comments
 (0)