summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2021-01-31 23:07:42 +0100
committerVasily Gorbik <gor@linux.ibm.com>2021-02-09 15:57:05 +0100
commitfe8344a09272f3a8b71c2ad72fdf8ef3eaef71e5 (patch)
tree5411d5102b759920caca9c8506868523214bad71
parenteeab78b05d202f15e58ab10675a4f736a1c9bd29 (diff)
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 <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-rw-r--r--arch/s390/kernel/vdso.c17
1 files 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: