From 42167827fbbc9d0100f151c2980d15a46e61957b Mon Sep 17 00:00:00 2001 From: Rob Barnes Date: Thu, 20 Apr 2023 10:28:28 -0600 Subject: tasks: Only report stack overflow if task is enabled Don't report stack overflow on a task that has been disabled. Without this change, system safe mode will fail to recover from a stackoverflow because the stackoverflow will be detected again, even though the task has already been disabled. BUG=b:278792557 TEST=System safe mode starts on boten after a stackoverflow Change-Id: I59ab579c296d108dcd8c5aba9cb32bba6c7bbf54 Signed-off-by: Rob Barnes Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4455298 Reviewed-by: Daisuke Nojiri Reviewed-by: Boris Mittelberg --- core/cortex-m/task.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/cortex-m/task.c') diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c index 336cafc99a..f42b4f9dc0 100644 --- a/core/cortex-m/task.c +++ b/core/cortex-m/task.c @@ -301,7 +301,8 @@ void svc_handler(int desched, task_id_t resched) current = current_task; #ifdef CONFIG_DEBUG_STACK_OVERFLOW - if (*current->stack != STACK_UNUSED_VALUE) { + if (*current->stack != STACK_UNUSED_VALUE && + task_enabled(current - tasks)) { panic_printf("\n\nStack overflow in %s task!\n", task_names[current - tasks]); software_panic(PANIC_SW_STACK_OVERFLOW, current - tasks); -- cgit v1.2.1