Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/uvm Pull up following revision(s) (requested by chs i...



details:   https://anonhg.NetBSD.org/src/rev/d6bc107a974a
branches:  netbsd-9
changeset: 940151:d6bc107a974a
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Oct 04 18:14:13 2020 +0000

description:
Pull up following revision(s) (requested by chs in ticket #1095):

        sys/uvm/uvm_amap.c: revision 1.124 (via patch)
        sys/uvm/uvm_amap.c: revision 1.125 (via patch)
        sys/uvm/uvm_io.c: revision 1.29 (via patch)

Effectively disable the AMAP_REFALL flag because it is unsafe.

This flag tells the amap code that it does not need to allocate ppref
as part of adding or removing a reference, but that is only correct
if the range of the reference being added or removed is the same
as the range of all other references to the amap, and the point of
this flag is exactly to try to optimize the case where the range is
different and thus this flag would not be correct to use.
Fixes PR 55366.

The previous fix for PR 55366 in uvm_amap.c 1.124 was incomplete:
 - amap_adjref_anons() must also ignore AMAP_REFALL when updating
   the ppref, not just when deciding whether or not to initialize ppref.
 - UVM_EXTRACT_QREF relies on AMAP_REFALL to work properly,
   and since we can't use AMAP_REFALL then we can't use QREF either.

diffstat:

 sys/uvm/uvm_amap.c |  12 ++++--------
 sys/uvm/uvm_io.c   |   8 ++++++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diffs (69 lines):

diff -r f7f52207859f -r d6bc107a974a sys/uvm/uvm_amap.c
--- a/sys/uvm/uvm_amap.c        Sun Sep 27 10:31:09 2020 +0000
+++ b/sys/uvm/uvm_amap.c        Sun Oct 04 18:14:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_amap.c,v 1.109.4.1 2020/08/19 18:36:59 martin Exp $        */
+/*     $NetBSD: uvm_amap.c,v 1.109.4.2 2020/10/04 18:14:13 martin Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.109.4.1 2020/08/19 18:36:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.109.4.2 2020/10/04 18:14:13 martin Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1588,7 +1588,7 @@
         * so that the ppref values match the current amap refcount.
         */
 
-       if (amap->am_ppref == NULL && !all && len != amap->am_nslot) {
+       if (amap->am_ppref == NULL) {
                amap_pp_establish(amap, offset);
        }
 #endif
@@ -1597,11 +1597,7 @@
 
 #ifdef UVM_AMAP_PPREF
        if (amap->am_ppref && amap->am_ppref != PPREF_NONE) {
-               if (all) {
-                       amap_pp_adjref(amap, 0, amap->am_nslot, refv, &tofree);
-               } else {
-                       amap_pp_adjref(amap, offset, len, refv, &tofree);
-               }
+               amap_pp_adjref(amap, offset, len, refv, &tofree);
        }
 #endif
        uvm_anon_freelst(amap, tofree);
diff -r f7f52207859f -r d6bc107a974a sys/uvm/uvm_io.c
--- a/sys/uvm/uvm_io.c  Sun Sep 27 10:31:09 2020 +0000
+++ b/sys/uvm/uvm_io.c  Sun Oct 04 18:14:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_io.c,v 1.28 2016/05/25 17:43:58 christos Exp $     */
+/*     $NetBSD: uvm_io.c,v 1.28.22.1 2020/10/04 18:14:13 martin Exp $  */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_io.c,v 1.28 2016/05/25 17:43:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_io.c,v 1.28.22.1 2020/10/04 18:14:13 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -87,6 +87,10 @@
        error = 0;
 
        flags |= UVM_EXTRACT_QREF | UVM_EXTRACT_CONTIG | UVM_EXTRACT_FIXPROT;
+
+       /* XXX cannot use QREF with without AMAP_REFALL, and REFALL is unsafe */
+       flags &= ~UVM_EXTRACT_QREF;
+
        /*
         * step 1: main loop...  while we've got data to move
         */



Home | Main Index | Thread Index | Old Index