summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2019-06-14 10:39:22 -0600
committerCommit Bot <commit-bot@chromium.org>2019-06-14 22:05:58 +0000
commitf5838f96e4baf263891752fef86c9bf9d03a2907 (patch)
tree54c48a6779faae9ee267e2855a1a90fcfbbb3c7b
parent0ad3ac0876bdda14129d9a8aa104e11ff1e248aa (diff)
downloadchrome-ec-f5838f96e4baf263891752fef86c9bf9d03a2907.tar.gz
minute-ia: show EC task information during panic
In order to receive better debug info from panic reports, include the current task when the panic was encountered. BUG=b:134071217 BRANCH=none TEST=saw that task was "CONSOLE" when typing "crash divzero" from console Change-Id: I2fa9f931eea0274a762f812b6a7a8281cb8fcc5f Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1660018 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--core/minute-ia/panic.c4
-rw-r--r--core/minute-ia/task.c16
-rw-r--r--include/panic.h3
3 files changed, 19 insertions, 4 deletions
diff --git a/core/minute-ia/panic.c b/core/minute-ia/panic.c
index 442a69464a..9b0cf68c69 100644
--- a/core/minute-ia/panic.c
+++ b/core/minute-ia/panic.c
@@ -76,6 +76,7 @@ void panic_data_print(const struct panic_data *pdata)
panic_printf("EDX = 0x%08X\n", pdata->x86.edx);
panic_printf("ESI = 0x%08X\n", pdata->x86.esi);
panic_printf("EDI = 0x%08X\n", pdata->x86.edi);
+ panic_printf("EC Task = %s\n", task_get_name(pdata->x86.task_id));
}
/**
@@ -133,6 +134,9 @@ __attribute__((noreturn)) void __keep exception_panic(
PANIC_DATA_PTR->x86.cs = cs;
PANIC_DATA_PTR->x86.eflags = eflags;
+ /* Save task information */
+ PANIC_DATA_PTR->x86.task_id = task_get_current();
+
/* Initialize panic data */
PANIC_DATA_PTR->arch = PANIC_ARCH_X86;
PANIC_DATA_PTR->struct_version = 2;
diff --git a/core/minute-ia/task.c b/core/minute-ia/task.c
index 18c23f5515..fe00340994 100644
--- a/core/minute-ia/task.c
+++ b/core/minute-ia/task.c
@@ -90,7 +90,7 @@ static void task_exit_trap(void)
{
int i = task_get_current();
- cprints(CC_TASK, "Task %d (%s) exited!", i, task_names[i]);
+ cprints(CC_TASK, "Task %d (%s) exited!", i, task_get_name(i));
/* Exited tasks simply sleep forever */
while (1)
task_wait_event(-1);
@@ -187,6 +187,14 @@ task_id_t task_get_current(void)
return current_task - tasks;
}
+const char *task_get_name(task_id_t tskid)
+{
+ if (tskid < ARRAY_SIZE(task_names))
+ return task_names[tskid];
+
+ return "<< unknown >>";
+}
+
uint32_t *task_get_event_bitmap(task_id_t tskid)
{
task_ *tsk = __task_id_to_ptr(tskid);
@@ -211,7 +219,7 @@ uint32_t switch_handler(int desched, task_id_t resched)
#ifdef CONFIG_DEBUG_STACK_OVERFLOW
if (*current->stack != STACK_UNUSED_VALUE) {
panic_printf("\n\nStack overflow in %s task!\n",
- task_names[current - tasks]);
+ task_get_name(current - tasks));
#ifdef CONFIG_SOFTWARE_PANIC
software_panic(PANIC_SW_STACK_OVERFLOW, current - tasks);
#endif
@@ -512,11 +520,11 @@ void task_print_list(void)
#ifdef CONFIG_FPU
ccprintf("%4d %c %-16s %08x %11.6ld %3d/%3d %c\n", i, is_ready,
- task_names[i], tasks[i].events, tasks[i].runtime,
+ task_get_name(i), tasks[i].events, tasks[i].runtime,
stackused, tasks_init[i].stack_size, use_fpu);
#else
ccprintf("%4d %c %-16s %08x %11.6ld %3d/%3d\n", i, is_ready,
- task_names[i], tasks[i].events, tasks[i].runtime,
+ task_get_name(i), tasks[i].events, tasks[i].runtime,
stackused, tasks_init[i].stack_size);
#endif
diff --git a/include/panic.h b/include/panic.h
index afbe4b9357..d956eebf6a 100644
--- a/include/panic.h
+++ b/include/panic.h
@@ -65,6 +65,9 @@ struct x86_panic_data {
uint32_t edx;
uint32_t esi;
uint32_t edi;
+
+ /* Task id at time of panic */
+ uint8_t task_id;
};
/* Data saved across reboots */