ligd
e751451f36
sched/wdog: move SMP enter_critical_section to sched_timerexpiration.c
...
Change-Id: Id654e6d2151e3b807ed2df4ab8169b90ab07b015
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-08-26 14:38:35 +08:00
ligd
a11c1d8246
sched/wdog: fix switch_context caused error in wd_start()
...
Thead A: Thread B:
wd_start(wdogX)
wd_cancel
nxsched_cancel_timer --> wd_start(wdogX)
wd_cancel
add wdogX to g_wdactivelist
<--
add wdogX to g_wdactivelist
then, you will find wdogX add twice.
Change-Id: Icbf3b2badff20908e115c9134e2400cdcb32b1e0
Signed-off-by: ligd <liguiding1@xiaomi.com >
(cherry picked from commit 3493c0cddb8db7154724a88c7c7786815675c561)
2021-08-26 14:38:35 +08:00
chao.an
19432f62ab
sched/backtrace: simplify the assign of tcb in case of negative pid
...
Change-Id: I447a905f105131d1e3527800a8686d516af2affc
Signed-off-by: chao.an <anchao@xiaomi.com >
2021-08-23 12:08:43 +08:00
Jiuzhu Dong
5867fd2ccc
task_spawn: release g_spawn_parmsem and sched_unlock at the ending
...
Change-Id: Ifcb5b9921e82fc495c4457fdb5f0607f40b07fc0
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-08-19 16:16:36 +08:00
chao.an
7f192ca255
sched/backtrace: add sched_backtrace support
...
Change-Id: Ia764cf54dfa215b313f9d5f1a060aac18d765982
Signed-off-by: chao.an <anchao@xiaomi.com >
2021-08-18 19:36:38 +08:00
chao.an
db06f769ff
libs/libc: move the backtrace implement to sched
...
1. move the backtrace implement to sched
2. rename CONFIG_UNWINDER to CONFIG_SCHED_BACKTRACE
Change-Id: I8176727602bfc695184b88210a3aaf90c6acaac7
Signed-off-by: chao.an <anchao@xiaomi.com >
2021-08-18 19:36:23 +08:00
Xiang Xiao
4bffde887d
Rename LIB_ to LIBC_ for all libc Kconfig
...
follow other libc component naming convention
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
Change-Id: I66cf8f3201560ce71576279640e94ae3147ad0a2
2021-08-09 21:03:17 +08:00
Xiang Xiao
df1ffd9680
signal: Allow SIG_EVTHREAD selectable in protected mode
...
since we can delivery signal through libs/libc/wqueue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2021-08-05 21:19:34 +08:00
Jiuzhu Dong
c4e5410fa5
usrwqueue: implement order work queue
...
N/A
Change-Id: I9b6a76dec96f669c0b55bef39a9e5a2a71dde50b
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-07-25 00:12:40 +08:00
Jiuzhu Dong
3d8a09e4cb
fs/inode: add sanity check for inode
...
Change-Id: Ib2c74ba308b8f15756fac4e69632c296243eb4ab
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-07-24 15:20:27 +08:00
Jiuzhu Dong
dc1c7a644a
wqueue: delete sem_wait to avoid race condition
...
when work_cancel was called, we need to check work.timer whether is active
by WDOG_ISACTIVE for work_queue with delay.
The wdog cb has not been executed when the flag:active is cleared
and if we check flag:active at this moment, WDOG_ISACTIVE will return false.
so the work_cancel will sem_wait until post a semaphore, but all free hpwork_thread
also wait this semphore and their priority are high than caller, this will be a race
condition causing thread/task of calling work_cancel block.
Change-Id: Id86289da60bf967d1062c1cdaaf6959b4f6dd054
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-07-19 20:20:47 +08:00
ligd
055079e948
sched: fix build break on spin_lock_irqsave()
...
Change-Id: Ibfa95021964f44a714cf504fbd0f491b9d8a18c3
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-16 16:19:11 +08:00
ligd
9b6665b9e9
sched/signal: add spinlock to g_sigfreeaction
...
To avoid nxsig_alloc_action() & nxsig_release_action() competition
MIRTOS-800
Change-Id: I6091ed9d6425a382e8c41351817b6d5ea06638f1
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-16 11:54:06 +08:00
Xiang Xiao
5d9a22a0bb
arch/sim: Initialize the idle thread stack info correctly
...
and change the default value of IDLETHREAD_STACKSIZE to 65536
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
Change-Id: Ia54efbbca4b69706150bc4178844b316688a104e
2021-07-16 11:19:56 +08:00
Xiang Xiao
31e4067eed
sched/init: initialize all idle thread's tl_task
...
since this patch forget to initialize the idle tls info:
commit 50c08bf45b
Author: Huang Qi <huangqi3@xiaomi.com >
Date: Tue Jun 29 16:01:02 2021 +0800
libc: Move pthread_key_destructor to task_info_s
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
Change-Id: If7d0c0118323fa3dcf44081d675cd57b14eba75a
2021-07-16 11:19:25 +08:00
Xiang Xiao
0cfc7f6b4a
sched/init: Remove the unnessary CONFIG_SMP check
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
Change-Id: I2afaf310b411993e37140b3d7977968a7fda5c3b
2021-07-16 11:19:18 +08:00
anjiahao
b8eb7e36ed
mq_msgqalloc:del check MQ_MAX_MSGS
...
N/A
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
Change-Id: If43fdd937f23de24921f5a14072fa37d9d339c94
2021-07-15 20:32:03 +08:00
Jiuzhu Dong
57533c66c9
group/child_status: Dynamically expand group child_status
...
Change-Id: I4033e93b6adceb01eebe1c2a12ffe8737042b1a6
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-07-15 17:53:43 +08:00
anjiahao
8c057b46ab
mq_open: add long file name check and parameter check
...
N/A
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
Change-Id: Ie777cd38af86c3f25e818a1477996a5f0c1cc195
2021-07-15 14:29:47 +08:00
Xiang Xiao
b7b96941b3
fs: Support the root file system attributes(mode, uid, gid and time)
...
Note: all attributes is guarded by PSEUDOFS_ATTRIBUTES to save the space
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
Change-Id: I664d60382e356068fd920f08aca5b4a49d8d92a9
2021-07-14 23:33:43 +08:00
Xiang Xiao
4e1f26700d
wqueue: Fix unrefernce reference to `DEBUGASSERT'
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
Change-Id: Ia7450b93bfe8ed22d75efebcfb203b4b2e467da2
2021-07-13 21:40:46 +08:00
Xiang Xiao
c4f3d2d296
Revert "[Boottime] add syslog info in system bootup stages"
...
This reverts commit b8423e9681 .
2021-07-13 03:16:53 +08:00
Xiang Xiao
c8f1eeed57
Merge commit '2e43815c929acb818b34a5ff8828494b0c6f6891' into dev
...
Change-Id: Idcbac12fec435abff01cfb4efd5a26a02eb08f93
2021-07-13 03:14:34 +08:00
Jiuzhu Dong
9b1f554429
sched: Dynamically extend the pid hash table
...
Change-Id: I3a719bc575cd408cd530a39efa203f507b44fa9c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-07-11 19:42:30 -07:00
Jiuzhu Dong
bb867a38fc
nx_start: Simplify and unify the partial initialization process
...
for both SMP and non-SMP
Change-Id: I0fea8b4f59fc27d253a2ef9b7503acbb7410cc14
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-07-11 19:42:30 -07:00
Peter Bee
8a47dd95c9
sched/clock: add nsec range check in clock_settime
...
MIRTOS-109
Return error when tv_nsec <0 or >=1000 million.
Change-Id: Iddbbcda163cb402551f619efb7486f6798859d57
Signed-off-by: Peter Bee <bijunda1@xiaomi.com >
2021-07-09 14:19:03 -03:00
Jiuzhu Dong
2d9b18a8ea
smp: fix pid assign issue
...
example:lack pid:4 when CONFIG_SMP_NCPUS=4
nsh> ps
PID PPID CPU PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND
0 0 0 0 FIFO Kthread N-- Assigned 00000000 000944 CPU0 IDLE
1 0 1 0 FIFO Kthread N-- Running 00000000 000000 CPU1 IDLE
2 0 2 0 FIFO Kthread N-- Running 00000000 000000 CPU2 IDLE
3 0 3 0 FIFO Kthread N-- Running 00000000 000000 CPU3 IDLE
5 0 0 100 FIFO Task --- Running 00000000 065504 init
Change-Id: I30a7e50c418332ec89edfd42473d9bebb2b02bbc
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-07-08 15:16:35 +08:00
Huang Qi
50c08bf45b
libc: Move pthread_key_destructor to task_info_s
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com >
2021-07-04 07:36:44 -05:00
ligd
ece224a7e3
sched/waitpid: handle waitpid waitting tcb->group is NULL
...
Fail case:
exit -> nxtask_terminate -> nxtask_exithook -> nxsched_release_tcb
group_leave || nxsched_releasepid & group_leave
/\
/ \
switch out & waitpid()
Thread A group_leave in nxtask_exithook, switch out,
Thread B do waitpid(thread A) then meet traget thread A group is NULL, error.
Change-Id: Ia181d7a13aa645ec1c3141a45839fbf79db35b17
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-04 06:23:59 -05:00
ligd
8d2615f78d
sched: add STACK_USAGE_SAFE_PERCENT for stack overflow check
...
Change-Id: Ia70e243b36401e28c31fcd7e1b480b79374c27ef
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-03 12:56:40 -05:00
ligd
940c80f7b3
sched: fix stack check crash in idle thread
...
Change-Id: Iea7c096ffcab181f318edcc1bfe1717785831b7a
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-03 12:56:40 -05:00
ligd
68d66148ad
mm: idle check heap use mm_trysemaphore
...
Change-Id: I92e1df572fa6cd801b10e5b06e7b04d450b3e3fb
Signed-off-by: ligd <liguiding1@xiaomi.com >
(cherry picked from commit bc9a5d1ca9656f6effd3a419cc2488586dfb1489)
2021-07-03 12:56:40 -05:00
ligd
646b229f74
sched/init/nx_start.c: enter_critical_section when check heap & stack in idle
...
Change-Id: I2ef95ee8e1dc1ba3e74c1d6c8c6af20f53be85c7
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-03 12:56:40 -05:00
ligd
a96cab58ad
sched: add depends on ARCH_INTERRUPTSTACK to SMP
...
Change-Id: I7edbbcf314045c5567e30b39b0693672e5d10e9a
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-03 07:02:33 -05:00
Huang Qi
65fa11634b
sched: Refine tls_info_s and task_info_s
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com >
2021-07-02 10:33:34 -05:00
ligd
adfaa140cc
sched: add CONFIG_SCHED_CRITMONITOR_XX for debugging system lantency
...
Change-Id: Id2a75db28caf1a89552e33391bd90f85cde08dbd
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-02 08:25:02 -05:00
ligd
2d32a52353
sched_critmon: add thread run time to critmonitor
...
Change-Id: Ib44e45f0f9a1b249b4067db324c9dbdf0cf3f288
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-02 08:25:02 -05:00
Jiuzhu Dong
198b85d233
sched/idle: disable sched when idle call nx_bringup
...
Because idle task will call mm_malloc to create some task
and will take sem of mm. But if smp enable, the sem of mm may be
taken by other cpu, so idle may be block because take this sem and crash.
Change-Id: I22f0233ef6c59a1b81607d4389e68f8646c89395
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-07-02 04:51:15 -05:00
Xiang Xiao
d7d3177668
sched/wdog: Remove flags field from wdog_s to save memory
...
since WDOG_ISACTIVE can check func field instead
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
Change-Id: I21d7f9cfe6195c8ccb6cc5925ff66f3c89822f9d
2021-07-01 19:27:10 -03:00
Jiuzhu Dong
5d51a3c3ec
wqueue: fix assert about work was cancelled when work doesn't occur.
...
N/A
Change-Id: I04916e041b1b3329287214c052d3ba5fc259235c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-07-01 19:10:50 +08:00
ligd
1438eca2a7
sched/waitpid: handle waitpid waitting tcb->group is NULL
...
Fail case:
exit -> nxtask_terminate -> nxtask_exithook -> nxsched_release_tcb
group_leave || nxsched_releasepid & group_leave
/\
/ \
switch out & waitpid()
Thread A group_leave in nxtask_exithook, switch out,
Thread B do waitpid(thread A) then meet traget thread A group is NULL, error.
Change-Id: Ia181d7a13aa645ec1c3141a45839fbf79db35b17
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-01 18:26:20 +08:00
ligd
17e65242d3
sched: add depends on ARCH_INTERRUPTSTACK to SMP
...
Change-Id: I7edbbcf314045c5567e30b39b0693672e5d10e9a
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-01 18:26:20 +08:00
ligd
5c7166f9dd
sched: add STACK_USAGE_SAFE_PERCENT for stack overflow check
...
Change-Id: Ia70e243b36401e28c31fcd7e1b480b79374c27ef
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-01 18:26:20 +08:00
ligd
2d71063825
sched: fix stack check crash in idle thread
...
Change-Id: Iea7c096ffcab181f318edcc1bfe1717785831b7a
Signed-off-by: ligd <liguiding1@xiaomi.com >
2021-07-01 18:26:20 +08:00
Nathan Hartman
a8cbcd084f
signal: Fix docs and comments related to SIGWORK and its config
...
Documentation/reference/os/wqueue.rst:
* CONFIG_SIG_SIGWORK: Fix sentence that was cut off in the
middle.
include/signal.h:
* SIGWORK: Fix grammar in comment.
sched/Kconfig:
* config SIG_SIGWORK: Fix ---help--- text to indicate that
this user-configured signal number may be used by various
internal worker threads.
2021-06-30 21:22:49 -05:00
Jiuzhu Dong
482b151d73
work_queue: schedule the work queue using the timer mechanism
...
N/A
Change-Id: I6488e8d3b63f04d43832efaf75f5083e9184d717
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-06-28 23:35:56 +08:00
Jiuzhu Dong
b658b85bae
wqueue: fix compile break becauseof work_process
...
N/A
Change-Id: I97acaaa4575f87051596ab0b436721690e9289ad
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-06-28 15:10:30 +08:00
Jiuzhu Dong
67dc33bbe1
sched/wqueue: merge kwork_lpthread.c and kwork_hpthread.c to kwork_thread.c
...
N/A
Change-Id: Ib24a80d8373c954d4532ba54f76c887f62800a36
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-06-28 14:09:59 +08:00
Xiang Xiao
5cd03beaf1
sched: Add kthread_create_with_stack
...
let caller customize the stack buffer
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
Change-Id: I878818ec1ce5650165dbbe2d72a4618cb2e6a094
2021-06-28 10:57:42 +08:00
Xiang Xiao
13780dada3
sched: Add kthread_create_with_stack
...
let caller customize the stack buffer
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
Change-Id: I878818ec1ce5650165dbbe2d72a4618cb2e6a094
2021-06-27 12:35:13 -03:00