Commit Graph

41934 Commits

Author SHA1 Message Date
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 03b7bd9cf1 fs: move out nx_close from filelock
Change-Id: Ia6c4ec88d90db0330134d0aaa30e94cb71c8a066
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
ligd dcea2afd7e mm: fix memory corruption when loop create/exit thread in SMP mode
Root casue:
when do thread exit, need add free stack operation to mm_delaylist,
but in SMP mode, CPU0 thread1 exit, at this time, CPU1 call malloc
and free mm_delaylist.

Fix:
Divide mm_delaylist for per CPU in SMP mode.

Change-Id: Ibf7d04614ea2f99fb5b506356b7346a0d94f0590
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
ligd 772044bbdf serial: add ioctl TIOCNOTTY
Change-Id: I14ab1304d6330578423e0775f42faa8e19886fef
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
ligd 34f63bdc13 mm: don't do mm_checkcorruption in IRQ
because this not safe in SMP mode

Change-Id: Ifaf49818c51ee4283f0e280ae3e4e23cbd0dba08
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
ligd 23f948aa7f syslog: add CPU id to system when open CONFIG_SMP
Change-Id: Ie8aaf44583ff4146b79b1392d1410b31806a81e8
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
Xiang Xiao 82047fe3c4 mm: Add kmm_malloc_size and mm_malloc_size
make malloc_size implementation align with malloc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8d7781925f06e58a880437a16569dccbfd2ea035
2021-07-01 18:08:54 +08:00
Xiang Xiao 1c5b37a1f5 libc: Remove the duplication lib_xxx macro
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I73c876ed40811c013dad83b8b2aeb7bdc3041913
2021-07-01 18:08:54 +08:00
Xiang Xiao 3dd31cba2c Move aligned_alloc, posix_memalign and valloc from mm/umm to libs/libc/stdlib
since the similar functions(e.g. strdup/strndup) put into libs/libc/string

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ifb2c0c51298b09014748e5ee8275db51213d6911
2021-07-01 18:08:54 +08:00
Xiang Xiao da028e391b fs: Initialize fs_allmaps_s::exclsem in declaration directly
and then remove rammap_initialize and caller

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ife9f04d409b3a14a3be4bbb61c23da6e7a9f8a3d
2021-07-01 12:52:01 +08:00
Xiang Xiao 2cfb3f673a mmap: Implement the minial but reasonable mlock/munlock/mprotect
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I538e0d78ecd0680374a2e0f56adbc61d7a4e6d1f
2021-07-01 12:31:17 +08:00
Xiang Xiao 6c9e7a1b21 libc/debug: Rename CONFIG_EABI_UNWINDER to CONFIG_UNWINDER
since the unwinder not only work with arm but also other arch(e.g. riscv)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I56cc54f2c99560c858362ab2dfba524097385716
2021-06-30 22:14:18 +08:00
nietingting 97c6d983b5 sim: create symlink for mirtos_test
N/A

Signed-off-by: nietingting <nietingting@xiaomi.com>
Change-Id: Ie54e6d0107cf5bc7f2c851105302b604f2dc16ba
2021-06-30 20:40:51 +08:00
丁欣童 cf3d397dd7 sensor/fakesenor: fix set_interval fail sometime.
N/A

When fakesensor was activated, csv file is not opened timely, so
the sensor->interval that set_interval() seted will be coverd by
interval form csv file.

Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
Change-Id: I611587f886c4d2eb6ddb6c28e575e0a0d2ac9cec
2021-06-30 15:00:10 +08:00
liuhaitao bf711cf263 sim: remove the obsolete mirtos/mirtos_test symlink configs
Change-Id: I713fe8affce38eb9ec72343959ec50c5985c0e17
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-06-29 22:16:30 +08:00
Jiuzhu Dong d78b1ff5b3 ramlog: fix compile break
Change-Id: I03afb41790dbba1d3290c566b099fe511771de3c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-29 16:56:35 +08: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
Xiang Xiao 4b7c156321 arch/sim: Implement mm_mallinfo for the custom heap
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idf07081869a4659490109aacf8d7905bdb485835
2021-06-28 21:26:09 +08:00
Xiang Xiao a9f917e44d arch/sim: Implement malloc_size for the custom heap
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-28 21:26:09 +08:00
Xiang Xiao 62ac1e1b6d arch/sim: Remove host_malloc and host_calloc
use host_realloc instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I41e5a722532830b9ec26dd7b32bfab9f30b443c2
2021-06-28 21:26:09 +08:00
Xiang Xiao 4e3c1ed8af mm: Support malloc_size function
and rename malloc_usable_size to malloc_size

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8d83e9148d70e752142af26d7dd9a291123fdd14
2021-06-28 21:26:09 +08:00
liuhaitao 29d1bc9e87 Add exfat directory into .gitignore
Change-Id: I86b94644157af2b1204bcc0d52b118a61c683f53
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-06-28 20:24:31 +08:00
Jiuzhu Dong 6d883bbb5d driver/sensor: fix crash casued by closing the handle during the reading.
N/A

Change-Id: I0632f3f81192b3924302f9b363497822b1117032
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-28 19:53:40 +08:00
Xiang Xiao d37d8e00a5 mtd: Add MTDIOC_FLUSH IOCTL like MTDIOC_XIPBASE
since the old design reuse BIOC_FLUSH for
MTD device which make some confusion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-28 18:06:52 +08:00
Virus.V 4624cb25d6 riscv/bl602:replace syslog to debugging log macros 2021-06-28 18:06:52 +08:00
Xiang Xiao 8c5c09b4bb fs/tmpfs: Account the filename in the allocation block
and caclulate the available block more accurately

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia6382239f422970771ccefbd6e461241a5f995a5
2021-06-28 16:57:33 +08:00
Xiang Xiao 4e011793dc fs/tmpfs: Remove the temporary strdup in all place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I224cc9d4ec5fd08937f9f2ddfff022866090be29
2021-06-28 16:57:33 +08:00
Xiang Xiao 4bee08c67f fs/tmpfs: Fix the memory corruption when reallocate tmpfs_directory_s
since it's hard to adjust all childern to point back the new parent
location. Let's allocate the dynamical part(e.g. tdo_entry) separately
and remove the back pointer.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I53afb8336360b7845bd8ecb5aa908acea20e7797
2021-06-28 16:57:33 +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 b16a6b9aac net/udp: Fix error: 'MAX_IFINDEX' undeclared
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I6bc09ede185d6ee71d93268c44a8f69a49bf68c9
2021-06-27 19:40:53 -07:00
Xiang Xiao 811bcd413d net: Add if_nameindex and if_freenameindex API
Specified here:
https://man7.org/linux/man-pages/man3/if_nameindex.3.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia5daed775bd11fa5978d54860632554da8f7b416
2021-06-26 19:45:21 -07:00
Xiang Xiao 52b7656205 libc/time: Initialize tm_zone field correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ief32aedc72ec062d428f8538a25ddfe4f81d7e29
2021-06-25 23:40:19 +08:00
Xiang Xiao 7f23b68038 libc/time: Fix nxstyle issue in lib_localtime.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2e98d92e62b47ade375bda3f043175841d9fa1b7
2021-06-25 23:40:19 +08:00
Xiang Xiao b0493deda7 libc/time: Rename lclptr/gmtptr to g_lcl_ptr/g_gmt_ptr
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I380f28c15ffe3d98734016bfedb1618b20a5f400
2021-06-25 23:40:19 +08:00
Xiang Xiao b7a8ad8318 libc/time: Update g_lcl_tzname only after the success
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0117c5b43bee3affb36d118e0b97f6dd7137080b
2021-06-25 23:40:19 +08:00
Xiang Xiao 73285ea7f4 libc/time: Avoid modify the global variables concurrently in tzset
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7fb6439c3a669ef07c1756ccc294cd487805a510
2021-06-25 23:40:19 +08:00
Xiang Xiao 266db9067e libc/time: Change the type of ls_corr to int_fast32_t
since the leap correction is always four bytes in timezone file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2d72f5eaf37f0c86d95eaf7504a1b8b1469bf06a
2021-06-25 23:40:19 +08:00
Xiang Xiao 2241f12282 libc/time: Update TZDEFRULESTRING to ",M3.2.0,M11.1.0"
which is the current DST plan used by US

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I50001e69ec1cb9cbf6a0b84fc87f4ad8ff41c0f0
2021-06-25 23:40:19 +08:00
Xiang Xiao 212025c2ba libc/time: Update timezone by tzset in localtime_r
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I54d6aed8f6bc35c1a1d8156702ff71471c3f8066
2021-06-25 23:40:19 +08:00
Xiang Xiao c9c9d84ca4 libc/zoneinfo: Correct the path in comment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I4bc0490d12f8b469a1f250cd410290a51ef9640f
2021-06-25 23:40:19 +08:00
Xiang Xiao 87709b3a7c 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-06-25 23:40:19 +08:00
liuhaitao 7b93d0c99f sim/miot: add simulator miot defconfig symlink
Change-Id: Iedfaf2fc4d08e307f9711978e3c123e154b6f879
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-06-25 21:09:08 +08:00
yangjiukui b112e70f8b L61: Sensor: Add driver for OPT3006 light sensor.
N/A

Add light sensor.

Signed-off-by: yangjiukui <yangjiukui@xiaomi.com>
Change-Id: If0695aaec21476e68d739c420db732b184c178bb
2021-06-25 17:47:55 +08:00
Jiuzhu Dong b41923aad3 Revert "sched/wqueue: replace the notification mech from signal to semaphore"
This reverts commit a3a0f578bc.
2021-06-25 17:04:36 +08:00