[Crash-utility] ppc: fix backtrace problem when NT_PRSTATUS was not saved
Dave Anderson
anderson at redhat.com
Fri Jun 22 15:36:50 UTC 2012
----- Original Message -----
> Hi Dave,
>
> I've reworked patch about ppc "bt" problem discussed in
> https://www.redhat.com/archives/crash-utility/2012-June/msg00029.html
>
> A patch is now getting to work only for ppc targets,
> and notes are relocatecd in first ppc's "bt", not in
> initialization-time.
>
> And I've tested both "bt" diskdump by makedumpfile and netdump by
> /proc/vmcore with patched kernel like
> void crash_save_cpu(struct pt_regs *regs, int cpu)
> if ((cpu % 2))
> return;
>
> I was worried about beeing able to catch all of non-contiguous NT_PRSTATUS
> notes, alternate with invalid odd notes in every process well,
> so I modified test case this time (that's no problem, everything OK).
>
> [After initialization: notes are not relocated yet]
> crash> help -D | grep notes
> num_prstatus_notes: 4
> notes_buf: 107a3518
> notes[0]: 107a3518
> notes[1]: 107a3638
> notes[2]: 107a3758
> notes[3]: 107a3878
>
> [Relocate in first bt(only once) and display correctly]
> crash> bt
> PID: 1000 TASK: eb0cf800 CPU: 4 COMMAND: "bash"
> bt: WARNING: cpu#1: not saved crash_notes
> bt: WARNING: cpu#3: not saved crash_notes
> bt: WARNING: cpu#5: not saved crash_notes
> bt: WARNING: cpu#7: not saved crash_notes
>
> R0: 00000001 R1: ea11be60 R2: eb0cf800 R3: 00000063
> R4: 00000000 R5: ffffffff R6: c043ba2c R7: 00000000
> R8: 00008000 R9: 00000000 R10: 00000000 R11: ea11be70
> R12: 28242444 R13: 100b8448 R14: 100b07b8 R15: 100b0894
> R16: 00000000 R17: 00000000 R18: 00000000 R19: 1006d270
> R20: 00000000 R21: 100f02e0 R22: 00000000 R23: 00000001
> R24: c08f1ac8 R25: 00029002 R26: c08f1bac R27: c08d0000
> R28: 00000000 R29: c09ada48 R30: 00000063 R31: ea11be60
> NIP: c0423378 MSR: 00021002 OR3: c09ada48 CTR: c0423344
> LR: c0423d8c XER: 00000000 CCR: 28242444 MQ: 00008000
> DAR: 00000000 DSISR: 00800000 Syscall Result: ea11be60
> NIP [00000000c0423378] sysrq_handle_crash
> LR [00000000c0423d8c] __handle_sysrq
>
> => PC: c0423378 (sysrq_handle_crash+52) FP: ea11be60
> #0 [ea11be60] sysrq_handle_crash at c0423378
> #1 [ea11be70] __handle_sysrq at c0423d8c
> #2 [ea11bea0] write_sysrq_trigger at c0423ed0
> #3 [ea11beb0] proc_reg_write at c01a79a4
> #4 [ea11bee0] vfs_write at c014ba44
> #5 [ea11bf00] sys_write at c014bcd8
> #6 [ea11bf40] ret_from_syscall at c0013834
> syscall [c00] exception frame:
> R0: 00000004 R1: bfe54e00 R2: 48027f80 R3: 00000001
> R4: 4811d000 R5: 00000002 R6: 00000000 R7: 00000001
> R8: 00000000 R9: 00000000 R10: 00000000 R11: 00000200
> R12: 28242442 R13: 100b8448 R14: 100b07b8 R15: 100b0894
> R16: 00000000 R17: 00000000 R18: 00000000 R19: 1006d270
> R20: 00000000 R21: 100f02e0 R22: 1006b4d0 R23: 00000001
> R24: 100b0000 R25: 1009b474 R26: bfe54ec8 R27: 00000002
> R28: 0fefa400 R29: 4811d000 R30: 0fef9ff4 R31: 00000002
> NIP: 0fe61494 MSR: 0002f902 OR3: 00000001 CTR: 0fe06fec
> LR: 0fe07050 XER: 00000000 CCR: 28242444 MQ: 00000000
> DAR: 4811d000 DSISR: 00800000 Syscall Result: 00000000
>
> [notes has been relocated: Counts num_prstatus_notes even if NULL]
> crash> help -D | grep notes
> num_prstatus_notes: 8
> notes_buf: 107a3518
> notes[0]: 107a3518
> notes[1]: 0
> notes[2]: 107a3638
> notes[3]: 0
> notes[4]: 107a3758
> notes[5]: 0
> notes[6]: 107a3878
> notes[7]: 0
>
> Thanks,
> Toshi
OK, doing it that way looks reasonable, and safely segregated to PPC only.
Just two more suggestions -- first, please do me a favor by running
"make warn" prior to posting a patch, and fix these:
$ make warn
TARGET: X86_64
CRASH: 6.0.8rc15
GDB: 7.3.1
cc -c -g -DX86_64 -DGDB_7_3_1 build_data.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector
cc -c -g -DX86_64 -DGDB_7_3_1 ppc.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector
cc -c -g -DX86_64 -DGDB_7_3_1 netdump.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector
netdump.c: In function 'get_netdump_regs_ppc':
netdump.c:2603: warning: pointer targets in passing argument 2 of 'relocate_nt_prstatus_percpu_ppc' differ in signedness
cc -c -g -DX86_64 -DGDB_7_3_1 diskdump.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector
diskdump.c:1061: warning: no previous prototype for ‘relocate_nt_prstatus_percpu_ppc’
diskdump.c: In function 'get_diskdump_regs_ppc':
diskdump.c:1103: warning: pointer targets in passing argument 2 of 'relocate_nt_prstatus_percpu_ppc' differ in signedness
...
Secondly, since your new relocate_nt_prstatus_percpu_ppc() and
verify_crash_note_in_kernel_ppc() functions are used for both
kdump ELF and compressed kdump formats, and since they are
PPC-specific, can you just move the two functions into ppc.c?
All that should require is to #include elf.h.
Thanks,
Dave
More information about the Crash-utility
mailing list