All CMP platforms: Apply same fix verified on other platforms found on Xtensa.

This commit is contained in:
Gregory Nutt
2016-12-21 14:04:09 -06:00
parent 733a57b4df
commit fb146abee0
3 changed files with 200 additions and 134 deletions
+23 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/armv7-a/arm_releasepending.c
*
* Copyright (C) 2013-2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2013-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -39,8 +39,10 @@
#include <nuttx/config.h>
#include <stdbool.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
@@ -66,9 +68,24 @@
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.
*/
#ifdef CONFIG_SMP
if (!busy)
{
busy = true;
#endif
/* Merge the g_pendingtasks list into the ready-to-run task list */
/* sched_lock(); */
@@ -141,4 +158,9 @@ void up_release_pending(void)
up_fullcontextrestore(rtcb->xcp.regs);
}
}
#ifdef CONFIG_SMP
busy = false;
}
#endif
}
+23 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/armv7-m/up_releasepending.c
*
* Copyright (C) 2007-2009, 2012, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2012, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -39,8 +39,10 @@
#include <nuttx/config.h>
#include <stdbool.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
@@ -65,9 +67,24 @@
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.
*/
#ifdef CONFIG_SMP
if (!busy)
{
busy = true;
#endif
/* Merge the g_pendingtasks list into the ready-to-run task list */
/* sched_lock(); */
@@ -129,4 +146,9 @@ void up_release_pending(void)
*/
}
}
#ifdef CONFIG_SMP
busy = false;
}
#endif
}
+23 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/sim/src/up_releasepending.c
*
* Copyright (C) 2007-2009, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -39,8 +39,10 @@
#include <nuttx/config.h>
#include <stdbool.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
@@ -65,9 +67,24 @@
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.
*/
#ifdef CONFIG_SMP
if (!busy)
{
busy = true;
#endif
/* Merge the g_pendingtasks list into the ready-to-run task list */
/* sched_lock(); */
@@ -116,4 +133,9 @@ void up_release_pending(void)
up_longjmp(rtcb->xcp.regs, 1);
}
}
#ifdef CONFIG_SMP
busy = false;
}
#endif
}