PR kern/55467

tmpfs calls pmap_kenter_pa(9) with virtual address with page offset

Bisectioning revealed that the failure starts with this commit:

sys/fs/tmpfs/tmpfs_vnops.c rev 1.142:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/fs/tmpfs/tmpfs_vnops.c#rev1.142

by which tmpfs became to use UBC_FAULTBUSY flag for ubc_uiomove(9).
If this flag is specified, pmap_kenter_pa(9) is called with virtual
address with page offset via ubc_alloc(9):

https://nxr.netbsd.org/xref/src/sys/uvm/uvm_bio.c#616

Most ports seem to neglect silently page offset of va argument for
pmap_kenter_pa(9). However, it causes KASSERT failure correctly for
powerpc/booke. So, truncate page offset there.

Now, tmpfs works just fine on evbppc-booke, and I've confirmed that
no new failures are detected by ATF.

Discussed with chs@. Thanks!
This commit is contained in:
rin 2020-07-09 09:24:32 +00:00
parent 5a883cb715
commit b0317a421b
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_bio.c,v 1.120 2020/07/09 05:57:15 skrll Exp $ */
/* $NetBSD: uvm_bio.c,v 1.121 2020/07/09 09:24:32 rin Exp $ */
/*
* Copyright (c) 1998 Chuck Silvers.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.120 2020/07/09 05:57:15 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.121 2020/07/09 09:24:32 rin Exp $");
#include "opt_uvmhist.h"
#include "opt_ubc.h"
@ -613,7 +613,8 @@ again_faultbusy:
rw_exit(uobj->vmobjlock);
pgs[i] = pg;
}
pmap_kenter_pa(va + slot_offset + (i << PAGE_SHIFT),
pmap_kenter_pa(
va + trunc_page(slot_offset) + (i << PAGE_SHIFT),
VM_PAGE_TO_PHYS(pg),
VM_PROT_READ | VM_PROT_WRITE, 0);
}