Commit Graph

120 Commits

Author SHA1 Message Date
yinshengkai c83858bbb6 note: fix note_common unaligned access
Data in ARMV8-M may be aligned with less than 4 bytes, resulting in USAGE FAULT

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 11:55:17 +08:00
yinshengkai 464d284587 drivers/note: simplify notesnap_dump logic
RTOSXMDPYX-969

Crash at startup, index is 0 will cause loop printing

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 11:55:17 +08:00
yinshengkai a70175ea06 note: make sched_note_start depend on INSTRUMENTATION_SWITCH
In some cases, we only need to use INSTRUMENTATION_DUMP to record custom data,
and we don't want the thread start and end information

Move this part to INSTRUMENTATION_SWTICH for recording

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 11:55:17 +08:00
yinshengkai 453cde945f note: add note stream drivers
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 11:55:17 +08:00
yinshengkai 43d96a5d9e note: Increase crash dump buffer
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 11:55:17 +08:00
yinshengkai ec691cc5e4 tools: prasetrace.py supports parsing syslog
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 01:30:11 +08:00
yinshengkai 3271142b87 note: print without relying on format strings
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-09 22:23:29 +08:00
yinshengkai b5cf4310cb gote: implement asynchronous printf formatting
Do not format immediately when calling sched_note_printf, but delay formatting until dump trace.
After turning on SYSTEM_NOTE, similar asynchronous syslog functions can be achieved.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-09 22:23:29 +08:00
xuxingliang bc5a337a58 sched/note: add note for wdog module
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-09 08:39:58 +08:00
wangmingrong1 1fdb3f5107 notesnap_driver.c: modify struct notesnap_s member type
clang atomic no support other type:
modify .index type size_t --- atomic_int
modify .dumping type bool --- atomic_bool

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-08 23:48:32 +08:00
Bowen Wang 064eb5fd35 rpmsg services: should release the tx buffer when rpmsg_send_nocopy failed
Otherwise, the tx buffer will be discarded and can no longer be obtained

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-08 18:26:39 +08:00
zhangwenjian 869271f5b8 drivers/note: suport rpmsg transfer channel for note,some note api
need to adapte for rpmsg.

We can transfer note content through rpmsg

Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-08 08:58:43 +08:00
xuxingliang 18d5ae20f5 drivers/segger: add heap data plot
Add heap current used to note.
Plot it in segger sysview data plot.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang ee11d6ca0a drivers/noteram: fix compile error
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang eac6a8597f sched/note: add note when mm add new region
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang 0663ac1483 sched/note: specify note event for heap instrumentation
1. Add NOTE_HEAP_ prefix for heap note event.
2. Use note type as heap instrumentation parameter.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
yinshengkai 79eab8783f note: add memory tracing event support
Record all memory allocation and release, save to ram, used to analyze memory allocation rate and memory usage
Its absolute value is not trustworthy because the memory will be allocated in thread A and released in thread B

 netinit-5   [0]   0.105984392: tracing_mark_write: C|5|Heap Usage|96|free: heap: 0x606000000020 size:24, address: 0x603000000370
 netinit-5   [0]   0.105996874: tracing_mark_write: C|5|Heap Usage|24|free: heap: 0x606000000020 size:72, address: 0x6070000008e0
nsh_main-4   [0]   3.825169408: tracing_mark_write: C|4|Heap Usage|2177665|free: heap: 0x606000000020 size:424, address: 0x614000000840
nsh_main-4   [0]   3.825228525: tracing_mark_write: C|4|Heap Usage|14977|free: heap: 0x606000000020 size:2162688, address: 0x7f80a639f800
nsh_main-4   [0]   3.825298789: tracing_mark_write: C|4|Heap Usage|15189|malloc: heap: 0x606000000020 size:20, address: 0x6030000003a0

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang 7044b10c88 task: use get_task_name where possible
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-01 20:38:06 +08:00
dulibo1 c055fc2f85 noteram:read noteram may cause crash
noteram_get may cause _read = ni_bufsize cause assert crash

