PUD index size was changed to 9 from 7 since kernel v3.7, but it was not updated here. Also, currently L4_MASK is set to 0xfff for kernel v3.10 and above irrespective of page size but it should be based on l4 index size which is different for 4k & 64K page sizes. This patch fixes them. Signed-off-by: Hari Bathini <hbathini at linux.vnet.ibm.com> --- arch/ppc64.c | 10 +++++++--- makedumpfile.h | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/ppc64.c b/arch/ppc64.c index 89a7f05..2cc3906 100644 --- a/arch/ppc64.c +++ b/arch/ppc64.c @@ -160,10 +160,12 @@ ppc64_vmalloc_init(void) info->l1_index_size = PTE_INDEX_SIZE_L4_64K_3_10; info->l2_index_size = PMD_INDEX_SIZE_L4_64K_3_10; info->l3_index_size = PUD_INDEX_SIZE_L4_64K; + info->l4_index_size = PGD_INDEX_SIZE_L4_64K_3_10; } else { info->l1_index_size = PTE_INDEX_SIZE_L4_64K; info->l2_index_size = PMD_INDEX_SIZE_L4_64K; info->l3_index_size = PUD_INDEX_SIZE_L4_64K; + info->l4_index_size = PGD_INDEX_SIZE_L4_64K; } info->pte_shift = SYMBOL(demote_segment_4k) ? @@ -175,7 +177,9 @@ ppc64_vmalloc_init(void) */ info->l1_index_size = PTE_INDEX_SIZE_L4_4K; info->l2_index_size = PMD_INDEX_SIZE_L4_4K; - info->l3_index_size = PUD_INDEX_SIZE_L4_4K; + info->l3_index_size = (info->kernel_version >= KERNEL_VERSION(3, 7, 0) ? + PUD_INDEX_SIZE_L4_4K_3_7 : PUD_INDEX_SIZE_L4_4K); + info->l4_index_size = PGD_INDEX_SIZE_L4_4K; info->pte_shift = PTE_SHIFT_L4_4K; info->l2_masked_bits = PMD_MASKED_BITS_4K; @@ -188,8 +192,8 @@ ppc64_vmalloc_init(void) info->ptrs_per_l1 = (1 << info->l1_index_size); info->ptrs_per_l2 = (1 << info->l2_index_size); info->ptrs_per_l3 = (1 << info->l3_index_size); - - info->ptrs_per_pgd = info->ptrs_per_l3; + info->ptrs_per_l4 = (1 << info->l4_index_size); + info->ptrs_per_pgd = info->ptrs_per_l4; /* * Compute shifts diff --git a/makedumpfile.h b/makedumpfile.h index 1814139..46c940c 100644 --- a/makedumpfile.h +++ b/makedumpfile.h @@ -650,6 +650,7 @@ int get_va_bits_arm64(void); #define PMD_INDEX_SIZE_L4_4K 7 #define PUD_INDEX_SIZE_L4_4K 7 #define PGD_INDEX_SIZE_L4_4K 9 +#define PUD_INDEX_SIZE_L4_4K_3_7 9 #define PTE_SHIFT_L4_4K 17 #define PMD_MASKED_BITS_4K 0 @@ -666,7 +667,7 @@ int get_va_bits_arm64(void); #define PMD_MASKED_BITS_64K 0x1ff #define L4_MASK \ - (info->kernel_version >= KERNEL_VERSION(3, 10, 0) ? 0xfff : 0x1ff) + (info->kernel_version >= KERNEL_VERSION(3, 10, 0) ? (info->ptrs_per_pgd - 1) : 0x1ff) #define L4_OFFSET(vaddr) ((vaddr >> (info->l4_shift)) & L4_MASK) #define PGD_OFFSET_L4(vaddr) \ @@ -1123,9 +1124,11 @@ struct DumpInfo { * page table info for ppc64 */ int ptrs_per_pgd; + uint l4_index_size; uint l3_index_size; uint l2_index_size; uint l1_index_size; + uint ptrs_per_l4; uint ptrs_per_l3; uint ptrs_per_l2; uint ptrs_per_l1;