Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Fix uvmplock regression - a lock against oneself cas...



details:   https://anonhg.NetBSD.org/src/rev/2c93d47167fb
branches:  trunk
changeset: 766497:2c93d47167fb
user:      rmind <rmind%NetBSD.org@localhost>
date:      Fri Jun 24 01:39:22 2011 +0000

description:
Fix uvmplock regression - a lock against oneself case in amap_swap_off().
Happens since amap is NULL in uvmfault_anonget(), so uvmfault_unlockall()
keeps anon locked, when it should unlock it.

diffstat:

 sys/uvm/uvm_amap.c  |  6 +++---
 sys/uvm/uvm_anon.c  |  9 +++++----
 sys/uvm/uvm_anon.h  |  4 ++--
 sys/uvm/uvm_fault.c |  6 +++---
 4 files changed, 13 insertions(+), 12 deletions(-)

diffs (112 lines):

diff -r 444ac35fef44 -r 2c93d47167fb sys/uvm/uvm_amap.c
--- a/sys/uvm/uvm_amap.c        Fri Jun 24 01:23:05 2011 +0000
+++ b/sys/uvm/uvm_amap.c        Fri Jun 24 01:39:22 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_amap.c,v 1.97 2011/06/24 01:03:08 rmind Exp $      */
+/*     $NetBSD: uvm_amap.c,v 1.98 2011/06/24 01:39:22 rmind 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.97 2011/06/24 01:03:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.98 2011/06/24 01:39:22 rmind Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1358,7 +1358,7 @@
 
                        am->am_flags |= AMAP_SWAPOFF;
 
-                       rv = uvm_anon_pagein(anon);
+                       rv = uvm_anon_pagein(am, anon);
                        amap_lock(am);
 
                        am->am_flags &= ~AMAP_SWAPOFF;
diff -r 444ac35fef44 -r 2c93d47167fb sys/uvm/uvm_anon.c
--- a/sys/uvm/uvm_anon.c        Fri Jun 24 01:23:05 2011 +0000
+++ b/sys/uvm/uvm_anon.c        Fri Jun 24 01:39:22 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_anon.c,v 1.56 2011/06/24 01:23:05 yamt Exp $       */
+/*     $NetBSD: uvm_anon.c,v 1.57 2011/06/24 01:39:22 rmind Exp $      */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.56 2011/06/24 01:23:05 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.57 2011/06/24 01:39:22 rmind Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -311,18 +311,19 @@
  */
 
 bool
-uvm_anon_pagein(struct vm_anon *anon)
+uvm_anon_pagein(struct vm_amap *amap, struct vm_anon *anon)
 {
        struct vm_page *pg;
        struct uvm_object *uobj;
 
        KASSERT(mutex_owned(anon->an_lock));
+       KASSERT(anon->an_lock == amap->am_lock);
 
        /*
         * Get the page of the anon.
         */
 
-       switch (uvmfault_anonget(NULL, NULL, anon)) {
+       switch (uvmfault_anonget(NULL, amap, anon)) {
        case 0:
                /* Success - we have the page. */
                KASSERT(mutex_owned(anon->an_lock));
diff -r 444ac35fef44 -r 2c93d47167fb sys/uvm/uvm_anon.h
--- a/sys/uvm/uvm_anon.h        Fri Jun 24 01:23:05 2011 +0000
+++ b/sys/uvm/uvm_anon.h        Fri Jun 24 01:39:22 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_anon.h,v 1.28 2011/06/12 03:36:02 rmind Exp $      */
+/*     $NetBSD: uvm_anon.h,v 1.29 2011/06/24 01:39:22 rmind Exp $      */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -109,7 +109,7 @@
 #define        uvm_anon_dropswap(a)    /* nothing */
 #endif /* defined(VMSWAP) */
 void uvm_anon_release(struct vm_anon *);
-bool uvm_anon_pagein(struct vm_anon *);
+bool uvm_anon_pagein(struct vm_amap *, struct vm_anon *);
 #endif /* _KERNEL */
 
 #endif /* _UVM_UVM_ANON_H_ */
diff -r 444ac35fef44 -r 2c93d47167fb sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Fri Jun 24 01:23:05 2011 +0000
+++ b/sys/uvm/uvm_fault.c       Fri Jun 24 01:39:22 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.187 2011/06/23 17:36:59 rmind Exp $    */
+/*     $NetBSD: uvm_fault.c,v 1.188 2011/06/24 01:39:22 rmind Exp $    */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.187 2011/06/23 17:36:59 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.188 2011/06/24 01:39:22 rmind Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -275,7 +275,7 @@
 
        UVMHIST_FUNC("uvmfault_anonget"); UVMHIST_CALLED(maphist);
        KASSERT(mutex_owned(anon->an_lock));
-       KASSERT(amap == NULL || anon->an_lock == amap->am_lock);
+       KASSERT(anon->an_lock == amap->am_lock);
 
        /* Increment the counters.*/
        uvmexp.fltanget++;



Home | Main Index | Thread Index | Old Index