Commit Graph

2045 Commits

Author SHA1 Message Date
Xiang Xiao
701bbaac74 sched/environ: Ensure tg_envp terminated by double '\0'
so we can compute the whole environ string length from it

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-14 07:49:00 +03:00
anjiahao
a191d9bc3c sched/pthread_create:fix bug,delete data_sem
if a pthread set attr is detach,and when call pthread_create,
new thread exit quikly,new thread's tcb be free,then pthread_create
use new thread's tcb will crash.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-04-14 01:42:16 +08:00
chao.an
a594a5d7a8 sched/init: drivers_initialize() should be late than up_initialize()
up_initialize
|
 ->up_serialinit
   |
    ->uart_register  /* ("/dev/console", &CONSOLE_DEV); */

drivers_initialize
|
 ->syslog_console_init
   |
    ->register_driver /* ("/dev/console", &g_consoleops, 0666, NULL); */

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-12 07:51:34 +09:00
Xiang Xiao
51ffa3edb0 sched/irq: Fix array overrun in coverity check
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-08 21:02:13 -03:00
Xiang Xiao
aed5dadc3d sched/irq: Remove CONFIG_SCHED_IRQMONITOR when define CALL_VECTOR
since up_perf_ API doesn't couple with CONFIG_SCHED_IRQMONITOR

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-08 21:02:13 -03:00
Xiang Xiao
bf3da321c9 sched/wqueue: Simplify CALL_WORKER dispatch condition
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-08 21:02:13 -03:00
chao.an
8cb008c3c7 sched/note: correct flatten format
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-08 02:41:25 +08:00
anjiahao
47304e7254 sched/pthread:need check pthread is DETACHED
pthread_join need check thread is DETACHED,
Whether to wait according to the result.And,
if a thread is DETACHED,it will not set a new
attr.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-04-08 01:41:06 +08:00
zhuyanlin
26ab4e9200 mod_insmod: fix coverity warning
Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2022-04-02 20:09:42 +08:00
zhuyanlin
c46a926e2b sched_note: fix buffer size warning in coverity
Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2022-04-02 20:09:42 +08:00
zhuyanlin
497d24f145 timerexpiration:fix DEADCODE when RR_INTERVAL or SCHED_SPORADIC not select
tmp is always true for CONFIG_RR_INTERVAL > 0
and CONFIG_SCHED_SPORADIC not select

Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2022-04-02 12:52:08 +03:00
chao.an
6e0ba2bed5 sched/note: add support of trace section mark
The implementation of this feature is based on android systrace:

https://source.android.com/devices/tech/debug/ftrace

Application developers are more concerned about the performance of
the specified application section,
added two APIs to implement performance measurement:

void sched_note_begin(uintptr_t ip, FAR const char *buf);
void sched_note_end(uintptr_t ip, FAR const char *buf);
or
SCHED_NOTE_BEGIN();  /* defined to sched_note_begin(_THIS_IP_, __FUNCTION__) */
SCHED_NOTE_END();    /* defined to sched_note_end(_THIS_IP_, __FUNCTION__) */

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-01 21:06:00 +08:00
chao.an
e05f64735f sched/trace: correct the note print format
note print should with Instruction pointer.

e.g:

        trace_printk("hello NuttX");

trace dump:

hello-6  [000] .... 23080.367994: 0xc044a005: hello NuttX

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-01 21:06:00 +08:00
chao.an
6c86e77dee sched/note: unify the data format
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-01 21:06:00 +08:00
Jiuzhu Dong
37ef22b106 sigact: get free sigact from freelist always successful
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-04-01 13:38:29 +08:00
ligd
e9f17947b7 task: don't set default signal in kernal thread
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:53:14 +09:00
ligd
0c1f63625a signal: Don't do schedule_sigaction when there is no action
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:53:14 +09:00
ligd
d09be7d658 workqueue: add work_foreach support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-29 18:03:08 +08:00
zhuyanlin
0460367a70 irq_csection: fix assert warning
constant 65535 with expression of type 'int16_t' (aka 'short')
is always true

Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2022-03-29 13:44:01 +08:00
Petro Karashchenko
98ba65c422 c89: get rid of designated initializers in common code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-28 13:39:27 +08:00
zouboan
466063ac9e sched/sched/sched_timerexpiration: change from sched_time to eventtime
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-27 18:22:58 +03:00
Petro Karashchenko
68902d8732 pid_t: unify usage of special task IDs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-22 21:22:32 +08:00
Ville Juven
3581668c6b env_dup: Allocate memory from the correct memory pool
When the initial proxy task is duplicated into the first user task,
the environment exists in kernel memory and this must be copied to user
memory.

The memory allocated for the new task was allocated with the parent's
priority which is incorrect. Use the new task's priority instead.

Follow-up for: #5753
2022-03-22 10:15:29 +08:00
chao.an
38b3da6d00 sched/module: correct the check condition
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-18 20:13:25 +02:00
Petro Karashchenko
6472a698b6 style/typo: fix few style and typo issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-18 17:05:10 +01:00
Xiang Xiao
c1bde1a4d2 sched/Kconfig: Remove CPULOAD_ENTROPY depend on CPULOAD_ONESHOT
since it's also used by the period cpuload

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-18 12:43:06 +02:00
Ville Juven
75afe491ad RISC-V: Prepare for CONFIG_BUILD_KERNEL
- Thread context prior to system call needs to be preserved
- Allocate a kernel heap
2022-03-18 18:20:12 +08:00
Ville Juven
50578dc501 Fix the initial idle tasks environment
- User mode allocator was used for setting up the environment. This
  works in flat mode and probably in protected mode as well, as there
  is always a a single user allocator present
- This does not work in kernel mode, where each user task has its own
  heap allocator. Also, when the idle tasks environment is being set,
  no allocator is ready and the system crashes at once.

Fix this by using the group allocators instead:
- Idle task is a kernel task, so its group is privileged
- Add group_realloc
- Use the group_malloc/realloc functions instead of kumm_malloc
2022-03-16 20:21:19 +08:00
Xiang Xiao
c96c96a399 drivers: Merge the common driver initialization into one place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-13 11:24:48 -03:00
Xiang Xiao
4cc28882f9 sched/init: Don't call sq_init/dq_init on global link list
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 15:06:39 -03:00
Xiang Xiao
ab872b0199 sched/init: Move binfmt_initialize before hardware initialization
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 15:06:39 -03:00
Xiang Xiao
2ce62bb583 sched/irq: Remove the code which zero out g_irqvector fields
since the boot up code already do it

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 15:06:39 -03:00
Xiang Xiao
b0786606fc sched/wdog: Remove wd_initialize which isn't really used anymore
since g_wdactivelist is already set to zero by the boot code

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 15:06:39 -03:00
Xiang Xiao
cf2538c277 mm/shm: Initialize shm_info_s at the definition place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 15:06:39 -03:00
Gustavo Henrique Nihei
5e15a3bce5 sched: Fix typo in references to SIGEV_THREAD
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-03-10 23:18:26 +02:00
Xiang Xiao
8fa26944f7 sched/init: Fix the compiler warning
/github/workspace/sources/nuttx/include/nuttx/init.h: In function 'nx_start':
Error: init/nx_start.c:439:7: error: 'strncpy' output truncated copying 8 bytes from a string of length 9 [-Werror=stringop-truncation]
  439 |       strncpy(g_idletcb[i].cmn.name, g_idlename, CONFIG_TASK_NAME_SIZE);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-10 19:46:01 +02:00
Xiang Xiao
a50d87d5b7 sched/group: Simplify the allocation and deallocation logic
1.Move tg_membe allocation to group_alloc
2.Merge group_deallocate to group_release

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-04 12:11:24 +09:00
ligd
fe6aa4a874 sim: add loop thread to handle dev loops
For some dev loops will call sem_wait/sem_trywait

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-02 20:29:52 +09:00
Xiang Xiao
eb1cc02d09 sched/group: Move files_initlist/lib_stream_initialize to group_alloc
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-02 20:29:52 +09:00
Xiang Xiao
4a16cf71f9 Fix -Werror=nonnull-compare and -Werror=format-truncation=
Error: module/mod_insmod.c:203:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
  203 |   strncpy(modp->modname, modname, MODLIB_NAMEMAX);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

wqueue/kwork_thread.c: In function 'work_start_lowpri':
Error: wqueue/kwork_thread.c:212:22: error: '%lx' directive output may be truncated writing between 1 and 16 bytes into a region of size 14 [-Werror=format-truncation=]
  212 |   snprintf(args, 16, "0x%" PRIxPTR, (uintptr_t)wqueue);

local/local_sockif.c: In function 'local_getsockname':
Error: local/local_sockif.c:392:11: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
  392 |           strncpy(unaddr->sun_path, conn->lc_path, namelen);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

chip/esp32_wifi_utils.c: In function 'esp_wifi_scan_event_parse':
Error: chip/esp32_wifi_utils.c:373:37: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
   memset(ap_list_buffer, 0x0, sizeof(ap_list_buffer));
                                     ^

stdio/lib_fputs.c: In function 'fputs':
Error: stdio/lib_fputs.c:99:9: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s == NULL || stream == NULL)
         ^
Error: stdio/lib_fputs.c:99:27: error: nonnull argument 'stream' compared to NULL [-Werror=nonnull-compare]
   if (s == NULL || stream == NULL)
                           ^

stdio/lib_vfprintf.c: In function 'vfprintf':
Error: stdio/lib_vfprintf.c:40:6: error: nonnull argument 'stream' compared to NULL [-Werror=nonnull-compare]
   if (stream)
      ^

string/lib_strdup.c: In function 'strdup':
Error: string/lib_strdup.c:39:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

string/lib_strndup.c: In function 'strndup':
Error: string/lib_strndup.c:56:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

string/lib_strpbrk.c: In function 'strpbrk':
Error: string/lib_strpbrk.c:39:7: error: nonnull argument 'str' compared to NULL [-Werror=nonnull-compare]
   if (!str || !charset)
       ^~~~
Error: string/lib_strpbrk.c:39:15: error: nonnull argument 'charset' compared to NULL [-Werror=nonnull-compare]
   if (!str || !charset)
               ^~~~~~~~

string/lib_strrchr.c: In function 'strrchr':
Error: string/lib_strrchr.c:40:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

Error: time/lib_asctimer.c:73:50: error: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 12 [-Werror=format-truncation=]
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
                                                  ^~
time/lib_asctimer.c:73:21: note: directive argument in the range [-2147481748, 2147483647]
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
time/lib_asctimer.c:73:3: note: 'snprintf' output between 17 and 68 bytes into a destination of size 26
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            g_wday_name[tp->tm_wday], g_mon_name[tp->tm_mon],
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec,
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            1900 + tp->tm_year);
            ~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-02 15:55:38 +08:00
Xiang Xiao
ddde41018a Revert "sched: Don't duplicate caller file handler when creating kernel thread"
since the temporary kernel spawn proxy need duplicate file handler
from caller, please reference the follow source code for more info:
sched/task/task_posixspawn.c
sched/task/task_spawn.c

This reverts commit 5c5f1dec08.
2022-03-01 12:26:49 +01:00
Xiang Xiao
da954956e7 Simplify DEFAULT_SMALL usage in Kconfig
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-01 03:15:01 +08:00
Masayuki Ishikawa
dcafd95971 sched: group: Fix dataabort when exiting task or pthread if ARCH_ADDRENV=y
Summary:
- I noticed that exiting task or pthread causes dataabort if ARCH_ADDRENV=y
- This commit fixes this issue by switching the addrenv correctly

Impact:
- CONFIG_ARCH_ADDRENV=y only

Testing:
- Tested with sabre-6quad:netknsh (not merged yet)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-02-28 16:10:10 +08:00
Petro Karashchenko
fa761a8a6a sched/timer: remove unused variable
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-02-27 12:27:35 -05:00
Huang Qi
e516c6247e sched: Implement task local storage
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-23 22:05:02 +08:00
zhanghu6
ebf751b16e xsched/note:add switch and dump instrumentation
Signed-off-by: zhanghu6 <zhanghu6@xiaomi.com>
2022-02-23 21:56:58 +08:00
ligd
61a0453e6e os init_state: add new state OSINIT_IDLELOOP
This is for distinguish we are in init idle or idle loop.
Use for assertion for sem_trywait & sem_wait

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-02-23 22:05:37 +09:00
Xiang Xiao
f1ed349dd9 sched/clock: Remove CLOCK_MONOTONIC option from Kconfig
here is the reason:
1.clock_systime_timespec(core function) always exist regardless the setting
2.CLOCK_MONOTONIC is a foundamental clock type required by many places

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-23 01:21:26 +08:00
Masayuki Ishikawa
fccdcf7011 Revert "os init_state: add new state OSINIT_IDLELOOP"
This reverts commit 051bb32010.
2022-02-22 10:56:14 +01:00
ligd
051bb32010 os init_state: add new state OSINIT_IDLELOOP
This is for distinguish we are in init idle or idle loop.
Use for assertion for sem_trywait & sem_wait

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-02-22 07:58:55 +01:00
Petro Karashchenko
9b02a91c72 libc/sched/task_setcanceltype: fix function name in comment
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-02-21 20:32:49 +08:00
Huang Qi
f452dd7ab4 sched: Mark pthread as non-cancelable to avoid additional calls to pthread_exit()
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-20 15:36:07 +01:00
Oki Minabe
682984e9ba add the kernel stack allocation in pthread create. 2022-02-19 19:32:21 +08:00
ligd
756c9fb60d semaphore: fix corner case sem_waitirq assert crash
[   11.041077] [25] [ EMERG] [ap] up_assert: Assertion failed at file:semaphore/sem_waitirq.c line: 84 task: thermal service
[   11.041407] [25] [ EMERG] [ap] backtrace:
[   11.041517] [25] [ EMERG] [ap] [25] [<0x2c687c9e>] up_backtrace+0xa/0x164
[   11.041627] [25] [ EMERG] [ap] [25] [<0x2c676e6c>] sched_dumpstack+0x1c/0x5c
[   11.041682] [25] [ EMERG] [ap] [25] [<0x2c68763a>] up_assert+0x42/0x24c
[   11.041792] [25] [ EMERG] [ap] [25] [<0x2c67355e>] _assert+0x2/0xc
[   11.041847] [25] [ EMERG] [ap] [25] [<0x2c65d536>] nxsem_wait_irq+0x3e/0x134
[   11.042288] [25] [ EMERG] [ap] [25] [<0x2c65d378>] nxsem_timeout+0x24/0x34
[   11.043169] [25] [ EMERG] [ap] [25] [<0x2c65f74c>] wd_timer+0xc0/0x104
[   11.043995] [25] [ EMERG] [ap] [25] [<0x2c65c930>] nxsched_alarm_expiration+0x4c/0xdc
[   11.044986] [25] [ EMERG] [ap] [25] [<0x2c670872>] oneshot_callback+0x16/0x24
[   11.045867] [25] [ EMERG] [ap] [25] [<0x2c6822b8>] bes_oneshot_irq_handler+0x18/0x28
[   11.046858] [25] [ EMERG] [ap] [25] [<0x57e5c>] up_irq_handler+0x4/0xc
[   11.047684] [25] [ EMERG] [ap] [25] [<0x2c65a20e>] irq_dispatch+0x5a/0xb8
[   11.048510] [25] [ EMERG] [ap] [25] [<0x2c6864d8>] arm_doirq+0x28/0x3c
[   11.049336] [25] [ EMERG] [ap] [25] [<0x2c681732>] exception_common+0x4a/0xac
[   11.050272] [25] [ EMERG] [ap] [25] [<0x2c65a324>] leave_critical_section+0x2c/0x54
[   11.051208] [25] [ EMERG] [ap] [25] [<0x2c65f472>] timer_settime+0x9e/0x10c

There are 2 ways can caused this:
1. sem_timedwait
   HW IRQ sem_post
   TIMER IRQ do wd_timer -> nxsem_timeout -> crash

   Note: The 2 IRQS happens amost at same time

2. sem_timedwait
   TIMER IRQ do wd_timer -> wd_func1 sem_post
                         -> wd_func2 nxsem_timeout -> crash

Resolve:
Stop the watchdog when sem_post

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-02-18 23:00:28 +08:00
Petro Karashchenko
7933442b98 sched/semaphore/sem_clockwait: fix typo in comment
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-02-17 12:54:49 +01:00
Petro Karashchenko
41c95da594 register_driver: fix driver modes accross the code
State of problem:
 - Some drivers that do not support write operations (does not
   have write handler or ioctl do not perform any write actions)
   are registered with write permissions
 - Some drivers that do not support read operation (does not
   have read handler or ioctl do not perform any read actions)
   are registered with read permissions
 - Some drivers are registered with execute permissions

Solution:
 - Iterate code where register_driver() is used and change 'mode'
   parameter to reflect the actual read/write operations executed
   by a driver
 - Remove execute permissions from 'mode' parameter

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-02-16 16:15:29 +08:00
Zeng Zhaoxiu
fc4ab4fd94 semaphore: Improve the nxsem_release_holder function.
1. The task which called nxsem_release_holder may not be a holder of the semaphore,
   counts of the holder would not be decreamented.
   This commit try to resolve the problem if there is only one holder.
2. Avoid counts overflow.

Signed-off-by: Zeng Zhaoxiu <walker.zeng@transtekcorp.com>
2022-02-13 03:20:51 +08:00
Zeng Zhaoxiu
ea8f5f565e semaphore: Cleanup, merge public code.
Signed-off-by: Zeng Zhaoxiu <walker.zeng@transtekcorp.com>
2022-02-13 03:20:51 +08:00
Zeng Zhaoxiu
5bf7c185af semphore: release all semphores' holder that the task held when exit
Add a list in TCB to track all semphores the task held, so we
can release all holders when exit, so nxsched_verify_tcb
is unnecessary.

Signed-off-by: Zeng Zhaoxiu <walker.zeng@transtekcorp.com>
2022-02-13 03:20:51 +08:00
patacongo
cfee589a4a Update sched/wdog/wd_start.c
Co-authored-by: David Sidrane <David.Sidrane@Nscdg.com>
2022-02-10 22:33:47 +08:00
Gregory Nutt
8af4d65c9a Added comment to wdog_start
Add a comment briefly explaining why one timer tick is added to the watchdog delay.  This has confused a lot of people and has resulted in numerous awkward discussions and ill-informed attempts to modify the code to remove that addition.  Perhaps a rather lengthy comment will reduce that confusion and put an end to this thrashing.
2022-02-10 22:33:47 +08:00
chao.an
b3d45fd6c0 sched/mqueue: remove unused leave_cancellation_point
should be removed by:

commit fca07be1df
Author: Gregory Nutt <gnutt@nuttx.org>
Date:   Tue Oct 10 08:43:10 2017 -0600

    Squashed commit of the following:

        Change all calls to mq_send() and mq_timedsend() in the OS to calls to
        nxmq_send() and nxmq_timedsend(), making appropriate changes for differences
        in return values.

        sched/mqueue:  Add internal function nxmq_send() and nxmq_timedsend() that are
        equivalent to mq_send() and mq_timedsend() except that they do not create
        cancellation points and do to not modify the errno variable.

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 22:33:21 +08:00
chao.an
479d196208 sched/module: remove redundant unlock
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 22:31:51 +08:00
Xiang Xiao
d426875fcf tools/mkconfig: Remove the unnecessary config option correction
since Kconfig can handle the dependence correctly for us

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-09 14:34:38 -03:00
Huang Qi
8bf7f94d39 pthread: Call cleanup callback while asyncrhonous cancel
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-09 21:21:43 +08:00
Huang Qi
c0a0de97ce Revert "libc: Call pthread_exit in user-space by up_pthread_exit"
This reverts commit f4a0b7aedd.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-09 21:21:43 +08:00
Huang Qi
6814b1416f Revert "pthread: Avoid recursive pthread_exit call"
This reverts commit a2941532bd.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-09 21:21:43 +08:00
Xiang Xiao
0000e61da6 task: Always implement posix_spawnp as macro
Since there is no benefit to implement it as
function when CONFIG_LIBC_ENVPATH equals y

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-09 20:09:11 +08:00
Xiang Xiao
ab3b0d0162 sched: Implement sysinfo function
specify here:
https://man7.org/linux/man-pages/man2/sysinfo.2.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-08 10:27:38 +08:00
Xiang Xiao
0499979908 sched: Disable pthread by default when DEFAULT_SMALL is enabled
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-07 12:04:03 +08:00
Xiang Xiao
ef1abbbea0 Fix signal/sig_default.c:195:21: error: unused variable 'rtcb'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-07 12:04:03 +08:00
Xiang Xiao
5c5f1dec08 sched: Don't duplicate caller file handler when creating kernel thread
kernel thread should have only the starndard file i/o just like idle thread

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-01 08:22:45 +09:00
Xiang Xiao
d48946063a Revert "sched: Don't duplicate caller file handler when creating kernel thread"
This reverts commit 512676cb06.
2022-02-01 08:22:45 +09:00
Xiang Xiao
a9d7a776c4 sched: Remove SDCLONE_DISABLE option and config
since the related code was removed by:
commit 4d5a964f29
Author: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Date:   Tue Feb 23 18:04:13 2021 +0800

    net: unify socket into file descriptor

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-31 19:03:20 +01:00
Xiang Xiao
512676cb06 sched: Don't duplicate caller file handler when creating kernel thread
kernel thread should have only the starndard file i/o just like idle thread

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-31 14:44:29 +01:00
ligd
d8c2610157 idle: remove heap & stack check in idle thread
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-01-29 00:53:47 +08:00
ligd
b316611ef0 Revert "sem: remove limitation of irq context when do sem_trywait"
This reverts commit 7c547b3ebd.
2022-01-29 00:53:47 +08:00
chao.an
e781787cb9 sched/critmonitor: remove the assertion if counter == 0
Perf timer interface generally uses the hardware cycle counter
provided by the arch chip directly(such as DWT_CYCCNT(cortex-m)),
CYCCNT is a free running counter and counting upwards.
It wraps around to 0 on overflow.

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-25 20:24:58 +08:00
Xiang Xiao
a24ae559c2 arch: Decouple up_critmon_[gettime|convert] from critmon
and rename to up_perf_[gettime|convert] since it's useful in other case

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-25 14:43:34 +08:00
Petro Karashchenko
c0881feca9 boards/arm/samv7/same70-qmtech: fix description in README.txt
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-23 20:08:10 -03:00
Xiang Xiao
77792a1598 sched: Define CONFIG_SMP_NCPUS to 1 in no SMP case
to simplify the SMP related code logic

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-20 23:21:21 +08:00
Petro Karashchenko
08043fb5bc net: unify FAR keyword usage for all net buffer memory mapped buffers
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-20 01:42:56 +08:00
ligd
dd08815991 idle: remove heap & stack check in idle thread
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-01-20 01:14:56 +08:00
ligd
cb502a869c clock: update clock_synchronize() to support with time
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-01-18 22:48:15 +08:00
ligd
0a51f13ca5 rpmsg_rtc: merge the rpmsg_rtc_init to same place
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-01-18 22:48:15 +08:00
Xiang Xiao
1b77ae88ef fs/procfs: Remove the unnecessary strcmp
since the procfs already make the same check for us

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-12 07:19:40 +01:00
Petro Karashchenko
a743fed63d file_operations: get back C89 compatible initializer
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-11 02:14:00 +08:00
Petro Karashchenko
2447b7bd9a pthread: restore pthread mutex default protocol POSIX compatibility
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-11 01:55:12 +08:00
Xiang Xiao
964f4b7ed7 sched/Kconfig: Remove CONFIG_ prefix from SCHED_HPWORK
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-06 18:45:13 -03:00
Zeng Zhaoxiu
fb43fd73ed signal: signal handler may cause task's state error
For example, task is blocked by nxsem_wait(sem1), use nxsem_wait(sem2)
in signal handler, and take sem2 successfully, after exit from signal
handler to task, nxsem_wait(sem1) returns OK, but the correct result
should be -EINTR.

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
2022-01-05 21:36:44 +09:00
walker.zeng
76b2f7199d sched: fix the bug of task's tmeslice
The BUG is as follow:
 1. Suppose there are two ready tasks t1 and t2 have the same priority, and t1 is the running.
 2. A new, higher priority task t0 (such as hpwork) is ready, then switch to t0.
 3. After t0 is suspended, then switch to t1 and reset the t1's timeslice.
 4. goto 2
