diff --git a/arch/arm/src/armv7-a/arm_cpustart.c b/arch/arm/src/armv7-a/arm_cpustart.c index 012d2e438e..d63c035db6 100644 --- a/arch/arm/src/armv7-a/arm_cpustart.c +++ b/arch/arm/src/armv7-a/arm_cpustart.c @@ -43,6 +43,7 @@ #include #include +#include #include "up_internal.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) { - FAR struct tcb_s *tcb; + FAR struct tcb_s *tcb = this_task(); 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 */ - tcb = this_task(); sched_resume_scheduler(tcb); /* 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()); +#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 */ cp15_clean_dcache(CONFIG_RAM_START, CONFIG_RAM_END - 1); diff --git a/arch/arm/src/sam34/sam4cm_cpustart.c b/arch/arm/src/sam34/sam4cm_cpustart.c index 44c8d9508c..7a5c62f0fc 100644 --- a/arch/arm/src/sam34/sam4cm_cpustart.c +++ b/arch/arm/src/sam34/sam4cm_cpustart.c @@ -47,6 +47,7 @@ #include #include +#include #include "nvic.h" #include "up_arch.h" @@ -124,6 +125,12 @@ static void cpu1_boot(void) 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 */ (void)os_idle_task(0, NULL); @@ -163,7 +170,15 @@ int up_cpu_start(int cpu) DPRINTF("cpu=%d\n",cpu); 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 */ diff --git a/arch/xtensa/src/esp32/esp32_cpustart.c b/arch/xtensa/src/esp32/esp32_cpustart.c index 3a603579b6..90998f107c 100644 --- a/arch/xtensa/src/esp32/esp32_cpustart.c +++ b/arch/xtensa/src/esp32/esp32_cpustart.c @@ -47,6 +47,7 @@ #include #include #include +#include #include "sched/sched.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) { - FAR struct tcb_s *tcb; + FAR struct tcb_s *tcb = this_task(); int i; 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*/ g_appcpu_started = true; @@ -164,7 +171,6 @@ int xtensa_start_handler(int irq, FAR void *context) /* Reset scheduler parameters */ - tcb = this_task(); sched_resume_scheduler(tcb); /* Move CPU0 exception vectors to IRAM */ @@ -261,6 +267,12 @@ int up_cpu_start(int 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 * have priority inheritance enabled. */ diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index ab4d4b5fa0..dda5ef7620 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -118,6 +118,9 @@ Status 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. +2016-12-07: Just a note to remind myself. The PL310 L2 cache has *not* + yet been enbled. + Platform Features ================= diff --git a/configs/sabre-6quad/src/imx_bringup.c b/configs/sabre-6quad/src/imx_bringup.c index 13f1742c15..6c3f4949ba 100644 --- a/configs/sabre-6quad/src/imx_bringup.c +++ b/configs/sabre-6quad/src/imx_bringup.c @@ -40,7 +40,8 @@ #include #include -#include +#include +#include #include "sabre-6quad.h" @@ -58,5 +59,18 @@ 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; } diff --git a/include/nuttx/sched_note.h b/include/nuttx/sched_note.h index c27e931deb..47c028b617 100644 --- a/include/nuttx/sched_note.h +++ b/include/nuttx/sched_note.h @@ -82,6 +82,8 @@ enum note_type_e NOTE_RESUME #ifdef CONFIG_SMP , + NOTE_CPU_START, + NOTE_CPU_STARTED, NOTE_CPU_PAUSE, NOTE_CPU_PAUSED, NOTE_CPU_RESUME, @@ -153,6 +155,22 @@ struct note_resume_s }; #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 */ 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); #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_paused(FAR struct tcb_s *tcb); void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu); void sched_note_cpu_resumed(FAR struct tcb_s *tcb); #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_paused(t) # define sched_note_cpu_resume(t,c) @@ -353,6 +375,8 @@ int note_register(void); # define sched_note_stop(t) # define sched_note_suspend(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_paused(t) # define sched_note_cpu_resume(t,c) diff --git a/sched/sched/sched_note.c b/sched/sched/sched_note.c index 22d87b8264..cf7b475c61 100644 --- a/sched/sched/sched_note.c +++ b/sched/sched/sched_note.c @@ -435,6 +435,33 @@ void sched_note_resume(FAR struct tcb_s *tcb) } #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) { struct note_cpu_pause_s note;