This commit reduced 1 write operation for wdog deleting and decoupled
the WDOG_ISACTIVE with the list implementation.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
The value returned by sizeof(struct note_start_s) is larger
than the actual memory footprint of struct note_start_s.
This causes the length calculated in sched_note_start to be larger
than the actual memory size,which further leads to out-of-bounds reads in note_common.
Signed-off-by: guohao15 <guohao15@xiaomi.com>
Since the adafruit-kb2040:smp do not support the `atomic_init`, we have
to remove the function.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
The optimization reduces one judgment in read operations, improving write performance by 3% and read performance by 10%.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit implemented seqlock for non-SMP platforms, which achieves
1.62x performance improvement.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit improved the seqlock performance on non-SMP and SMP
platforms by 31.7% on average (83Mops -> 106Mops, tested on qemu-intel64/KVM).
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit provided a better implementation of the seqlock, which
ensure the functional correctness and provide better performance.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit removed unnecessary memory barriers of the seqlock
implementation, since they may block the CPU pipeline and lead to
performance degradation.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
03:17:57 /home/work/ssd1/workspace/Vela-Multi-Boards-dev-system-Build@2/nuttx/include/nuttx/seqlock.h: In function 'read_seqbegin':
03:17:57 /home/work/ssd1/workspace/Vela-Multi-Boards-dev-system-Build@2/nuttx/include/nuttx/seqlock.h:107:3: error: 'asm' undeclared (first use in this function)
03:17:57 SMP_RMB();
03:17:57 ^
03:17:57 /home/work/ssd1/workspace/Vela-Multi-Boards-dev-system-Build@2/nuttx/include/nuttx/seqlock.h:107:3: note: each undeclared identifier is reported only once for each function it appears in
03:17:57 /home/work/ssd1/workspace/Vela-Multi-Boards-dev-system-Build@2/nuttx/include/nuttx/seqlock.h:107:3: error: expected ';' before 'volatile'
03:17:57 SMP_RMB();
03:17:57 ^
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
when C++ lib has an atomic implementation, we shouldn't include NuttX defined macros to avoid conflicts
Fix errors like:
build/include/libcxx/__atomic/atomic.h:445:1: error: expected identifier before numeric constant
445 | atomic_fetch_add(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
| ^~~~~~~~~~~~~~~~
Signed-off-by: raiden00pl <raiden00@railab.me>
This reverts commit 29e50ffa73.
reason:
Placing the main thread and the gourd in the same memory block, and allocating and freeing memory simultaneously, presents the following two problems:
When the main thread creates a child thread and performs a detach operation, there is a possibility that the main thread may have exited, but the main thread's TCB (Transaction Control Block) may not have been released.
This could potentially cause the main thread's TCB to be double-freed. The core contradiction in this problem lies in binding the main thread's TCB (Trust Container Registry) and the group together. When releasing the main thread's TCB, an additional check is needed to ensure the main thread was the last to leave the group. If this check and the free operation are atomically guaranteed, the logic is sound, and double freeing won't occur. However, this atomicity cannot be completely guaranteed. If other free operations cause a block, problems still arise.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
This allows the compiler to automatically identify which string functions
can be compiled into libraries, and the compiler's internal implementation
is faster than libc functions.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Add MTD driver for Winbond W25N series SPI NAND flash.
Currently supports W25N01GV (1Gbit/128MB).
Features:
- Standard SPI interface with configurable frequency (up to 104 MHz)
- Hardware ECC enabled by default
- Block erase with sleep-based wait (releases SPI bus)
- Page read/write with busy-wait for fast operations
Limitations:
- No bad block management (BBM). Factory bad blocks and runtime bad
blocks are not tracked.
- No bad block table (BBT) scanning at initialization.
- No Quad SPI support (standard SPI only).
- No access to spare area (64 bytes/page) or OTP region.
Tested using:
- Board with STM32H743
- W25N01GV on SPI at 96 MHz with DMA enabled
- Flash mounted using littlefs
- Tested using sdbench:
- Sequential write speed of 1760 KB/s
- Sequential read speed of 4900 KB/s
Signed-off-by: Julian Oes <julian@oes.ch>
Add handling for GPIOC_SETDEBOUNCE to set GPIO pin debounce duration.
Add handling for GPIOC_SETMASK to enable/disable GPIO interrupt mask.
Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
Add a safe synchronous hrtimer cancel API, hrtimer_cancel_sync().
If the timer callback is currently executing, this function waits
until the callback has completed and the timer state transitions
to HRTIMER_STATE_INACTIVE.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
Enable up_alarm_start and up_timer_start by default so they can be used
by both the tickless scheduler and the high-resolution timer subsystem.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
NuttX provides the wdog module to implement timers for the scheduler.
While it is lightweight and efficient, wdog only supports tick-level timers,
typically in milliseconds. Although the tick duration can be configured,
setting it to microsecond or nanosecond resolution is not practical.
Doing so may cause an interrupt storm, where the CPU is constantly
occupied handling tick interrupts.
To address this limitation, a new hrtimer module is introduced.
It coexists with the wdog module, providing both tick-level timers
for wdog and high-resolution timers (nanosecond-level) directly to users.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
TCP_CORK and TCP_NODELAY behave almost exactly the opposite,
so first provide simple support for TCP_CORK.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
In order to reduce code duplication, use the eeprom/spi_xx25xx
driver within mtd/at25ee.
The eeprom/xxx.h includes have been merged into eeprom/eeprom.h, to
provide a common include file like mtd/mtd.h.
Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
In rare case, the round-nearest behavior in the clkcnt_best_multshift
may result in converted tv_nsec > NSEC_PER_SEC. This commit fixed the
issue.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Upperhalf supports multiple working modes at the same time,
which is specified by NIC when register
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>