Commit Graph

41920 Commits

Author SHA1 Message Date
ligd aa43a0215d 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-02 04:55:46 -05:00
Jiuzhu Dong 554310bd78 fs/fs_dup2: correct check before dup
Change-Id: I2387ab447f0d8ed9429960922a72de35b2730acb
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-02 04:54:43 -05:00
Jiuzhu Dong f57ba35151 fs/procfs: add StackAlloc field for task stack info
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-02 04:51:55 -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
YAMAMOTO Takashi 669619a06a tcp_close: Fix a race with passive close
tcp_close disposes the connection immediately if it's called in
TCP_LAST_ACK. If it happens, we will end up with responding the
last ACK with a RST.

This commit fixes it by making tcp_close wait for the completion
of the passive close.
2021-07-02 13:54:15 +09:00
ligd 50eee2f081 arm: fix enable interrupt too earlier caused system crash
reason:
	msr	cpsr, r2   /* Set the CPSR */

    // interrupt hanppend, context switch

	pop	{r0-r2, pc}

resolve:
    use SPSR instead, and recover with ldmia ^

Change-Id: Id7cee6452997ec19919eeecf6e7616164b3a0ab3
Signed-off-by: ligd <liguiding1@xiaomi.com>
(cherry picked from commit 6fa6c1676932d7babb7ff22ef556a17bb18f1c0d)
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 22:20:36 -05:00
ligd 5de150160f syslog: add CPU id to system when open CONFIG_SMP
Change-Id: Ie8aaf44583ff4146b79b1392d1410b31806a81e8
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 08:45:43 +09: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
ligd 179f5999d9 libs/libc/spawn: fix posix_spawn_file_actions_adddup2 alloc size error
Change-Id: I9f6f2c87b0d54c1c1a71056073a1d358b87dd1fd
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 12:14:50 -07:00
Xiang Xiao 187538c0b9 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 11:44:38 -07:00
Xiang Xiao 1d0ade6fa2 libc: Remove the duplication lib_xxx macro
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I73c876ed40811c013dad83b8b2aeb7bdc3041913
2021-07-01 11:28:34 -07:00
Nathan Hartman ee81b5a1d5 drivers/sensors/hyt271: Fix typos in comments and identifier
drivers/sensors/hyt271.c:

    * struct hyt271_dev_s: Identifier "lock_measure_cylce" was
      misspelled. Fix to "lock_measure_cycle" and update all instances
      in the file.

    * hyt271_mr(), hyt271_cmd(), hyt271_change_addr(),
      hyt271_measure_read(), hyt271_thread(): Update instances of the
      renamed "lock_measure_cycle" variable and fix various typos in
      comments.
2021-07-01 12:43:18 -05:00
Fotis Panagiotopoulos de213401a7 lpc17_40_progmem: fixed compilation issues. 2021-07-01 09:11:12 -05:00
Masanari Iida 839414987c efm32: Fix missing closing bracket
This patch fixes missing closing bracket and semicolon.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
2021-07-01 06:37:17 -07:00
Virus.V 94f45d5c06 netlink: fix compile error when enable netlink
Signed-off-by: Virus.V <virusv@live.com>
2021-07-01 06:55:57 -05:00
Xiang Xiao 1b5341f6c0 boards/bl602: Fix uart_nx.c:419: undefined reference to `uart_bth4_register'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-01 05:01:21 -05:00
Sara Souza b45ccad6a0 xtensa/esp32: Adds support for SERIAL_TXDMA. 2021-07-01 01:50:13 -05:00
David Sidrane e659ae83b0 Kinetis:Serial No DMA Poll needed 2021-07-01 01:44:46 -05:00
David Sidrane 78584b4569 kinetis:Serial use eDMA
kinetis:serial mark priv->rxdma after use
2021-07-01 01:44:46 -05:00
David Sidrane e5a1b2e797 kinetis:SPI use eDMA
Kinetis:SPI only allocate DMA once
2021-07-01 01:44:46 -05:00
David Sidrane 78bf264af0 kinetis:Replace DMA
Kinetis:DMAMUX use hex in mask
2021-07-01 01:44:46 -05:00
David Sidrane 3439c40044 stm32h7:SDMMC fix reset of do_gpio
For the case when the watchdog is triggering a timeout we did not
correctly reset the d0 GPIO.

Without this fix, the SD card can become inaccessible.
2021-07-01 01:37:58 -05:00
Julian Oes 6d6ca8f0b6 stm32:sdio: fix wrong ifdefs
This was wrong but presumably did not matter.
2021-07-01 01:37:58 -05:00
Julian Oes 2a86335055 stm32:sdio: fix reset of GPIO_SDIO_D0
For the case when the watchdog is triggering a timeout we did not
correctly reset the GPIO_SDIO_D0.

Without this fix, the SD card can become inaccessible.
2021-07-01 01:37:58 -05:00
Julian Oes 665f847760 stm32f7: fix reset of d0_gpio
For the case when the watchdog is triggering a timeout we did not
correctly reset the d0 GPIO.

Without this fix, the SD card can become inaccessible.
2021-07-01 01:37:58 -05:00
Julian Oes 154795a247 stm32f7: Removed bit that is reserved for f7 2021-07-01 01:37:58 -05:00
Julian Oes 87fd8903a0 stm32f7: whitespace fix 2021-07-01 01:37:58 -05:00
Julian Oes 804445fc15 stm32f7: unify identical sdmmc.h header files
It turns out there is no difference in these two files as well as the
reference manual for the registers between the two parts, so it probably
makes sense to unify them
2021-07-01 01:37:58 -05:00
buyuer 82f57bd3f9 driver/fakesensor: fix bugs.
1.fix crash casued by closing the handle during the reading.
2.fix set_interval fail sometime: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: buyuer <dingddding@163.com>
2021-07-01 01:34:45 -05:00
chenwen 31a6da2343 risc-v/esp32c3: Notifies networking layer whether the carrier is available 2021-06-30 23:09:34 -05:00
McKay Ransom 863834057b Renesas/RX: add RX setjmp, ARCH_RENESAS_RX, and RX65N ioctl 2021-06-30 23:01:57 -05:00
Sara Souza 87fabb2bc7 xtensa/esp32: Support to select different clock source for RTC controller and close TODOs. 2021-06-30 21:27:27 -05: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
Xiang Xiao 06215be327 mmap: Implement the minial but reasonable mlock/munlock/mprotect
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I538e0d78ecd0680374a2e0f56adbc61d7a4e6d1f
2021-07-01 08:06:54 +09:00
Xiang Xiao ec30d6ef6b 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 08:06:54 +09:00
Xiang Xiao 4ba1bafe55 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 05:08:57 -07:00
Peter Bee 181ad49ffd Support for Waveshare Pico-LCD-1.x modules
Add support for Chinese brand LCDs. The 1.14" and 1.3" modules are
tested.

Module details:
https://www.waveshare.com/wiki/Pico-LCD-1.14
https://www.waveshare.com/wiki/Pico-LCD-1.3

Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-06-30 09:03:46 -03:00
YAMAMOTO Takashi c7ba75697c tcp_recvwindow.c: Use iob_tailroom to replace the home grown one 2021-06-30 06:40:13 -05:00
YAMAMOTO Takashi 314237588e Add iob_tailroom
I plan to use this for tcp.
2021-06-30 06:40:13 -05:00
YAMAMOTO Takashi 7599ca4e95 Kconfig: mention that IOB_NCHAINS is not used by TCP anymore 2021-06-30 06:40:13 -05:00
YAMAMOTO Takashi 52c237cb5f net/tcp/tcp.h: Update a comment about readahead 2021-06-30 06:40:13 -05:00
YAMAMOTO Takashi 08e9dff0e9 tcp_close: disable send callback before sending FIN
This fixes connection closing issues with CONFIG_NET_TCP_WRITE_BUFFERS.

Because TCP_CLOSE is used for both of input and output for tcp_callback,
the close callback and the send callback confuses each other as
the following. As it effectively disposes the connection immediately,
we end up with responding to the consequent ACK and FIN/ACK from the peer
with RSTs.

tcp_timer
    -> tcp_close_eventhandler
        returns TCP_CLOSE (meaning an active close)
    -> psock_send_eventhandler
        called with TCP_CLOSE from tcp_close_eventhandler, misinterpet as
        a passive close.
        -> tcp_lost_connection
            -> tcp_shutdown_monitor
                -> tcp_callback
                    -> tcp_close_eventhandler
                        misinterpret TCP_CLOSE from itself as
                        a passive close
2021-06-30 06:39:13 -05:00
YAMAMOTO Takashi 326a8ef0a2 tcp_close_disconnect: don't nullify sndcb
It isn't necessary and I plan to use the value later in
the close processing.
2021-06-30 06:39:13 -05:00
YAMAMOTO Takashi 8472430f22 tcp_close: replace scaring comments 2021-06-30 06:39:13 -05:00
Virus.V 84100128b2 risc-v/bl602: update wifi firmware version
Signed-off-by: Virus.V <virusv@live.com>
2021-06-30 01:08:10 -05:00
YAMAMOTO Takashi 1ce13ee731 tcp_reset: Don't copy the peer window
The current code just leave the window value from the segment
from the peer. It doesn't make sense.

Instead, always use 0.
This matches what NetBSD and Linux do.
(As far as I read their code correctly.)
2021-06-29 22:23:48 -05:00
YAMAMOTO Takashi 98e7c6924d tcp: always responds to keep-alive segments
* It doesn't make sense to have this conditional on our own
  SO_KEEPALIVE support. (CONFIG_NET_TCP_KEEPALIVE)
  Actually we don't have a control on the peer tcp stack,
  who decides to send us keep-alive probes.

* We should respond them for non ESTABLISHED states. eg. FIN_WAIT_2
  See also:
  https://github.com/apache/incubator-nuttx/pull/3919#issuecomment-868248576
2021-06-30 11:52:08 +09:00
YAMAMOTO Takashi 4878b7729c tcp: simplify readahead
Do not bother to preserve segment boundaries in the tcp
readahead queues.

* Avoid wasting the tail IOB space for each segments.
  Instead, pack the newly received data into the tail space
  of the last IOB. Also, advertise the tail space as
  a part of the window.

* Use IOB chain directly. Eliminate IOB queue overhead.

* Allow to accept only a part of a segment.

* This change improves the memory efficiency.
  And probably more importantly, allows less-confusing
  recv window advertisement behavior.
  Previously, even when we advertise N bytes window,
  we often couldn't actually accept N bytes. Depending on
  the segment sizes and IOB configurations, it was causing
  segment drops.
  Also, the previous code was moving the right edge of the
  window back and forth too often, even when nothing in
  the system was competing on the IOBs. Shrinking the
  window that way is a kinda well known recipe to confuse
  the peer stack.
2021-06-30 06:22:14 +09:00
YAMAMOTO Takashi b2d3bf920d Change the type of io_pktlen from uint16_t to unsigned int
I plan to use a simple IOB chain w/o IOB queue for tcp recv buffers.
for large configurations, uint16_t is not large enough to represent
the entire socket buffer.
2021-06-30 06:22:14 +09:00
YAMAMOTO Takashi 0886257eb4 tcp_input: Accept segments spanning over rcvseq 2021-06-30 06:22:14 +09:00