s390/vdso: get rid of vdso_fault

Implement vdso mapping similar to arm64 and powerpc.

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>
This commit is contained in:
Heiko Carstens 2021-01-24 21:36:14 +01:00 committed by Vasily Gorbik
parent 8d4be7f318
commit dfc11c9876

View File

@ -20,7 +20,6 @@
extern char vdso64_start[], vdso64_end[]; extern char vdso64_start[], vdso64_end[];
static unsigned int vdso_pages; static unsigned int vdso_pages;
static struct page **vdso_pagelist;
static union { static union {
struct vdso_data data[CS_BASES]; struct vdso_data data[CS_BASES];
@ -41,17 +40,6 @@ static int __init vdso_setup(char *str)
} }
__setup("vdso=", vdso_setup); __setup("vdso=", vdso_setup);
static vm_fault_t vdso_fault(const struct vm_special_mapping *sm,
struct vm_area_struct *vma, struct vm_fault *vmf)
{
if (vmf->pgoff >= vdso_pages)
return VM_FAULT_SIGBUS;
vmf->page = vdso_pagelist[vmf->pgoff];
get_page(vmf->page);
return 0;
}
static int vdso_mremap(const struct vm_special_mapping *sm, static int vdso_mremap(const struct vm_special_mapping *sm,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
@ -59,9 +47,8 @@ static int vdso_mremap(const struct vm_special_mapping *sm,
return 0; return 0;
} }
static const struct vm_special_mapping vdso_mapping = { static struct vm_special_mapping vdso_mapping = {
.name = "[vdso]", .name = "[vdso]",
.fault = vdso_fault,
.mremap = vdso_mremap, .mremap = vdso_mremap,
}; };
@ -113,24 +100,20 @@ out:
static int __init vdso_init(void) static int __init vdso_init(void)
{ {
struct page **pages;
int i; int i;
vdso_pages = ((vdso64_end - vdso64_start) >> PAGE_SHIFT) + 1; vdso_pages = ((vdso64_end - vdso64_start) >> PAGE_SHIFT) + 1;
/* Make sure pages are in the correct state */ pages = kcalloc(vdso_pages + 1, sizeof(struct page *), GFP_KERNEL);
vdso_pagelist = kcalloc(vdso_pages + 1, sizeof(struct page *), if (!pages) {
GFP_KERNEL);
if (!vdso_pagelist) {
vdso_enabled = 0; vdso_enabled = 0;
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < vdso_pages - 1; i++) { for (i = 0; i < vdso_pages - 1; i++)
struct page *pg = virt_to_page(vdso64_start + i * PAGE_SIZE); pages[i] = virt_to_page(vdso64_start + i * PAGE_SIZE);
get_page(pg); pages[vdso_pages - 1] = virt_to_page(vdso_data);
vdso_pagelist[i] = pg; pages[vdso_pages] = NULL;
} vdso_mapping.pages = pages;
vdso_pagelist[vdso_pages - 1] = virt_to_page(vdso_data);
vdso_pagelist[vdso_pages] = NULL;
get_page(virt_to_page(vdso_data));
return 0; return 0;
} }
arch_initcall(vdso_init); arch_initcall(vdso_init);