From fe8344a09272f3a8b71c2ad72fdf8ef3eaef71e5 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Sun, 31 Jan 2021 23:07:42 +0100 Subject: [PATCH] s390/vdso: on timens page fault prefault also VVAR page This is the s390 variant of commit e6b28ec65b6d ("x86/vdso: On timens page fault prefault also VVAR page"). Reviewed-by: Alexander Gordeev Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik --- arch/s390/kernel/vdso.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c index dd967af29d2b..8c4e07d533c8 100644 --- a/arch/s390/kernel/vdso.c +++ b/arch/s390/kernel/vdso.c @@ -105,14 +105,23 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm, struct vm_area_struct *vma, struct vm_fault *vmf) { struct page *timens_page = find_timens_vvar_page(vma); - unsigned long pfn; + unsigned long addr, pfn; + vm_fault_t err; switch (vmf->pgoff) { case VVAR_DATA_PAGE_OFFSET: - if (timens_page) + pfn = virt_to_pfn(vdso_data); + if (timens_page) { + /* + * Fault in VVAR page too, since it will be accessed + * to get clock data anyway. + */ + addr = vmf->address + VVAR_TIMENS_PAGE_OFFSET * PAGE_SIZE; + err = vmf_insert_pfn(vma, addr, pfn); + if (unlikely(err & VM_FAULT_ERROR)) + return err; pfn = page_to_pfn(timens_page); - else - pfn = virt_to_pfn(vdso_data); + } break; #ifdef CONFIG_TIME_NS case VVAR_TIMENS_PAGE_OFFSET: