Commit 146122e2 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

x86/mm/dump_pagetables: Make the address hints correct and readable

The address hints are a trainwreck. The array entry numbers have to kept
magically in sync with the actual hints, which is doomed as some of the
array members are initialized at runtime via the entry numbers.

Designated initializers have been around before this code was
implemented....

Use the entry numbers to populate the address hints array and add the
missing bits and pieces. Split 32 and 64 bit for readability sake.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent c0534494
...@@ -44,10 +44,12 @@ struct addr_marker { ...@@ -44,10 +44,12 @@ struct addr_marker {
unsigned long max_lines; unsigned long max_lines;
}; };
/* indices for address_markers; keep sync'd w/ address_markers below */ /* Address space markers hints */
#ifdef CONFIG_X86_64
enum address_markers_idx { enum address_markers_idx {
USER_SPACE_NR = 0, USER_SPACE_NR = 0,
#ifdef CONFIG_X86_64
KERNEL_SPACE_NR, KERNEL_SPACE_NR,
LOW_KERNEL_NR, LOW_KERNEL_NR,
VMALLOC_START_NR, VMALLOC_START_NR,
...@@ -56,56 +58,70 @@ enum address_markers_idx { ...@@ -56,56 +58,70 @@ enum address_markers_idx {
KASAN_SHADOW_START_NR, KASAN_SHADOW_START_NR,
KASAN_SHADOW_END_NR, KASAN_SHADOW_END_NR,
#endif #endif
# ifdef CONFIG_X86_ESPFIX64 #ifdef CONFIG_X86_ESPFIX64
ESPFIX_START_NR, ESPFIX_START_NR,
# endif #endif
#ifdef CONFIG_EFI
EFI_END_NR,
#endif
HIGH_KERNEL_NR, HIGH_KERNEL_NR,
MODULES_VADDR_NR, MODULES_VADDR_NR,
MODULES_END_NR, MODULES_END_NR,
#else FIXADDR_START_NR,
END_OF_SPACE_NR,
};
static struct addr_marker address_markers[] = {
[USER_SPACE_NR] = { 0, "User Space" },
[KERNEL_SPACE_NR] = { (1UL << 63), "Kernel Space" },
[LOW_KERNEL_NR] = { 0UL, "Low Kernel Mapping" },
[VMALLOC_START_NR] = { 0UL, "vmalloc() Area" },
[VMEMMAP_START_NR] = { 0UL, "Vmemmap" },
#ifdef CONFIG_KASAN
[KASAN_SHADOW_START_NR] = { KASAN_SHADOW_START, "KASAN shadow" },
[KASAN_SHADOW_END_NR] = { KASAN_SHADOW_END, "KASAN shadow end" },
#endif
#ifdef CONFIG_X86_ESPFIX64
[ESPFIX_START_NR] = { ESPFIX_BASE_ADDR, "ESPfix Area", 16 },
#endif
#ifdef CONFIG_EFI
[EFI_END_NR] = { EFI_VA_END, "EFI Runtime Services" },
#endif
[HIGH_KERNEL_NR] = { __START_KERNEL_map, "High Kernel Mapping" },
[MODULES_VADDR_NR] = { MODULES_VADDR, "Modules" },
[MODULES_END_NR] = { MODULES_END, "End Modules" },
[FIXADDR_START_NR] = { FIXADDR_START, "Fixmap Area" },
[END_OF_SPACE_NR] = { -1, NULL }
};
#else /* CONFIG_X86_64 */
enum address_markers_idx {
USER_SPACE_NR = 0,
KERNEL_SPACE_NR, KERNEL_SPACE_NR,
VMALLOC_START_NR, VMALLOC_START_NR,
VMALLOC_END_NR, VMALLOC_END_NR,
# ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
PKMAP_BASE_NR, PKMAP_BASE_NR,
# endif
FIXADDR_START_NR,
#endif #endif
FIXADDR_START_NR,
END_OF_SPACE_NR,
}; };
/* Address space markers hints */
static struct addr_marker address_markers[] = { static struct addr_marker address_markers[] = {
{ 0, "User Space" }, [USER_SPACE_NR] = { 0, "User Space" },
#ifdef CONFIG_X86_64 [KERNEL_SPACE_NR] = { PAGE_OFFSET, "Kernel Mapping" },
{ 0x8000000000000000UL, "Kernel Space" }, [VMALLOC_START_NR] = { 0UL, "vmalloc() Area" },
{ 0/* PAGE_OFFSET */, "Low Kernel Mapping" }, [VMALLOC_END_NR] = { 0UL, "vmalloc() End" },
{ 0/* VMALLOC_START */, "vmalloc() Area" }, #ifdef CONFIG_HIGHMEM
{ 0/* VMEMMAP_START */, "Vmemmap" }, [PKMAP_BASE_NR] = { 0UL, "Persistent kmap() Area" },
#ifdef CONFIG_KASAN
{ KASAN_SHADOW_START, "KASAN shadow" },
{ KASAN_SHADOW_END, "KASAN shadow end" },
#endif #endif
# ifdef CONFIG_X86_ESPFIX64 [FIXADDR_START_NR] = { 0UL, "Fixmap area" },
{ ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, [END_OF_SPACE_NR] = { -1, NULL }
# endif
# ifdef CONFIG_EFI
{ EFI_VA_END, "EFI Runtime Services" },
# endif
{ __START_KERNEL_map, "High Kernel Mapping" },
{ MODULES_VADDR, "Modules" },
{ MODULES_END, "End Modules" },
#else
{ PAGE_OFFSET, "Kernel Mapping" },
{ 0/* VMALLOC_START */, "vmalloc() Area" },
{ 0/*VMALLOC_END*/, "vmalloc() End" },
# ifdef CONFIG_HIGHMEM
{ 0/*PKMAP_BASE*/, "Persistent kmap() Area" },
# endif
{ 0/*FIXADDR_START*/, "Fixmap Area" },
#endif
{ -1, NULL } /* End of list */
}; };
#endif /* !CONFIG_X86_64 */
/* Multipliers for offsets within the PTEs */ /* Multipliers for offsets within the PTEs */
#define PTE_LEVEL_MULT (PAGE_SIZE) #define PTE_LEVEL_MULT (PAGE_SIZE)
#define PMD_LEVEL_MULT (PTRS_PER_PTE * PTE_LEVEL_MULT) #define PMD_LEVEL_MULT (PTRS_PER_PTE * PTE_LEVEL_MULT)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment