Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm PR kern/55467



details:   https://anonhg.NetBSD.org/src/rev/3a85da6af469
branches:  trunk
changeset: 935684:3a85da6af469
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Jul 09 09:24:32 2020 +0000

description:
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!

diffstat:

 sys/uvm/uvm_bio.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 571f5b31b41d -r 3a85da6af469 sys/uvm/uvm_bio.c
--- a/sys/uvm/uvm_bio.c Thu Jul 09 08:40:13 2020 +0000
+++ b/sys/uvm/uvm_bio.c Thu Jul 09 09:24:32 2020 +0000
@@ -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 @@
                                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);
                }



Home | Main Index | Thread Index | Old Index