Review some SMP logic; update comments; refresh configuration.

This commit is contained in:
Gregory Nutt 2016-11-15 09:24:00 -06:00
parent 65ab12fbb9
commit 21f92ba601
3 changed files with 35 additions and 18 deletions

View File

@ -243,9 +243,6 @@ SMP
You can enable SMP for ostest configuration by enabling:
-# CONFIG_EXPERIMENTAL is not set
+CONFIG_EXPERIMENTAL=y
+CONFIG_SPINLOCK=y
+CONFIG_SMP=y
+CONFIG_SMP_NCPUS=2

View File

@ -58,10 +58,13 @@ CONFIG_DEBUG_NOOPT=y
# CONFIG_ARCH_AVR is not set
# CONFIG_ARCH_HC is not set
# CONFIG_ARCH_MIPS is not set
# CONFIG_ARCH_MISOC is not set
# CONFIG_ARCH_RGMP is not set
# CONFIG_ARCH_RENESAS is not set
# CONFIG_ARCH_RISCV is not set
CONFIG_ARCH_SIM=y
# CONFIG_ARCH_X86 is not set
# CONFIG_ARCH_XTENSA is not set
# CONFIG_ARCH_Z16 is not set
# CONFIG_ARCH_Z80 is not set
CONFIG_ARCH="sim"
@ -79,6 +82,7 @@ CONFIG_SIM_NET_HOST_ROUTE=y
# CONFIG_SIM_NET_BRIDGE is not set
# CONFIG_SIM_FRAMEBUFFER is not set
# CONFIG_SIM_SPIFLASH is not set
# CONFIG_SIM_QSPIFLASH is not set
#
# Architecture Options
@ -168,6 +172,7 @@ CONFIG_ARCH_HAVE_TICKLESS=y
CONFIG_USEC_PER_TICK=10000
# CONFIG_SYSTEM_TIME64 is not set
# CONFIG_CLOCK_MONOTONIC is not set
# CONFIG_ARCH_HAVE_TIMEKEEPING is not set
# CONFIG_JULIAN_TIME is not set
CONFIG_START_YEAR=2007
CONFIG_START_MONTH=2
@ -180,6 +185,7 @@ CONFIG_PREALLOC_TIMERS=8
#
# Tasks and Scheduling
#
# CONFIG_SMP is not set
# CONFIG_INIT_NONE is not set
CONFIG_INIT_ENTRYPOINT=y
# CONFIG_INIT_FILEPATH is not set
@ -262,6 +268,7 @@ CONFIG_PTHREAD_STACK_DEFAULT=8192
CONFIG_DISABLE_POLL=y
CONFIG_DEV_NULL=y
# CONFIG_DEV_ZERO is not set
# CONFIG_DEV_URANDOM is not set
# CONFIG_DEV_LOOP is not set
#
@ -277,12 +284,16 @@ CONFIG_DEV_NULL=y
# CONFIG_ARCH_HAVE_I2CRESET is not set
# CONFIG_I2C is not set
# CONFIG_SPI is not set
# CONFIG_ARCH_HAVE_SPI_CRCGENERATION is not set
# CONFIG_ARCH_HAVE_SPI_CS_CONTROL is not set
# CONFIG_ARCH_HAVE_SPI_BITORDER is not set
# CONFIG_I2S is not set
#
# Timer Driver Support
#
# CONFIG_TIMER is not set
# CONFIG_ONESHOT is not set
# CONFIG_RTC is not set
# CONFIG_WATCHDOG is not set
# CONFIG_ANALOG is not set
@ -351,10 +362,12 @@ CONFIG_SERIAL_CONSOLE=y
# CONFIG_SERIAL_OFLOWCONTROL is not set
# CONFIG_SERIAL_DMA is not set
# CONFIG_ARCH_HAVE_SERIAL_TERMIOS is not set
# CONFIG_PSEUDOTERM is not set
# CONFIG_USBDEV is not set
# CONFIG_USBHOST is not set
# CONFIG_HAVE_USBTRACE is not set
# CONFIG_DRIVERS_WIRELESS is not set
# CONFIG_DRIVERS_CONTACTLESS is not set
#
# System Logging
@ -456,6 +469,8 @@ CONFIG_LIB_HOMEDIR="/"
# CONFIG_LIBC_FLOATINGPOINT is not set
CONFIG_LIBC_LONG_LONG=y
# CONFIG_LIBC_IOCTL_VARIADIC is not set
# CONFIG_LIBC_WCHAR is not set
# CONFIG_LIBC_LOCALE is not set
CONFIG_LIB_RAND_ORDER=1
# CONFIG_EOL_IS_CR is not set
# CONFIG_EOL_IS_LF is not set
@ -501,9 +516,9 @@ CONFIG_ARCH_HAVE_TLS=y
#
# Examples
#
# CONFIG_EXAMPLES_CCTYPE is not set
# CONFIG_EXAMPLES_CHAT is not set
# CONFIG_EXAMPLES_CONFIGDATA is not set
# CONFIG_EXAMPLES_CPUHOG is not set
# CONFIG_EXAMPLES_DHCPD is not set
# CONFIG_EXAMPLES_ELF is not set
# CONFIG_EXAMPLES_FTPC is not set
@ -535,10 +550,9 @@ CONFIG_EXAMPLES_OSTEST_RR_RANGE=10000
CONFIG_EXAMPLES_OSTEST_RR_RUNS=10
CONFIG_EXAMPLES_OSTEST_WAITRESULT=y
# CONFIG_EXAMPLES_PCA9635 is not set
# CONFIG_EXAMPLES_PIPE is not set
# CONFIG_EXAMPLES_POLL is not set
# CONFIG_EXAMPLES_POSIXSPAWN is not set
# CONFIG_EXAMPLES_PPPD is not set
# CONFIG_EXAMPLES_RFID_READUID is not set
# CONFIG_EXAMPLES_RGBLED is not set
# CONFIG_EXAMPLES_RGMP is not set
# CONFIG_EXAMPLES_SENDMAIL is not set
@ -577,6 +591,7 @@ CONFIG_EXAMPLES_OSTEST_WAITRESULT=y
#
# CONFIG_INTERPRETERS_FICL is not set
# CONFIG_INTERPRETERS_MICROPYTHON is not set
# CONFIG_INTERPRETERS_MINIBASIC is not set
# CONFIG_INTERPRETERS_PCODE is not set
#
@ -620,6 +635,7 @@ CONFIG_EXAMPLES_OSTEST_WAITRESULT=y
# CONFIG_READLINE_HAVE_EXTMATCH is not set
# CONFIG_SYSTEM_READLINE is not set
# CONFIG_SYSTEM_SUDOKU is not set
# CONFIG_SYSTEM_TEE is not set
# CONFIG_SYSTEM_UBLOXMODEM is not set
# CONFIG_SYSTEM_VI is not set
# CONFIG_SYSTEM_ZMODEM is not set

