Fw: Cross architecture analysis for Crash
by Petr Tesarik
I'm taking this thread to the crash-utility mailing list.
I don't know why it didn't get there...
Begin forwarded message:
Date: Wed, 19 Jun 2013 15:33:29 +0200
From: Petr Tesarik <ptesarik(a)suse.cz>
To: kexec(a)lists.infradead.org
Subject: Re: Cross architecture analysis for Crash
On Fri, 14 Jun 2013 15:40:02 +0530
"Suzuki K. Poulose" <suzuki(a)in.ibm.com> wrote:
> Hi,
>
> We have been working on enabling 'cross' analysis support for
> Crash, where the target and the host differ in endian-ness.
>
> For e.g, analysing a powerpc dump on an Intel box.
>
> This would be useful for debugging the dumps captured on an
> embedded board (say ppc44x), on a normal desktop PC(Intel based).
>
> While the patches are being tested for 'Crash' utility we came
> across a problem with the analysis of the compressed dump formats(aka
> diskdump). There is no information about the endian-ness of the dump
> unlike the ELF format. Hence, we need to embed this information during
> the makedumpfile processing of vmcores.
>
> Here are some of the options we thought about :
>
> 1) Interpret the new_utsname.machine and decode the endian-ness/word
> size.
>
> 2) Extend the signature string to contain information about the
> endian-ness / word size.
>
> e.g, KDUMPB64 - for KDUMP, BigEndian 64bit
I had the same issue with a dump identification tool. I ended up with
checking whether the fields are "sane" if interpreted in a specific
way. You may want to check my code here:
http://sourceforge.net/projects/kdumpid/
I agree that this is ugly and a better approach would be to store the
information in the header, but then you would not be able to read
legacy dumps, which is a major drawback.
BTW how far did you get with a cross-platform crash? I did some research
on this subject earlier, so maybe I can help you avoid some dead ends..?
HTH,
Petr Tesarik
11 years, 5 months
[ANNOUNCE] crash-7.0.1 is available
by Dave Anderson
Download from: http://people.redhat.com/anderson
Changelog:
- Fix the -I include path sequence in the extensions/eppic.mk file to
prevent a series of "redefined" and "redeclaration" warnings when
compiling the EPPIC extension module.
(anderson(a)redhat.com)
- Address two compile-time warnings generated as a result of the
gdb-7.6.patch. Without the patch, there are "warning: no previous
prototype" warnings for gdb_main_entry() and replace_ui_file_FILE().
(anderson(a)redhat.com)
- Implemented a new "mod -t" option that walks through the installed
modules and checks for non-zero values in each module's "taints"
bitmask, and translates the bits into symbolic letters if possible,
or shows the hexadecimal value of the bitmask if not. In older
kernels, the "license_gplok" field is checked, and if non-zero, its
value is displayed in hexadecimal. Lastly, if the "gpgsig_ok" member
exists and is zero, a "(U)" notation will also be displayed.
(atomlin(a)redhat.com, anderson(a)redhat.com)
- Fixed compiler warnings generated by extensions/trace.c when compiled
with -DFORTIFY_SOURCE=2. Without the patch, the messages "warning:
ignoring return value of 'mktemp', declared with attribute
warn_unused_result", "warning: ignoring return value of 'fwrite',
declared with attribute warn_unused_result", and "warning:
'trace_dat' may be used uninitialized in this function" are
generated.
(anderson(a)redhat.com)
- Laid down the basic infrastructure for the ARM64 backtrace facility
using the kernel's arm64 unwind facility as a basis. Compile-tested
only.
(anderson(a)redhat.com)
- Implemented the ARM64 virtual-to-physical kernel and user address
translation functions, supporting both 2-level page tables with
64K pages, and 3-level page tables with 4K pages. Also added the
associated PTE translator function. Compile-tested only.
(anderson(a)redhat.com)
- Implemented the capability of building crash as an x86_64 binary
for analyzing ARM64 dumpfiles on an x86_64 host, which can be done
by entering "make target=ARM64". After the initial build is
complete, subsequent builds can be done by entering "make" alone.
(anderson(a)redhat.com)
- Added "aarch64" to the ExclusiveArch: line in the crash.spec file.
(anderson(a)redhat.com)
- Fix for the S390X "bt" command for Linux 3.10 and later kernels.
Without the patch, the starting stack location of the per-cpu async
and panic stacks of active tasks would be incorrectly determined.
(holzheu(a)linux.vnet.ibm.com)
11 years, 5 months
[PATCH] s390x: Fix linux-3.10 backtrace for interrupt stacks
by Michael Holzheu
Hi Dave,
The following upstream kernel git commit introduced a crash regression
in v3.10-rc1 for s390x:
commit dc7ee00d4771b3218b10e09e1071ee6eb176d381
Date: Wed Apr 24 10:20:43 2013 +0200
s390: lowcore stack pointer offsets
Store the stack pointers in the lowcore for the kernel stack, the async
stack and the panic stack with the offset required for the first user.
This avoids an unnecessary add instruction on the system call path.
- lc->async_stack = pcpu->async_stack + ASYNC_SIZE;
- lc->panic_stack = pcpu->panic_stack + PAGE_SIZE;
+ lc->async_stack = pcpu->async_stack + ASYNC_SIZE
+ - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
+ lc->panic_stack = pcpu->panic_stack + PAGE_SIZE
+ - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
The s390x crash code uses lowcore->panic/async_stack to find out the
location of the per-cpu stacks. With the above kernel change this is
no longer correct. For newer kernels with the "pcpu_devices" array
there is a second location where the stacks are stored. With this
patch we use the new location if available.
Signed-off-by: Michael Holzheu <holzheu(a)linux.vnet.ibm.com>
---
s390x.c | 42 ++++++++++++++++++++++++++++++++++--------
1 file changed, 34 insertions(+), 8 deletions(-)
--- a/s390x.c
+++ b/s390x.c
@@ -913,10 +913,34 @@ s390x_get_lowcore(struct bt_info *bt, ch
}
/*
+ * Get stack address for interrupt stack using the pcpu array
+ */
+static unsigned long get_int_stack_pcpu(char *stack_name, int cpu)
+{
+ unsigned long addr;
+
+ if (!MEMBER_EXISTS("pcpu", stack_name))
+ return 0;
+ addr = symbol_value("pcpu_devices") +
+ cpu * STRUCT_SIZE("pcpu") + MEMBER_OFFSET("pcpu", stack_name);
+ return readmem_ul(addr) + INT_STACK_SIZE;
+}
+
+/*
+ * Get stack address for interrupt stack using the lowcore
+ */
+static unsigned long get_int_stack_lc(char *stack_name, char *lc)
+{
+ if (!MEMBER_EXISTS(lc_struct, stack_name))
+ return 0;
+ return ULONG(lc + MEMBER_OFFSET(lc_struct, stack_name));
+}
+
+/*
* Read interrupt stack (either "async_stack" or "panic_stack");
*/
-static void get_int_stack(char *stack_name, char *lc, unsigned long *start,
- unsigned long *end)
+static void get_int_stack(char *stack_name, int cpu, char *lc,
+ unsigned long *start, unsigned long *end)
{
unsigned long stack_addr;
@@ -925,9 +949,10 @@ static void get_int_stack(char *stack_na
stack_addr = symbol_value("restart_stack");
stack_addr = readmem_ul(stack_addr);
} else {
- if (!MEMBER_EXISTS(lc_struct, stack_name))
- return;
- stack_addr = ULONG(lc + MEMBER_OFFSET(lc_struct, stack_name));
+ if (symbol_exists("pcpu_devices"))
+ stack_addr = get_int_stack_pcpu(stack_name, cpu);
+ else
+ stack_addr = get_int_stack_lc(stack_name, lc);
}
if (stack_addr == 0)
return;
@@ -1157,12 +1182,13 @@ static void s390x_back_trace_cmd(struct
s390x_print_lowcore(lowcore,bt,1);
fprintf(fp,"\n");
if (symbol_exists("restart_stack")) {
- get_int_stack("restart_stack", lowcore, &low, &high);
+ get_int_stack("restart_stack",
+ cpu, lowcore, &low, &high);
sp = show_trace(bt, cnt, sp, low, high);
}
- get_int_stack("panic_stack", lowcore, &low, &high);
+ get_int_stack("panic_stack", cpu, lowcore, &low, &high);
sp = show_trace(bt, cnt, sp, low, high);
- get_int_stack("async_stack", lowcore, &low, &high);
+ get_int_stack("async_stack", cpu, lowcore, &low, &high);
sp = show_trace(bt, cnt, sp, low, high);
}
/*
11 years, 5 months