summaryrefslogtreecommitdiff
path: root/sys/kern/subr_hibernate.c
AgeCommit message (Collapse)Author
2018-06-21don't let the retguard skip region exceed the space we have reserved forMike Larkin
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.
2018-06-21Save and restore retguard area during hibernate unpack. This copies theMike Larkin
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.
2017-08-17print why the signature block check of an unhibernate attempt failed, toMike Larkin
let people know what changed. ok kettenis, phessler
2017-06-22calculate a "sum" based upon pointers to functions all over the kernel,Theo de Raadt
so that an unhibernate kernel can detect if it is running with the kernel it booted. ok mlarkin
2017-03-27If hibernate_alloc() encounters a problem it should undo the partialTheo de Raadt
work. ok mlarkin kettenis
2016-09-27move from RB macros to RBT functionsDavid Gwynne
2016-09-16move the vm_page struct from being stored in RB macro trees to RBT functionsDavid Gwynne
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.
2016-09-05Fix hibernation - make stack protector writable during resumeBob Beck
Committing for guenther@ because he is on United and apparently they break ssh (as well as guitars) ok deraadt@ in the car from cambridge
2016-09-01Fix undefined behaviour when comparing pointers by casting them to vaddr_t.akfaew
OK mlarkin@
2015-05-04Clarify that hibernate_resume must be called with interrupts enabled.Mike Larkin
2015-02-07Preserve a page's worth of random data on hibernate resume. Used to improveMike Larkin
entropy after resuming. Tested on i386 and amd64. ok deraadt@
2015-02-07New framework that allows hibernate to pass in entropy from it's freshTheo de Raadt
boot. ok mlarkin
2015-02-06Fix a hibernate crash on some machines due to unmapping a page thatMike Larkin
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
2015-01-12hibernate_suspend() should not pmap_kremove by itself; hibernate_free()Theo de Raadt
must do that. otherwise, pmap_kremove is called twice. i386 in particular does not tolerate that, found by sebastia ok mlarkin kettenis
2014-12-22fix an error in piglet allocation when requesting an alignment < PAGE_SIZEMike Larkin
(which we never did, but it was a bug nonetheless). ok kettenis, deraadt
2014-12-17remove lock.h from uvm_extern.h. another holdover from the simpletonlockTed Unangst
era. fix uvm including c files to include lock.h or atomic.h as necessary. ok deraadt
2014-11-16Replace a plethora of historical protection options with justTheo de Raadt
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
2014-11-05No reason to have things like the hibernate allocation area and chunkMike Larkin
ordering regions mapped executable, so remove those permissions. ok deraadt@
2014-11-02Unmap the hibernate hiballoc page after we are done with it.Mike Larkin
ok deraadt, kettenis
2014-10-22Remove some unused/unneeded code.Mike Larkin
2014-10-22Use the global piglet address variables as sparingly as possible to avoidMike Larkin
redundant copies of the same information. No functional change. Also add some comments as to how these globals are used.
2014-10-16No need to reserve separate KVA ranges for the RLE and copy pages inMike Larkin
hibernate anymore.
2014-10-09fix some data type mismatches in the zlib paths in hibernateMike Larkin
2014-10-09remove an unused function and some unused variables in hibernateMike Larkin
2014-09-26Rework piglet and pig allocation. Currently the piglet gets allocatedMark Kettenis
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@
2014-09-19Use config_suspend_all(9).Mark Kettenis
2014-07-21fix some wrong comments and a bit of KNFMike Larkin
2014-07-20Support hibernating to softraid crypto volumes.Mike Larkin
much help and ok from deraadt@
2014-07-16Reenable hibernate RLE support and flush+zero all memory after unpack.Mike Larkin
2014-07-09Minor cleanups in wording in some comments and printfs, and added someMike Larkin
dprintfs to help debugging in the field (disabled by default)
2014-07-09Don't use the suspending kernel's VA mapping for the piglet. It's farMike Larkin
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.
2014-07-09Cleanup the chunk placement routine by removing the conflict resolver.Mike Larkin
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.
2014-07-09Use suspending kernel's stack smash guard to avoid panicing during unpack.Mike Larkin
ok deraadt@
2014-05-31Fix a format specifier in a debug printf.Mike Larkin
Noticed by Josh Grosse.
2014-05-29Read MAXPHYS bytes at a time in the hibernate image read, instead ofMike Larkin
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.
2014-05-21Change use of Z_PARTIAL_FLUSH to Z_SYNC_FLUSH in the hibernate code as perMike Larkin
a warning/comment in zlib.h that Z_PARTIAL_FLUSH "will be removed, use Z_SYNC_FLUSH instead".
2014-04-26Perform MAXPHYS-sized reads for the chunktable instead of PAGE_SIZE-sizedMike Larkin
reads. Also fix a VA leak in the chunktable read error path.
2014-04-20More dead stores removal in subr_hibernate.cMike Larkin
2014-04-19Dead stores in subr_hibernate.cMike Larkin
2014-03-21Allow for two more pmap-specific bits in vm_page pg_flags. DefineMiod Vallat
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.
2014-03-13get rid of the assumption that the head of the alldevs list is theDavid Gwynne
"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.
2014-02-01Remove some of the excessive cache and TLB flushing going on duringMike Larkin
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
2014-01-21bzero -> memsetTed Unangst
2014-01-14Typo in a printf, should be 'bytes' not 'blocks'Mike Larkin
2013-11-21remove the #define b_cylinder b_resid from bufs. i hated theDavid Gwynne
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@
2013-11-09Remove hibernate_get_next_rle function (unused, and we need to redo itMike Larkin
anyway as we move toward a streamed implmentation)
2013-11-09unbias the chunks and chunktable writing and reading. as a result, itTheo de Raadt
is now possible to move the chunktable right after the chunks, not at the end of the swap. ok mlarkin
2013-11-06simplify a crazy expressionTheo de Raadt
2013-11-06In hibernate_write_chunks(), keep track of relative block numbers insteadTheo de Raadt
of absolute, so that we can add range checking. ok mlarkin
2013-11-06spacingTheo de Raadt