summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_hibernate.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* spellingjsg2021-03-101-3/+3
| | | | ok gnezdo@ semarie@ mpi@
* don't let the retguard skip region exceed the space we have reserved formlarkin2018-06-211-1/+10
| | | | | | it in the piglet during unhibernate. Missed this block during the previous commit. We'll panic, which will likely just reboot the machine, but that's better than trashing a chunk and causing mystery errors later.
* Save and restore retguard area during hibernate unpack. This copies themlarkin2018-06-211-5/+28
| | | | | | | original retguard data to the piglet and bcopys it back in place immediately before resuming via the ACPI Sx trampoline. ok deraadt, guenther, tested by many.
* print why the signature block check of an unhibernate attempt failed, tomlarkin2017-08-171-5/+5
| | | | | | let people know what changed. ok kettenis, phessler
* calculate a "sum" based upon pointers to functions all over the kernel,deraadt2017-06-221-1/+19
| | | | | | so that an unhibernate kernel can detect if it is running with the kernel it booted. ok mlarkin
* If hibernate_alloc() encounters a problem it should undo the partialderaadt2017-03-271-6/+11
| | | | | work. ok mlarkin kettenis
* move from RB macros to RBT functionsdlg2016-09-271-13/+13
|
* move the vm_page struct from being stored in RB macro trees to RBT functionsdlg2016-09-161-5/+5
| | | | | | | vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and uvm_pmr_size. all these have been moved to RBT code. this should give us a decent chunk of code space back.
* Fix hibernation - make stack protector writable during resumebeck2016-09-051-2/+46
| | | | | | | Committing for guenther@ because he is on United and apparently they break ssh (as well as guitars) ok deraadt@ in the car from cambridge
* Fix undefined behaviour when comparing pointers by casting them to vaddr_t.akfaew2016-09-011-2/+5
| | | | OK mlarkin@
* Clarify that hibernate_resume must be called with interrupts enabled.mlarkin2015-05-041-1/+3
|
* Preserve a page's worth of random data on hibernate resume. Used to improvemlarkin2015-02-071-4/+39
| | | | | | | entropy after resuming. Tested on i386 and amd64. ok deraadt@
* New framework that allows hibernate to pass in entropy from it's freshderaadt2015-02-071-1/+7
| | | | | boot. ok mlarkin
* Fix a hibernate crash on some machines due to unmapping a page thatmlarkin2015-02-061-6/+7
| | | | | | | | may not have been mapped previously (in the failure to hibernate case). Also ensure that the lowmem ptp is mapped in all cases (not just MP). ok kettenis
* hibernate_suspend() should not pmap_kremove by itself; hibernate_free()deraadt2015-01-121-9/+4
| | | | | | must do that. otherwise, pmap_kremove is called twice. i386 in particular does not tolerate that, found by sebastia ok mlarkin kettenis
* fix an error in piglet allocation when requesting an alignment < PAGE_SIZEmlarkin2014-12-221-2/+3
| | | | | | (which we never did, but it was a bug nonetheless). ok kettenis, deraadt
* remove lock.h from uvm_extern.h. another holdover from the simpletonlocktedu2014-12-171-1/+4
| | | | | era. fix uvm including c files to include lock.h or atomic.h as necessary. ok deraadt
* Replace a plethora of historical protection options with justderaadt2014-11-161-7/+7
| | | | | | | PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
* No reason to have things like the hibernate allocation area and chunkmlarkin2014-11-051-6/+8
| | | | | | ordering regions mapped executable, so remove those permissions. ok deraadt@
* Unmap the hibernate hiballoc page after we are done with it.mlarkin2014-11-021-7/+10
| | | | ok deraadt, kettenis
* Remove some unused/unneeded code.mlarkin2014-10-221-9/+1
|
* Use the global piglet address variables as sparingly as possible to avoidmlarkin2014-10-221-10/+22
| | | | | | redundant copies of the same information. No functional change. Also add some comments as to how these globals are used.
* No need to reserve separate KVA ranges for the RLE and copy pages inmlarkin2014-10-161-37/+5
| | | | hibernate anymore.
* fix some data type mismatches in the zlib paths in hibernatemlarkin2014-10-091-10/+12
|
* remove an unused function and some unused variables in hibernatemlarkin2014-10-091-39/+2
|
* Rework piglet and pig allocation. Currently the piglet gets allocatedkettenis2014-09-261-226/+79
| | | | | | | | | | | | | | deep down in the suspend path, where it is really hard to recover from allocation failure. So allocate the piglet early on in the suspend path. Also change the piglet and piglet allocation functions to use km_alloc(9) instead of doing pmemrange magic. This removes a bunch of code which, in the case of the piglet allocation, is broken since it results in a NULL pointer dereference. Also switch the piglet allocation to not wait. If we can't allocate 16MB of phys contig memory on a halfway modern machine we're almost certainly under a lot of memory pressure and we're better off not trying to hibernate anyway. ok mlarkin@
* Use config_suspend_all(9).kettenis2014-09-191-3/+3
|
* fix some wrong comments and a bit of KNFmlarkin2014-07-211-11/+9
|
* Support hibernating to softraid crypto volumes.mlarkin2014-07-201-3/+3
| | | | much help and ok from deraadt@
* Reenable hibernate RLE support and flush+zero all memory after unpack.mlarkin2014-07-161-25/+187
|
* Minor cleanups in wording in some comments and printfs, and added somemlarkin2014-07-091-6/+11
| | | | dprintfs to help debugging in the field (disabled by default)
* Don't use the suspending kernel's VA mapping for the piglet. It's farmlarkin2014-07-091-10/+14
| | | | | | | | | | easier and much less error-prone to just identity map it in the resuming kernel as we have more control over the VA space layout there (otherwise we are at the mercy of the suspending kernel's placement of the piglet VA). This diff also increases the size of the piglet to 4 chunks, to avoid an overwrite issue seen in m2k14 where the start of the kernel text was overwritten with a bounced chunk before unpack.
* Cleanup the chunk placement routine by removing the conflict resolver.mlarkin2014-07-091-106/+47
| | | | | | Chunks are now sorted by ascending PA and all chunks are bounced before unpack. This fixes an issue where the trampoline chunks were being placed at the end of the unpack ordering, causing overwrite during unpack.
* Use suspending kernel's stack smash guard to avoid panicing during unpack.mlarkin2014-07-091-1/+15
| | | | ok deraadt@
* Fix a format specifier in a debug printf.mlarkin2014-05-311-3/+6
| | | | Noticed by Josh Grosse.
* Read MAXPHYS bytes at a time in the hibernate image read, instead ofmlarkin2014-05-291-14/+30
| | | | | | | PAGE_SIZE bytes. Completes the MAXPHYS optimizations in the read path. with input from guenther@ who suggested a version that was a little easier to understand. Tested on i386 and amd64.
* Change use of Z_PARTIAL_FLUSH to Z_SYNC_FLUSH in the hibernate code as permlarkin2014-05-211-3/+3
| | | | | a warning/comment in zlib.h that Z_PARTIAL_FLUSH "will be removed, use Z_SYNC_FLUSH instead".
* Perform MAXPHYS-sized reads for the chunktable instead of PAGE_SIZE-sizedmlarkin2014-04-261-14/+21
| | | | | | reads. Also fix a VA leak in the chunktable read error path.
* More dead stores removal in subr_hibernate.cmlarkin2014-04-201-9/+1
|
* Dead stores in subr_hibernate.cmlarkin2014-04-191-9/+2
|
* Allow for two more pmap-specific bits in vm_page pg_flags. Definemiod2014-03-211-5/+3
| | | | | | | | PG_PMAPMASK as all the possible pmap-specific bits (similar to the other PG_fooMASK) to make sure MI code does not need to be updated, the next time more bits are allocated to greedy pmaps. No functional change, soon to be used by the (greedy) mips64 pmap.
* get rid of the assumption that the head of the alldevs list is thedlg2014-03-131-3/+3
| | | | | | | | | | | "mainbus" device. this breaks when mpath is enabled because it attaches before mainbus and therefore takes the head position. have autoconf provide device_mainbus() which looks up mainbus_cd, and use that instead. discussed with deraadt who just wants mpath stuff to move forward despite there being many ways to shine this particular turd.
* Remove some of the excessive cache and TLB flushing going on duringmlarkin2014-02-011-8/+1
| | | | | | | hibernate unpack - these were added a while ago when we were fighting different issues that have now been solved. Tested by myself and dcoppa on a variety of machines
* bzero -> memsettedu2014-01-211-6/+6
|
* Typo in a printf, should be 'bytes' not 'blocks'mlarkin2014-01-141-2/+2
|
* remove the #define b_cylinder b_resid from bufs. i hated thedlg2013-11-211-2/+1
| | | | | | | | | | | | | | | | | | | overloading of that thing. the only hardware that seems to care about cylinders in our tree are floppy drives, and the drivers for those calculate their own cylinders from logical block addresses and ignore whatever the rest of the kernel thought b_cylinders should be. most of this diff is moving the floppy drivers to using b_resid as a resid and using that as part of the calculation for real cylinder values. the rest of the diff is getting rid of the useless assignments to b_cylinder that dont get used by anything (now that disksort is gone). ok miod@
* Remove hibernate_get_next_rle function (unused, and we need to redo itmlarkin2013-11-091-37/+1
| | | | anyway as we move toward a streamed implmentation)
* unbias the chunks and chunktable writing and reading. as a result, itderaadt2013-11-091-7/+4
| | | | | | is now possible to move the chunktable right after the chunks, not at the end of the swap. ok mlarkin
* simplify a crazy expressionderaadt2013-11-061-5/+4
|
* In hibernate_write_chunks(), keep track of relative block numbers insteadderaadt2013-11-061-11/+10
| | | | | of absolute, so that we can add range checking. ok mlarkin