From: Yadviga <yadviga@mvista.com>
To: kexec@lists.infradead.org
Subject: separate lowmem and highmem in crashdump segments for ppc32
Date: Fri, 28 Feb 2014 15:48:43 +0400 [thread overview]
Message-ID: <5310779B.8050400@mvista.com> (raw)
In-Reply-To: <530FA89D.2010105@mvista.com>
[-- Attachment #1: Type: text/plain, Size: 3239 bytes --]
Hello all
I would like to suggest the patch for ppc32 arch against kexec-2.0.5.
Could you please include it into kexec tools.
The patch separates highmem and lowmem.
Usually highmem and lowmem merges in common segment.
Virtual addresses for this segment are invalid because code from
crashdump-elf.c set virtual address -1 for lowmem
addresses if they share segment with highmem addresses.
/* HIGMEM has a virtual address of -1 */
if (elf_info->lowmem_limit
&& (mend > (elf_info->lowmem_limit - 1)))
phdr->p_vaddr = -1;
The patch locates them in different segments.
So lowmem will have the valid virtual address
This is result of gdb backtrace before applying the patch.
powerpc-montavista-linux-gnuspe-gdb vmlinux /opt/tmp/vmcore_kexec2.0.5
GNU gdb (MontaVista Linux G++ 4.7-140117041417) 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=i686-pc-linux-gnu
--target=powerpc-montavista-linux-gnuspe".
For bug reporting instructions, please see:
<http://support.mvista.com/>...
Reading symbols from /home/yadviga/MVL7/mvl7kernel_jan/vmlinux...done.
[New LWP 1993]
#0 0xc033c1e0 in sysrq_handle_crash (key=99) at drivers/tty/sysrq.c:138
138 *killer = 1;
(gdb) bt
#0 0xc033c1e0 in sysrq_handle_crash (key=99) at drivers/tty/sysrq.c:138
#1 0xc033ca68 in __handle_sysrq (key=99,
key@entry=<error reading variable: Cannot access memory at address
0xcf6a5ed4>,
check_mask=<optimized out>) at drivers/tty/sysrq.c:533
(gdb)
Here is backtrace after aapying the patch. Backtrace looks better.
powerpc-montavista-linux-gnuspe-gdb vmlinux /opt/tmp/vmcore
GNU gdb (MontaVista Linux G++ 4.7-140117041417) 7.6
...
Reading symbols from /home/yadviga/MVL7/mvl7kernel_jan/vmlinux...done.
[New LWP 1969]
#0 0xc033c1e0 in sysrq_handle_crash (key=99) at drivers/tty/sysrq.c:138
138 *killer = 1;
(gdb) bt
#0 0xc033c1e0 in sysrq_handle_crash (key=99) at drivers/tty/sysrq.c:138
#1 0xc033ca68 in __handle_sysrq (key=99,
check_mask=check_mask@entry=false) at drivers/tty/sysrq.c:533
#2 0xc033cb24 in write_sysrq_trigger (file=<optimized out>,
buf=<optimized out>, count=2,
ppos=<optimized out>) at drivers/tty/sysrq.c:1030
#3 0xc0192654 in proc_reg_write (file=<optimized out>, buf=<optimized
out>, count=<optimized out>,
ppos=<optimized out>) at fs/proc/inode.c:224
#4 0xc0135dd4 in vfs_write (file=file@entry=0xcfb2e480,
buf=buf@entry=0x1011b408 <Address 0x1011b408 out of bounds>,
count=count@entry=2,
pos=pos@entry=0xcf063f18) at fs/read_write.c:446
#5 0xc0136258 in SYSC_write (count=2, buf=0x1011b408 <Address
0x1011b408 out of bounds>, fd=<optimized out>)
at fs/read_write.c:494
#6 SyS_write (fd=<optimized out>, buf=269595656, count=2) at
fs/read_write.c:487
#7 0xc000ed08 in syscall_dotrace_cont () at
arch/powerpc/kernel/entry_32.S:385
Backtrace stopped: frame did not save the PC
(gdb)
Best regards
Yadviga
[-- Attachment #2: separate-highmem-lowmem.patch --]
[-- Type: text/plain, Size: 2202 bytes --]
From f8454324a060b997b652362fdaa2f01a7c548cc0 Mon Sep 17 00:00:00 2001
From: Yadviga Grigoryeva <yadviga@mvista.com>
Date: Fri, 28 Feb 2014 00:49:59 +0400
Subject: [PATCH] separate highmem and lowmem for ppc32
The patch separates highmem and lowmem.
Usually highmem and lowmem merges in common segment.
Virtual addresses for this segment are invalid because
code from crashdump-elf.c set virtual address -1 for lowmem
addresses if they share segment with highmem addresses
/* HIGMEM has a virtual address of -1 */
if (elf_info->lowmem_limit
&& (mend > (elf_info->lowmem_limit - 1)))
phdr->p_vaddr = -1;
The patch locates them in different segments.
So lowmem will have the valid virtual address
Signed-off-by: Yadviga Grigoryeva <yadviga@mvista.com>
---
kexec/arch/ppc/crashdump-powerpc.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/kexec/arch/ppc/crashdump-powerpc.c b/kexec/arch/ppc/crashdump-powerpc.c
index c06d310..39a12ca 100644
--- a/kexec/arch/ppc/crashdump-powerpc.c
+++ b/kexec/arch/ppc/crashdump-powerpc.c
@@ -214,6 +214,34 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges)
crash_memory_range[memory_ranges++].end = cend;
}
+#ifndef CONFIG_PPC64
+ /* separate lowmem and highmem in segment */
+ if (memory_ranges < crash_max_memory_ranges ) {
+ int k,l;
+ for (l=0; l<memory_ranges; l++) {
+ if (crash_memory_range[l].start <
+ elf_info32.lowmem_limit &&
+ crash_memory_range[l].end >
+ elf_info32.lowmem_limit) {
+ /* shift crash_memory_range */
+ for (k=memory_ranges; k>l; k--) {
+ crash_memory_range[k].start
+ = crash_memory_range[k-1].start;
+ crash_memory_range[k].end
+ = crash_memory_range[k-1].end;
+ crash_memory_range[k].type
+ = crash_memory_range[k-1].type;
+ }
+ memory_ranges++;
+ crash_memory_range[l].end
+ = elf_info32.lowmem_limit;
+ crash_memory_range[l+1].start
+ = elf_info32.lowmem_limit;
+ break;
+ }
+ }
+ }
+#endif
*range = crash_memory_range;
*ranges = memory_ranges;
--
1.6.3.3.334.gb7e98.dirty
[-- Attachment #3: Type: text/plain, Size: 143 bytes --]
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
parent reply other threads:[~2014-02-28 11:55 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <530FA89D.2010105@mvista.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5310779B.8050400@mvista.com \
--to=yadviga@mvista.com \
--cc=kexec@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox