Given the lack of any feedback from any of the IBM ppc64 users
on the list, I went ahead and wrote a simple patch that presumably
suffices for the 3.10 ppc64 virtual-to-physical translation changes.
The patch only deals with the PTE_INDEX_SIZE, PMD_INDEX_SIZE and
PGD_INDEX_SIZE changes in 419df06eea5bfa815e3a78e0aad6cfb320c1654f, but
does nothing for the pgd_index() change in 0e5f35d0e4a8179cdfac115023f418126419e659.
The crash utility has a PGD_OFFSET_L4() macro, but the index it uses always
seems to equate to zero, so I left it alone.
With the patch applied, the "WARNING: cannot access vmalloc'd module
memory"
message is no longer seen during initialization:
# ./crash
crash 7.0.2rc4
Copyright (C) 2002-2013 Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation
Copyright (C) 1999-2006 Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited
Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011 NEC Corporation
Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. Enter "help copying" to see the conditions.
This program has absolutely no warranty. Enter "help warranty" for details.
GNU gdb (GDB) 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 "powerpc64-unknown-linux-gnu"...
KERNEL: /usr/lib/debug/lib/modules/3.10.0-0.rc7.64.el7.ppc64/vmlinux
DUMPFILE: /dev/crash
CPUS: 28
DATE: Mon Jul 8 15:34:32 2013
UPTIME: 00:54:18
LOAD AVERAGE: 0.02, 0.33, 0.42
TASKS: 294
NODENAME:
ibm-p720-01-lp5.rhts.eng.bos.redhat.com
RELEASE: 3.10.0-0.rc7.64.el7.ppc64
VERSION: #1 SMP Tue Jun 25 10:03:47 EDT 2013
MACHINE: ppc64 (3000 Mhz)
MEMORY: 8 GB
PID: 15797
COMMAND: "crash"
TASK: c0000001f5e39de0 [THREAD_INFO: c0000001f5ed4000]
CPU: 1
STATE: TASK_RUNNING (ACTIVE)
crash>
Module vmalloc'd virtual addresses can be translated such that
the module list can be traversed:
crash> mod
MODULE NAME SIZE OBJECT FILE
d000000001016f08 dm_mod 126667 (not loaded) [CONFIG_KALLSYMS]
d000000001072a60 dm_log 14799 (not loaded) [CONFIG_KALLSYMS]
d0000000010d2308 dm_region_hash 14977 (not loaded) [CONFIG_KALLSYMS]
d000000001134778 dm_mirror 21713 (not loaded) [CONFIG_KALLSYMS]
d000000001192e40 scsi_tgt 17615 (not loaded) [CONFIG_KALLSYMS]
d0000000011f14c8 scsi_transport_srp 8607 (not loaded) [CONFIG_KALLSYMS]
d000000001266d60 ibmvscsi 34969 (not loaded) [CONFIG_KALLSYMS]
d0000000012c02f8 crc_t10dif 1671 (not loaded) [CONFIG_KALLSYMS]
...
and a module address translated to its physical address:
crash> vtop d000000001016f08
VIRTUAL PHYSICAL
d000000001016f08 1f48d6f08
PAGE DIRECTORY: c0000000011d0000
L4: c0000000011d0000 => c0000001fb980000
PMD: c0000001fb980008 => c0000001fb961000
PMD: c0000001fb980008 => fb961008
PTE: fb961008 => 7d2348000395
PAGE: 1f48d0000
PTE PHYSICAL FLAGS
7d2348000395 1f48d0000 (PRESENT|RW|COHERENT|DIRTY|ACCESSED)
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
c000000004541ed8 1f48d0000 0 0 1 7d00000000000
crash>
And with that physical address, the module contents confirm the
correct location is being read:
crash> module d000000001016f08
struct module {
state = MODULE_STATE_LIVE,
list = {
next = 0xc000000000feea88 <modules>,
prev = 0xd000000001072a68
},
name = "dm_mod",
mkobj = {
kobj = {
name = 0xc0000001f9120110 "dm_mod",
entry = {
next = 0xd000000001072ab8,
prev = 0xc0000001fe084ce8
},
parent = 0xc0000001fe083258,
kset = 0xc0000001fe083240,
ktype = 0xc000000000feb620 <module_ktype>,
...
And user-space virtual addresses can be translated, for example
to translate and read the first page of the crash executable,
which contains the ELF header:
crash> vm
PID: 15797 TASK: c0000001f5e39de0 CPU: 1 COMMAND: "crash"
MM PGD RSS TOTAL_VM
c0000001f7d1dc00 c0000001dddb0000 166656k 316032k
VMA START END FLAGS FILE
c00000001bd10b80 10000000 10970000 875
/root/rpmbuild/BUILD/crash-7.0.1/crash
c00000001bd17528 10970000 10980000 100871
/root/rpmbuild/BUILD/crash-7.0.1/crash
c00000001bd12840 10980000 10a30000 100873
/root/rpmbuild/BUILD/crash-7.0.1/crash
c00000001bd19918 10a30000 10ac0000 100073
c00000001bd15d70 10034e20000 10038860000 100073
...
crash> vtop 10000000
VIRTUAL PHYSICAL
10000000 118ec0000
PAGE DIRECTORY: c0000001dddb0000
L4: c0000001dddb0000 => c0000001f7e78000
PMD: c0000001f7e78080 => c0000000a90c2000
PMD: c0000001f7e78080 => a90c2000
PTE: a90c2000 => 463b08000117
PAGE: 118ec0000
PTE PHYSICAL FLAGS
463b08000117 118ec0000 (PRESENT|USER|RW|COHERENT|ACCESSED)
VMA START END FLAGS FILE
c00000001bd10b80 10000000 10970000 875
/root/rpmbuild/BUILD/crash-7.0.1/crash
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
c0000000037833a0 118ec0000 c000000101a5e4e0 0 3 460000000086c
crash> rd -p 118ec0000 2
118ec0000: 7f454c4602020100 0000000000000000 .ELF............
crash>
If there are no objections, I'll queue it for crash-7.0.2.
Thanks,
Dave
--- crash-7.0.1/defs.h.orig
+++ crash-7.0.1/defs.h
@@ -3486,6 +3486,9 @@ struct efi_memory_desc_t {
#define PMD_INDEX_SIZE_L4_64K 12
#define PUD_INDEX_SIZE_L4_64K 0
#define PGD_INDEX_SIZE_L4_64K 4
+#define PTE_INDEX_SIZE_L4_64K_3_10 8
+#define PMD_INDEX_SIZE_L4_64K_3_10 10
+#define PGD_INDEX_SIZE_L4_64K_3_10 12
#define PTE_SHIFT_L4_64K_V1 32
#define PTE_SHIFT_L4_64K_V2 30
#define PTE_SHIFT_L4_BOOK3E_64K 28
--- crash-7.0.1/ppc64.c.orig
+++ crash-7.0.1/ppc64.c
@@ -227,10 +227,18 @@ ppc64_init(int when)
struct machine_specific *m = machdep->machspec;
if (machdep->pagesize == 65536) {
/* 64K pagesize */
- m->l1_index_size = PTE_INDEX_SIZE_L4_64K;
- m->l2_index_size = PMD_INDEX_SIZE_L4_64K;
- m->l3_index_size = PUD_INDEX_SIZE_L4_64K;
- m->l4_index_size = PGD_INDEX_SIZE_L4_64K;
+ if (THIS_KERNEL_VERSION >= LINUX(3,10,0)) {
+ m->l1_index_size = PTE_INDEX_SIZE_L4_64K_3_10;
+ m->l2_index_size = PMD_INDEX_SIZE_L4_64K_3_10;
+ m->l3_index_size = PUD_INDEX_SIZE_L4_64K;
+ m->l4_index_size = PGD_INDEX_SIZE_L4_64K_3_10;
+
+ } else {
+ m->l1_index_size = PTE_INDEX_SIZE_L4_64K;
+ m->l2_index_size = PMD_INDEX_SIZE_L4_64K;
+ m->l3_index_size = PUD_INDEX_SIZE_L4_64K;
+ m->l4_index_size = PGD_INDEX_SIZE_L4_64K;
+ }
if (!(machdep->flags & BOOK3E))
m->pte_shift = symbol_exists("demote_segment_4k") ?
PTE_SHIFT_L4_64K_V2 : PTE_SHIFT_L4_64K_V1;