NetBSD/sys/uvm
chs d54dda5c99 uvm: avoid a deadlock in uvm_map_clean()
The locking order between map locks and page "busy" locks
is that the page "busy" lock comes first, but uvm_map_clean()
breaks this rule by holding a map locked (as reader) while
waiting for page "busy" locks.

If another thread is in the page-fault path holding a page
"busy" lock while waiting for the map lock (as a reader)
and at the same time a third thread is blocked waiting for
the map lock as a writer (which blocks the page-fault thread),
then these three threads will all deadlock with each other.

Fix this by marking the map "busy" (to block any modifications)
and unlocking the map lock before possibly waiting for any
page "busy" locks.

Martin Pieuchot reported that the same problem existed in OpenBSD
he applied this fix there after several people tested it.

fixes PR 56952
2023-05-15 01:42:42 +00:00
..
pmap Correct a type. 2023-04-27 06:23:31 +00:00
Makefile
files.uvm
uvm.h
uvm_amap.c uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B) 2023-04-09 09:00:56 +00:00
uvm_amap.h
uvm_anon.c
uvm_anon.h
uvm_aobj.c uvm: Eliminate __HAVE_ATOMIC_AS_MEMBAR conditionals. 2023-02-24 11:03:13 +00:00
uvm_aobj.h
uvm_bio.c uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B) 2023-04-09 09:00:56 +00:00
uvm_coredump.c
uvm_ddb.h
uvm_device.c uvm: CTASSERT about MIN_PAGE_SIZE, which is constant. 2022-07-07 13:27:02 +00:00
uvm_device.h
uvm_extern.h nkmempages should be size_t 2023-02-26 07:27:14 +00:00
uvm_fault.c uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B) 2023-04-09 09:00:56 +00:00
uvm_fault.h
uvm_fault_i.h
uvm_glue.c
uvm_glue.h
uvm_init.c
uvm_io.c
uvm_km.c uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B) 2023-04-09 09:00:56 +00:00
uvm_km.h
uvm_loan.c
uvm_loan.h
uvm_map.c uvm: avoid a deadlock in uvm_map_clean() 2023-05-15 01:42:42 +00:00
uvm_map.h
uvm_meter.c
uvm_mmap.c Convert CTASSERT(9) for PAGE_{SIZE,MASK} into KASSERT(9). 2022-07-07 11:29:18 +00:00
uvm_mremap.c
uvm_object.c
uvm_object.h
uvm_page.c uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B) 2023-04-09 09:00:56 +00:00
uvm_page.h
uvm_page_array.c
uvm_page_array.h
uvm_page_status.c
uvm_pager.c
uvm_pager.h
uvm_param.h
uvm_pdaemon.c
uvm_pdaemon.h
uvm_pdpolicy.h uvm_pdpolicy.h: Fix missing forward declarations and includes. 2022-08-20 23:26:02 +00:00
uvm_pdpolicy_clock.c
uvm_pdpolicy_clockpro.c
uvm_pdpolicy_impl.h
uvm_pgflcache.c
uvm_pgflcache.h
uvm_pglist.c
uvm_pglist.h
uvm_physseg.c uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B) 2023-04-09 09:00:56 +00:00
uvm_physseg.h
uvm_pmap.h uvm/uvm_pmap.h: Fix missing types and forward declarations. 2022-08-20 23:08:53 +00:00
uvm_prot.h
uvm_readahead.c
uvm_readahead.h
uvm_stat.c
uvm_stat.h
uvm_swap.c uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B) 2023-04-09 09:00:56 +00:00
uvm_swap.h
uvm_swapstub.c
uvm_unix.c
uvm_user.c
uvm_vnode.c uvm: Simplify assertion in uvn_get. 2023-04-09 12:37:12 +00:00