Dave,
Thanks for your double-check,
On Thu, Oct 19, 2017 at 01:55:11PM -0400, Dave Anderson wrote:
>
>
> ----- Original Message -----
> >
> > Hi Takahiro,
> >
> > I haven't had a chance to investigate why it fails, but with this latest
> > patch applied, the "bt -[fF]" option fails to show the topmost frame
dump
> > for *all* user-space tasks.
>
> By *all* user-space tasks, I mean in pre-4.14 dumpfiles. I don't have a 4.14
> dumpfile, but on a live 4.14 system, it does dump the frame.
>
> Anyway, it's caused by this diff segment:
>
> @@ -1778,7 +1783,7 @@ arm64_display_full_frame(struct bt_info *bt, ulong
> sp)
> ulong words, addr;
> char buf[BUFSIZE];
>
> - if (bt->frameptr == sp)
> + if (bt->frameptr >= sp)
> return;
>
> if (INSTACK(bt->frameptr, bt)) {
>
> If I set it back to "==", it works as expected. In fact, if I set it back
to "=="
> and run it on my live 4.14 system, it still works. So I'm not sure why it's
been
> changed?
Well, this is related to this code:
=== arm64_unwind_frame() ==
* If we want to see pt_regs,
* comment out the below.
* bt->frameptr = frame->sp; <---- (A)
*/
===>8===
At my initial fix, I wanted to dump a full frame (on process stack)
even for interrupt case like:
===8< (only on v4.14) ==
#7 [ffff00000800bfc0] gic_handle_irq at ffff000008081718
ffff00000800bfc0: ffff000009193f50 ffff0000080830f0
ffff00000800bfd0: ffff000009193e20 0001000000000000
ffff00000800bfe0: ffff000009193f60 ffff0000080854b8
ffff00000800bff0: 0000000000000145 0000000000000000
--- <IRQ stack> ---
ffff000009193e20: 0000000000000000 0000000000000000 <----- (pt_regs)
ffff000009193e30: 0000000000000001 0000000000000000
ffff000009193e40: 0000000000000000 ffff000009193f60
ffff000009193e50: 0000800006038000 0000000000000001
ffff000009193e60: ffff80000d95a660 ffff000009193ee0
ffff000009193e70: 0000000000000a00 000000000004dccc
ffff000009193e80: 000000075e3f3040 0000000000000000
ffff000009193e90: 00096ae380000000 0000145b90000000
ffff000009193ea0: ffff00000820e7c8 0000ffffb4c4ee30
ffff000009193eb0: 0000000000000014 ffff000008f21000
ffff000009193ec0: ffff000008f39000 ffff000008f39000
ffff000009193ed0: ffff000008f2c620 ffff000008f39e90
ffff000009193ee0: 0000000000000000 0000000000000000
ffff000009193ef0: ffff80000d959c00 0000000000000000
ffff000009193f00: 0000000000000000 ffff000009193f60
ffff000009193f10: ffff0000080854b4 ffff000009193f60
ffff000009193f20: ffff0000080854b8 0000000000000145
ffff000009193f30: 0000000000000000 0000000000000000
ffff000009193f40: ffffffffffffffff ffff00000813ce8c ------>
#8 [ffff000009193f50] el1_irq at ffff0000080830ec
PC: ffff0000080854b8 [arch_cpu_idle+16]
LR: ffff0000080854b4 [arch_cpu_idle+12]
SP: ffff000009193f60 PSTATE: 00000145
X29: ffff000009193f60 X28: 0000000000000000 X27: 0000000000000000
X26: ffff80000d959c00 X25: 0000000000000000 X24: 0000000000000000
X23: ffff000008f39e90 X22: ffff000008f2c620 X21: ffff000008f39000
X20: ffff000008f39000 X19: ffff000008f21000 X18: 0000000000000014
X17: 0000ffffb4c4ee30 X16: ffff00000820e7c8 X15: 0000145b90000000
X14: 00096ae380000000 X13: 0000000000000000 X12: 000000075e3f3040
X11: 000000000004dccc X10: 0000000000000a00 X9: ffff000009193ee0
X8: ffff80000d95a660 X7: 0000000000000001 X6: 0000800006038000
X5: ffff000009193f60 X4: 0000000000000000 X3: 0000000000000000
X2: 0000000000000001 X1: 0000000000000000 X0: 0000000000000000
==8<===
But this code breaks on older kernels and I had to manage it.
Now that (A) is commented out, we don't need such a workaround
as you suggested. So I think you can revert that hunk (plus remove
the entire comment around (A)).
In this investigation, I also found that
=== arm64_display_full_frame() ===
if (INSTACK(bt->frameptr, bt)) {
if (INSTACK(sp, bt)) {
; /* normal case */
} else {
if (sp == 0)
/* interrupt in user mode */ <--- (B)
sp = bt->stacktop - USER_EFRAME_OFFSET;
else
/* interrupt in kernel mode */
sp = bt->stacktop; <---- (C)
}
} else {
/* This is a transition case from irq to process stack. */
return; <---- (D)
}
===>8===
* (B) are not only for interrupt case, but also for all exceptions.
* (C) and (D) are very unlikely to be hit at any cases.
(D) is supposed to already be handled in arm64_switch_stack(),
but why (C)?
Actually (D) gets hit every time when switching from the IRQ stack to the
process stack on older kernels. I've thought about fixing that, but given
that the exception frame itself is a stack dump (albeit translated), I've
left it alone for now. I don't remember about (C).
Thanks,
Dave
Sorry for those inaccuracies.
Thanks,
-Takahiro AKASHI
> Dave
>
>
> > For example, here frame #6 is missing its dump:
> >
> > crash> bt -f 1
> > PID: 1 TASK: ffffffc3e8890000 CPU: 5 COMMAND: "systemd"
> > #0 [ffffffc3e889bb10] __switch_to at ffffffc000084960
> > ffffffc3e889bb10: ffffffc3e889bb40 ffffffc00062f99c
> > ffffffc3e889bb20: ffffffc3e88e1400 ffffffc3e8898000
> > ffffffc3e889bb30: ffffffc00090d400 ffffffc3e88e1400
> > #1 [ffffffc3e889bb40] __schedule at ffffffc00062f998
> > ffffffc3e889bb40: ffffffc3e889bd00 ffffffc00062fe30
> > ffffffc3e889bb50: 0000000000000000 0000000000000000
> > ffffffc3e889bb60: 0000000000000000 ffffffc3e8898000
> > ffffffc3e889bb70: 0000007fea93aa40 0000000000000000
> > ffffffc3e889bb80: 0000000000000000 0000000000000000
> > ffffffc3e889bb90: ffffffc3e3551f60 ffffffc3e3551f00
> > ffffffc3e889bba0: 0000000000000000 0000000000000000
> > ffffffc3e889bbb0: 0000000000000000 00000000ffffffff
> > ffffffc3e889bbc0: ffffffc00062fe30 ffffffc0007f3af8
> > ffffffc3e889bbd0: ffffffc00098c00c ffffffc00090d400
> > ffffffc3e889bbe0: ffffffc3e889bce0 ffffffc000501290
> > ffffffc3e889bbf0: ffffffc3e889be88 0000000000000800
> > ffffffc3e889bc00: 0000000040000040 ffffffc3e889bd50
> > ffffffc3e889bc10: 0000000000000000 0000000000000000
> > ffffffc3e889bc20: 0000000000000000 ffffffc3e889bc68
> > ffffffc3e889bc30: ffffffc3e8890000 0000000000000000
> > ffffffc3e889bc40: 0000000000000000 0000000000000000
> > ffffffc3e889bc50: 0000000000000000 0000000000000000
> > ffffffc3e889bc60: 0000000000000000 ffffffc000146984
> > ffffffc3e889bc70: 0000000000000000 0000080040000040
> > ffffffc3e889bc80: ffffffc3e3047700 4000000000000000
> > ffffffc3e889bc90: ffffffc3e889bcb0 ffffffc0004ffabc
> > ffffffc3e889bca0: ffffffc3e3047700 ffffffc3e889be88
> > ffffffc3e889bcb0: ffffffc3e889bd00 ffffffc0001e033c
> > ffffffc3e889bcc0: ffffffc3f9a19c18 0000000000000000
> > ffffffc3e889bcd0: ffffffc3e889bdb0 0000007fea93aa40
> > ffffffc3e889bce0: ffffffc3e889be38 ffffffc000502270
> > ffffffc3e889bcf0: ffffffc3e889bd00 ffffffc0001e0318
> > #2 [ffffffc3e889bd00] schedule at ffffffc00062fe2c
> > ffffffc3e889bd00: ffffffc3e889bd10 ffffffc00062f5e8
> > #3 [ffffffc3e889bd10] schedule_hrtimeout_range_clock at
> > ffffffc00062f5e4
> > ffffffc3e889bd10: ffffffc3e889bdb0 ffffffc00062f610
> > ffffffc3e889bd20: 0000000000000001 0000000000000001
> > ffffffc3e889bd30: ffffffc3e34c8300 0000000000000000
> > ffffffc3e889bd40: 0000000000000000 ffffffc3e3551f60
> > ffffffc3e889bd50: ffffffc3e889bd60 ffffffc0001e0b30
> > ffffffc3e889bd60: ffffffc3e889bdc0 ffffffc0001e1a28
> > ffffffc3e889bd70: ffffffffffffffea 0000000000000001
> > ffffffc3e889bd80: ffffffc3e34c8300 ffffffc3e8898000
> > ffffffc3e889bd90: ffffffc3e889bdc0 ffffffc0001e1ae0
> > ffffffc3e889bda0: 0000000000000000 0000000000000001
> > #4 [ffffffc3e889bdb0] schedule_hrtimeout_range at ffffffc00062f60c
> > ffffffc3e889bdb0: ffffffc3e889bdc0 ffffffc0001e1b58
> > #5 [ffffffc3e889bdc0] sys_epoll_wait at ffffffc0001e1b54
> > ffffffc3e889bdc0: ffffffc3e889be70 ffffffc0001e1cfc
> > ffffffc3e889bdd0: 0000000000000004 0000000000000000
> > ffffffc3e889bde0: 0000000000000001 0000000000000004
> > ffffffc3e889bdf0: 0000007fea93aa40 0000000000000015
> > ffffffc3e889be00: 0000000000000112 0000000000000016
> > ffffffc3e889be10: ffffffc00091f000 ffffffc3e8898000
> > ffffffc3e889be20: 0000000000000000 0000000000000000
> > ffffffc3e889be30: ffffffc3e889be50 ffffffc000000001
> > ffffffc3e889be40: 0000007fea93aa40 ffffffc300000001
> > ffffffc3e889be50: ffffffc3e8890000 ffffffc0000cc8f0
> > ffffffc3e889be60: ffffffc3e3551f38 ffffffc3e3551f38
> > #6 [ffffffc3e889be70] sys_epoll_pwait at ffffffc0001e1cf8
> > #7 [ffffffc3e889bed0] cpu_switch_to at ffffffc0000837e8
> > PC: 0000007f8fb55a6c LR: 000000557a5fb704 SP: 0000007fea93a8d0
> > X29: 0000007fea93a8d0 X28: 0000000000000001 X27: 000000557a712000
> > X26: 000000557a683998 X25: 000000557a682ef0 X24: 000000557a681cc0
> > X23: 000000558b51f920 X22: 0000000000000000 X21: 0000007fea93aa40
> > X20: 0000000000000000 X19: 0000000000000004 X18: 0000000000000800
> > X17: 0000007f8fb557e8 X16: 000000557a7125a0 X15: 003b9aca00000000
> > X14: 000a16e0ae000000 X13: ffffffffacbd0ac2 X12: 0000000000000018
> > X11: 000000003a2be47d X10: 0000000000000035 X9: 00000000000013a4
> > X8: 0000000000000016 X7: 0000000000000000 X6: 0000007f8fe3f000
> > X5: 0000000000000008 X4: 0000000000000000 X3: ffffffffffffffff
> > X2: 0000000000000001 X1: 0000007fea93aa40 X0: 0000000000000004
> > ORIG_X0: 0000000000000004 SYSCALLNO: 16 PSTATE: 60000000
> >
> > Without the patch, the dump for frame #6 is there:
> >
> > crash> bt -f 1
> > PID: 1 TASK: ffffffc3e8890000 CPU: 5 COMMAND: "systemd"
> > #0 [ffffffc3e889bb10] __switch_to at ffffffc000084960
> > ffffffc3e889bb10: ffffffc3e889bb40 ffffffc00062f99c
> > ffffffc3e889bb20: ffffffc3e88e1400 ffffffc3e8898000
> > ffffffc3e889bb30: ffffffc00090d400 ffffffc3e88e1400
> > #1 [ffffffc3e889bb40] __schedule at ffffffc00062f998
> > ffffffc3e889bb40: ffffffc3e889bd00 ffffffc00062fe30
> > ffffffc3e889bb50: 0000000000000000 0000000000000000
> > ffffffc3e889bb60: 0000000000000000 ffffffc3e8898000
> > ffffffc3e889bb70: 0000007fea93aa40 0000000000000000
> > ffffffc3e889bb80: 0000000000000000 0000000000000000
> > ffffffc3e889bb90: ffffffc3e3551f60 ffffffc3e3551f00
> > ffffffc3e889bba0: 0000000000000000 0000000000000000
> > ffffffc3e889bbb0: 0000000000000000 00000000ffffffff
> > ffffffc3e889bbc0: ffffffc00062fe30 ffffffc0007f3af8
> > ffffffc3e889bbd0: ffffffc00098c00c ffffffc00090d400
> > ffffffc3e889bbe0: ffffffc3e889bce0 ffffffc000501290
> > ffffffc3e889bbf0: ffffffc3e889be88 0000000000000800
> > ffffffc3e889bc00: 0000000040000040 ffffffc3e889bd50
> > ffffffc3e889bc10: 0000000000000000 0000000000000000
> > ffffffc3e889bc20: 0000000000000000 ffffffc3e889bc68
> > ffffffc3e889bc30: ffffffc3e8890000 0000000000000000
> > ffffffc3e889bc40: 0000000000000000 0000000000000000
> > ffffffc3e889bc50: 0000000000000000 0000000000000000
> > ffffffc3e889bc60: 0000000000000000 ffffffc000146984
> > ffffffc3e889bc70: 0000000000000000 0000080040000040
> > ffffffc3e889bc80: ffffffc3e3047700 4000000000000000
> > ffffffc3e889bc90: ffffffc3e889bcb0 ffffffc0004ffabc
> > ffffffc3e889bca0: ffffffc3e3047700 ffffffc3e889be88
> > ffffffc3e889bcb0: ffffffc3e889bd00 ffffffc0001e033c
> > ffffffc3e889bcc0: ffffffc3f9a19c18 0000000000000000
> > ffffffc3e889bcd0: ffffffc3e889bdb0 0000007fea93aa40
> > ffffffc3e889bce0: ffffffc3e889be38 ffffffc000502270
> > ffffffc3e889bcf0: ffffffc3e889bd00 ffffffc0001e0318
> > #2 [ffffffc3e889bd00] schedule at ffffffc00062fe2c
> > ffffffc3e889bd00: ffffffc3e889bd10 ffffffc00062f5e8
> > #3 [ffffffc3e889bd10] schedule_hrtimeout_range_clock at
> > ffffffc00062f5e4
> > ffffffc3e889bd10: ffffffc3e889bdb0 ffffffc00062f610
> > ffffffc3e889bd20: 0000000000000001 0000000000000001
> > ffffffc3e889bd30: ffffffc3e34c8300 0000000000000000
> > ffffffc3e889bd40: 0000000000000000 ffffffc3e3551f60
> > ffffffc3e889bd50: ffffffc3e889bd60 ffffffc0001e0b30
> > ffffffc3e889bd60: ffffffc3e889bdc0 ffffffc0001e1a28
> > ffffffc3e889bd70: ffffffffffffffea 0000000000000001
> > ffffffc3e889bd80: ffffffc3e34c8300 ffffffc3e8898000
> > ffffffc3e889bd90: ffffffc3e889bdc0 ffffffc0001e1ae0
> > ffffffc3e889bda0: 0000000000000000 0000000000000001
> > #4 [ffffffc3e889bdb0] schedule_hrtimeout_range at ffffffc00062f60c
> > ffffffc3e889bdb0: ffffffc3e889bdc0 ffffffc0001e1b58
> > #5 [ffffffc3e889bdc0] sys_epoll_wait at ffffffc0001e1b54
> > ffffffc3e889bdc0: ffffffc3e889be70 ffffffc0001e1cfc
> > ffffffc3e889bdd0: 0000000000000004 0000000000000000
> > ffffffc3e889bde0: 0000000000000001 0000000000000004
> > ffffffc3e889bdf0: 0000007fea93aa40 0000000000000015
> > ffffffc3e889be00: 0000000000000112 0000000000000016
> > ffffffc3e889be10: ffffffc00091f000 ffffffc3e8898000
> > ffffffc3e889be20: 0000000000000000 0000000000000000
> > ffffffc3e889be30: ffffffc3e889be50 ffffffc000000001
> > ffffffc3e889be40: 0000007fea93aa40 ffffffc300000001
> > ffffffc3e889be50: ffffffc3e8890000 ffffffc0000cc8f0
> > ffffffc3e889be60: ffffffc3e3551f38 ffffffc3e3551f38
> > #6 [ffffffc3e889be70] sys_epoll_pwait at ffffffc0001e1cf8
> > ffffffc3e889be70: 0000007fea93a8d0 ffffffc0000837ec
> > ffffffc3e889be80: 0000000000000004 0000000000000000
> > ffffffc3e889be90: ffffffffffffffff 0000007f8fb55a6c
> > ffffffc3e889bea0: 0000000060000000 0000007fea9396e0
> > ffffffc3e889beb0: 0000000000001010 0000000040000000
> > ffffffc3e889bec0: 0000007fea93a700 ffffffc0000837ec
> > #7 [ffffffc3e889bed0] cpu_switch_to at ffffffc0000837e8
> > PC: 0000007f8fb55a6c LR: 000000557a5fb704 SP: 0000007fea93a8d0
> > X29: 0000007fea93a8d0 X28: 0000000000000001 X27: 000000557a712000
> > X26: 000000557a683998 X25: 000000557a682ef0 X24: 000000557a681cc0
> > X23: 000000558b51f920 X22: 0000000000000000 X21: 0000007fea93aa40
> > X20: 0000000000000000 X19: 0000000000000004 X18: 0000000000000800
> > X17: 0000007f8fb557e8 X16: 000000557a7125a0 X15: 003b9aca00000000
> > X14: 000a16e0ae000000 X13: ffffffffacbd0ac2 X12: 0000000000000018
> > X11: 000000003a2be47d X10: 0000000000000035 X9: 00000000000013a4
> > X8: 0000000000000016 X7: 0000000000000000 X6: 0000007f8fe3f000
> > X5: 0000000000000008 X4: 0000000000000000 X3: ffffffffffffffff
> > X2: 0000000000000001 X1: 0000007fea93aa40 X0: 0000000000000004
> > ORIG_X0: 0000000000000004 SYSCALLNO: 16 PSTATE: 60000000
> >
> > Dave
> >
> >
> >
> > ----- Original Message -----
> > > Dave,
> > >
> > > On Wed, Oct 18, 2017 at 02:12:17PM -0400, Dave Anderson wrote:
> > > >
> > > >
> > > > ----- Original Message -----
> > > > > On Tue, Oct 17, 2017 at 03:44:36PM -0400, Dave Anderson wrote:
> > > > > >
> > > > > > Thanks Takahiro, much appreciated. Queued for
crash-7.2.1:
> > > > > >
> > > > > >
https://github.com/crash-utility/crash/commit/2b93c036edf2a5cc21a06a14f37...
> > > > >
> > > > > Oops, I've made small changes, nothing essential but some
sort of
> > > > > clean-ups/readability improvements with deleting incomplete
fixes
> > > > > against "bt -o."
> > > >
> > > > Hmmm, except it's kind of difficult to pick through the patch
below
> > > > for the changes, given that it's a combination of your original
patch
> > > > plus the new changes. So I can't apply it to get a clean view
of
> > > > the new changes. I do see that it's mostly the stacksize and
> > > > stackframe
> > > > related updates, but would it be possible for you to make a patch
> > > > that can be applied to the github sources?
> > >
> > > Here is what you requested. Pls check.
> > >
> > > Thanks,
> > > -Takahiro AKASHI
> > >
> > > ===8<===
> > > >From 7b99a1c2e688ba81e18541c21a7d0fa70504e5bc Mon Sep 17 00:00:00
2001
> > > From: AKASHI Takahiro <takahiro.akashi(a)linaro.org>
> > > Date: Thu, 19 Oct 2017 10:18:22 +0900
> > > Subject: [PATCH] arm64: bt: cleanup stuff
> > >
> > > ---
> > > arm64.c | 159
> > > +++++++++++++++++++++++++++++++++-------------------------------
> > > defs.h | 3 ++
> > > task.c | 2 +
> > > 3 files changed, 86 insertions(+), 78 deletions(-)
> > >
> > > diff --git a/arm64.c b/arm64.c
> > > index c75669b..1f742d4 100644
> > > --- a/arm64.c
> > > +++ b/arm64.c
> > > @@ -612,6 +612,7 @@ arm64_dump_machdep_table(ulong arg)
> > > fprintf(fp, " exp_entry2_end: %lx\n",
ms->exp_entry2_end);
> > > fprintf(fp, " panic_task_regs: %lx\n",
> > > (ulong)ms->panic_task_regs);
> > > fprintf(fp, " user_eframe_offset: %ld\n",
ms->user_eframe_offset);
> > > + fprintf(fp, " kern_eframe_offset: %ld\n",
ms->kern_eframe_offset);
> > > fprintf(fp, " PTE_PROT_NONE: %lx\n",
ms->PTE_PROT_NONE);
> > > fprintf(fp, " PTE_FILE: ");
> > > if (ms->PTE_FILE)
> > > @@ -1383,7 +1384,7 @@ arm64_irq_stack_init(void)
> > >
> > > if (!(ms->irq_stacks = (ulong *)malloc((size_t)(kt->cpus *
> > > sizeof(ulong)))))
> > > error(FATAL, "cannot malloc irq_stack addresses\n");
> > > - ms->irq_stack_size = 16384;
> > > + ms->irq_stack_size = ARM64_IRQ_STACK_SIZE;
> > > machdep->flags |= IRQ_STACKS;
> > >
> > > for (i = 0; i < kt->cpus; i++) {
> > > @@ -1410,10 +1411,13 @@ arm64_stackframe_init(void)
> > > MEMBER_OFFSET_INIT(elf_prstatus_pr_pid, "elf_prstatus",
"pr_pid");
> > > MEMBER_OFFSET_INIT(elf_prstatus_pr_reg, "elf_prstatus",
"pr_reg");
> > >
> > > - if (MEMBER_EXISTS("pt_regs", "stackframe"))
> > > + if (MEMBER_EXISTS("pt_regs", "stackframe")) {
> > > machdep->machspec->user_eframe_offset = SIZE(pt_regs);
> > > - else
> > > + machdep->machspec->kern_eframe_offset = SIZE(pt_regs) - 16;
> > > + } else {
> > > machdep->machspec->user_eframe_offset = SIZE(pt_regs) + 16;
> > > + machdep->machspec->kern_eframe_offset = SIZE(pt_regs);
> > > + }
> > >
> > > machdep->machspec->__exception_text_start =
> > > symbol_value("__exception_text_start");
> > > @@ -1503,6 +1507,7 @@ arm64_stackframe_init(void)
> > > #define USER_MODE (2)
> > >
> > > #define USER_EFRAME_OFFSET (machdep->machspec->user_eframe_offset)
> > > +#define KERN_EFRAME_OFFSET (machdep->machspec->kern_eframe_offset)
> > >
> > > /*
> > > * PSR bits
> > > @@ -1778,7 +1783,7 @@ arm64_display_full_frame(struct bt_info *bt,
> > > ulong
> > > sp)
> > > ulong words, addr;
> > > char buf[BUFSIZE];
> > >
> > > - if (bt->frameptr == sp)
> > > + if (bt->frameptr >= sp)
> > > return;
> > >
> > > if (INSTACK(bt->frameptr, bt)) {
> > > @@ -1793,7 +1798,7 @@ arm64_display_full_frame(struct bt_info *bt,
> > > ulong
> > > sp)
> > > sp = bt->stacktop;
> > > }
> > > } else {
> > > - /* IRQ exception frame */
> > > + /* This is a transition case from irq to process stack. */
> > > return;
> > > }
> > >
> > > @@ -1903,61 +1908,73 @@ arm64_unwind_frame(struct bt_info *bt, struct
> > > arm64_stackframe *frame)
> > > if (!(machdep->flags & IRQ_STACKS))
> > > return TRUE;
> > >
> > > - /*
> > > - * The kernel's manner of determining the end of the IRQ stack:
> > > - *
> > > - * #define THREAD_SIZE 16384
> > > - * #define THREAD_START_SP (THREAD_SIZE - 16)
> > > - * #define IRQ_STACK_START_SP THREAD_START_SP
> > > - * #define IRQ_STACK_PTR(cpu) ((unsigned long)per_cpu(irq_stack,
> > > cpu) +
> > > IRQ_STACK_START_SP)
> > > - * #define IRQ_STACK_TO_TASK_STACK(ptr) (*((unsigned long *)((ptr) -
> > > 0x08)))
> > > - *
> > > - * irq_stack_ptr = IRQ_STACK_PTR(raw_smp_processor_id());
> > > - * orig_sp = IRQ_STACK_TO_TASK_STACK(irq_stack_ptr); (pt_regs
> > > pointer
> > > on
> > > process stack)
> > > - */
> > > + if (!(machdep->flags & IRQ_STACKS))
> > > + return TRUE;
> > > +
> > > if (machdep->flags & UNW_4_14) {
> > > if ((bt->flags & BT_IRQSTACK) &&
> > > !arm64_on_irq_stack(bt->tc->processor, frame->fp)) {
> > > if (arm64_on_process_stack(bt, frame->fp)) {
> > > arm64_set_process_stack(bt);
> > >
> > > - frame->sp = frame->fp - SIZE(pt_regs) + 16;
> > > - /* for switch_stack */
> > > - /* fp still points to irq stack */
> > > + frame->sp = frame->fp - KERN_EFRAME_OFFSET;
> > > + /*
> > > + * for switch_stack
> > > + * fp still points to irq stack
> > > + */
> > > bt->bptr = fp;
> > > - /* for display_full_frame */
> > > - /* sp points to process stack */
> > > - bt->frameptr = frame->sp;
> > > + /*
> > > + * for display_full_frame
> > > + * sp points to process stack
> > > + *
> > > + * If we want to see pt_regs,
> > > + * comment out the below.
> > > + * bt->frameptr = frame->sp;
> > > + */
> > > } else {
> > > /* irq -> user */
> > > return FALSE;
> > > }
> > > }
> > > - } else { /* !UNW_4_14 */
> > > - ms = machdep->machspec;
> > > - irq_stack_ptr = ms->irq_stacks[bt->tc->processor] +
> > > ms->irq_stack_size -
> > > 16;
> > > -
> > > - if (frame->sp == irq_stack_ptr) {
> > > - orig_sp = GET_STACK_ULONG(irq_stack_ptr - 8);
> > > - arm64_set_process_stack(bt);
> > > - if (INSTACK(orig_sp, bt) && (INSTACK(frame->fp, bt) ||
(frame->fp
> > > ==
> > > 0)))
> > > {
> > > - ptregs = (struct arm64_pt_regs
> > > *)&bt->stackbuf[(ulong)(STACK_OFFSET_TYPE(orig_sp))];
> > > - frame->sp = orig_sp;
> > > - frame->pc = ptregs->pc;
> > > - bt->bptr = fp;
> > > - if (CRASHDEBUG(1))
> > > - error(INFO,
> > > - "arm64_unwind_frame: switch stacks: fp: %lx sp: %lx pc:
> > > %lx\n",
> > > - frame->fp, frame->sp, frame->pc);
> > > - } else {
> > > - error(WARNING,
> > > - "arm64_unwind_frame: on IRQ stack: oriq_sp: %lx%s fp:
> > > %lx%s\n",
> > > - orig_sp, INSTACK(orig_sp, bt) ? "" : " (?)",
> > > - frame->fp, INSTACK(frame->fp, bt) ? "" : "
(?)");
> > > - return FALSE;
> > > - }
> > > +
> > > + return TRUE;
> > > + }
> > > +
> > > + /*
> > > + * The kernel's manner of determining the end of the IRQ stack:
> > > + *
> > > + * #define THREAD_SIZE 16384
> > > + * #define THREAD_START_SP (THREAD_SIZE - 16)
> > > + * #define IRQ_STACK_START_SP THREAD_START_SP
> > > + * #define IRQ_STACK_PTR(cpu) ((unsigned long)per_cpu(irq_stack,
> > > cpu) +
> > > IRQ_STACK_START_SP)
> > > + * #define IRQ_STACK_TO_TASK_STACK(ptr) (*((unsigned long *)((ptr) -
> > > 0x08)))
> > > + *
> > > + * irq_stack_ptr = IRQ_STACK_PTR(raw_smp_processor_id());
> > > + * orig_sp = IRQ_STACK_TO_TASK_STACK(irq_stack_ptr); (pt_regs
> > > pointer
> > > on
> > > process stack)
> > > + */
> > > + ms = machdep->machspec;
> > > + irq_stack_ptr = ms->irq_stacks[bt->tc->processor] +
> > > ms->irq_stack_size -
> > > 16;
> > > +
> > > + if (frame->sp == irq_stack_ptr) {
> > > + orig_sp = GET_STACK_ULONG(irq_stack_ptr - 8);
> > > + arm64_set_process_stack(bt);
> > > + if (INSTACK(orig_sp, bt) && (INSTACK(frame->fp, bt) ||
(frame->fp ==
> > > 0)))
> > > {
> > > + ptregs = (struct arm64_pt_regs
> > > *)&bt->stackbuf[(ulong)(STACK_OFFSET_TYPE(orig_sp))];
> > > + frame->sp = orig_sp;
> > > + frame->pc = ptregs->pc;
> > > + bt->bptr = fp;
> > > + if (CRASHDEBUG(1))
> > > + error(INFO,
> > > + "arm64_unwind_frame: switch stacks: fp: %lx sp: %lx pc:
> > > %lx\n",
> > > + frame->fp, frame->sp, frame->pc);
> > > + } else {
> > > + error(WARNING,
> > > + "arm64_unwind_frame: on IRQ stack: oriq_sp: %lx%s fp:
%lx%s\n",
> > > + orig_sp, INSTACK(orig_sp, bt) ? "" : " (?)",
> > > + frame->fp, INSTACK(frame->fp, bt) ? "" : "
(?)");
> > > + return FALSE;
> > > }
> > > - } /* UNW_4_14 */
> > > + }
> > >
> > > return TRUE;
> > > }
> > > @@ -2147,17 +2164,10 @@ arm64_unwind_frame_v2(struct bt_info *bt,
> > > struct
> > > arm64_stackframe *frame,
> > > * We are on process stack. Just add a faked frame
> > > */
> > >
> > > - if (!arm64_on_irq_stack(bt->tc->processor, ext_frame.fp)) {
> > > - if (MEMBER_EXISTS("pt_regs", "stackframe")) {
> > > - frame->sp = ext_frame.fp
> > > - - sizeof(struct arm64_pt_regs) - 16;
> > > - frame->fp = ext_frame.fp;
> > > - } else {
> > > - frame->sp = ext_frame.fp
> > > - - sizeof(struct arm64_pt_regs);
> > > - frame->fp = frame->sp;
> > > - }
> > > - } else {
> > > + if (!arm64_on_irq_stack(bt->tc->processor, ext_frame.fp))
> > > + frame->sp = ext_frame.fp
> > > + - sizeof(struct arm64_pt_regs);
> > > + else {
> > > /*
> > > * FIXME: very exceptional case
> > > * We are already back on process stack, but
> > > @@ -2177,10 +2187,10 @@ arm64_unwind_frame_v2(struct bt_info *bt,
> > > struct
> > > arm64_stackframe *frame,
> > > * Really ugly
> > > */
> > > frame->sp = frame->fp + 0x20;
> > > - frame->fp = frame->sp;
> > > fprintf(ofp, " (Next exception frame might be wrong)\n");
> > > }
> > >
> > > + frame->fp = frame->sp;
> > > } else {
> > > /* We are on IRQ stack */
> > >
> > > @@ -2190,15 +2200,9 @@ arm64_unwind_frame_v2(struct bt_info *bt, struct
> > > arm64_stackframe *frame,
> > > if (ext_frame.fp != irq_stack_ptr) {
> > > /* (2) Just add a faked frame */
> > >
> > > - if (MEMBER_EXISTS("pt_regs", "stackframe")) {
> > > - frame->sp = ext_frame.fp
> > > - - sizeof(struct arm64_pt_regs);
> > > - frame->fp = ext_frame.fp;
> > > - } else {
> > > - frame->sp = ext_frame.fp
> > > - - sizeof(struct arm64_pt_regs) - 16;
> > > - frame->fp = frame->sp;
> > > - }
> > > + frame->sp = ext_frame.fp
> > > + - sizeof(struct arm64_pt_regs);
> > > + frame->fp = frame->sp;
> > > } else {
> > > /*
> > > * (3)
> > > @@ -2285,6 +2289,11 @@ arm64_back_trace_cmd(struct bt_info *bt)
> > > FILE *ofp;
> > >
> > > if (bt->flags & BT_OPT_BACK_TRACE) {
> > > + if (machdep->flags & UNW_4_14) {
> > > + error(WARNING, "\"-o\" is no longer supported for this
version of
> > > kernel.
> > > Please use bt\n");
> > > + return;
> > > + }
> > > +
> > > arm64_back_trace_cmd_v2(bt);
> > > return;
> > > }
> > > @@ -2346,7 +2355,7 @@ arm64_back_trace_cmd(struct bt_info *bt)
> > > goto complete_user;
> > >
> > > if (DUMPFILE() && is_task_active(bt->task)) {
> > > - exception_frame = stackframe.fp - SIZE(pt_regs);
> > > + exception_frame = stackframe.fp - KERN_EFRAME_OFFSET;
> > > if (arm64_is_kernel_exception_frame(bt, exception_frame))
> > > arm64_print_exception_frame(bt, exception_frame,
> > > KERNEL_MODE, ofp);
> > > @@ -2377,13 +2386,9 @@ arm64_back_trace_cmd(struct bt_info *bt)
> > >
> > > if (arm64_in_exception_text(bt->instptr) &&
INSTACK(stackframe.fp,
> > > bt))
> > > {
> > > if (!(bt->flags & BT_IRQSTACK) ||
> > > - (((stackframe.sp + SIZE(pt_regs)) < bt->stacktop))) {
> > > - if (MEMBER_EXISTS("pt_regs", "stackframe"))
> > > - /* v4.14 or later */
> > > - exception_frame = stackframe.fp - SIZE(pt_regs) + 16;
> > > - else
> > > - exception_frame = stackframe.fp - SIZE(pt_regs);
> > > - }
> > > + (((stackframe.sp + SIZE(pt_regs)) < bt->stacktop)))
> > > + exception_frame = stackframe.fp
> > > + - KERN_EFRAME_OFFSET;
> > > }
> > >
> > > if ((bt->flags & BT_IRQSTACK) &&
> > > @@ -2503,8 +2508,6 @@ user_space:
> > > * otherwise show an exception frame.
> > > * Since exception entry code doesn't have a real
> > > * stackframe, we fake a dummy frame here.
> > > - * Note: Since we have a real stack frame in pt_regs,
> > > - * We no longer need a dummy frame on v4.14 or later.
> > > */
> > > if (!arm64_in_exp_entry(stackframe.pc))
> > > continue;
> > > diff --git a/defs.h b/defs.h
> > > index 7768895..a694a66 100644
> > > --- a/defs.h
> > > +++ b/defs.h
> > > @@ -3038,6 +3038,7 @@ typedef signed int s32;
> > > #define ARM64_VMEMMAP_END (ARM64_VMEMMAP_VADDR + GIGABYTES(8UL) -
> > > 1)
> > >
> > > #define ARM64_STACK_SIZE (16384)
> > > +#define ARM64_IRQ_STACK_SIZE ARM64_STACK_SIZE
> > >
> > > #define _SECTION_SIZE_BITS 30
> > > #define _MAX_PHYSMEM_BITS 40
> > > @@ -3117,6 +3118,8 @@ struct machine_specific {
> > > ulong kimage_text;
> > > ulong kimage_end;
> > > ulong user_eframe_offset;
> > > + /* for v4.14 or later */
> > > + ulong kern_eframe_offset;
> > > };
> > >
> > > struct arm64_stackframe {
> > > diff --git a/task.c b/task.c
> > > index 2b12af0..23c2b7b 100644
> > > --- a/task.c
> > > +++ b/task.c
> > > @@ -6750,6 +6750,8 @@ panic_search(void)
> > > fd->keyword_array[0] = FOREACH_BT;
> > > if (machine_type("S390X"))
> > > fd->flags |= FOREACH_o_FLAG;
> > > + else if (machine_type("ARM64") && (machdep->flags
& UNW_4_14))
> > > + fd->flags |= FOREACH_t_FLAG;
> > > else
> > > fd->flags |= (FOREACH_t_FLAG|FOREACH_o_FLAG);
> > >
> > > --
> > > 2.14.1
> > >
> > > --
> > > Crash-utility mailing list
> > > Crash-utility(a)redhat.com
> > >
https://www.redhat.com/mailman/listinfo/crash-utility
> > >
> >
> > --
> > Crash-utility mailing list
> > Crash-utility(a)redhat.com
> >
https://www.redhat.com/mailman/listinfo/crash-utility
> >
>
> --
> Crash-utility mailing list
> Crash-utility(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/crash-utility
--
Crash-utility mailing list
Crash-utility(a)redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility