Commit Graph

2124 Commits

Author SHA1 Message Date
Petro Karashchenko
1a06ea4356 sched/signal: fix error handling in sigtimedwait()
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-11-13 09:11:54 +08:00
Petro Karashchenko
12646cc142 sched/signal: fix typo in comment
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-11-13 09:11:54 +08:00
Xiang Xiao
6f33dd6ea0 mm/heap: Change TCB_FLAG_HEAPCHECK to TCB_FLAG_HEAP_CHECK
align with other flags naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-12 09:39:01 +01:00
ligd
a9c647d418 semaphore: move param check to sem_xx level
for the speed improve

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-10 22:36:21 +08:00
ligd
a4b378a583 mqueue: use to DEBUGASSERT to cover some param check
for the speed improve

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-10 22:36:21 +08:00
YAMAMOTO Takashi
316f6aea71 group_setupidlefiles: fall back to /dev/null if /dev/console is disabled
Tested with a modified nsh on esp32-devkitc.
```
 int main(int argc, FAR char *argv[])
  {
  +  int fd = open("/dev/null", O_RDWR);
  +  _info("hey _info %d\n", fd);
  +  write(1, "hey stdout\n", 11);
  +  write(2, "hey stderr\n", 11);
```
2022-11-09 17:06:38 +08:00
ligd
d4ba93067e sched: remove sched_continue, merge code
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-04 08:51:02 +01:00
yinshengkai
85f727f232 tools: replace INCDIR to Makefile variable
In the past, header file paths were generated by the incdir command
Now they are generated by concatenating environment variables

In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
zhangyuan21
8512ca74b1 clock: adjust clock function to support tick
When CONFIG_SCHED_TICKLESS_TICK_ARGUMENT enabled, we can
use up_timer_gettick to get ticks for better performance.
2022-11-01 21:54:20 +08:00
Xiang Xiao
28947517ca sched/spawn: Rename task_spawnattr_[get|set]stack[size|addr] to posix_spawnattr_[get|set]stack[size|addr]
since they can be not only used in task_spawn but also in posix_spawn

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-01 09:51:18 +09:00
chao an
e0a3fdf982 sched/posix/timer: handle invaild timerid correctly
TIMER_SETTIME(2)

NAME
       timer_settime, timer_gettime - arm/disarm and fetch state of POSIX per-process timer

SYNOPSIS
       #include <time.h>

       int timer_settime(timer_t timerid, int flags,
                         const struct itimerspec *new_value,
                         struct itimerspec *old_value);
       int timer_gettime(timer_t timerid, struct itimerspec *curr_value);
...
ERRORS
...
       EINVAL timerid is invalid.

Signed-off-by: chao an <anchao@xiaomi.com>
2022-10-31 19:59:29 -03:00
zhangyuan21
18266c1012 nuttx/sched: use pid to check idle task
Pid is more appropriate than the flink pointer to determine idle task,
when we want to use other data structure to optimize the task list.
2022-10-31 17:53:08 +09:00
Xiang Xiao
64e7833cbc sched/spawn: Support task_spawnattr_[set|get]stackaddr
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-31 12:46:58 +09:00
Xiang Xiao
3f12b4f1e3 sched: Remove the unnecessary (FAR sem_t *) cast
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-29 21:12:40 +02:00
yinshengkai
2c95c04f4e sched: catch task memory leak
Print all unreleased memory blocks when the task exits

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-10-29 11:35:27 +08:00
Xiang Xiao
5bee68ebac sched: remove the unused function nx_wait and nx_waitid
This partially reverts commit de2a9d8a77.
2022-10-28 21:19:46 +02:00
luoyong1
126ce6428e sched/semaphore: add the wdog judge before cancel
N/A

to avoid entering critical again in wd_cancel when wdog not actived. But when the wdog is actived, may add more judge
2022-10-28 09:34:52 +02:00
Xiang Xiao
677a907dc8 sched: Pass idle thread environment variables to the child task through copy
because if we pass predefined environment variables table explicitly,
the environment variables created by the board code will be lost.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 10:28:05 +09:00
Petro Karashchenko
e43db5fe28 sched/semaphore: fix typo in comment
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-10-24 12:59:24 +08:00
anjiahao
577e550698 libc/semaphore:sem_init change defult protocol
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
anjiahao
e1ca516488 use SEM_INITIALIZER inside of NXSEM_INITIALIZER
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
anjiahao
5724c6b2e4 sem:remove sem default protocl
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
chao an
205c8934a3 sched/msgq: add support of System V message queue
https://man.openbsd.org/msgget.2

