From: Fredrik Noring <noring@nocrew.org>
To: "Maciej W. Rozycki" <macro@mips.com>
Cc: "Jürgen Urban" <JuergenUrban@gmx.de>, linux-mips@linux-mips.org
Subject: Re: [RFC v2] MIPS: R5900: Workaround exception NOP execution bug (FLX05)
Date: Sat, 17 Feb 2018 12:16:46 +0100 [thread overview]
Message-ID: <20180217111644.GA2496@localhost.localdomain> (raw)
In-Reply-To: <alpine.DEB.2.00.1802151934180.3553@tp.orcam.me.uk>
Hi Maciej,
> You could use /dev/mem to inspect exception handlers I suppose, but that
> would be awkward. It's mostly useful to access MMIO as I described in the
> message you were kind enough to dig out from the depths of history.
>
> For exception handler examination I suggest using /proc/kcore instead,
> which gives you access to kernel memory via an artificial ELF image,
> making this a piece of cake. Like this for example:
>
> $ gdb -c /proc/kcore
> [...]
> #0 0x00000000 in ?? ()
> (gdb) set architecture mips:isa32r2
> The target architecture is assumed to be mips:isa32r2
> (gdb) x /32i 0x80000000
> 0x80000000: lui k1,0x8483
> 0x80000004: mfc0 k0,c0_badvaddr
> 0x80000008: lw k1,-30560(k1)
> 0x8000000c: srl k0,k0,0x1a
This was an interesting exercise. I suspect GDB runs out of memory since
# gdb -q -c /proc/kcore
[New process 1]
Segmentation fault
with
# dmesg | tail -n3
do_page_fault(): sending SIGSEGV to gdb for invalid read access from 000000a8
epc = 00953910 in gdb[400000+6d1000]
ra = 009538b8 in gdb[400000+6d1000]
to me looks like GDB does a NULL pointer deference (the PS2 has 32 MiB of
RAM, of which 16 MiB is used for a ramdisk in my setup). GDB once could
handle core files remotely, but this capability is apparently now lost:
https://www.redhat.com/archives/crash-utility/2011-December/msg00019.html
One can get a little further by sharing /proc using v9fs to obtain:
# mipsel-linux-gdb -q -c /mnt/kcore
[New process 1]
Core was generated by `ramdisk_size=16384 crtmode=pal1 video=ps2fb:pal,640x480-32 rd_start=0x8063c000'.
#0 0x00000000 in ?? ()
(gdb) set architecture mips:5900
The target architecture is assumed to be mips:5900
(gdb) x /32i 0x80000000
0x80000000: Cannot access memory at address 0x80000000
In this case I'm wondering whether kcore contains proper ELF headers. What
is the output of readelf for your kcore? I have this:
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: CORE (Core file)
Machine: MIPS R3000
Version: 0x1
Entry point address: 0x0
Start of program headers: 52 (bytes into file)
Start of section headers: 0 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 3
Size of section headers: 0 (bytes)
Number of section headers: 0
Section header string table index: 0
There are no sections in this file.
There are no sections to group in this file.
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
NOTE 0x000094 0x00000000 0x00000000 0x0074c 0x00000 0
LOAD 0x40001000 0xc0000000 0xffffffff 0x3f7fe000 0x3f7fe000 RWE 0x1000
LOAD 0x001000 0x80000000 0x00000000 0x2000000 0x2000000 RWE 0x1000
There is no dynamic section in this file.
There are no relocations in this file.
The decoding of unwind sections for machine type MIPS R3000 is not currently supported.
No version information found in this file.
Displaying notes found at file offset 0x00000094 with length 0x0000074c:
Owner Data size Description
CORE 0x00000100 NT_PRSTATUS (prstatus structure)
CORE 0x00000080 NT_PRPSINFO (prpsinfo structure)
CORE 0x00000590 NT_TASKSTRUCT (task structure)
Returning to the more awkward /dev/mem device, the "bad address" error with
for example
# xxd -s $(( 0x80000000 )) -l 256 /dev/mem
xxd: /dev/mem: Bad address
is due to drivers/char/mem.c:valid_phys_addr_range which fails on
return addr + count <= __pa(high_memory);
since
0x80000000 + 16 <= 0x2000000
is false for CPHYSADDR(0x82000000) in arch/mips/include/asm/page.h:___pa:
if (!IS_ENABLED(CONFIG_EVA)) {
/*
* We're using the standard MIPS32 legacy memory map, ie.
* the address x is going to be in kseg0 or kseg1. We can
* handle either case by masking out the desired bits using
* CPHYSADDR.
*/
return CPHYSADDR(x);
}
I noticed that /dev/mem is an exception to this comment just above ___pa:
/*
* __pa()/__va() should be used only during mem init.
*/
Finally, trying to mmap /dev/mem also fails, because
/* Does it even fit in phys_addr_t? */
if (offset >> PAGE_SHIFT != vma->vm_pgoff) {
in drivers/char/mem.c:mmap_mem computes
0x00080000 != 0xfff80000
resulting in -EINVAL. Is this the expected behaviour?
Fredrik
next prev parent reply other threads:[~2018-02-17 11:17 UTC|newest]
Thread overview: 117+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-27 13:23 [PATCH] MIPS: Add basic R5900 support Fredrik Noring
2017-08-28 13:53 ` Ralf Baechle
2017-08-28 17:11 ` Maciej W. Rozycki
2017-08-29 17:33 ` Fredrik Noring
2017-08-29 17:24 ` Maciej W. Rozycki
2017-08-29 17:24 ` Maciej W. Rozycki
2017-08-30 13:23 ` Fredrik Noring
2017-08-31 15:11 ` Maciej W. Rozycki
2017-08-31 15:11 ` Maciej W. Rozycki
2017-09-02 10:28 ` Fredrik Noring
2017-09-09 10:13 ` Maciej W. Rozycki
2017-09-09 10:13 ` Maciej W. Rozycki
2017-09-11 5:21 ` Maciej W. Rozycki
2017-09-11 5:21 ` Maciej W. Rozycki
2017-09-12 17:59 ` Fredrik Noring
2017-09-15 11:12 ` Maciej W. Rozycki
2017-09-15 11:12 ` Maciej W. Rozycki
2017-09-15 13:19 ` Fredrik Noring
2017-09-15 18:28 ` Maciej W. Rozycki
2017-09-15 18:28 ` Maciej W. Rozycki
2017-09-02 14:10 ` [PATCH v2] " Fredrik Noring
2017-09-11 5:18 ` Maciej W. Rozycki
2017-09-11 5:18 ` Maciej W. Rozycki
2017-09-11 15:17 ` Fredrik Noring
2017-09-14 13:50 ` Maciej W. Rozycki
2017-09-14 13:50 ` Maciej W. Rozycki
2017-09-16 13:34 ` Fredrik Noring
2017-09-18 17:05 ` Maciej W. Rozycki
2017-09-18 17:05 ` Maciej W. Rozycki
2017-09-18 19:24 ` Fredrik Noring
2017-09-19 12:44 ` Maciej W. Rozycki
2017-09-19 12:44 ` Maciej W. Rozycki
2017-09-20 14:54 ` Fredrik Noring
2017-09-26 11:50 ` Maciej W. Rozycki
2017-09-26 11:50 ` Maciej W. Rozycki
2017-09-27 17:21 ` Fredrik Noring
2017-09-28 12:13 ` Maciej W. Rozycki
2017-09-28 12:13 ` Maciej W. Rozycki
2017-09-30 6:56 ` Fredrik Noring
2017-10-02 9:05 ` Maciej W. Rozycki
2017-10-02 9:05 ` Maciej W. Rozycki
2017-10-02 16:33 ` Fredrik Noring
2017-10-29 17:20 ` Fredrik Noring
2017-11-10 23:34 ` Maciej W. Rozycki
2017-11-10 23:34 ` Maciej W. Rozycki
2017-11-11 16:04 ` Fredrik Noring
2018-01-29 20:27 ` Fredrik Noring
2018-01-31 23:01 ` Maciej W. Rozycki
2018-02-11 7:29 ` [RFC] MIPS: R5900: Workaround for the short loop bug Fredrik Noring
2018-02-12 9:25 ` Maciej W. Rozycki
2018-02-12 15:22 ` Fredrik Noring
2018-02-11 7:46 ` [RFC] MIPS: R5900: Use SYNC.L for data cache and SYNC.P for instruction cache Fredrik Noring
2018-02-11 7:56 ` [RFC] MIPS: R5900: Workaround exception NOP execution bug (FLX05) Fredrik Noring
2018-02-12 9:28 ` Maciej W. Rozycki
2018-02-15 19:15 ` [RFC v2] " Fredrik Noring
2018-02-15 20:49 ` Maciej W. Rozycki
2018-02-17 11:16 ` Fredrik Noring [this message]
2018-02-17 11:57 ` Maciej W. Rozycki
2018-02-17 13:38 ` Fredrik Noring
2018-02-17 15:03 ` Maciej W. Rozycki
2018-02-17 20:04 ` Fredrik Noring
2018-02-20 14:09 ` Maciej W. Rozycki
2018-02-22 17:04 ` Fredrik Noring
2018-02-18 8:47 ` Fredrik Noring
2018-02-20 14:41 ` Maciej W. Rozycki
2018-02-22 17:27 ` Fredrik Noring
2018-02-11 8:01 ` [RFC] MIPS: R5900: Workaround for CACHE instruction near branch delay slot Fredrik Noring
2018-02-11 11:16 ` Aw: " "Jürgen Urban"
2018-02-11 8:09 ` [RFC] MIPS: R5900: The ERET instruction has issues with delay slot and CACHE Fredrik Noring
2018-02-11 11:07 ` Aw: " "Jürgen Urban"
2018-02-11 8:29 ` [RFC] MIPS: R5900: Use mandatory SYNC.L in exception handlers Fredrik Noring
2018-02-11 10:33 ` Aw: " "Jürgen Urban"
2018-02-12 9:22 ` Maciej W. Rozycki
2018-02-12 9:22 ` Maciej W. Rozycki
2018-02-18 10:30 ` Fredrik Noring
2018-02-17 14:43 ` [RFC] MIPS: R5900: Workaround for saving and restoring FPU registers Fredrik Noring
2018-02-17 15:18 ` Maciej W. Rozycki
2018-02-17 17:47 ` Fredrik Noring
2018-02-17 19:33 ` Maciej W. Rozycki
2018-02-18 9:26 ` [RFC] MIPS: R5900: Workaround where MSB must be 0 for the instruction cache Fredrik Noring
2018-02-18 11:08 ` [RFC] MIPS: R5900: Add mandatory SYNC.P to all M[FT]C0 instructions Fredrik Noring
2018-03-03 12:26 ` [RFC] MIPS: PS2: Interrupt request (IRQ) support Fredrik Noring
2018-03-03 13:09 ` Maciej W. Rozycki
2018-03-03 14:14 ` Fredrik Noring
2018-04-09 15:51 ` Fredrik Noring
2018-03-18 10:45 ` Fredrik Noring
2018-03-19 19:15 ` Thomas Gleixner
2018-06-18 18:52 ` [RFC v2] " Fredrik Noring
2017-10-30 17:55 ` [PATCH v2] MIPS: Add basic R5900 support Fredrik Noring
2017-11-24 10:26 ` Maciej W. Rozycki
2017-11-24 10:26 ` Maciej W. Rozycki
2017-11-24 10:39 ` Maciej W. Rozycki
2017-11-24 10:39 ` Maciej W. Rozycki
2017-09-20 14:07 ` Fredrik Noring
2017-09-21 21:07 ` Maciej W. Rozycki
2017-09-21 21:07 ` Maciej W. Rozycki
2017-09-22 16:37 ` Fredrik Noring
2017-09-22 16:37 ` Fredrik Noring
2017-09-29 23:55 ` Maciej W. Rozycki
2017-09-29 23:55 ` Maciej W. Rozycki
2017-09-30 18:26 ` Fredrik Noring
2017-10-02 9:11 ` Maciej W. Rozycki
2017-10-02 9:11 ` Maciej W. Rozycki
2017-10-03 19:49 ` Fredrik Noring
2017-10-05 19:04 ` Fredrik Noring
2017-10-06 20:28 ` Fredrik Noring
2017-10-15 16:39 ` Fredrik Noring
2017-10-17 12:23 ` Maciej W. Rozycki
2017-10-17 12:23 ` Maciej W. Rozycki
2017-10-21 18:00 ` Fredrik Noring
2017-10-23 16:10 ` Maciej W. Rozycki
2017-10-23 16:10 ` Maciej W. Rozycki
2017-09-21 18:11 ` Paul Burton
2017-09-21 18:11 ` Paul Burton
2017-09-21 19:48 ` Maciej W. Rozycki
2017-09-21 19:48 ` Maciej W. Rozycki
2017-10-29 18:42 ` Fredrik Noring
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=20180217111644.GA2496@localhost.localdomain \
--to=noring@nocrew.org \
--cc=JuergenUrban@gmx.de \
--cc=linux-mips@linux-mips.org \
--cc=macro@mips.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.