mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
Add missing sched_note_*() calls to sam4cm SMP functions.
This commit is contained in:
@@ -244,14 +244,14 @@ int up_cpu_pause(int cpu)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
DEBUGASSERT(cpu >= 0 && cpu < CONFIG_SMP_NCPUS && cpu != this_cpu());
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
/* Notify of the pause event */
|
/* Notify of the pause event */
|
||||||
|
|
||||||
sched_note_cpu_pause(this_task(), cpu);
|
sched_note_cpu_pause(this_task(), cpu);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUGASSERT(cpu >= 0 && cpu < CONFIG_SMP_NCPUS && cpu != this_cpu());
|
|
||||||
|
|
||||||
/* Take the both spinlocks. The g_cpu_wait spinlock will prevent the SGI2
|
/* Take the both spinlocks. The g_cpu_wait spinlock will prevent the SGI2
|
||||||
* handler from returning until up_cpu_resume() is called; g_cpu_paused
|
* handler from returning until up_cpu_resume() is called; g_cpu_paused
|
||||||
* is a handshake that will prefent this function from returning until
|
* is a handshake that will prefent this function from returning until
|
||||||
@@ -313,14 +313,14 @@ int up_cpu_pause(int cpu)
|
|||||||
|
|
||||||
int up_cpu_resume(int cpu)
|
int up_cpu_resume(int cpu)
|
||||||
{
|
{
|
||||||
|
DEBUGASSERT(cpu >= 0 && cpu < CONFIG_SMP_NCPUS && cpu != this_cpu());
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
/* Notify of the resume event */
|
/* Notify of the resume event */
|
||||||
|
|
||||||
sched_note_cpu_resume(this_task(), cpu);
|
sched_note_cpu_resume(this_task(), cpu);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUGASSERT(cpu >= 0 && cpu < CONFIG_SMP_NCPUS && cpu != this_cpu());
|
|
||||||
|
|
||||||
/* Release the spinlock. Releasing the spinlock will cause the SGI2
|
/* Release the spinlock. Releasing the spinlock will cause the SGI2
|
||||||
* handler on 'cpu' to continue and return from interrupt to the newly
|
* handler on 'cpu' to continue and return from interrupt to the newly
|
||||||
* established thread.
|
* established thread.
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/spinlock.h>
|
#include <nuttx/spinlock.h>
|
||||||
|
#include <nuttx/sched_note.h>
|
||||||
|
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
@@ -145,6 +146,12 @@ int up_cpu_paused(int cpu)
|
|||||||
|
|
||||||
sched_suspend_scheduler(tcb);
|
sched_suspend_scheduler(tcb);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
|
/* Notify that we are paused */
|
||||||
|
|
||||||
|
sched_note_cpu_paused(tcb);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Save the current context at CURRENT_REGS into the TCB at the head
|
/* Save the current context at CURRENT_REGS into the TCB at the head
|
||||||
* of the assigned task list for this CPU.
|
* of the assigned task list for this CPU.
|
||||||
*/
|
*/
|
||||||
@@ -162,6 +169,12 @@ int up_cpu_paused(int cpu)
|
|||||||
|
|
||||||
tcb = this_task();
|
tcb = this_task();
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
|
/* Notify that we have resumed */
|
||||||
|
|
||||||
|
sched_note_cpu_resumed(tcb);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Reset scheduler parameters */
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
sched_resume_scheduler(tcb);
|
sched_resume_scheduler(tcb);
|
||||||
@@ -247,18 +260,24 @@ int up_cpu_pause(int cpu)
|
|||||||
|
|
||||||
DEBUGASSERT(cpu >= 0 && cpu < CONFIG_SMP_NCPUS && cpu != this_cpu());
|
DEBUGASSERT(cpu >= 0 && cpu < CONFIG_SMP_NCPUS && cpu != this_cpu());
|
||||||
|
|
||||||
/* Take the both spinlocks. The g_cpu_wait spinlock will prevent the SGI2
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
|
/* Notify of the pause event */
|
||||||
|
|
||||||
|
sched_note_cpu_pause(this_task(), cpu);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Take the both spinlocks. The g_cpu_wait spinlock will prevent the interrupt
|
||||||
* handler from returning until up_cpu_resume() is called; g_cpu_paused
|
* handler from returning until up_cpu_resume() is called; g_cpu_paused
|
||||||
* is a handshake that will prefent this function from returning until
|
* is a handshake that will prefent this function from returning until
|
||||||
* the CPU is actually paused.
|
* the CPU is actually paused.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DEBUGASSERT(!spin_islocked(&g_cpu_wait[cpu]) &&
|
||||||
|
!spin_islocked(&g_cpu_paused[cpu]));
|
||||||
|
|
||||||
spin_lock(&g_cpu_wait[cpu]);
|
spin_lock(&g_cpu_wait[cpu]);
|
||||||
spin_lock(&g_cpu_paused[cpu]);
|
spin_lock(&g_cpu_paused[cpu]);
|
||||||
|
|
||||||
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
|
|
||||||
spin_islocked(&g_cpu_paused[cpu]));
|
|
||||||
|
|
||||||
/* Execute Pause IRQ to CPU(cpu) */
|
/* Execute Pause IRQ to CPU(cpu) */
|
||||||
/* Set IPC Interrupt (IRQ0) (write-only) */
|
/* Set IPC Interrupt (IRQ0) (write-only) */
|
||||||
|
|
||||||
@@ -276,7 +295,6 @@ int up_cpu_pause(int cpu)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
spin_lock(&g_cpu_paused[cpu]);
|
spin_lock(&g_cpu_paused[cpu]);
|
||||||
|
|
||||||
spin_unlock(&g_cpu_paused[cpu]);
|
spin_unlock(&g_cpu_paused[cpu]);
|
||||||
|
|
||||||
/* On successful return g_cpu_wait will be locked, the other CPU will be
|
/* On successful return g_cpu_wait will be locked, the other CPU will be
|
||||||
@@ -284,7 +302,7 @@ int up_cpu_pause(int cpu)
|
|||||||
* called. g_cpu_paused will be unlocked in any case.
|
* called. g_cpu_paused will be unlocked in any case.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return 0;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -312,6 +330,12 @@ int up_cpu_resume(int cpu)
|
|||||||
|
|
||||||
DEBUGASSERT(cpu >= 0 && cpu < CONFIG_SMP_NCPUS && cpu != this_cpu());
|
DEBUGASSERT(cpu >= 0 && cpu < CONFIG_SMP_NCPUS && cpu != this_cpu());
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
|
/* Notify of the resume event */
|
||||||
|
|
||||||
|
sched_note_cpu_resume(this_task(), cpu);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Release the spinlock. Releasing the spinlock will cause the SGI2
|
/* Release the spinlock. Releasing the spinlock will cause the SGI2
|
||||||
* handler on 'cpu' to continue and return from interrupt to the newly
|
* handler on 'cpu' to continue and return from interrupt to the newly
|
||||||
* established thread.
|
* established thread.
|
||||||
@@ -321,8 +345,7 @@ int up_cpu_resume(int cpu)
|
|||||||
!spin_islocked(&g_cpu_paused[cpu]));
|
!spin_islocked(&g_cpu_paused[cpu]));
|
||||||
|
|
||||||
spin_unlock(&g_cpu_wait[cpu]);
|
spin_unlock(&g_cpu_wait[cpu]);
|
||||||
|
return OK;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SMP */
|
#endif /* CONFIG_SMP */
|
||||||
|
|||||||
Reference in New Issue
Block a user