Add support for the 'irq' series of commands in the MIPS32/64
architecture, except for the 'irq -d' command, others can be
used. Without the patch, the 'irq' command fails as follows:
irq: cannot determine number of IRQs
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Add support form printing out the registers from the dump file. We don't
take the registers directly from the ELF notes but instead use the version
we've saved into the machine_specific structure. If we don't do this,
we'd get misleading output when the number of ELF notes don't match the
number of online CPUs.
E.g. Without this patch:
crash> help -r
help: -r option not supported for this dumpfile
E.g. With this patch:
crash> help -r
...
CPU 3:
R0: 0000000000000000 R1: 0000000000000001 R2: 9800000254f3c400
R3: 0000000000000000 R4: ffffffff8123b6b0 R5: 0000000000000000
R6: 9800000243bcf200 R7: fffffffffffffff8 R8: fffffffffffffffd
R9: 00180000000000ff R10: ffffffff810e29a8 R11: ffffffff80e84190
R12: 000000005400cce0 R13: 0000000000000000 R14: 0000000000000040
R15: 6e69636e79732074 R16: ffffffff81200000 R17: ffffffff81240000
R18: 0000000000000000 R19: ffffffff81430000 R20: 980000024291f938
R21: 0000000000000001 R22: 980000024aef7320 R23: ffffffff81430000
R24: 0000000000000002 R25: ffffffff80878b58 R26: 0000000000000000
R27: 0000000000000000 R28: 980000024291c000 R29: 980000024291f930
R30: 9800000243bcf200 R31: ffffffff802fff00
LO: ffffffff81210000 HI: ffffffff81210000
EPC: ffffffff802fff84 BADVADDR: ffffffff802bbe9c
STATUS: ffffffff81430000 CAUSE: 9800000243bcf200
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Add mips64_verify_symbol() implementation, accept or reject a
symbol from the kernel namelist.
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Add 'bt -l' command support, get a line number associated with a
current pc address.
E.g. With this patch:
crash> bt -l
PID: 4768 TASK: 9800000243bcf200 CPU: 3 COMMAND: "bash"
#0 [980000024291f930] __crash_kexec at ffffffff802fff84
/home/tang/loongson-419/linux-4.19.152kexec/./arch/mips/include/asm/stacktrace.h: 43
#1 [980000024291faa0] panic at ffffffff80248cac
/home/tang/loongson-419/linux-4.19.152kexec/kernel/panic.c: 206
...
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
dumpfiles:
(1) If the kernel's crash_notes are not available, read them from
ELF notes.
(2) If an online CPUs did not save its ELF notes, then adjust
the mapping of each ELF note to its CPU accordingly.
E.g. With this patch:
crash> bt
PID: 4768 TASK: 9800000243bcf200 CPU: 3 COMMAND: "bash"
#0 [980000024291f930] __crash_kexec at ffffffff802fff84
#1 [980000024291faa0] panic at ffffffff80248cac
#2 [980000024291fb40] die at ffffffff8021b338
#3 [980000024291fb70] do_page_fault at ffffffff802315e0
#4 [980000024291fbd0] tlb_do_page_fault_1 at ffffffff80239388
#5 [980000024291fd00] sysrq_handle_crash at ffffffff8085d308
#6 [980000024291fd10] __handle_sysrq at ffffffff8085d9e0
#7 [980000024291fd60] write_sysrq_trigger at ffffffff8085e020
#8 [980000024291fd80] proc_reg_write at ffffffff804762f0
#9 [980000024291fda0] __vfs_write at ffffffff803f3138
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Add basic support for the 'bt' command, refer to the implementation
of mips.c.
E.g. With this patch:
crash> bt
PID: 4768 TASK: 9800000243bcf200 CPU: 3 COMMAND: "bash"
bt: WARNING: cannot determine starting stack frame for task 9800000243bcf200
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
The 'mach' command can only get some basic machine state information, such
as machine type, processor speed, etc.
E.g. With this patch:
crash> mach
MACHINE TYPE: mips64
MEMORY SIZE: 7.5 GB
CPUS: 4
PROCESSOR SPEED: 1800 Mhz
HZ: 250
PAGE SIZE: 16384
KERNEL STACK SIZE: 16384
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Obtain the processor speed from the kernel symbol "mips_cpu_frequency" or
"cpu_clock_freq".
E.g. With this patch:
...
MACHINE: mips64 (1800 Mhz)
...
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
1. Add mips64_init() implementation, do all necessary machine-specific setup,
which will be called multiple times during initialization.
2. Add the implementation of the vtop command, which is used to convert a
virtual address to a physical address. When entering the crash command line,
the corresponding symbols in the kernel will be read, and at the same time,
the conversion of virtual and real addresses will also be used, so the vtop
command is a prerequisite for entering the crash command line.
3. Add mips64_get_smp_cpus() implementation, get the number of online cpus.
4. Add mips64_get_page_size() implementation, get page size.
The results after applying patch 01~04 are as follows:
...
KERNEL: /boot/vmlinux-4.19.161kexec+
DUMPFILE: /home/tang/vmcore_4.19.161
CPUS: 4
DATE: Mon Jan 25 18:54:14 HKT 2021
UPTIME: (cannot calculate: unknown HZ value)
LOAD AVERAGE: 0.24, 0.21, 0.09
TASKS: 348
NODENAME: bogon
RELEASE: 4.19.161kexec+
VERSION: #15 SMP PREEMPT Mon Jan 25 17:56:16 HKT 2021
MACHINE: mips64 (unknown Mhz)
MEMORY: 0
PANIC: "CPU 3 Unable to handle kernel paging request at virtual address 0000000000000000, epc == ffffffff8085d318, ra == ffffffff8085d308"
PID: 4768
COMMAND: "bash"
TASK: 9800000243bcf200 [THREAD_INFO: 980000024291c000]
CPU: 3
STATE: TASK_RUNNING (PANIC)
crash>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Add support for using the notes in MIPS kdump compressed format dumpfiles.
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Mainly added some environment configurations, macro definitions, specific
architecture structures and some function declarations supported by the
MIPS64 architecture.
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>