Hi Dave, Currently when we find a userspace pt_regs at the beginning of the stack, we print nothing. With this patch the userspace PSW and general purpose registers are printed. With this change for the user it is clearer now that the task has been interrupted while running in userspace. Example: External interrupt while in userspace Before change: crash> bt -a ... #1 [176327e08] arch_send_call_function_ipi_mask at 115d80 #2 [176327e38] do_extint at 10dd82 #3 [176327eb0] ext_skip at 63e344 After change: crash> bt -a ... #1 [176327e08] arch_send_call_function_ipi_mask at 115d80 #2 [176327e38] do_extint at 10dd82 #3 [176327eb0] ext_skip at 63e344 PSW: 0705e00180000000 0000000080000a16 (userspace) GPRS: 0000000000000001 000003ff00647213 000003fffd800000 0000000003710001 0000000080000afc 000003fffff77e58 0000000080000bb0 000003fffff781c0 00000000800007bc 0000000000000000 0000000080000b44 000003fffff77e58 000003fffd7c6000 000003fffd777020 0000000080000b02 000003fffff77e58 Michael --- s390x.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) --- a/s390x.c +++ b/s390x.c @@ -978,12 +978,16 @@ static void print_ptregs(struct bt_info return; fprintf(fp, " PSW: %016lx %016lx ", psw_flags, psw_addr); - sym = closest_symbol(psw_addr); - offs = psw_addr - closest_symbol_value(psw_addr); - if (module_symbol(psw_addr, NULL, &lm, NULL, 0)) - fprintf(fp, "(%s+%ld [%s])\n", sym, offs, lm->mod_name); - else - fprintf(fp, "(%s+%ld)\n", sym, offs); + if (psw_flags & S390X_PSW_MASK_PSTATE) { + fprintf(fp, "(user space)\n"); + } else { + sym = closest_symbol(psw_addr); + offs = psw_addr - closest_symbol_value(psw_addr); + if (module_symbol(psw_addr, NULL, &lm, NULL, 0)) + fprintf(fp, "(%s+%ld [%s])\n", sym, offs, lm->mod_name); + else + fprintf(fp, "(%s+%ld)\n", sym, offs); + } addr = sp + MEMBER_OFFSET("pt_regs", "gprs"); for (i = 0; i < 16; i++) { @@ -1039,8 +1043,10 @@ static unsigned long show_trace(struct b return sp; /* Check for user PSW */ reg = readmem_ul(sp + MEMBER_OFFSET("pt_regs", "psw")); - if (reg & S390X_PSW_MASK_PSTATE) + if (reg & S390X_PSW_MASK_PSTATE) { + print_ptregs(bt, sp); return sp; + } /* Get new backchain from r15 */ reg = readmem_ul(sp + MEMBER_OFFSET("pt_regs", "gprs") + 15 * sizeof(long));
[PATCH] s390x/bt: Print userspace PSW and registers for active tasks Currently when we find a userspace pt_regs at the beginning of the stack, we print nothing. With this patch the userspace PSW and general purpose registers are printed. With this change for the user it is clearer that the task has been interrupted while running in userspace. Example output before change: crash> bt -a ... #1 [176327e08] arch_send_call_function_ipi_mask at 115d80 #2 [176327e38] do_extint at 10dd82 #3 [176327eb0] ext_skip at 63e344 Example output after change: crash> bt -a ... #1 [176327e08] arch_send_call_function_ipi_mask at 115d80 #2 [176327e38] do_extint at 10dd82 #3 [176327eb0] ext_skip at 63e344 PSW: 0705e00180000000 0000000080000a16 (userspace) GPRS: 0000000000000001 000003ff00647213 000003fffd800000 0000000003710001 0000000080000afc 000003fffff77e58 0000000080000bb0 000003fffff781c0 00000000800007bc 0000000000000000 0000000080000b44 000003fffff77e58 000003fffd7c6000 000003fffd777020 0000000080000b02 000003fffff77e58 --- s390x.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) --- a/s390x.c +++ b/s390x.c @@ -978,12 +978,16 @@ static void print_ptregs(struct bt_info return; fprintf(fp, " PSW: %016lx %016lx ", psw_flags, psw_addr); - sym = closest_symbol(psw_addr); - offs = psw_addr - closest_symbol_value(psw_addr); - if (module_symbol(psw_addr, NULL, &lm, NULL, 0)) - fprintf(fp, "(%s+%ld [%s])\n", sym, offs, lm->mod_name); - else - fprintf(fp, "(%s+%ld)\n", sym, offs); + if (psw_flags & S390X_PSW_MASK_PSTATE) { + fprintf(fp, "(user space)\n"); + } else { + sym = closest_symbol(psw_addr); + offs = psw_addr - closest_symbol_value(psw_addr); + if (module_symbol(psw_addr, NULL, &lm, NULL, 0)) + fprintf(fp, "(%s+%ld [%s])\n", sym, offs, lm->mod_name); + else + fprintf(fp, "(%s+%ld)\n", sym, offs); + } addr = sp + MEMBER_OFFSET("pt_regs", "gprs"); for (i = 0; i < 16; i++) { @@ -1039,8 +1043,10 @@ static unsigned long show_trace(struct b return sp; /* Check for user PSW */ reg = readmem_ul(sp + MEMBER_OFFSET("pt_regs", "psw")); - if (reg & S390X_PSW_MASK_PSTATE) + if (reg & S390X_PSW_MASK_PSTATE) { + print_ptregs(bt, sp); return sp; + } /* Get new backchain from r15 */ reg = readmem_ul(sp + MEMBER_OFFSET("pt_regs", "gprs") + 15 * sizeof(long));
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility