CVS commit: [netbsd-11] src/sys
"Martin Husemann" <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.cvs |
|---|---|
| Message-ID | <[email protected]> |
Module Name: src Committed By: martin Date: Fri Apr 3 12:38:34 UTC 2026 Modified Files: src/sys/sys [netbsd-11]: buf.h src/sys/uvm [netbsd-11]: uvm_pager.c uvm_swap.c uvm_swap.h Log Message: Pull up following revision(s) (requested by yamt in ticket #243): sys/sys/buf.h: revision 1.136 sys/uvm/uvm_swap.c: revision 1.220 sys/uvm/uvm_swap.c: revision 1.221 sys/uvm/uvm_swap.c: revision 1.222 sys/uvm/uvm_pager.c: revision 1.133 sys/uvm/uvm_swap.c: revision 1.224 sys/uvm/uvm_pager.c: revision 1.134 sys/uvm/uvm_swap.c: revision 1.225 sys/uvm/uvm_pager.c: revision 1.135 sys/uvm/uvm_swap.h: revision 1.30 sys/uvm/uvm_swap.c: revision 1.226 sys/uvm/uvm_swap.c: revision 1.227 sys/uvm/uvm_swap.c: revision 1.228 sys/uvm/uvm_swap.c: revision 1.229 sys/uvm/uvm_swap.c: revision 1.216 sys/uvm/uvm_swap.c: revision 1.217 sys/uvm/uvm_swap.c: revision 1.219 sys/uvm/uvm_swap.c: revision 1.230 sys/uvm/uvm_swap.c: revision 1.231 swap_on: add a comment about the motivation to defer key generation the original text from Taylor R Campbell, in PR/60084. uvm_swap.c: make the drum mpsafe * simplify the VREG path and make it mpsafe * VBLK path seems already ok * mark them D_MPSAFE uvm_aio_aiodone_pages: do not discard user data on swap out failure if swap out i/o failed, maybe the swap device is broken. it's reasonable to mark it bad. however, there is no point to discard the user data on the page being swapped out. unlike file pages, the association to the particular swap slot is not permanent. next time the page is picked as a victim by the page daemon, a different swap slot, which is hopefully good, will be allocated. sw_reg_strategy: stop panicking on hole after the recent change to uvm_aio_aiodone_pages, it should be ok to report errors here. the swap slots will be marked bad as expected. tested with a swap file with 50% holes: ``` Device Size Used Bad Avail Capacity Priority /dev/dk1 2.0G 1.8G 0B 190M 91% 0 /swapfile_with_half_holes 2.0G 2.0G 1.0G 5.6M 100% 0 Total 4.0G 3.8G 1.0G 196M 95% ``` uvm_aio_aiodone_pages: add a comment simplify swap encryption a bit * disallow changes of vm.swap_encrypt sysctl when any swap is configured. note: this doesn't affect the ability to set it in /etc/sysctl.conf because /etc/rc.d/sysctl is executed before /etc/rc.d/swap1. * retire per-page encryption tracking. (swd_encmap) from now on, the whole swap is encrypted or not. PR/60084 uvm_swap.c: add a few assertions fix swap encryption data corruption issue when paging out, uvm_swap_io encrypts the page contents in-place and then issues write requests to swapdev. if the write fails for some reason, the pageout will be cancelled. but it leaves the data in the pages encrypted. ie. data corruption. note that this doesn't necessarily involve broken swap devices. as we are in the pagedaemon context, some kind of transient errors are rather normal. for example, ffs VOP_BMAP has special cases for the pagedaemon to return ENOMEM. this commit fixes the issue by simply reverting the encryption on error. PR/60082 uvm_swap.c: make the drum mpsafe (cont.) mark swapiod WQ_MPSAFE. swstrategy: add an assertion swread/swwrite: hold swap_syscall_lock to ensure that the list of swap devices is stable while we are operating on them. PR 60147 swstrategy: reject non page aligned i/o explicitly our swap offset calculation logic assumes page aligned i/o. non aligned requests from /dev/drum silently go to a wrong block. it has always been this way since the initial uvm import in 1998. this commit fixes it by simply rejecting non aligned requests. note: requests from swap and libkvm are always page aligned. Add b_private2 to struct buf i plan to use this for swap i/o. i'm not bumping kernel version as i reused an unused field. (it used to be softdep b_dep and has been unused since 2009.) sw_reg_strategy: do not clobber b_private this fixes a regression caused by "uvm_swap.c: make the drum mpsafe". b_private is for the owner of the buffer. in case of /dev/drum i/o, we are not the owner of the buffer. kern_physio.c is. swread/swwrite: hold swap_syscall_lock (cont.) fix a harmless merge botch i introduced while porting the patch from git to cvs. PR/60147 uvm_swap.c: fix /dev/drum regression caused by swap encryption * decrypt data using a bounce buffer * reject writes with ENOTSUP for now PR/60083 swread/swwrite: update a comment about swapdev stability PR/60147 To generate a diff of this commit: cvs rdiff -u -r1.135 -r1.135.4.1 src/sys/sys/buf.h cvs rdiff -u -r1.131 -r1.131.4.1 src/sys/uvm/uvm_pager.c cvs rdiff -u -r1.209.2.1 -r1.209.2.2 src/sys/uvm/uvm_swap.c cvs rdiff -u -r1.29 -r1.29.4.1 src/sys/uvm/uvm_swap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.