Signed-off-by: chao an <anchao@xiaomi.com>
2022-10-22 12:58:11 +08:00
chao an
96c3debe6a sched/mqueue: decoupling condition member to common prologue
Signed-off-by: chao an <anchao@xiaomi.com>
2022-10-22 12:58:11 +08:00
YAMAMOTO Takashi
a31316cab5 group_kill_children_handler: use nxtask_delete as this is in-kernel 2022-10-19 21:32:30 +08:00
Xiang Xiao
9ccddde6a9 sched/spawn: Launch nxposix_spawn_proxy through nxthread_create
to ensure the caller environment variable always get copied

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09:00
Xiang Xiao
aed85964ff sched/env: Don't need copy env variable from parent in env_dup
since caller always pass them if needed

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09:00
Xiang Xiao
e2a18ad339 sched: Support envp argument of task_spawn and nxtask_create
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09:00
Xiang Xiao
6b31918b42 Remove the unnecessary cast for main_t, NULL and argv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 08:51:45 +02:00
anjiahao
d1d46335df Replace nxsem API when used as a lock with nxmutex API
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
Junbo Zheng
1ab8b921f6 nuttx/sched/sched: fix runtime error UBSan(division by zero)
NuttShell (NSH) NuttX-10.3.0
ap>
ap>
ap> uptime
sched/sched_sysinfo.c:69:37: runtime error: division by zero
[1]    28220 floating point exception  sudo ./nuttx

Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2022-10-16 12:43:31 +08:00
zhangyuan21
750007ded9 sched: use tick count for sched timer expiration 2022-10-12 11:55:46 +08:00
zhangyuan21
09a06e7fce sem: don't clear waitobj when do sem recover
This commit is intended to solve the bug caused by #7159.
It will fixed data abort issue when task restart in wait sem status.
If delete waitobj in the sem recover function, then we will get the wrong
task list when remove the task from task list.
2022-10-11 16:31:54 +09:00
Xiang Xiao
8c80b3d908 sched: Guard backtrace related code correctly
1.Don't include unwind.h when arch specific backtrace is enable
2.Built arch specific backtrace wrapper only when enable

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-11 00:01:35 +02:00
Masayuki Ishikawa
d071d6869f sched: irq: Refactor irq_spinlock.c
Summary:
- Call this_cpu() properly in spin_unlock_irqrestore()

Impact:
- None

Testing:
- Tested with spresense:wifi_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-10-04 23:41:04 +08:00
Petro Karashchenko
d247e8d1d2 sched/semaphore: fix priority boost restoration for priority inheritance
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-10-03 15:14:24 -03:00
Xiang Xiao
e38248ee08 Return -EINVAL for the internal API
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-30 17:54:56 +02:00
Xiang Xiao
bdeaea3742 Remove the unnessary empty line after label
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-30 17:54:56 +02:00
zhangyuan21
85d013f69a sched: mqueue wait list optimize 2022-09-28 18:08:37 +08:00
zhangyuan21
838309313e sched: semaphore wait list optimize 2022-09-28 18:08:37 +08:00
Xiang Xiao
764540267e sched/clock: Rename g_system_timer to g_system_ticks
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-27 17:45:44 -03:00
yinshengkai
ae38e3eb10 sched: Optimize sched_note_begin/end
Optimize sched_note_begin/end, replace note_printf with note_string
sched_note_begin/end optimized from 50us to 1us per consumption

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-09-27 21:32:35 +08:00
Xiang Xiao
40ef5bc6db libc: Move queue.h from include to include/nuttx
to avoid the conflict with libuv's queue.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-26 08:04:58 +02:00
zhangyuan21
40366f4153 sched: clear waitsem and msgwaitq after remove blocked 2022-09-22 16:32:44 +08:00
zhangyuan21
af72a528f1 sched: merge waitsem and msgwaitq 2022-09-22 16:32:44 +08:00
Xiang Xiao
af12a552fe sched/Kconfig: let PREALLOC_TIMERS depends on !DISABLE_POSIX_TIMERS
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-19 11:39:22 -03:00
Xiang Xiao
8a265e274d Kconfig: Remove EXPERIMENTAL for features which is been around a long time
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-19 11:39:22 -03:00
ligd
e2df52390a SMP: fix crash when switch to new task which is still running
Situation:

Assume we have 2 cpus, and busy run task0.

CPU0                                CPU1
task0 -> task1                      task2 -> task0
1. remove task0 form runninglist
2. take task1 as new tcb
3. add task0 to blocklist
4. clear spinlock
                                    4.1 remove task2 form runninglist
                                    4.2 take task0 as new tcb
                                    4.3 add task2 to blocklist
                                    4.4 use svc ISR swith to task0
                                    4.5 crash
5. use svc ISR swith to task1

Fix:
Move clear spinlock to the end of svc ISR

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-17 17:37:47 +09:00
ligd
615bc9f0e2 SMP: fix assert failed when one task set to 255
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-17 17:37:47 +09:00
chao an
e586f86918 sched/mqueue: fix resource leak in mq_timedsend()
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-15 01:56:35 +08:00