diff options
author | Klemens Nanni <kn@cvs.openbsd.org> | 2022-02-10 10:15:36 +0000 |
---|---|---|
committer | Klemens Nanni <kn@cvs.openbsd.org> | 2022-02-10 10:15:36 +0000 |
commit | d5bce34037bf75f0bf44183231876cc74dc6787d (patch) | |
tree | f6f7d29ba1d17b614149b0951199bcd931c9ad74 /sys/uvm/uvm_fault.c | |
parent | bb180ea8a9f82c56b5ef1d42ac28a4165decbe92 (diff) |
Assert vm map locks
Introduce vm_map_assert_{wrlock,rdlock,anylock,unlocked}() in rwlock(9)
fashion and back up function comments about locking assumptions with proper
assertions.
Also add new comments/assertions based on code analysis and sync with
NetBSD as much as possible.
vm_map_lock() and vm_map_lock_read() are used for exclusive and shared
access respectively; currently no code path is purely protected by
vm_map_lock_read() alone, i.e. functions called with a read lock held by the
callee are also called with a write lock elsewhere.
Thus only vm_map_assert_{wrlock,anylock}() are used as of now.
This should help with unlocking UVM related syscalls
Tested as part of a larger diff through
- amd64 package bulk build by naddy
- amd64, arm64, powerpc64 base builds and regress by bluhm
- amd64 and sparc64 base builds and regress by me
Input mpi
Feedback OK kettenis
Diffstat (limited to 'sys/uvm/uvm_fault.c')
-rw-r--r-- | sys/uvm/uvm_fault.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c index e7a54be4c5a..e2a8186fd14 100644 --- a/sys/uvm/uvm_fault.c +++ b/sys/uvm/uvm_fault.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_fault.c,v 1.126 2022/02/03 19:57:11 guenther Exp $ */ +/* $OpenBSD: uvm_fault.c,v 1.127 2022/02/10 10:15:35 kn Exp $ */ /* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */ /* @@ -1616,6 +1616,7 @@ uvm_fault_unwire_locked(vm_map_t map, vaddr_t start, vaddr_t end) struct vm_page *pg; KASSERT((map->flags & VM_MAP_INTRSAFE) == 0); + vm_map_assert_anylock(map); /* * we assume that the area we are unwiring has actually been wired |