Commit Graph

111 Commits

Author SHA1 Message Date
wanggang26 848b596a12 coredump: measure the system's running time in milliseconds unit
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-16 15:35:21 +08:00
anjiahao d347da10ca coredump:need close block device when finish coredump
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-16 15:35:21 +08:00
wanggang26 2414fc91ff coredump: fix issue that calculated dump region range is
smaller than it should be.

0x21000000    0x210105e8    0x210105f8      0x21044000
  |----------------|-------------|--------------|

If there is already a range of 0x210105e8 - 0x210105f8, adding another
range of 0x21000000 - 0x21044000 would result in an incorrect range of
0x210105e8 - 0x21044000.

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-16 15:35:21 +08:00
wangmingrong1 533c11eee2 coredump.c: Delete the judgment of continue
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-16 08:07:09 +08:00
wangmingrong1 2beef702cc coredump.c: del multiple behavior
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-16 08:07:09 +08:00
yinshengkai ef62c70e5f sched: modify CONFIG_DUMP_ON_EXIT to CONFIG_SCHED_DUMP_ON_EXIT
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-15 01:50:55 +08:00
wanggang26 7a352d2b83 coredump: fix bug that memsegs got invalid value
for (; cinfo.regions[memsegs].start <
       cinfo.regions[memsegs].end; memsegs++);

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-15 01:07:45 +08:00
xuxingliang a8b7d26db5 Use BACKTRACE_BUFFER_SIZE to declare backtrace buffer
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-15 01:07:21 +08:00
anjiahao 52126aede1 coredump:Move coredump to sched/misc
1. move coredump form libelf to sched/misc
2. rename core_dump to coredump

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao 9e868cadfb coredump:Move private functions to internal header files
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
buxiasen ca45ad69bd misc: flush syslog before possible long time cost coredump
When coredump to mtd, it maybe cost lots of time, do flush syslog can
make user access all log when coredump processing, should be better.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-12 09:32:44 +08:00
Neo Xu d598da80e4 Rename group_argvstr to nxtask_argvstr
Now argument vector is stored to TLS, task_argvstr fits better.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-10 23:13:37 +08:00
anjiahao fa59adde40 Simplify BOARD_MEMORY_RANGE initialization logic
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-09 15:41:48 +08:00
anjiahao e0bcad3a1d gdbstub:support gdbstub memory access control
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-09 15:41:48 +08:00
fangpeina b5145c528e misc/assert: add backtrace dump support for mutex hold task
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-10-09 08:37:01 +08:00
wangmingrong1 ba05a36eed board_reset: flush cache before reset
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-09 02:30:21 +08:00
xuxingliang b7824264f6 sched: optimize deadlock detection readability
Use meaningful variable names.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-08 23:35:01 +08:00
anjiahao 97425687cf deadlock:fix find deadlock bug
bug:
  thread 1: get mutexA
            wait a sem

  thread 2: wait mutexA

  This situation will be mistakenly judged as a deadlock.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-08 23:35:01 +08:00
anjiahao 3d69dbe1c8 deadlock:fix bug,When holder is -1 need stop search next
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-08 23:35:01 +08:00
Xu Xingliang 4ed506d6ab board/coredump: add option to use base64 stream
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-10-08 22:33:19 +08:00
anjiahao f2bdfa43e1 coredump:Add a coreudmp api to watch custom variables
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-01 20:40:28 +08:00
anjiahao 60796a7063 coredump:add const to memory region struct ptr
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-01 20:40:28 +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
xuxingliang 2b8a4a361d assert: dump all CPU registers and stack
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-09-30 18:43:35 +08:00
xuxingliang 6d0180f12e assert: cleanup assert handler
1. extract dump from assert main flow
2. use OSINIT_PANIC for fatal error.
3. fix the method to judge kernel thread.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-09-30 18:43:35 +08:00
Xu Xingliang 2749736638 assert: disable kasan in assert
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-09-30 18:43:35 +08:00
chao an 3cce16dd0c fs/dump: correct SCHED_DUMP_ON_EXIT to DUMP_ON_EXIT
1. correct SCHED_DUMP_ON_EXIT to DUMP_ON_EXIT
2. dump file list only if DUMP_ON_EXIT enabled

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-18 23:48:31 +08:00
wanggang26 f07a1868ce coredump: just save latest core file
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-15 17:31:40 +08:00
hujun5 908df725ad arch: use up_current_regs/up_set_current_regs replace CURRENT_REGS
reason:
1 On different architectures, we can utilize more optimized strategies
  to implement up_current_regs/up_set_current_regs.
eg. use interrupt registersor percpu registers.

code size
before
    text    data     bss     dec     hex filename
 262848   49985   63893  376726   5bf96 nuttx

