Commit graph

60610 commits

Author SHA1 Message Date
fangxinyong
ef6278b0ff arch/arm: armv8-r irq type-safe bit ops
Use 1u/~1u constants for TPIDRPRW bit operations.
Avoid implicit conversion to a different underlying type (MISRA Rule 10.3).
No functional change to task pointer tagging logic.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
fangxinyong
a7b7630fd3 sched/task: task_setup return path cleanup
Refactor nxtask_setup_stackargs() to use a single ret exit path.
Avoid partially-initialized state on error paths and improve readability.
Addresses Coverity HIS_metric_violation: RETURN.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
fangxinyong
31901573ba sched/task: task_spawnparms return path cleanup
Initialize ret and propagate scheduler/param errors via a single return.
Make spawn_file_is_duplicateable() decision explicit using a dup state.
Addresses Coverity HIS_metric_violation: RETURN.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
fangxinyong
c9f460d793 task_task_cancelpt.c:coverity HIS_metric_violation: RETURN
Replace early return with a ret flag to unify the exit path.
Keep critical section behavior unchanged while simplifying control flow.
Addresses Coverity HIS_metric_violation: RETURN.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
fangxinyong
d2b87c7189 task_getpid.c:coverity HIS_metric_violation: RETURN
Use a local ret variable and return once at the end.
This keeps the IDLE_PROCESS_ID fallback behavior unchanged.
Addresses Coverity HIS_metric_violation: RETURN.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
hujun5
bb8d16f422 sched: add spinlock to sched_note_preemption and nxsched_critmon_preemption
Add spinlock protection to sched_note_preemption and nxsched_critmon_preemption.
Ensures thread-safe access to global state in preemption notification and critical
monitoring, preventing race conditions in SMP and interrupt contexts.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 20:29:55 +08:00
zhanghongyu
fa652f9c24 net: limit TCP and UDP send/recv buffer usage with throttled IOB
The main content of this submission is to limit both the TX/RX buffers
of TCP/UDP to throttled IOBs, avoiding impacts on the sending and
receiving of control-type messages.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-21 20:06:47 +08:00
hujun5
a50737a75f tools/pynuttx/nxgdb: fix semaphore field access in debugging scripts
Fix incorrect direct access to semcount field by using val intermediate
field in memory pool and network stats debugging scripts. This corrects
the data structure navigation to match actual kernel semaphore layout.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 20:05:18 +08:00
zhanghongyu
646010d0a0 net/bluetooth: fix rmutex deadlock
the lock in the "bluetooth_conn" was not initialized, which resulted in
a blocking situation when attempting to hold the lock for the first
time.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-21 19:24:02 +08:00
yukangzhi
3448e84a4c arch/arm: armv8-r PL at startup needs to be checked
When the system startup from the PL1 SYS mode, the initialization
of the PL2 HYP register needs to be skipped. Put the Hypervisor
initialization code together and skip it all at once.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-21 19:21:43 +08:00
xuxin19
98d4d887da msvc ci:change arm source to xpack
Try using Xpack to obtain the Windows toolchain to resolve CI/BB issues.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-21 19:19:39 +08:00
hujun5
f6f8acafbb arch: fix cmake error
Add default values (0x0) for ARCH_TEXT_VBASE, ARCH_DATA_VBASE, and
ARCH_HEAP_VBASE to resolve cmake configuration warnings when these
values are not explicitly set during initialization.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 14:38:36 +08:00
hujun5
37ecb28eb1 semaphore/sem_trywait.c: Remove redundancy leave_critical_section
Remove redundant leave_critical_section() call in nxsem_trywait_slow() as the
critical section is properly released at the exit point via 'out' label, making
the intermediate call unnecessary and eliminating code duplication.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 14:27:14 +08:00
hujun5
0b96303fda libc/environ: add interrupt context check to getenv
Prevent getenv() from being called in interrupt context by adding
up_interrupt_context() check. This ensures thread-safe access to
environment variables in multi-threaded scenarios.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:37:55 +08:00
hujun5
5fb2ff3fe9 sched/tls: fix thread ID initialization in tls_dup_info
Set the thread ID (tl_tid) to the destination task's pid during TLS
duplication in fork operations. This ensures the duplicated TLS info
correctly reflects the forked task's thread identifier.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:34:27 +08:00
wangchengdong
291938150f sched/hrtimer: add option for list-based hrtimer management
Add support for managing hrtimers using a simple list. This approach
  is more memory-efficient, as list nodes use less memory, and it is
  preferable to an RB-tree when the number of hrtimers is relatively small.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-21 10:33:12 +08:00
anpeiyun
3c1712c66d kasan/hook.c: prevent recursive report overflow
Stop the report handler from re-entering KASAN by halting checks when printing.
Reuse the dump_only flag so read/write panic toggles only emit stack traces.
Retain stack dumps for panic-disabled paths without risking another overflow.

Signed-off-by: anpeiyun <anpeiyun@xiaomi.com>
2026-01-21 10:27:02 +08:00
hujun5
c9e5b52f33 sched/pthread: remove duplicate robust mutex checking logic
Remove redundant robust mutex owner validation code from pthread_mutex_timedlock
that duplicates similar logic already present in pthread_mutex_take. This reduces
code duplication and improves maintainability.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:12:22 +08:00
hujun5
bc3d478749 sched/pthread: use spin_lock_irqsave_nopreempt for mutex head lock
Replace spin_lock_irqsave with spin_lock_irqsave_nopreempt in
pthread_mutex_inconsistent to prevent preemption during mutex list
manipulation and avoid potential deadlocks or race conditions.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:05:17 +08:00
yintao
f7dc54e869 drivers/rpmsg: use nuttx/atomic.h instead meatl/atomic.h
All the atomic operation already changed to nuttx's, so change
the include header too

Signed-off-by: yintao <yintao@xiaomi.com>
2026-01-21 10:01:40 +08:00
raiden00pl
491e86762b boards/nrf53: correct rptun names
after recent changes in rptun framework, HCI over rptun was broken due to
wrong cpu names.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-01-20 17:54:49 +01:00
Laczen JMS
88f62fd322 boards/xtensa/esp32: add rtc_reserved_seg to legacy_sections
Enable building the legacy idf format of nuttx when rtc is enabled.
Without this addition the build fails because the rtc data is placed in
rom.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2026-01-21 00:39:12 +08:00
makejian
5b52a32f5a crypto/crypto.c: Determine the order of obtained crypto drivers
After adding the cross-core crypto driver, there are now three encryption modes:
1. Hardware driver in local core
2. Crypto driver in remote core
3. Software encryption in local core

This prioritizes local hardware driver first, then remote driver (typically hardware),
and finally local software encryption as a fallback.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 00:25:07 +08:00
makejian
e23dd613c9 crypto/cryptodev: optimize without dynamic memory in crypto process
Replace dynamic memory allocation with stack-based variables in cryptodev_op().
This eliminates kmm_malloc/kmm_free overhead and simplifies error handling
by removing the need for goto bail cleanup paths.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 00:25:07 +08:00
makejian
66f9329839 crypto/cryptodev: export ivlen to support different cipher algs
Add ivlen field to crypt_op and crp_ivlen to cryptop structure to support
cipher algorithms with different IV lengths.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 00:25:07 +08:00
makejian
143547128b crypto/cryptodev: add encrypt op and olen for support virtio mode
Add olen field to crypt_op structure and crp_olen to cryptop structure
to support output length tracking in virtio crypto mode.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 00:25:07 +08:00
hujun5
66f9ced0cb arch: default enable TLS_ALIGNED when BUILD_PROTECTED=y
Change TLS_ALIGNED default configuration to enable when either BUILD_KERNEL
or BUILD_PROTECTED is selected. Protected mode requires stack alignment to
properly handle TLS data structure at stack base.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 00:20:13 +08:00
hujun5
e604bacd42 sim: it is not necessary to call restore_critical_section in irq
Remove restore_critical_section() call from up_switch_context() in simulator
as it is not necessary during interrupt context switching. The critical
section state is properly managed elsewhere in the interrupt handling flow.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 12:22:18 -03:00
hujun5
7ee3890e7a x64_64: it is not necessary to call restore_critical_section in irq
Remove restore_critical_section() call from common_handler() in x86_64 interrupt
processing as it is not necessary during interrupt handling. The critical section
state is properly managed by the interrupt framework elsewhere.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 11:49:39 -03:00
liwenxiang1
2645e06c86 arch/x86_64: Add gprof
add gprof tool

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 22:43:38 +08:00
liwenxiang1
b1373857b7 arch/x86_64: Resolve the issue of abnormal stack check display.
Resolve the issue of abnormal stack check display

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 22:43:38 +08:00
liwenxiang1
0046070395 arch/x86_64:Add runtime stack size analysis
Add runtime stack size analysis tool

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 22:43:38 +08:00
liwenxiang1
79b82da476 arch/x86_64: Add stack usage
add stack usage tool

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 22:43:38 +08:00
daichuan
a82ee60da8 usrsock: Check RECVFROM_AVAIL before setting POLLIN in pollsetup
In usrsock_pollsetup, only set POLLIN if USRSOCK_EVENT_RECVFROM_AVAIL is set when remote is closed, avoiding invalid POLLIN events.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 22:37:10 +08:00
daichuan
7a4a6ce4ce usrsock: Avoid frequent POLLIN when remote close during accept.
Clear USRSOCK_EVENT_RECVFROM_AVAIL flag when remote closes connection during accept to prevent repeated POLLIN events and EPIPE loop.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 22:37:10 +08:00
hujun5
8bb6758490 sched: move process ID from kernel to TLS for faster access
Add pid field to task_info_s and move getpid() implementation to user
space TLS access. Remove getpid from syscall interface as it now returns
cached PID from thread local storage instead of kernel lookup.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 22:33:45 +08:00
hujun5
0f7c992cea sched/task: fix gettid by moving tls_dup_info after child pid initialization
Move tls_dup_info() call to after child process priority is set, ensuring
the child's pid is properly initialized before duplicating TLS information.
This fixes incorrect thread ID assignment during task fork operations.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 22:33:45 +08:00
v-zhangxiaomeng5
c95b6b1bb6 libxx: fix __config_site for libcxx compile errors
The errors are 'No thread API' and '__ULong undefined'

Signed-off-by: v-zhangxiaomeng5 <v-zhangxiaomeng5@xiaomi.com>
2026-01-20 17:45:48 +08:00
liwenxiang1
bd2cce7f1a arch/x64: fix revoke_low_memory
the virtual address of the page table (PT) is saved into the page directory (PD) entry, but the PD entry should store the physical address instead

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 17:15:50 +08:00
makejian
8309aadd69 Documentation: Add Whetstone FPU benchmark documentation
Add documentation for the Whetstone floating-point benchmark
application which is being added to nuttx-apps.

The documentation includes:
- Overview of the benchmark
- Configuration options
- Usage examples
- Output interpretation
- Test modules description

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-20 17:15:31 +08:00
hujun5
2c1e3d6ed0 sched/addrenv: replace critical section with spinlock for refs protection
Replace global enter_critical_section() calls with lightweight spinlock in
addrenv_switch() to reduce interrupt latency, and convert refs counter to
atomic_t for thread-safe reference counting without blocking operations.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 11:29:22 +08:00
daichuan
d19ee93c60 net: Support no-lto option for the network build.
Add CONFIG_NET_NO_LTO to allow compiling the network stack with -fno-lto.
This is useful for avoiding LTO-related issues in the network layer.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 10:12:45 +08:00
daichuan
32ffc69bdd net/icmp: Fix devif_loopback dead loop when unrecognized ICMP packet received
When an unrecognized ICMP (type=3, code=2) packet is received, the ICMP flow does not set dev->d_len to 0, causing a devif_loopback dead loop.

Therefore, in ICMP input processing, when an ICMP_DEST_UNREACHABLE message is received, if it is not ICMP_FRAG_NEEDED code, jump to typeerr for error handling.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 06:56:27 +08:00
wangchengdong
303bc7411f sched/sched: add hrtimer support to drive the scheduler
Add hrtimer support to drive the scheduler.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-20 06:55:15 +08:00
wangchengdong
9d8f0ace40 sched/sched: consolidate nxsched_process_timer into sched_timer.c
Consolidate nxsched_process_timer into sched_timer.c, and introduce
nxsched_process_tick() to improve readability and maintainability of
the scheduler timer processing logic.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-20 06:55:15 +08:00
liwenxiang1
46c319d948 arch/x64: Solve the sig_nest hang issue
When an interrupt occurs, the hardware automatically pushes the current RIP/RSP onto the interrupt stack. During the interrupt return, the iretq instruction pops them back. The problem is that the RIP/RSP modified by the signal is stored in the XCP context, whereas iretq operates on the interrupt stack. As a result, the RIP/RSP modified by the signal does not take effect in the iretq instruction, causing the task receiving the signal to fail to jump correctly to the signal handler. This behavior appears as if the signal is lost

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 06:53:04 +08:00
liwenxiang1
41da7121bd arch/x64: interrupt add CFI info
interrupt add CFI info

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 06:52:00 +08:00
zhangshuai39
49ffd94d84 net/pkt: Fix coverity issue
The value ret is overwritten after being assigned a value.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2026-01-19 15:33:03 -05:00
makejian
60b1cef84b Kconfig: Add ALLOW_CUSTOM_PERMISSIVE_COMPONENTS option
Add a new license configuration option for components that have
custom permissive licenses which are not covered by the standard
license options (BSD, MIT, GPL, etc.).

This option allows projects to explicitly opt-in to using components
with custom permissive licenses that allow free use, modification,
and distribution but may have specific attribution or notice
requirements.

Also update the License Setup documentation section to include
this new option.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-20 02:15:19 +08:00
hujun5
63e59e26c0 arch: move some macros to public code.
Move stack alignment and kernel stack macros from architecture-specific internal
headers to public include/nuttx/irq.h. Consolidates duplicate definitions across
17 architecture families, reducing code duplication while enabling common code
to access these core alignment utilities without architecture dependencies.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 01:53:08 +08:00