From 4504268a1b3cc208ac7fddfae567217aa1f2b68d Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Mon, 2 Dec 2019 22:38:25 +0000 Subject: [PATCH] Fix the last few cases that grab without busy or valid. The grab functions must return the page in some held state for consistency elsewhere. Reviewed by: alc, kib, markj Differential Revision: https://reviews.freebsd.org/D22610 --- sys/compat/cloudabi/cloudabi_vdso.c | 5 +++-- sys/compat/linux/linux_vdso.c | 5 +++-- sys/kern/kern_sharedpage.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/compat/cloudabi/cloudabi_vdso.c b/sys/compat/cloudabi/cloudabi_vdso.c index 27c3d365af83..b89dd68e683c 100644 --- a/sys/compat/cloudabi/cloudabi_vdso.c +++ b/sys/compat/cloudabi/cloudabi_vdso.c @@ -59,9 +59,10 @@ cloudabi_vdso_init(struct sysentvec *sv, char *begin, char *end) addr = kva_alloc(PAGE_SIZE); for (i = 0; i < pages; ++i) { VM_OBJECT_WLOCK(obj); - m = vm_page_grab(obj, i, VM_ALLOC_NOBUSY | VM_ALLOC_ZERO); - m->valid = VM_PAGE_BITS_ALL; + m = vm_page_grab(obj, i, VM_ALLOC_ZERO); VM_OBJECT_WUNLOCK(obj); + vm_page_valid(m); + vm_page_xunbusy(m); pmap_qenter(addr, &m, 1); memcpy((void *)addr, begin + i * PAGE_SIZE, diff --git a/sys/compat/linux/linux_vdso.c b/sys/compat/linux/linux_vdso.c index 012e1d75c599..96a6f7ef6f54 100644 --- a/sys/compat/linux/linux_vdso.c +++ b/sys/compat/linux/linux_vdso.c @@ -83,9 +83,10 @@ __elfN(linux_shared_page_init)(char **mapping) obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, VM_PROT_DEFAULT, 0, NULL); VM_OBJECT_WLOCK(obj); - m = vm_page_grab(obj, 0, VM_ALLOC_NOBUSY | VM_ALLOC_ZERO); - m->valid = VM_PAGE_BITS_ALL; + m = vm_page_grab(obj, 0, VM_ALLOC_ZERO); VM_OBJECT_WUNLOCK(obj); + vm_page_valid(m); + vm_page_xunbusy(m); addr = kva_alloc(PAGE_SIZE); pmap_qenter(addr, &m, 1); *mapping = (char *)addr; diff --git a/sys/kern/kern_sharedpage.c b/sys/kern/kern_sharedpage.c index 2b1fe70ad333..45a33f8d31dd 100644 --- a/sys/kern/kern_sharedpage.c +++ b/sys/kern/kern_sharedpage.c @@ -114,9 +114,10 @@ shared_page_init(void *dummy __unused) shared_page_obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, VM_PROT_DEFAULT, 0, NULL); VM_OBJECT_WLOCK(shared_page_obj); - m = vm_page_grab(shared_page_obj, 0, VM_ALLOC_NOBUSY | VM_ALLOC_ZERO); - m->valid = VM_PAGE_BITS_ALL; + m = vm_page_grab(shared_page_obj, 0, VM_ALLOC_ZERO); VM_OBJECT_WUNLOCK(shared_page_obj); + vm_page_valid(m); + vm_page_xunbusy(m); addr = kva_alloc(PAGE_SIZE); pmap_qenter(addr, &m, 1); shared_page_mapping = (char *)addr;