arch: Move the DUMP_ON_EXIT logic after nxtask_exit.

Otherwise we will try to dump the state of the current task, however the
exit handler has already started doing some cleanup and invalidated its
group.  Accessing the group from dumponexit will crash.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2022-04-13 13:34:42 +02:00 committed by Xiang Xiao
parent d6c952c56f
commit 6d12ee19e2
15 changed files with 62 additions and 62 deletions

View File

@ -115,15 +115,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -114,15 +114,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -114,15 +114,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -116,15 +116,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -108,15 +108,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -108,15 +108,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the head /* Now, perform the context switch to the new ready-to-run task at the head
* of the list. * of the list.
*/ */

View File

@ -115,15 +115,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -114,15 +114,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -116,15 +116,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -137,11 +137,6 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
#ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n");
sched_foreach(_up_dumponexit, NULL);
#endif
/* Update scheduler parameters */ /* Update scheduler parameters */
nxsched_suspend_scheduler(tcb); nxsched_suspend_scheduler(tcb);
@ -150,6 +145,11 @@ void up_exit(int status)
(void)nxtask_exit(); (void)nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n");
sched_foreach(_up_dumponexit, NULL);
#endif
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -114,15 +114,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -114,15 +114,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", this_task()); sinfo("TCB=%p exiting\n", this_task());
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -116,11 +116,6 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
#ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n");
nxsched_foreach(_xtensa_dumponexit, NULL);
#endif
#if XCHAL_CP_NUM > 0 #if XCHAL_CP_NUM > 0
/* Disable co-processor support for the task that is exit-ing. */ /* Disable co-processor support for the task that is exit-ing. */
@ -131,6 +126,11 @@ void up_exit(int status)
nxtask_exit(); nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n");
nxsched_foreach(_xtensa_dumponexit, NULL);
#endif
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -114,15 +114,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_z16_dumponexit, NULL); nxsched_foreach(_z16_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */

View File

@ -116,15 +116,15 @@ void up_exit(int status)
sinfo("TCB=%p exiting\n", tcb); sinfo("TCB=%p exiting\n", tcb);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
#ifdef CONFIG_DUMP_ON_EXIT #ifdef CONFIG_DUMP_ON_EXIT
sinfo("Other tasks:\n"); sinfo("Other tasks:\n");
nxsched_foreach(_up_dumponexit, NULL); nxsched_foreach(_up_dumponexit, NULL);
#endif #endif
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the /* Now, perform the context switch to the new ready-to-run task at the
* head of the list. * head of the list.
*/ */