|
|
608733 |
commit 3141bba98af302e2a7c5e2a19203bb8a40b6aa63
|
|
|
608733 |
Author: Dave Anderson <anderson@redhat.com>
|
|
|
608733 |
Date: Wed Oct 10 09:15:42 2018 -0400
|
|
|
608733 |
|
|
|
608733 |
Fix the calculation of the vmalloc memory region size to account for
|
|
|
608733 |
Linux 4.17 commit a7412546d8cb5ad578805060b4006f2a021b5868, titled
|
|
|
608733 |
"x86/mm: Adjust vmalloc base and size at boot-time", which increases
|
|
|
608733 |
the region's size from 32TB to 1280TB when 5-level pagetables are
|
|
|
608733 |
enabled. Also presume that virtual addresses above the end of the
|
|
|
608733 |
vmalloc space up to the beginning of vmemmap space are translatable
|
|
|
608733 |
via 5-level page tables. Without the patch, mapped virtual addresses
|
|
|
608733 |
may fail translation in whatever command accesses them, with errors
|
|
|
608733 |
indicating "seek error: kernel virtual address: <mapped-address>
|
|
|
608733 |
type: <type-string>"
|
|
|
608733 |
(anderson@redhat.com)
|
|
|
608733 |
|
|
|
608733 |
diff --git a/x86_64.c b/x86_64.c
|
|
|
608733 |
index 6f547e8..345122c 100644
|
|
|
608733 |
--- a/x86_64.c
|
|
|
608733 |
+++ b/x86_64.c
|
|
|
608733 |
@@ -393,8 +393,12 @@ x86_64_init(int when)
|
|
|
608733 |
readmem(symbol_value("vmalloc_base"), KVADDR,
|
|
|
608733 |
&machdep->machspec->vmalloc_start_addr,
|
|
|
608733 |
sizeof(ulong), "vmalloc_base", FAULT_ON_ERROR);
|
|
|
608733 |
- machdep->machspec->vmalloc_end =
|
|
|
608733 |
- machdep->machspec->vmalloc_start_addr + TERABYTES(32) - 1;
|
|
|
608733 |
+ if (machdep->flags & VM_5LEVEL)
|
|
|
608733 |
+ machdep->machspec->vmalloc_end =
|
|
|
608733 |
+ machdep->machspec->vmalloc_start_addr + TERABYTES(1280) - 1;
|
|
|
608733 |
+ else
|
|
|
608733 |
+ machdep->machspec->vmalloc_end =
|
|
|
608733 |
+ machdep->machspec->vmalloc_start_addr + TERABYTES(32) - 1;
|
|
|
608733 |
if (kernel_symbol_exists("vmemmap_base")) {
|
|
|
608733 |
readmem(symbol_value("vmemmap_base"), KVADDR,
|
|
|
608733 |
&machdep->machspec->vmemmap_vaddr, sizeof(ulong),
|
|
|
608733 |
@@ -1626,7 +1630,8 @@ x86_64_IS_VMALLOC_ADDR(ulong vaddr)
|
|
|
608733 |
(vaddr >= VSYSCALL_START && vaddr < VSYSCALL_END) ||
|
|
|
608733 |
(machdep->machspec->cpu_entry_area_start &&
|
|
|
608733 |
vaddr >= machdep->machspec->cpu_entry_area_start &&
|
|
|
608733 |
- vaddr <= machdep->machspec->cpu_entry_area_end));
|
|
|
608733 |
+ vaddr <= machdep->machspec->cpu_entry_area_end) ||
|
|
|
608733 |
+ ((machdep->flags & VM_5LEVEL) && vaddr > VMALLOC_END && vaddr < VMEMMAP_VADDR));
|
|
|
608733 |
}
|
|
|
608733 |
|
|
|
608733 |
static int
|