----- Original Message ----- > From: Rabin Vincent <rabinv@xxxxxxxx> > > The mips stackframe handling has two problems: > > (1) It does not read the registers from the kernel's crash_notes if ELF > notes are not available for some reason. This is important when > debugging raw memory dumps. > > (2) If one of the online CPUs did not save the ELF notes, then the > mapping of ELF notes to CPUs may be incorrect. > > ARM has an implementation which handles both these cases, so we borrow > it. Note that this code is entirely copy/pasted from arm, so perhaps > we could make a common function out of this which could be shared > between the two architectures? Rabin, The duplication is fine, so let's leave it at that. However, when you originally did the mips port, you gave me two ELF kdumps named "oops-sysrq" and "oops-module", which I've been testing with a crash binary built with "make target=MIPS". Without this 3rd patch installed, both dumpfiles look OK: $ crash vmlinux oops-sysrq crash 7.1.6 Copyright (C) 2002-2016 Red Hat, Inc. Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation Copyright (C) 1999-2006 Hewlett-Packard Co Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited Copyright (C) 2006, 2007 VA Linux Systems Japan K.K. Copyright (C) 2005, 2011 NEC Corporation Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc. Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. This program is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Enter "help copying" to see the conditions. This program has absolutely no warranty. Enter "help warranty" for details. GNU gdb (GDB) 7.6 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=mipsel-elf-linux"... KERNEL: vmlinux DUMPFILE: oops-sysrq CPUS: 1 DATE: Sun Jan 11 12:45:20 2015 UPTIME: 00:00:54 LOAD AVERAGE: 6.68, 1.62, 0.54 TASKS: 47 NODENAME: buildroot RELEASE: 3.19.0-rc3-00169-geb74926-dirty VERSION: #23 SMP Sun Jan 11 18:00:43 CET 2015 MACHINE: mips (unknown Mhz) MEMORY: 128 MB PANIC: "SysRq : Trigger a crash" PID: 14 COMMAND: "kworker/u2:1" TASK: 87d20e20 [THREAD_INFO: 87df6000] CPU: 0 STATE: TASK_RUNNING (SYSRQ) crash> bt PID: 14 TASK: 87d20e20 CPU: 0 COMMAND: "kworker/u2:1" #0 [87df78e8] __udelay at 803773f8 #1 [87df78e8] panic at 8054be58 #2 [87df7928] die at 8010bc10 #3 [87df7958] __do_page_fault at 8011638c #4 [87df7a28] ret_from_exception at 80105aa0 $ 0 : 00000000 00000001 00000001 806d0000 $ 4 : 00000063 81103288 811045a0 806d8fa0 $ 8 : 00000001 00000000 80650000 000038b8 $12 : 000000bc 00000002 00000000 00000000 $16 : 8066c9e4 80650000 00000063 00000007 $20 : 80670000 00000001 80680740 80638400 $24 : 000000bc 00000001 80608ee4 87df7ae4 $28 : 87df6000 87df7ae0 00000000 803c8434 Hi : 00001644 Lo : 00005910 epc : 803c7c80 sysrq_handle_crash+0x10 ra : 803c8434 __handle_sysrq+0x144 Status: 1000a302 Cause : c080840c BadVA : 00000000 #5 [87df7ae0] sysrq_handle_crash at 803c7c80 #6 [87df7ae0] __handle_sysrq at 803c8434 #7 [87df7b18] serial8250_rx_chars at 803dd678 #8 [87df7b50] serial8250_handle_irq at 803e0180 #9 [87df7b78] serial8250_interrupt at 803dda5c #10 [87df7ba8] handle_irq_event_percpu at 8016b300 #11 [87df7be8] handle_irq_event at 8016b530 #12 [87df7c08] handle_level_irq at 8016eb50 #13 [87df7c28] generic_handle_irq at 8016a8ec #14 [87df7c40] do_IRQ at 80107a8c #15 [87df7c60] i8259_handler at 801013fc #16 [87df7c78] handle_irq_event_percpu at 8016b300 #17 [87df7cb8] handle_percpu_irq at 8016f4c8 #18 [87df7cd8] generic_handle_irq at 8016a8ec #19 [87df7cf0] do_IRQ at 80107a8c #20 [87df7d10] plat_irq_dispatch at 8011358c #21 [87df7d38] ret_from_irq at 80105ab0 $ 0 : 00000000 806d0000 00000000 876773bc $ 4 : 0000000c 00000000 00000064 00000000 $ 8 : 0003d090 00000000 fffffffc 00000001 $12 : 811051f0 00000005 00000000 00000005 $16 : 00000000 87435e78 876773b0 00000000 $20 : 876774d8 876774dc 87677480 80680000 $24 : 00000010 80155448 00000000 8023d2a4 $28 : 87df6000 87df7df0 00000000 8023efe4 Hi : 00013880 Lo : 00011170 epc : 8023f000 bdi_writeback_workfn+0x168 ra : 8023efe4 bdi_writeback_workfn+0x14c Status: 1000a703 Cause : 00800400 BadVA : 87435e78 #22 [87df7df0] bdi_writeback_workfn at 8023f000 #23 [87df7e58] process_one_work at 8013e1b8 #24 [87df7e98] worker_thread at 8013ed6c #25 [87df7ed0] kthread at 801434ac #26 [87df7f28] ret_from_kernel_thread at 80105af8 crash> $ crash vmlinux oops-module crash 7.1.6 Copyright (C) 2002-2016 Red Hat, Inc. Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation Copyright (C) 1999-2006 Hewlett-Packard Co Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited Copyright (C) 2006, 2007 VA Linux Systems Japan K.K. Copyright (C) 2005, 2011 NEC Corporation Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc. Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. This program is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Enter "help copying" to see the conditions. This program has absolutely no warranty. Enter "help warranty" for details. GNU gdb (GDB) 7.6 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=mipsel-elf-linux"... KERNEL: vmlinux DUMPFILE: oops-module CPUS: 1 DATE: Sun Jan 11 12:47:40 2015 UPTIME: 00:00:41 LOAD AVERAGE: 6.63, 1.61, 0.54 TASKS: 48 NODENAME: buildroot RELEASE: 3.19.0-rc3-00169-geb74926-dirty VERSION: #23 SMP Sun Jan 11 18:00:43 CET 2015 MACHINE: mips (unknown Mhz) MEMORY: 128 MB PANIC: "CPU 0 Unable to handle kernel paging request at virtual address 0000deb0, epc == c003f4fc, ra == c003f4f4" PID: 1009 COMMAND: "insmod" TASK: 87f80710 [THREAD_INFO: 86870000] CPU: 0 STATE: TASK_RUNNING (PANIC) crash> bt PID: 1009 TASK: 87f80710 CPU: 0 COMMAND: "insmod" #0 [868716d0] __udelay at 803773f8 #1 [868716d0] panic at 8054be58 #2 [86871710] die at 8010bc30 #3 [86871740] __do_page_fault at 8011638c #4 [86871810] ret_from_exception at 80105aa0 $ 0 : 00000000 00000001 0000dead 0000beef $ 4 : 81103284 00000007 00000001 000003f8 $ 8 : 803de068 00000000 80650000 78302065 $12 : 000000c0 1dcd6500 00000000 00000000 $16 : 8054be68 87e22200 c0040000 00000000 $20 : 805e0000 ffffffff 80246d0c 00000001 $24 : 00000003 803dcf4c c003fda4 868718cc $28 : 86870000 868718c8 00000000 c003f4f4 Hi : 00000bb8 Lo : 00002ee0 epc : c003f4fc free_cmd+0x70 ra : c003f4f4 free_cmd+0x68 Status: 1000a703 Cause : 0080000c BadVA : 0000deb0 #5 [868718c8] free_cmd at c003f4fc [null_blk] #6 [868718e8] generic_make_request at 8034a338 #7 [86871910] submit_bio at 8034a48c #8 [86871970] _submit_bh at 802483cc #9 [86871998] block_read_full_page at 8024894c #10 [86871a08] do_read_cache_page at 801bf358 #11 [86871a48] read_cache_page at 801bf4d4 #12 [86871a68] read_dev_sector at 8035e6a8 #13 [86871a80] read_lba at 80360644 #14 [86871ac8] efi_partition at 80360b58 #15 [86871be0] check_partition at 8035f884 #16 [86871c08] rescan_partitions at 8035edc0 #17 [86871c58] __blkdev_get at 8024cfb8 #18 [86871c98] blkdev_get at 8024d234 #19 [86871ce8] add_disk at 8035c548 #20 [86871d38] init_module at c0042570 [null_blk] #21 [86871d80] do_one_initcall at 8010058c #22 [86871df8] load_module at 8019674c #23 [86871ec8] sys_init_module at 80196f48 #24 [86871f28] handle_sys at 801139c8 $ 0 : 00000000 801105cc 00000fa0 773cc3ec $ 4 : 772b1008 0002e480 00c4b008 004dd5f0 $ 8 : 00000000 00000203 fffffffc f8000000 $12 : 03ff0000 ac000000 03bd0000 03bf0000 $16 : 772b1008 00000003 7f898eb0 7f8988a8 $20 : 7f898a64 004d0000 004d0000 00000002 $24 : 24000000 773cc3ec 004dd5f0 00000000 $28 : 77469e20 7f898890 00a73404 00419e7c Hi : 00000000 Lo : 0000000a epc : 773cc400 ra : 00419e7c Status: 0000a713 Cause : 00800020 BadVA : 772b1004 crash> But with the patch installed, both dumpfiles show the "WARNING: cannot retrieve registers for active task" during initialization, and "bt" fails as expected: $ crash vmlinux oops-sysrq crash 7.1.6 Copyright (C) 2002-2016 Red Hat, Inc. Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation Copyright (C) 1999-2006 Hewlett-Packard Co Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited Copyright (C) 2006, 2007 VA Linux Systems Japan K.K. Copyright (C) 2005, 2011 NEC Corporation Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc. Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. This program is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Enter "help copying" to see the conditions. This program has absolutely no warranty. Enter "help warranty" for details. GNU gdb (GDB) 7.6 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=mipsel-elf-linux"... WARNING: cannot retrieve registers for active task KERNEL: vmlinux DUMPFILE: oops-sysrq CPUS: 1 DATE: Sun Jan 11 12:45:20 2015 UPTIME: 00:00:54 LOAD AVERAGE: 6.68, 1.62, 0.54 TASKS: 47 NODENAME: buildroot RELEASE: 3.19.0-rc3-00169-geb74926-dirty VERSION: #23 SMP Sun Jan 11 18:00:43 CET 2015 MACHINE: mips (unknown Mhz) MEMORY: 128 MB PANIC: "SysRq : Trigger a crash" PID: 14 COMMAND: "kworker/u2:1" TASK: 87d20e20 [THREAD_INFO: 87df6000] CPU: 0 STATE: TASK_RUNNING (SYSRQ) crash> bt PID: 14 TASK: 87d20e20 CPU: 0 COMMAND: "kworker/u2:1" bt: WARNING: cannot determine starting stack frame for task 87d20e20 crash> $ crash vmlinux oops-module crash 7.1.6 Copyright (C) 2002-2016 Red Hat, Inc. Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation Copyright (C) 1999-2006 Hewlett-Packard Co Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited Copyright (C) 2006, 2007 VA Linux Systems Japan K.K. Copyright (C) 2005, 2011 NEC Corporation Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc. Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. This program is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Enter "help copying" to see the conditions. This program has absolutely no warranty. Enter "help warranty" for details. GNU gdb (GDB) 7.6 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=mipsel-elf-linux"... WARNING: cannot retrieve registers for active task KERNEL: vmlinux DUMPFILE: oops-module CPUS: 1 DATE: Sun Jan 11 12:47:40 2015 UPTIME: 00:00:41 LOAD AVERAGE: 6.63, 1.61, 0.54 TASKS: 48 NODENAME: buildroot RELEASE: 3.19.0-rc3-00169-geb74926-dirty VERSION: #23 SMP Sun Jan 11 18:00:43 CET 2015 MACHINE: mips (unknown Mhz) MEMORY: 128 MB PANIC: "CPU 0 Unable to handle kernel paging request at virtual address 0000deb0, epc == c003f4fc, ra == c003f4f4" PID: 1009 COMMAND: "insmod" TASK: 87f80710 [THREAD_INFO: 86870000] CPU: 0 STATE: TASK_RUNNING (PANIC) crash> bt PID: 1009 TASK: 87f80710 CPU: 0 COMMAND: "insmod" bt: WARNING: cannot determine starting stack frame for task 87f80710 crash> Just in case you don't have these two dumpfiles anymore, I've put them here: http://people.redhat.com/anderson/.rabin Thanks, Dave -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility