Revert "All CMP platforms: Apply same fix verified on other platforms found on Xtensa."
This reverts commit fb146abee0
.
This commit is contained in:
parent
9aedf1bdec
commit
49fae0ac6b
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/armv7-a/arm_releasepending.c
|
||||
*
|
||||
* Copyright (C) 2013-2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013-2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -39,10 +39,8 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
@ -68,99 +66,79 @@
|
||||
void up_release_pending(void)
|
||||
{
|
||||
struct tcb_s *rtcb = this_task();
|
||||
#ifdef CONFIG_SMP
|
||||
static bool busy = false;
|
||||
#endif
|
||||
|
||||
sinfo("From TCB=%p\n", rtcb);
|
||||
|
||||
/* In SMP configurations, this function will be called as part of leaving
|
||||
* the critical section. In that case, it may be re-entered as part of
|
||||
* the sched_addreadytorun() processing. We have to guard against that
|
||||
* case.
|
||||
*/
|
||||
/* Merge the g_pendingtasks list into the ready-to-run task list */
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
if (!busy)
|
||||
/* sched_lock(); */
|
||||
if (sched_mergepending())
|
||||
{
|
||||
busy = true;
|
||||
#endif
|
||||
/* The currently active task has changed! We will need to
|
||||
* switch contexts.
|
||||
*/
|
||||
|
||||
/* Merge the g_pendingtasks list into the ready-to-run task list */
|
||||
/* Update scheduler parameters */
|
||||
|
||||
/* sched_lock(); */
|
||||
if (sched_mergepending())
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we operating in interrupt context? */
|
||||
|
||||
if (CURRENT_REGS)
|
||||
{
|
||||
/* The currently active task has changed! We will need to
|
||||
* switch contexts.
|
||||
/* Yes, then we have to do things differently.
|
||||
* Just copy the CURRENT_REGS into the OLD rtcb.
|
||||
*/
|
||||
|
||||
up_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Are we operating in interrupt context? */
|
||||
|
||||
if (CURRENT_REGS)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
* Just copy the CURRENT_REGS into the OLD rtcb.
|
||||
*/
|
||||
|
||||
up_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
|
||||
up_restorestate(rtcb->xcp.regs);
|
||||
}
|
||||
|
||||
/* Copy the exception context into the TCB of the task that
|
||||
* was currently active. if up_saveusercontext returns a non-zero
|
||||
* value, then this is really the previously running task
|
||||
* restarting!
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
|
||||
else if (!up_saveusercontext(rtcb->xcp.regs))
|
||||
{
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Make sure that the address environment for the previously
|
||||
* running task is closed down gracefully (data caches dump,
|
||||
* MMU flushed) and set up the address environment for the new
|
||||
* thread at the head of the ready-to-run list.
|
||||
*/
|
||||
|
||||
(void)group_addrenv(rtcb);
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(rtcb->xcp.regs);
|
||||
}
|
||||
up_restorestate(rtcb->xcp.regs);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
busy = false;
|
||||
}
|
||||
/* Copy the exception context into the TCB of the task that
|
||||
* was currently active. if up_saveusercontext returns a non-zero
|
||||
* value, then this is really the previously running task
|
||||
* restarting!
|
||||
*/
|
||||
|
||||
else if (!up_saveusercontext(rtcb->xcp.regs))
|
||||
{
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Make sure that the address environment for the previously
|
||||
* running task is closed down gracefully (data caches dump,
|
||||
* MMU flushed) and set up the address environment for the new
|
||||
* thread at the head of the ready-to-run list.
|
||||
*/
|
||||
|
||||
(void)group_addrenv(rtcb);
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(rtcb->xcp.regs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/armv7-m/up_releasepending.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2012, 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -39,10 +39,8 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
@ -67,88 +65,68 @@
|
||||
void up_release_pending(void)
|
||||
{
|
||||
struct tcb_s *rtcb = this_task();
|
||||
#ifdef CONFIG_SMP
|
||||
static bool busy = false;
|
||||
#endif
|
||||
|
||||
sinfo("From TCB=%p\n", rtcb);
|
||||
|
||||
/* In SMP configurations, this function will be called as part of leaving
|
||||
* the critical section. In that case, it may be re-entered as part of
|
||||
* the sched_addreadytorun() processing. We have to guard against that
|
||||
* case.
|
||||
*/
|
||||
/* Merge the g_pendingtasks list into the ready-to-run task list */
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
if (!busy)
|
||||
/* sched_lock(); */
|
||||
if (sched_mergepending())
|
||||
{
|
||||
busy = true;
|
||||
#endif
|
||||
/* The currently active task has changed! We will need to switch
|
||||
* contexts.
|
||||
*/
|
||||
|
||||
/* Merge the g_pendingtasks list into the ready-to-run task list */
|
||||
/* Update scheduler parameters */
|
||||
|
||||
/* sched_lock(); */
|
||||
if (sched_mergepending())
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we operating in interrupt context? */
|
||||
|
||||
if (CURRENT_REGS)
|
||||
{
|
||||
/* The currently active task has changed! We will need to switch
|
||||
* contexts.
|
||||
/* Yes, then we have to do things differently. Just copy the
|
||||
* CURRENT_REGS into the OLD rtcb.
|
||||
*/
|
||||
|
||||
up_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Are we operating in interrupt context? */
|
||||
/* Then switch contexts */
|
||||
|
||||
if (CURRENT_REGS)
|
||||
{
|
||||
/* Yes, then we have to do things differently. Just copy the
|
||||
* CURRENT_REGS into the OLD rtcb.
|
||||
*/
|
||||
|
||||
up_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_restorestate(rtcb->xcp.regs);
|
||||
}
|
||||
|
||||
/* No, then we will need to perform the user context switch */
|
||||
|
||||
else
|
||||
{
|
||||
struct tcb_s *nexttcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(nexttcb);
|
||||
|
||||
/* Switch context to the context of the task at the head of the
|
||||
* ready to run list.
|
||||
*/
|
||||
|
||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||
|
||||
/* up_switchcontext forces a context switch to the task at the
|
||||
* head of the ready-to-run list. It does not 'return' in the
|
||||
* normal sense. When it does return, it is because the blocked
|
||||
* task is again ready to run and has execution priority.
|
||||
*/
|
||||
}
|
||||
up_restorestate(rtcb->xcp.regs);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
busy = false;
|
||||
/* No, then we will need to perform the user context switch */
|
||||
|
||||
else
|
||||
{
|
||||
struct tcb_s *nexttcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(nexttcb);
|
||||
|
||||
/* Switch context to the context of the task at the head of the
|
||||
* ready to run list.
|
||||
*/
|
||||
|
||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||
|
||||
/* up_switchcontext forces a context switch to the task at the
|
||||
* head of the ready-to-run list. It does not 'return' in the
|
||||
* normal sense. When it does return, it is because the blocked
|
||||
* task is again ready to run and has execution priority.
|
||||
*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/sim/src/up_releasepending.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -39,10 +39,8 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
@ -67,75 +65,55 @@
|
||||
void up_release_pending(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
#ifdef CONFIG_SMP
|
||||
static bool busy = false;
|
||||
#endif
|
||||
|
||||
sinfo("From TCB=%p\n", rtcb);
|
||||
|
||||
/* In SMP configurations, this function will be called as part of leaving
|
||||
* the critical section. In that case, it may be re-entered as part of
|
||||
* the sched_addreadytorun() processing. We have to guard against that
|
||||
* case.
|
||||
*/
|
||||
/* Merge the g_pendingtasks list into the ready-to-run task list */
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
if (!busy)
|
||||
/* sched_lock(); */
|
||||
if (sched_mergepending())
|
||||
{
|
||||
busy = true;
|
||||
#endif
|
||||
/* The currently active task has changed! We will need to switch
|
||||
* contexts.
|
||||
*
|
||||
* Update scheduler parameters.
|
||||
*/
|
||||
|
||||
/* Merge the g_pendingtasks list into the ready-to-run task list */
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* sched_lock(); */
|
||||
if (sched_mergepending())
|
||||
/* Copy the exception context into the TCB of the task that was
|
||||
* currently active. if up_setjmp returns a non-zero value, then
|
||||
* this is really the previously running task restarting!
|
||||
*/
|
||||
|
||||
if (!up_setjmp(rtcb->xcp.regs))
|
||||
{
|
||||
/* The currently active task has changed! We will need to switch
|
||||
* contexts.
|
||||
*
|
||||
* Update scheduler parameters.
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
rtcb = this_task();
|
||||
sinfo("New Active Task TCB=%p\n", rtcb);
|
||||
|
||||
/* Copy the exception context into the TCB of the task that was
|
||||
* currently active. if up_setjmp returns a non-zero value, then
|
||||
* this is really the previously running task restarting!
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded, interrupt
|
||||
* driven environment.
|
||||
*/
|
||||
|
||||
if (!up_setjmp(rtcb->xcp.regs))
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
sinfo("New Active Task TCB=%p\n", rtcb);
|
||||
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded, interrupt
|
||||
* driven environment.
|
||||
*/
|
||||
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("Delivering signals TCB=%p\n", rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
sinfo("Delivering signals TCB=%p\n", rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
busy = false;
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user