[ 1493.627200] [79] [ EMERG] [ap] _assert: Assertion failed : at file: note/noteram_driver.c:370 task: trace process: trace 0x446f238a
[ 1493.627400] [79] [ EMERG] [ap] backtrace:
[ 1493.627500] [79] [ EMERG] [ap] [79] [<0xf7933c9d>] _fini+0xae0720b9/0xb673e41b
[ 1493.628400] [79] [ EMERG] [ap] [79] [<0x498b1b0c>] host_backtrace+0x42/0x72
[ 1493.629300] [79] [ EMERG] [ap] [79] [<0x48bef3d1>] up_backtrace+0x127/0x2d2
[ 1493.630200] [79] [ EMERG] [ap] [79] [<0x48b86bed>] sched_backtrace+0x71/0x8a
[ 1493.631100] [79] [ EMERG] [ap] [79] [<0x44676273>] sched_dumpstack+0xed/0x486
[ 1493.631600] [79] [ EMERG] [ap] [79] [<0x445c61ff>] _assert+0x9f0/0xb38
[ 1493.632200] [79] [ EMERG] [ap] [79] [<0x4420dd07>] __assert+0x3f/0x4c
[ 1493.632800] [79] [ EMERG] [ap] [79] [<0x44151648>] noteram_get+0x1b0/0x5fe
[ 1493.633600] [79] [ EMERG] [ap] [79] [<0x44152370>] noteram_read+0x331/0x4f7
[ 1493.634200] [79] [ EMERG] [ap] [79] [<0x444c66f9>] file_read+0x38b/0x3c0
[ 1493.634700] [79] [ EMERG] [ap] [79] [<0x444c6840>] nx_read+0x112/0x170
[ 1493.635300] [79] [ EMERG] [ap] [79] [<0x444c68e5>] NXread+0x47/0xfa
[ 1493.635800] [79] [ EMERG] [ap] [79] [<0x446f2c70>] trace_dump+0x148/0x2f4
[ 1493.636400] [79] [ EMERG] [ap] [79] [<0x446f110b>] trace_cmd_dump+0x41b/0x4b9
[ 1493.636900] [79] [ EMERG] [ap] [79] [<0x446f2723>] trace_main+0x399/0x6e2
[ 1493.637500] [79] [ EMERG] [ap] [79] [<0x44217fc9>] nxtask_startup+0x69/0x7c
[ 1493.638000] [79] [ EMERG] [ap] [79] [<0x440f9b78>] nxtask_start+0x8a5/0x8b8

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:08:39 +08:00
yinshengkai d888df9673 note: add ringbuffer aligned access handle
Fix ubsan warning that writes need to be aligned to memory boundaries when writing data

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-28 11:08:39 +08:00
dulibo1 98482d429b noteram:overflow may discard all the trace message
noteram_add may cause head = tail when remain == NOTE_ALIGN(notelen)
log:
nsh_main-14  [0]   2.132127493: tracing_mark_write: B|14|trace dump -c

nsh_main-14  [0]   2.143322780: tracing_mark_write: E|14|trace dump -c

nsh_main-14  [0]   2.513023895: tracing_mark_write: B|14|trace dump -c

nsh_main-14  [0]   2.524060048: tracing_mark_write: E|14|trace dump -c

nsh_main-14  [0]   2.897055341: tracing_mark_write: B|14|trace dump -c

ap> trace dump -c
nsh_main-14  [0]   3.270037241: tracing_mark_write: B|14|trace dump -c

ap> trace dump -c

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:08:39 +08:00
Petro Karashchenko d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
chenrun1 667e92390b nuttx/atomic.h:replace ALL stdatomic.h with nuttx/stdatomic.h in nuttx/
Summary:
  1. Add nuttx/atomic.h in include
  2. Use nuttx/atomic.h instead of stdatomic.h in the nuttx directory

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:44:29 +08:00
cuiziwei 6071102c90 nuttx/note:fix missing the last character when printing custom labels.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-08-19 14:04:50 +08:00
hujun5 a4fece3450 spin_lock: inline spin_lock
test:
We can use qemu for testing.
compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
2024-07-15 02:29:30 +08:00
xuxingliang bbc31d70f4 drivers: add API for drivers early initialization
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-07-09 16:05:59 +08:00
YAMAMOTO Takashi 81996900db fix build with CONFIG_SCHED_INSTRUMENTATION_FUNCTION 2024-01-22 19:30:40 +08:00
anjiahao 7dfbd14eba libc: add instrument api support
Add registration function instrumentation API,
which can achieve instrumentation of entering and
exiting functions through the compiler's functionality.

We can use CONFIG_ARCH_INSTRUMENT_ALL to add instrumentation for all
source, or add '-finstrument-functions' to CFLAGS for Part of the
source.

Notice:
1. use CONFIG_ARCH_INSTRUMENT_ALL must mark _start or entry noinstrument_function,
   becuase bss not set.
2. Make sure your callbacks are not instrumented recursively.

use instrument_register to register entry function and exit function.
They will be called by the instrumented function

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-11 02:06:51 -08:00
yinshengkai c3009d46e9 note: delete sched_note_flatten
When we record data and dump data, they are all executed within the system,
and there is no need to consider the issue of big or small endianness.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-11-12 23:52:10 -08:00
yinshengkai 605c4e6c1f note: fix notesnap compilation failure
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-10-23 12:50:19 +03:00
yinshengkai 58c6b60df5 note: remove remaining event code
Some event-related codes were missed in the previous modification and have not been deleted.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-10-17 09:07:06 +08:00
Xiang Xiao f196d108bf drivers/note: Change 0/1 to false/true
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-13 14:38:51 -04:00
yinshengkai 9c59ee7c58 note: optimize note performance and reduce lib_sprintf calls
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-10-12 00:15:14 +08:00
yinshengkai ddb87d3b86 clock: replace all up_perf_xx with perf_xx
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-02 16:11:43 +02:00
Daniel Appiagyei 5bfda12634 c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
chao an 664927c86e mm/alloc: remove all unnecessary cast for alloc
Fix the minor style issue and remove unnecessary cast

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-30 14:34:20 +08:00
chao an b60f01a55b inode/i_private: remove all unnecessary cast for i_private
Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 08:58:07 +02:00
yinshengkai 02d0762c6e driver/note: fix trace dump: dump failed
Exceeding the length limit may cause an error when using sched_note_printf

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-29 00:09:10 +08:00
yinshengkai 1e164b7f75 note: add noteram crash dump
Dump all content when a crash occurs

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-19 21:48:56 +08:00
dongjiuzhu1 29ddfd44a0 driver/note: dump irq handler address to trace
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-08-19 01:42:17 +08:00
yinshengkai b106f032cb drivers/note: add maximum channel number check
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-14 13:41:00 +08:00
yinshengkai 67cb1d1650 note: simplify noteram logic
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-11 13:27:17 +08:00
yinshengkai e69dd5f705 noteram: remove task_context
syscall cannot be called in syscall, if this happens, it should be fixed (interruption is similar)

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-11 13:27:17 +08:00
yinshengkai 4aa13542d1 note: remove the name field of task_context
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-11 13:27:17 +08:00
yinshengkai 4cb2d7dc25 note: directly returns the taskname pointer
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-11 13:27:17 +08:00
yinshengkai 84799d15ac note: remove NOTERAM_GETTASKNAME
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-11 13:27:17 +08:00
yinshengkai 39001e3705 drivers/noteram: move trace_dump to noteram
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-11 13:27:17 +08:00
yinshengkai 72de29422a drivers/noteram: noteram support multiple instances
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-04 06:48:48 -07:00
yinshengkai 3ab4d4a113 drivers/noteram: reduce global variable references
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-04 06:48:48 -07:00
yinshengkai 2168b744ca drivers/noteram: change ni_buffer to point
ni_buffer is defined in the initialized structure, put it in the data segment, it will increase the flash size

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-04 06:48:48 -07:00