Skip to content

Commit 7b4ea94

Browse files
committed
Revert "x86/mm/64: Do not sync vmalloc/ioremap mappings"
This reverts commit 8bb9bf2. It seems the vmalloc page tables aren't always preallocated in all situations, because Jason Donenfeld reports an oops with this commit: BUG: unable to handle page fault for address: ffffe8ffffd00608 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP CPU: 2 PID: 22 Comm: kworker/2:0 Not tainted 5.8.0+ #154 RIP: process_one_work+0x2c/0x2d0 Code: 41 56 41 55 41 54 55 48 89 f5 53 48 89 fb 48 83 ec 08 48 8b 06 4c 8b 67 40 49 89 c6 45 30 f6 a8 04 b8 00 00 00 00 4c 0f 44 f0 <49> 8b 46 08 44 8b a8 00 01 05 Call Trace: worker_thread+0x4b/0x3b0 ? rescuer_thread+0x360/0x360 kthread+0x116/0x140 ? __kthread_create_worker+0x110/0x110 ret_from_fork+0x1f/0x30 CR2: ffffe8ffffd00608 and that page fault address is right in that vmalloc space, and we clearly don't have a PGD/P4D entry for it. Looking at the "Code:" line, the actual fault seems to come from the 'pwq->wq' dereference at the top of the process_one_work() function: struct pool_workqueue *pwq = get_work_pwq(work); struct worker_pool *pool = worker->pool; bool cpu_intensive = pwq->wq->flags & WQ_CPU_INTENSIVE; so 'struct pool_workqueue *pwq' is the allocation that hasn't been synchronized across CPUs. Just revert for now, while Joerg figures out the cause. Reported-and-bisected-by: Jason A. Donenfeld <[email protected]> Acked-by: Ingo Molnar <[email protected]> Acked-by: Joerg Roedel <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 6d2b84a commit 7b4ea94

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

arch/x86/include/asm/pgtable_64_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,6 @@ extern unsigned int ptrs_per_p4d;
159159

160160
#define PGD_KERNEL_START ((PAGE_SIZE / 2) / sizeof(pgd_t))
161161

162+
#define ARCH_PAGE_TABLE_SYNC_MASK (pgtable_l5_enabled() ? PGTBL_PGD_MODIFIED : PGTBL_P4D_MODIFIED)
163+
162164
#endif /* _ASM_X86_PGTABLE_64_DEFS_H */

arch/x86/mm/init_64.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ static void sync_global_pgds(unsigned long start, unsigned long end)
217217
sync_global_pgds_l4(start, end);
218218
}
219219

220+
void arch_sync_kernel_mappings(unsigned long start, unsigned long end)
221+
{
222+
sync_global_pgds(start, end);
223+
}
224+
220225
/*
221226
* NOTE: This function is marked __ref because it calls __init function
222227
* (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0.

0 commit comments

Comments
 (0)