Commit Graph

2867 Commits

Author SHA1 Message Date
yezhonghui d3b2b256b4 note: disable instrument for note driver to avoid infinite recursion
When CONFIG_ARCH_INSTRUMENT_ALL is enabled, the note driver functions
get instrumented, which causes infinite recursion because
sched_note_event_ip is called by __cyg_profile_func_enter/exit callbacks.

Use nuttx_add_aux_library to create a separate object library with
-fno-instrument-functions flag to prevent this recursion.

Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-21 01:36:07 +08:00
husong1 a1c66d632a noteram: Resolve the deadlock caused by the lack of protection for shared variables during noteram initialization.
Signed-off-by: husong1 <husong1@xiaomi.com>
2026-04-21 01:35:51 +08:00
zhangyu117 34d854ea11 nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr
Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
2026-04-21 01:35:40 +08:00
hongfengchen 725178c9c7 noteram: check devpath befor use it
Check devpath before use it, to make sure the
devpath is legal.

Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
2026-04-21 01:35:35 +08:00
yezhonghui 8de5938e6a nuttx: init note driver for mode and level
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-21 01:35:30 +08:00
wangmingrong1 462d29ae81 note/snap: Initialize note snap drivers directly within the array.
Since the functionality of storing notes in snap is already in place,this is simply a registration of a crash print callback.so rename notesnap_register to notesnap_notify_register

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:35:12 +08:00
wangmingrong1 816f0087b4 note: fix compile error
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:35:08 +08:00
yukangzhi a7fb3d3322 noteram: Solve the compilation error.
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-04-21 01:35:08 +08:00
wangmingrong1 a47b97595c note/fdx: Initialize note fdx drivers directly within the array.
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:35:05 +08:00
wangmingrong1 7ef95a03b8 note/fdx: defconfig CONFIG_TRACE32_FDX_NOTE rename to CONFIG_DRIVERS_NOTET32FDX
Keep the driver configuration name consistent with that under driver/note

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:35:05 +08:00
wangmingrong1 3af1465087 note/rtt: defconfig CONFIG_NOTE_RTT rename to CONFIG_DRIVERS_NOTERTT
Keep the driver configuration name consistent with that under driver/note

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:35:04 +08:00
yezhonghui 9004e4e442 nuttx: add vprintf hook function to add fmt context
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-21 01:34:59 +08:00
yezhonghui 86b51987d3 notedriver: remove BUFFER_SZIE to header file
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-21 01:34:59 +08:00
yezhonghui f65d492874 nuttx: note driver vprintf add tag param
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-21 01:34:58 +08:00
yukangzhi cdda0987c1 drivers/note/noteram_driver.c: Need check threshold when polling timeout.
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-04-21 01:34:43 +08:00
wangmingrong1 ea3636047c include/rtt: Unify all declarations in rtt.h
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:34:39 +08:00
wangmingrong1 90556971e2 include/trace32: Unify all declarations to trace32.h
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:34:36 +08:00
yukangzhi 1c66c97254 noteram_driver: add g_noteram_driver BMP support
Although g_ramnote_buffer is a global shared buffer, and spinlock already
inside buffer. the upper user may use poll like behavior, should make it
percpu noteram for BMP update, and isolate the open/poll API.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-04-21 01:34:35 +08:00
yukangzhi 450f128d11 drivers/syslog/noteram: add timeout, for polling timeout check.
For BMP case, other core may direct access the ramlog buffer, and did
not do kick, at this case, need a timeout method to polling check if
there is any poll waiter, to update the other core updated log.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-04-21 01:34:16 +08:00
xuxingliang fafc872dde note: keep natural alignmen of event
And use uintptr_t instead of pointer.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:34:15 +08:00
xuxingliang 8afc5ce3b9 note: change tag and level to 8bit
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:34:15 +08:00
xuxingliang 0fdd76ad34 noteram: set default event level filter to DEBUG
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:34:13 +08:00
xuxingliang ae20dd9ed5 drivers/note: add missing type filter for wdog
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:34:13 +08:00
xuxingliang 2de6bebd48 sched_note: add event level
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:34:12 +08:00
yukangzhi ded2b305db drivers/noteram: move spinlock to header
So it's possible to reuse the same buffer/spinlock in BMP.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-04-21 01:33:56 +08:00
wangmingrong1 1252c7b29b note: Send each note its own taskname independently
FDX needs to be sent once upon initial device connection. The initial implementation used packet loss statistics, which could lead to two scenarios: first, continuous packet loss occupies the buffer, causing further packet loss; second, no packet loss occurs, resulting in no task name record, and the script cannot parse it.
Meanwhile, the task name in FDX must be sent using blocking, not polling, otherwise it might fail to be sent. Without a callback, the design of the `notefdx_add` function would be more complex.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:33:50 +08:00
yezhonghui 80e202eb9f nuttx: fix early note add call work queue issue
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-21 01:33:45 +08:00
wangmingrong1 9acd942572 note: Add CONFIG_DRIVERS_NOTE_CPUID config
The value used to mark CPU ID in the note data. When SMP or BMP is
disabled, CPU ID is always 0. In order to distinguish between valid CPU
ID and invalid CPU ID in the note data, this option can be used to set a specific value as the CPU ID mark.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:33:37 +08:00
yezhonghui e4168ed0cf noteram: add timestamp to note common
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-21 01:33:28 +08:00
yukangzhi bdd947af99 noteram: The read interface should put aligned note to the buffer.
Avoid non-aligned access exceptions when accessing notes in the buffer.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-04-21 01:33:21 +08:00
zhangyu117 29e0ce3e97 nuttx: use unified interface in <nuttx/atomic.h>
Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
2026-04-21 01:32:47 +08:00
ligd 66bc43ae41 armv7-a/r: add syscall irq note
Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-21 01:32:42 +08:00
buxiasen b9813c9e97 sched: replace common code SMP_NCPUS to macro
Dump thread info inside smp call self.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-04-21 01:31:42 +08:00
xuxingliang 05f2122401 noteram: make sure buffer is aligned
buffer is converted to pointer to struct note_common_note *, thus needs to be aligned.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:31:24 +08:00
anpeiyun 4b74b0b9d5 drivers/note/note_driver.c: resolve kasan report from using g_running_tasks during interrupt exit
A use-after-free KASAN error occurs when accessing the free TCB in g_running_task during interrupt exit.

Signed-off-by: anpeiyun <anpeiyun@xiaomi.com>
2026-04-21 01:30:53 +08:00
xuxingliang 01a595f2b2 drivers/notesnap: assert if notetype array mismatch
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:30:41 +08:00
xuxingliang 2a6bc1d929 drivers/notesnap: fix wrong note type printed
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:30:41 +08:00
ligd d3f35affd7 note: add noswitches for SUSPEND/RESUME...
caused we can't do context swith again while caller
in special position like:
thread_suspend
thread_resume
enter_critical_section
leave_critical_section
...

Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-21 01:30:24 +08:00
ligd ddaa7962e8 note: remove cpu_pause & cpu_resume related code
Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-21 01:30:23 +08:00
wangmingrong1 f3400613a2 sched/note: Fix incorrect note output
The sched_note_taskname function is often used to print the system's existing character information at a fixed time. However, in the g_note_taskname cache, it often sets a pid equal to INVALID_PROCESS_ID at the end to manage the blank area of the buffer. This part is not needed when printing and should be skipped.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:30:06 +08:00
yukangzhi 1434ad0303 ratelimit: Support general current-limiting algorithms.
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-04-21 01:29:39 +08:00
wangzhi16 b82e82c245 sched/spinlock: Debug tools for spinlock.
The currently used spin_lock_irqsave does not support recursive calls and does not support automatic acquisition and release of spin locks, so developers need to pay attention to the correct use of spinlocks, such as not being able to schedule in spinlocks.

Two functions:
1. check if switchout when holding spinlock.
2. check if re-lock when holding non-recursion spinlock

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-04-21 01:29:37 +08:00
yinshengkai 94efbec0a8 note: note_printf supports 29 parameters when NOTE_STRIP_FORMAT is enabled
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-04-21 01:28:51 +08:00
yinshengkai 4f605cb450 note: fix sched_note_vprintf_ip filter type error
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-04-21 01:28:50 +08:00
yinshengkai 12d84514be syslog: fix compilation error when defining SYSLOG_TO_SCHED_NOTE
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-04-21 01:28:50 +08:00
yinshengkai 54b0d1b0a2 stream: extract lib_bsprintf from note_driver_vprintf_ip
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-04-21 01:28:49 +08:00
mazhuang b8cb84ab7e sched_note.h:add marco NOTE_EVENT_BUFFER_SIZE
Signed-off-by: mazhuang <mazhuang@xiaomi.com>
2026-04-21 01:28:35 +08:00
yinshengkai 4689c1ca7c note: add coresight itm backend
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-04-21 01:28:33 +08:00
yinshengkai 7f01f4be37 streams: rename lib_bsprintf to lib_osprintf
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-04-21 01:28:30 +08:00
yinshengkai b41938026e note: add sched_note_taskname
In real-time transmission channels, support
synchronization of historical task names

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-04-21 01:28:12 +08:00