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.
This commit is contained in:
rmind 2011-06-24 01:39:22 +00:00
parent fa43ee9ddc
commit 7be1d60258
4 changed files with 13 additions and 12 deletions

View File

@ -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 @@ amap_swap_off(int startslot, int endslot)
am->am_flags |= AMAP_SWAPOFF;
rv = uvm_anon_pagein(anon);
rv = uvm_anon_pagein(am, anon);
amap_lock(am);
am->am_flags &= ~AMAP_SWAPOFF;

View File

@ -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 @@ uvm_anon_lockloanpg(struct vm_anon *anon)
*/
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));

View File

@ -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 @@ void uvm_anon_dropswap(struct vm_anon *);
#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_ */

View File

@ -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 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap,
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++;