summaryrefslogtreecommitdiff
path: root/arch/ppc64.c
diff options
context:
space:
mode:
authorMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>2013-01-29 17:53:11 +0900
committerAtsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>2013-01-29 17:53:11 +0900
commitbfff315fac18fc8d98c79409fc5dad938bd899c5 (patch)
treeeff87906c19b3bfa230960705f2e28cc445c7340 /arch/ppc64.c
parentf06bdd972341a672739d932b96766dc4141ebed0 (diff)
[PATCH] ppc64: Auto-detect the correct MAX_PHYSMEM_BITS used in vmcore being analyzed.
The latest upstream kernel commit 048ee0993ec8360abb0b51bdf8f8721e9ed62ec4 adds 64TB support to ppc64 kernel and bumps the MAX_PHYSMEM_BITS from 44 to 46. This change causes sparsemem extreme check to fail in makedumpfile. This patch auto-detects the correct value to use for MAX_PHYSMEM_BITS by examining the mem_section array size from the vmcore being analyzed. This patch has been tested on upstream kernel 3.8.0-rc4 and older kernel 2.6.32. Reported-by: Dave Anderson <anderson@redhat.com> Reported-by: Dave Young <dyoung@redhat.com> Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Diffstat (limited to 'arch/ppc64.c')
-rw-r--r--arch/ppc64.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/arch/ppc64.c b/arch/ppc64.c
index 1cb69e1..afbaf55 100644
--- a/arch/ppc64.c
+++ b/arch/ppc64.c
@@ -25,12 +25,37 @@
#include "../makedumpfile.h"
int
+set_ppc64_max_physmem_bits(void)
+{
+ long array_len = ARRAY_LENGTH(mem_section);
+ /*
+ * The older ppc64 kernels uses _MAX_PHYSMEM_BITS as 42 and the
+ * newer kernels 3.7 onwards uses 46 bits.
+ */
+
+ info->max_physmem_bits = _MAX_PHYSMEM_BITS_ORIG ;
+ if ((array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME()))
+ || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT())))
+ return TRUE;
+
+ info->max_physmem_bits = _MAX_PHYSMEM_BITS_3_7;
+ if ((array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME()))
+ || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT())))
+ return TRUE;
+
+ return FALSE;
+}
+
+int
get_machdep_info_ppc64(void)
{
unsigned long vmlist, vmalloc_start;
info->section_size_bits = _SECTION_SIZE_BITS;
- info->max_physmem_bits = _MAX_PHYSMEM_BITS;
+ if (!set_ppc64_max_physmem_bits()) {
+ ERRMSG("Can't detect max_physmem_bits.\n");
+ return FALSE;
+ }
info->page_offset = __PAGE_OFFSET;
if (SYMBOL(_stext) == NOT_FOUND_SYMBOL) {