after
       text    data     bss     dec     hex filename
 262844   49985   63893  376722   5bf92 nuttx

size change -4

Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ 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

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-13 23:18:58 +08:00
Alin Jerpelea eb9030c891 sched: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-09-12 01:10:14 +08:00
fangxinyong 7b05a550dc sched: replace up_cpu_index with this_cpu
Make this_cpu is arch independent and up_cpu_index do that.
In AMP mode, up_cpu_index() may return the index of the physical core.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-09-05 12:09:24 +08:00
chao an 39e873f269 sched/policy: move g_policy from data to rodata
Signed-off-by: chao an <anchao@lixiang.com>
2024-09-02 18:23:57 +08:00
YAMAMOTO Takashi 52baca0a89 Increase the chance for _assert to work early in the boot 2024-08-30 01:12:45 +08:00
yinshengkai 624fc5a9b8 sched: support dumping all file information during assert
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 16:12:31 -03:00
yinshengkai 20b357abde assert: pause all other CPUs when assert
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 16:12:31 -03:00
yinshengkai b3794c8af7 assert: Avoid recursive calls of Assert
After the structure of the kernel core is wrong, dump_stack, dumpstack is easy to appear crash

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 16:12:31 -03:00
wanggang26 c58bd521a3 coredump: refine coredump info analyse
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-08-18 19:34:36 +08:00
anjiahao 2ff2b82437 coredump:coredump_set_memory_region to set memory region
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-12 02:02:25 +08:00
anjiahao 8d0d1f7571 coredump:Add coredump success log printing to remind you to use coreudmp
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-12 02:02:25 +08:00
p-szafonimateusz 2192d83200 arch/x86_64: add support for XSAVE/XRSTOR
Add support for XSAVE/XRSTOR to handle x86_64 procesor extended states.
Support for these instructions is required to support AVX instruction set

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-07-01 13:27:33 +08:00
simbit18 09bfaa7292 fix nxstyle
fix Relative file path does not match actual file.
2024-05-11 01:19:06 +08:00
chao an 1890b58e67 sched/misc: dump stack as platform bit width
before:
stack_dump: 0x8002ff80: 8003057b 00000000 00000000 00000000 00000002 00000000 80030068 00000000
stack_dump: 0x8002ffa0: 00000002 00000000 00000000 00000000 80030280 00000000 8000898e 00000000
stack_dump: 0x8002ffc0: 00000000 00000000 00000000 00000000 0000000b 00000000 0000000a 00000000
stack_dump: 0x8002ffe0: 8002a470 00000000 00000000 00000000 00000000 00000000 00000000 00000000

after:
stack_dump: 0x8002ff80: 000000008003057b 0000000000000000 0000000000000002 0000000080030068 0000000000000002 0000000000000000 0000000080030280 000000008000898e
stack_dump: 0x8002ffc0: 0000000000000000 0000000000000000 000000000000000b 000000000000000a 000000008002a470 0000000000000000 0000000000000000 0000000000000000

Signed-off-by: chao an <anchao@lixiang.com>
2024-05-10 19:42:41 +08:00
hujun5 d0820acbbb sched: misc: Remove sched_lock in _assert()
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-04-21 11:40:01 +02:00
Xiang Xiao 55e3cf7e2d sched: Move dump.c to sched_dumponexit.c
The dump.c is a part of sched module, so move it to sched directory.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-04-19 08:39:10 +08:00
ligd 3844efb5b8 stack: update up_get_intstackbase API to support cpu id
For crash dump all the CPU intstack

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-04-09 16:59:00 -03:00
chao an feb6ede434 sched/cpu: replace up_cpu_index() to this_cpu()
In SMP mode, up_cpu_index()/this_cpu() are the same, both return the index of the physical core.
In AMP mode, up_cpu_index() will return the index of the physical core, and this_cpu() will always return 0

| #ifdef CONFIG_SMP
| #  define this_cpu()             up_cpu_index()
| #elif defined(CONFIG_AMP)
| #  define this_cpu()             (0)
| #else
| #  define this_cpu()             (0)
| #endif

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-21 18:52:35 +08:00
Bowen Wang 3bac449286 assert: fix flags type, should be irqstate_t
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 22:16:54 -08:00
anjiahao 35051dd715 coredump: support coredump save to block device when crash
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-10 07:02:03 -08:00
anjiahao c3fd7f84ad assert/stack_dump: Output some more information on the premise that sp has it.
gdb may need more information when doing backtrace

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-08 19:55:32 -08:00
anjiahao 7fd172d9ff stack_dump:change Conditions for stack dump
If the gap between sp and stack_top is too small,
then the stack will not be output,
modify the conditional loop condition, and fix this problem

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-08 19:55:32 -08:00