The t2 will have no chance to run.

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
2021-12-30 18:01:56 +08:00
Xiang Xiao
dd942f0b04 sched/backtrace: Dump the complete stack regardless the depth
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 12:09:54 +08:00
ligd
0bb32f27c0 init: use exec_spawn instead of exec
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-24 08:23:30 -06:00
ligd
10ccba6671 init: move USERMAIN_XX out of INIT_ENTRYPOINT
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-24 08:23:30 -06:00
ligd
e5420c8eee wqueue: fix NO leave_critical_section() when only CONFIG_SCHED_HPWORK
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-23 02:27:34 -06:00
Nathan Hartman
878c347bb6 sched: Fix typos in comments
sched/pthread/pthread_mutextimedlock.c:
sched/pthread/pthread_mutextrylock.c:

    * Fix typos in comments. No functional change.
2021-12-21 11:07:23 -06:00
Juha Niskanen
422ceec99b Fix typos in comments and Kconfig files
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-12-21 03:26:16 -06:00
anjiahao
9a53601ba9 sched:add holder in sem_trywait
Avoid priority rollover

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2021-12-17 11:28:27 -06:00
raiden00pl
e2c9f612c9 sched/init/nx_start.c: fix compile break when CONIFG_TASK_NAME_SIZE=0 2021-12-17 10:29:00 +01:00
zhanghu6
f56aefaa41 sched_note: change uint32_t nbi_module into uint8_t array, because variables keep the same style that use uint8_t array
sched_note: add note dump module tag definitions

NOTE_MODULE(a, b, c, d)

example:
define TEST_MODULE NOTE_MODULE('t', 'e', 's', 't')
sched_note_dump(TEST_MODULE, event, data, len);

define AUDIO_MODULE NOTE_MODULE('a', 'u', 'd', 'i')
sched_note_dump(AUDIO_MODULE, event, data, len);
2021-12-16 04:18:17 -06:00