since other subsystem doesn't need call these function anymore
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idfb217c412db62d9f17f427310b75bb78785dc50
Fix missing semicolon at the end of a DEBUGASSERT statement:
sched/sched_sporadic.c: In function 'sporadic_budget_expire':
sched/sched_sporadic.c:512:15: error: expected ';' before 'period'
512 | period = (sporadic->repl_period >> 1) - unrealized;
| ^~~~~~
sched/sched_sporadic.c: In function 'nxsched_resume_sporadic':
sched/sched_sporadic.c:1078:19: error: expected ';' before 'period'
1078 | period = (sporadic->repl_period >> 1) - unrealized;
| ^~~~~~
Fix use of uninitialized variable in DEBUGASSERT statement:
sched/sched_sporadic.c:466:27: warning: 'sporadic' may be used uninitialized in this function [-Wmaybe-uninitialized]
466 | sporadic->nrepls > 0);
Also fixes some typos.
There should be no unexpected side-effects of this changed.
Tested with the stm32f4discovery:sporadic configuration (see PR #3097
Summary:
- This commit removes a redundant critical section in nxsem_tickkwait()
Impact:
- None
Testing:
- Tested with ping with the following configs
- spresense:rndis, spresense:rndis_smp
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
it is wrong to define a new grpid_t, but not reuse pid_t,
because it make getpid(parent) == getppid(child) impossible.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
since there are situation which send singal to idle thread already,
CONFIG_SCHED_CHILD_STATUS=y
CONFIG_SCHED_HAVE_PARENT=y
Signo SIGCHLD will send to parent group, when child exit
Change-Id: Iceb2ac41948c1c3418839a3b5de70985d48c75d1
Signed-off-by: ligd <liguiding1@xiaomi.com>
Summary:
- During investigating critical section with semaphores, I noticed
that nxtask_flushstreams() is called with a critical section.
- The function calls lib_flushall() which handles a semaphore
in userspace.
- So it should be done without a critical section
Impact:
- SMP only
Testing:
- Tested with ostest the following configs
- esp32-devkitc:smp (QEMU), sabre-6quad:smp (QEMU)
- maix-bit:smp (QEMU), sim:smp
- spresense:smp
- Tested with nxplayer and stress test with spresense:wifi_smp
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Otherwise, long-sleeping system calls using nxsig_timedwait
are not actually interrupted.
Tested with "ntpcstop" using lm3s6965-ek:qemu-protected config.
Summary:
- This commit changes spinlock APIs (spin_lock_irqsave/spin_unlock_irqrestore)
- In the previous implementation, the global spinlock (i.e. g_irq_spin) was used.
- This commit allows to use caller specific spinlock but also supports to use
g_irq_spin for backword compatibility (In this case, NULL must be specified)
Impact:
- None
Testing:
- Tested with the following configurations
- spresnse:wifi, spresense:wifi_smp
- esp32-devkitc:smp (QEMU), sabre6-quad:smp (QEMU)
- maxi-bit:smp (QEMU), sim:smp
- stm32f4discovery:wifi
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Summary:
- During testing iperf -s with lc823450-xgevk:rndis,
I noticed that hard fault happens
- Finally, I found that group_kill_children() is not
not protected by a critical section
- This commit fixes this issue
Impact:
- SMP only
Testing:
- Tested with iperf with the following configurations
- lc823450-xgevk:rndis, spresense:rndis_smp
- Tested with ostest with the following configurations
- lc823450-xgevk:rndis, esp32-devkitc:smp (QEMU)
- sabre-6quad:smp (QEMU), maix-bit:smp (QEMU)
- spresense:rndis_smp, sim:smp
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Summary:
- This commit fixes comments and label in nxtask_assign_pid()
Impact:
- None
Testing:
- Built with spresense:wifi
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Summary:
- During reviewing sched_lock() in nxtask_assign_pid(),
I noticed that g_pidhash is not protected by a critical section
- Because g_pidhash is accessed in an interrupt context,
it should be protected by a critical section.
- Actually, nxsched_foreach(), nxsched_get_tcb() and so on
use a critical section.
Impact:
- No impact
Testing:
- Tested with spresense:wifi (non-SMP) and spresense:wifi_smp
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Summary:
- Because this_task() and nxsched_get_tcb() are protected inside the funtcions
- Also, enter_critical_section() is used in nxsched_set_affinity()
Impact:
- No impact
Testing:
- Tested with spresense:wifi_smp
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
let's call either nx_dup/nx_dup2 or file_dup/file_dup2
instead just like other fs api: xxx->nx_xxx->file_xxx
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I1aacfb9e25dc7b3fcb0345ff7b269b1953a01e5b
1. remove descript management in mqueue, save code size
2. use i_ops instead of i_mqueue to remove the dup logic
Change-Id: Ie88960e50ddcae9c87977c9ad65a45297c663291
Signed-off-by: ligd <liguiding1@xiaomi.com>
Summary:
- Calling sched_lock()/unlock() is unnecessary for SMP
because we've been using the critical section API
Impact:
- SMP only
Testing:
- Tested with smp and ostest with the following configurations
- sabre-6quad:smp (QEMU, dev board)
- spresense:smp, spresense:wifi_smp
- sim:smp, sim:ostest
- maix-bit:smp (QEMU)
- esp32-devkitc:smp (QEMU)
- lc823450-xgevk:rndis
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
use the default testset implement on single core platform
that does not support test-and-set, more flexibility for
SMP drivers(using spinlock) if configured in a single-core mode.
Signed-off-by: chao.an <anchao@xiaomi.com>
Summary:
- During repeating ostest with sabre-6quad:smp (QEMU),
I noticed that pthread_rwlock_test sometimes stops
- Finally, I found that nxtask_exit() released a critical
section too early before context switching which resulted in
selecting inappropriate TCB
- This commit fixes this issue by moving nxsched_resume_scheduler()
from nxtask_exit() to up_exit() and also removing
spin_setbit() and spin_clrbit() from nxtask_exit()
because the caller holds a critical section
- To be consistent with non-SMP cases, the above changes
were done for all CPU architectures
Impact:
- This commit affects all CPU architectures regardless of SMP
Testing:
- Tested with ostest with the following configs
- sabre-6quad:smp (QEMU, dev board), sabre-6quad:nsh (QEMU)
- spresense:wifi_smp
- sim:smp, sim:ostest
- maix-bit:smp (QEMU)
- esp32-devkitc:smp (QEMU)
- lc823450-xgevk:rndis
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
the action can't be dynamically allocated in any irq handler
so it's important to let the user extend the number as needed
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id30c5d93003e63514c24f2ca0df2f634c4c63c5f
the message can't be dynamically allocated in any irq handler
so it's important to let the user extend the number as needed
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia26584c3815bac6cf24de4c88be0844ac8e8fba2
Summary:
- I found potential bugs in pthread_condclockwait.c
- Actually, sched_unlock() and wd_cancel() were misplaced.
- This commit fixes this issue
Impact:
- pthread_cond_clockwait() only
Testing:
- Tested with ostest with the following configs
- sabre-6quad:nsh, sabre-6quad:smp, sim:ostest
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Summary:
- This commit introduces SP_WFE() and SP_SEV() to be used for spinlock
- Also, use wfe/sev instructions for ARMV7-A to reduce power consumption
Impact:
- ARMV7-a SMP only
Testing:
- sabre-6quad:smp (QEMU, dev board)
- maix-bit:smp, esp32-devkitc:smp, spresense:smp sim:smp (compile only)
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Summary:
- This commit fixes global IRQ control logic
- In previous implementation, g_cpu_irqset for a remote CPU was
set in sched_add_readytorun(), sched_remove_readytorun() and
up_schedule_sigaction()
- In this implementation, they are removed.
- Instead, in the pause handler, call enter_critical_setion()
which will call up_cpu_paused() then acquire g_cpu_irqlock
- So if a new task with irqcount > 1 restarts on the remote CPU,
the CPU will only hold a critical section. Thus, the issue such as
'POSSIBLE FOR TWO CPUs TO HOLD A CRITICAL SECTION' could be resolved.
- Fix nxsched_resume_scheduler() so that it does not call spin_clrbit()
if a CPU does not hold a g_cpu_irqset
- Fix nxtask_exit() so that it acquires g_cpu_irqlock
- Update TODO
Impact:
- All SMP implementations
Testing:
- Tested with smp, ostest with the following configurations
- Tested with spresense:wifi_smp (NCPUS=2,4)
- Tested with sabre-6quad:smp (QEMU, dev board)
- Tested with maix-bit:smp (QEMU)
- Tested with esp32-core:smp (QEMU)
- Tested with lc823450-xgevk:rndis
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>