View File

@ -214,34 +214,38 @@ void leave_critical_section(irqstate_t flags)
if (g_os_initstate >= OSINIT_TASKLISTS)
{
/* If called from an interrupt handler, then just take the spinlock.
* If we are already in a critical section, this will lock the CPU
* in the interrupt handler. Sounds worse than it is.
/* If called from an interrupt handler, then just release the
* spinlock. The interrupt handling logic should already hold the
* spinlock if enter_critical_section() has been called. Unlocking
* the spinlock will allow interrupt handlers on other CPUs to execute
* again.
*/
if (up_interrupt_context())
{
/* We are in an interrupt handler but within a critical section.
* Wait until we can get the spinlock (meaning that we are no
* longer in the critical section).
*/
/* We are in an interrupt handler. Release the spinlock. */
DEBUGASSERT(g_cpu_irqlock == SP_LOCKED);
spin_unlock(&g_cpu_irqlock);
if (g_cpu_irqset == 0)
{
spin_unlock(&g_cpu_irqlock);
}
}
else
{
FAR struct tcb_s *rtcb = this_task();
DEBUGASSERT(rtcb != 0 && rtcb->irqcount > 0);
/* Normal tasking context */
/* Will we still have interrupts disabled after decrementing the
/* Normal tasking context. We need to coordinate with other
* tasks.
*
* Will we still have interrupts disabled after decrementing the
* count?
*/
*/
if (rtcb->irqcount > 1)
{
/* Yes... make sure that the spinlock is set */
/* Yes... the spinlock should remain set */
DEBUGASSERT(g_cpu_irqlock == SP_LOCKED);
rtcb->irqcount--;