mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
sched notes: Add additional note to see if/when CPU is started in SMP mode.
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/sched.h>
|
#include <nuttx/sched.h>
|
||||||
|
#include <nuttx/sched_note.h>
|
||||||
|
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
#include "cp15_cacheops.h"
|
#include "cp15_cacheops.h"
|
||||||
@@ -104,13 +105,18 @@ static inline void arm_registerdump(FAR struct tcb_s *tcb)
|
|||||||
|
|
||||||
int arm_start_handler(int irq, FAR void *context)
|
int arm_start_handler(int irq, FAR void *context)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *tcb;
|
FAR struct tcb_s *tcb = this_task();
|
||||||
|
|
||||||
sinfo("CPU%d Started\n", this_cpu());
|
sinfo("CPU%d Started\n", this_cpu());
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
|
/* Notify that this CPU has started */
|
||||||
|
|
||||||
|
sched_note_cpu_started(tcb);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Reset scheduler parameters */
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
tcb = this_task();
|
|
||||||
sched_resume_scheduler(tcb);
|
sched_resume_scheduler(tcb);
|
||||||
|
|
||||||
/* Dump registers so that we can see what is going to happen on return */
|
/* Dump registers so that we can see what is going to happen on return */
|
||||||
@@ -159,6 +165,12 @@ int up_cpu_start(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 start event */
|
||||||
|
|
||||||
|
sched_note_cpu_start(this_task(), cpu);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Make the content of CPU0 L1 cache has been written to coherent L2 */
|
/* Make the content of CPU0 L1 cache has been written to coherent L2 */
|
||||||
|
|
||||||
cp15_clean_dcache(CONFIG_RAM_START, CONFIG_RAM_END - 1);
|
cp15_clean_dcache(CONFIG_RAM_START, CONFIG_RAM_END - 1);
|
||||||
|
|||||||
@@ -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 "nvic.h"
|
#include "nvic.h"
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
@@ -124,6 +125,12 @@ static void cpu1_boot(void)
|
|||||||
|
|
||||||
spin_unlock(&g_cpu1_boot);
|
spin_unlock(&g_cpu1_boot);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
|
/* Notify that this CPU has started */
|
||||||
|
|
||||||
|
sched_note_cpu_started(this_task());
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Then transfer control to the IDLE task */
|
/* Then transfer control to the IDLE task */
|
||||||
|
|
||||||
(void)os_idle_task(0, NULL);
|
(void)os_idle_task(0, NULL);
|
||||||
@@ -163,7 +170,15 @@ int up_cpu_start(int cpu)
|
|||||||
DPRINTF("cpu=%d\n",cpu);
|
DPRINTF("cpu=%d\n",cpu);
|
||||||
|
|
||||||
if (cpu != 1)
|
if (cpu != 1)
|
||||||
return -1;
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
|
/* Notify of the start event */
|
||||||
|
|
||||||
|
sched_note_cpu_start(this_task(), cpu);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Reset coprocessor */
|
/* Reset coprocessor */
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/sched.h>
|
#include <nuttx/sched.h>
|
||||||
#include <nuttx/semaphore.h>
|
#include <nuttx/semaphore.h>
|
||||||
|
#include <nuttx/sched_note.h>
|
||||||
|
|
||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
#include "xtensa.h"
|
#include "xtensa.h"
|
||||||
@@ -152,11 +153,17 @@ static inline void xtensa_attach_fromcpu0_interrupt(void)
|
|||||||
|
|
||||||
int xtensa_start_handler(int irq, FAR void *context)
|
int xtensa_start_handler(int irq, FAR void *context)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *tcb;
|
FAR struct tcb_s *tcb = this_task();
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sinfo("CPU%d Started\n", up_cpu_index());
|
sinfo("CPU%d Started\n", up_cpu_index());
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
|
/* Notify that this CPU has started */
|
||||||
|
|
||||||
|
sched_note_cpu_started(tcb);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Handle interlock*/
|
/* Handle interlock*/
|
||||||
|
|
||||||
g_appcpu_started = true;
|
g_appcpu_started = true;
|
||||||
@@ -164,7 +171,6 @@ int xtensa_start_handler(int irq, FAR void *context)
|
|||||||
|
|
||||||
/* Reset scheduler parameters */
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
tcb = this_task();
|
|
||||||
sched_resume_scheduler(tcb);
|
sched_resume_scheduler(tcb);
|
||||||
|
|
||||||
/* Move CPU0 exception vectors to IRAM */
|
/* Move CPU0 exception vectors to IRAM */
|
||||||
@@ -261,6 +267,12 @@ int up_cpu_start(int cpu)
|
|||||||
|
|
||||||
sinfo("Starting CPU%d\n", cpu);
|
sinfo("Starting CPU%d\n", cpu);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||||
|
/* Notify of the start event */
|
||||||
|
|
||||||
|
sched_note_cpu_start(this_task(), cpu);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The waitsem semaphore is used for signaling and, hence, should not
|
/* The waitsem semaphore is used for signaling and, hence, should not
|
||||||
* have priority inheritance enabled.
|
* have priority inheritance enabled.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -118,6 +118,9 @@ Status
|
|||||||
2016-12-01: I committed a completely untest SPI driver. This was taken
|
2016-12-01: I committed a completely untest SPI driver. This was taken
|
||||||
directly from the i.MX1 and is most certainly not ready for use yet.
|
directly from the i.MX1 and is most certainly not ready for use yet.
|
||||||
|
|
||||||
|
2016-12-07: Just a note to remind myself. The PL310 L2 cache has *not*
|
||||||
|
yet been enbled.
|
||||||
|
|
||||||
Platform Features
|
Platform Features
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,8 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <debug.h>
|
#include <sys/mount.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
|
||||||
#include "sabre-6quad.h"
|
#include "sabre-6quad.h"
|
||||||
|
|
||||||
@@ -58,5 +59,18 @@
|
|||||||
|
|
||||||
int imx_bringup(void)
|
int imx_bringup(void)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
#ifdef CONFIG_FS_PROCFS
|
||||||
|
/* Mount the procfs file system */
|
||||||
|
|
||||||
|
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UNUSED(ret);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ enum note_type_e
|
|||||||
NOTE_RESUME
|
NOTE_RESUME
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
,
|
,
|
||||||
|
NOTE_CPU_START,
|
||||||
|
NOTE_CPU_STARTED,
|
||||||
NOTE_CPU_PAUSE,
|
NOTE_CPU_PAUSE,
|
||||||
NOTE_CPU_PAUSED,
|
NOTE_CPU_PAUSED,
|
||||||
NOTE_CPU_RESUME,
|
NOTE_CPU_RESUME,
|
||||||
@@ -153,6 +155,22 @@ struct note_resume_s
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
|
|
||||||
|
/* This is the specific form of the NOTE_CPU_START note */
|
||||||
|
|
||||||
|
struct note_cpu_start_s
|
||||||
|
{
|
||||||
|
struct note_common_s ncs_cmn; /* Common note parameters */
|
||||||
|
uint8_t ncs_target; /* CPU being started */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This is the specific form of the NOTE_CPU_STARTED note */
|
||||||
|
|
||||||
|
struct note_cpu_started_s
|
||||||
|
{
|
||||||
|
struct note_common_s ncs_cmn; /* Common note parameters */
|
||||||
|
};
|
||||||
|
|
||||||
/* This is the specific form of the NOTE_CPU_PAUSE note */
|
/* This is the specific form of the NOTE_CPU_PAUSE note */
|
||||||
|
|
||||||
struct note_cpu_pause_s
|
struct note_cpu_pause_s
|
||||||
@@ -248,11 +266,15 @@ void sched_note_suspend(FAR struct tcb_s *tcb);
|
|||||||
void sched_note_resume(FAR struct tcb_s *tcb);
|
void sched_note_resume(FAR struct tcb_s *tcb);
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
|
void sched_note_cpu_start(FAR struct tcb_s *tcb, int cpu);
|
||||||
|
void sched_note_cpu_started(FAR struct tcb_s *tcb);
|
||||||
void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu);
|
void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu);
|
||||||
void sched_note_cpu_paused(FAR struct tcb_s *tcb);
|
void sched_note_cpu_paused(FAR struct tcb_s *tcb);
|
||||||
void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu);
|
void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu);
|
||||||
void sched_note_cpu_resumed(FAR struct tcb_s *tcb);
|
void sched_note_cpu_resumed(FAR struct tcb_s *tcb);
|
||||||
#else
|
#else
|
||||||
|
# define sched_note_cpu_start(t,c)
|
||||||
|
# define sched_note_cpu_started(t)
|
||||||
# define sched_note_cpu_pause(t,c)
|
# define sched_note_cpu_pause(t,c)
|
||||||
# define sched_note_cpu_paused(t)
|
# define sched_note_cpu_paused(t)
|
||||||
# define sched_note_cpu_resume(t,c)
|
# define sched_note_cpu_resume(t,c)
|
||||||
@@ -353,6 +375,8 @@ int note_register(void);
|
|||||||
# define sched_note_stop(t)
|
# define sched_note_stop(t)
|
||||||
# define sched_note_suspend(t)
|
# define sched_note_suspend(t)
|
||||||
# define sched_note_resume(t)
|
# define sched_note_resume(t)
|
||||||
|
# define sched_note_cpu_start(t,c)
|
||||||
|
# define sched_note_cpu_started(t)
|
||||||
# define sched_note_cpu_pause(t,c)
|
# define sched_note_cpu_pause(t,c)
|
||||||
# define sched_note_cpu_paused(t)
|
# define sched_note_cpu_paused(t)
|
||||||
# define sched_note_cpu_resume(t,c)
|
# define sched_note_cpu_resume(t,c)
|
||||||
|
|||||||
@@ -435,6 +435,33 @@ void sched_note_resume(FAR struct tcb_s *tcb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
|
void sched_note_cpu_start(FAR struct tcb_s *tcb, int cpu)
|
||||||
|
{
|
||||||
|
struct note_cpu_start_s note;
|
||||||
|
|
||||||
|
/* Format the note */
|
||||||
|
|
||||||
|
note_common(tcb, ¬e.ncs_cmn, sizeof(struct note_cpu_start_s), NOTE_CPU_START);
|
||||||
|
note.ncs_target = (uint8_t)cpu;
|
||||||
|
|
||||||
|
/* Add the note to circular buffer */
|
||||||
|
|
||||||
|
note_add((FAR const uint8_t *)¬e, sizeof(struct note_cpu_start_s));
|
||||||
|
}
|
||||||
|
|
||||||
|
void sched_note_cpu_started(FAR struct tcb_s *tcb)
|
||||||
|
{
|
||||||
|
struct note_cpu_started_s note;
|
||||||
|
|
||||||
|
/* Format the note */
|
||||||
|
|
||||||
|
note_common(tcb, ¬e.ncs_cmn, sizeof(struct note_cpu_started_s), NOTE_CPU_STARTED);
|
||||||
|
|
||||||
|
/* Add the note to circular buffer */
|
||||||
|
|
||||||
|
note_add((FAR const uint8_t *)¬e, sizeof(struct note_cpu_started_s));
|
||||||
|
}
|
||||||
|
|
||||||
void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu)
|
void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu)
|
||||||
{
|
{
|
||||||
struct note_cpu_pause_s note;
|
struct note_cpu_pause_s note;
|
||||||
|
|||||||
Reference in New Issue
Block a user