OpenBSD CVS

CVS log for src/sys/sys/hibernate.h


[BACK] Up to [local] / src / sys / sys

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.46 / (download) - annotate - [select for diffs], Tue Jun 4 20:31:35 2024 UTC (5 days, 22 hours ago) by krw
Branch: MAIN
CVS Tags: HEAD
Changes since 1.45: +4 -3 lines
Diff to previous 1.45 (colored)

Enable hibernate/resume to nvme(4) disks with 4096 byte sectors.

testing by florian@ mglocker@ mlarkin@

ok deraadt@ mglocker@ mlarkin@

Revision 1.45 / (download) - annotate - [select for diffs], Mon Jan 17 02:54:28 2022 UTC (2 years, 4 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.44: +7 -5 lines
Diff to previous 1.44 (colored)

Allow more memory ranges in hibernate

The previous limit of VM_PHYSSEG_MAX ranges (16) was proving too small for
newer machines. This diff reorganizes the hibernate signature block to allow
for 22 ranges by removing the kernel version comparison and replacing it
with a SHA of several unique kernel features (the version string and several
addresses of functions not inside the same .o).

Reported by claudio@, who also helped fix some issues in the diff. Input
from deraadt@ as well.

Tested by myself and claudio on a variety of machines. Only compile tested on
i386 as I have no more S4-capable i386 hardware anymore.

ok claudio@

Revision 1.44 / (download) - annotate - [select for diffs], Sun Jan 16 22:27:46 2022 UTC (2 years, 4 months ago) by mlarkin
Branch: MAIN
Changes since 1.43: +3 -3 lines
Diff to previous 1.43 (colored)

Remove trailing whitespace in a few places. No code change.

Revision 1.43 / (download) - annotate - [select for diffs], Fri Jan 7 02:47:06 2022 UTC (2 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

hibernate_clear_signature() is only used by hibernate_resume(), so
pass in the already read hibernate_info instead of reading it again.

ok deraadt@

Revision 1.42 / (download) - annotate - [select for diffs], Thu Jun 21 07:33:30 2018 UTC (5 years, 11 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.41: +6 -1 lines
Diff to previous 1.41 (colored)

Save and restore retguard area during hibernate unpack. This copies the
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.

Revision 1.41 / (download) - annotate - [select for diffs], Thu Jun 22 15:56:29 2017 UTC (6 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.40: +2 -1 lines
Diff to previous 1.40 (colored)

calculate a "sum" based upon pointers to functions all over the kernel,
so that an unhibernate kernel can detect if it is running with the
kernel it booted.
ok mlarkin

Revision 1.40 / (download) - annotate - [select for diffs], Tue Sep 27 02:53:49 2016 UTC (7 years, 8 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

move from RB macros to RBT functions

Revision 1.39 / (download) - annotate - [select for diffs], Sat Feb 7 01:19:40 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.38: +2 -1 lines
Diff to previous 1.38 (colored)

New framework that allows hibernate to pass in entropy from it's fresh
boot.
ok mlarkin

Revision 1.38 / (download) - annotate - [select for diffs], Thu Oct 9 00:42:05 2014 UTC (9 years, 8 months ago) by mlarkin
Branch: MAIN
Changes since 1.37: +1 -2 lines
Diff to previous 1.37 (colored)



remove an unused function and some unused variables in hibernate

Revision 1.37 / (download) - annotate - [select for diffs], Fri Sep 26 09:25:38 2014 UTC (9 years, 8 months ago) by kettenis
Branch: MAIN
Changes since 1.36: +3 -2 lines
Diff to previous 1.36 (colored)

Rework piglet and pig allocation.  Currently the piglet gets allocated
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@

Revision 1.36 / (download) - annotate - [select for diffs], Sun Jul 20 18:05:21 2014 UTC (9 years, 10 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.35: +2 -2 lines
Diff to previous 1.35 (colored)


Support hibernating to softraid crypto volumes.

much help and ok from deraadt@

Revision 1.35 / (download) - annotate - [select for diffs], Wed Jul 16 07:42:51 2014 UTC (9 years, 10 months ago) by mlarkin
Branch: MAIN
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)



Reenable hibernate RLE support and flush+zero all memory after unpack.

Revision 1.34 / (download) - annotate - [select for diffs], Sat Jul 12 09:02:24 2014 UTC (9 years, 11 months ago) by kettenis
Branch: MAIN
Changes since 1.33: +2 -1 lines
Diff to previous 1.33 (colored)

Add a function to drop all clean pages on the page daemon queues and call
it when we hibernate.

ok mlarkin@, miod@, deraadt@

Revision 1.33 / (download) - annotate - [select for diffs], Fri Jul 11 03:06:08 2014 UTC (9 years, 11 months ago) by mlarkin
Branch: MAIN
Changes since 1.32: +3 -1 lines
Diff to previous 1.32 (colored)

Flush the buffercache to 16MB on hibernate and restore its previous max
size (kern.bufcachepercent) on resume, for better hibernate performance.

ok beck@

Revision 1.32 / (download) - annotate - [select for diffs], Wed Jul 9 14:10:25 2014 UTC (9 years, 11 months ago) by mlarkin
Branch: MAIN
Changes since 1.31: +2 -1 lines
Diff to previous 1.31 (colored)



Cleanup the chunk placement routine by removing the conflict resolver.
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.

Revision 1.31 / (download) - annotate - [select for diffs], Wed Jul 9 12:43:51 2014 UTC (9 years, 11 months ago) by mlarkin
Branch: MAIN
Changes since 1.30: +4 -1 lines
Diff to previous 1.30 (colored)



Use suspending kernel's stack smash guard to avoid panicing during unpack.

ok deraadt@

Revision 1.30 / (download) - annotate - [select for diffs], Sat Nov 9 06:54:00 2013 UTC (10 years, 7 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.29: +1 -2 lines
Diff to previous 1.29 (colored)



Remove hibernate_get_next_rle function (unused, and we need to redo it
anyway as we move toward a streamed implmentation)

Revision 1.29 / (download) - annotate - [select for diffs], Sat Nov 9 04:38:42 2013 UTC (10 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.28: +2 -1 lines
Diff to previous 1.28 (colored)

unbias the chunks and chunktable writing and reading.  as a result, it
is now possible to move the chunktable right after the chunks, not at
the end of the swap.
ok mlarkin

Revision 1.28 / (download) - annotate - [select for diffs], Wed Nov 6 19:45:45 2013 UTC (10 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.27: +1 -1 lines
Diff to previous 1.27 (colored)

shorten dev_t in hib_info

Revision 1.27 / (download) - annotate - [select for diffs], Wed Nov 6 17:02:59 2013 UTC (10 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.26: +1 -2 lines
Diff to previous 1.26 (colored)

use DEV_BSIZE instead of "secsize"
ok mlarkin

Revision 1.26 / (download) - annotate - [select for diffs], Wed Nov 6 12:06:56 2013 UTC (10 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.25: +1 -2 lines
Diff to previous 1.25 (colored)

teach the side-effect free drivers about the partition they are dealing
by passing a start/length in the HIB_INIT op.  Then rebase all
hibernate-time block offsets to be relative to the start of that partition.
This simplifies things a lot.
ok mlarkin

Revision 1.25 / (download) - annotate - [select for diffs], Sun Sep 29 16:28:35 2013 UTC (10 years, 8 months ago) by mlarkin
Branch: MAIN
Changes since 1.24: +1 -5 lines
Diff to previous 1.24 (colored)



Removed some unused code

Revision 1.24 / (download) - annotate - [select for diffs], Tue Apr 9 18:58:03 2013 UTC (11 years, 2 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.23: +9 -1 lines
Diff to previous 1.23 (colored)



Add a magic number to the head of the signature block. Check for magic
number match during signature block read during speculative unhibernate on
boot. If the magic number matches but we have otherwise chosen to not
unhibernate (due to kernel/memory mismatch), clear the signature block
early to avoid accidentally trying to unhibernate on subsequent boots. This
prevents accidental unhibernates and endless unhibernate/reboot cycles.

Add a define for HIBERNATE_DEBUG for various debugging printfs (disabled by
default).

Finally, change some KASSERTs to warning printfs (they probably shouldn't
have been KASSERTs in the first place).

"looks good" deraadt@

Revision 1.23 / (download) - annotate - [select for diffs], Thu Jan 17 02:36:45 2013 UTC (11 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.22: +2 -1 lines
Diff to previous 1.22 (colored)

Add a hibernate HIB_DONE op.  After the memory-side-effect driver finishes
IO to the disk, DVACT_RESUME the controller back to normal operation.  That
allows us to do the full DVACT_POWERDOWN sequence afterwards.
ok mlarkin

Revision 1.22 / (download) - annotate - [select for diffs], Sun Jul 8 12:22:26 2012 UTC (11 years, 11 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.21: +7 -2 lines
Diff to previous 1.21 (colored)



Reorganize some hibernate functions for easier readability.
Fix some incorrect/old comments.

ok deraadt@

Revision 1.21 / (download) - annotate - [select for diffs], Thu Jun 21 12:46:30 2012 UTC (11 years, 11 months ago) by jmatthew
Branch: MAIN
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

use regular i/o functions in the hibernate resume path.  ahci(4) hibernate
i/o will not mix with regular i/o so it can only be used in the hibernate
path.

ok deraadt@ mlarkin@

Revision 1.20 / (download) - annotate - [select for diffs], Mon Mar 26 16:15:42 2012 UTC (12 years, 2 months ago) by mlarkin
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)



Fix an integer math error when using the result of uvm_page_rle, and
at the same time increase said function's max RLE page count return value.

Add hooks in the right places to call the hibernate suspend and resume
routines, so that we can enable hibernation with a HIBERNATE option
line in GENERIC and appropriate acpi.c goo.

discussed on and off with deraadt@ over the past few months

Revision 1.19 / (download) - annotate - [select for diffs], Tue Nov 29 05:21:10 2011 UTC (12 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

ready this for big-endian support later on
ok mlarkin

Revision 1.18 / (download) - annotate - [select for diffs], Wed Nov 16 23:52:27 2011 UTC (12 years, 6 months ago) by mlarkin
Branch: MAIN
Changes since 1.17: +4 -3 lines
Diff to previous 1.17 (colored)



Reduce use of globals in hibernate code.

discussed with deraadt@

Revision 1.17 / (download) - annotate - [select for diffs], Mon Nov 14 00:25:17 2011 UTC (12 years, 6 months ago) by mlarkin
Branch: MAIN
Changes since 1.16: +2 -1 lines
Diff to previous 1.16 (colored)



Use a fixed io_page for all hibernate I/O, which is needed for
ahci_hibernate_io, a skeleton of which is also provided in this diff.

This code is from deraadt@. Tested on a few wd machines to ensure it works
there as well.

Revision 1.16 / (download) - annotate - [select for diffs], Sun Nov 13 23:13:29 2011 UTC (12 years, 6 months ago) by mlarkin
Branch: MAIN
Changes since 1.15: +4 -1 lines
Diff to previous 1.15 (colored)



Add some #defines for the various hibernate I/O modes, some of the
groundwork for *_hibernate_io functions other than wd_hibernate_io

These changes were sent to me by deraadt@

Revision 1.15 / (download) - annotate - [select for diffs], Sun Nov 13 22:36:27 2011 UTC (12 years, 6 months ago) by mlarkin
Branch: MAIN
Changes since 1.14: +2 -1 lines
Diff to previous 1.14 (colored)



In hibernate resume, free the piglet and other VAs we allocated during
suspend.

ok pirofti@

Revision 1.14 / (download) - annotate - [select for diffs], Thu Sep 22 22:12:43 2011 UTC (12 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.13: +10 -20 lines
Diff to previous 1.13 (colored)

KNF of mlarkin's code, requested by him.  Some improvements to the interface
for talking to the disk driver snuck in.
ok mlarkin

Revision 1.13 / (download) - annotate - [select for diffs], Wed Sep 21 02:51:23 2011 UTC (12 years, 8 months ago) by mlarkin
Branch: MAIN
Changes since 1.12: +30 -19 lines
Diff to previous 1.12 (colored)



Perform most of the remaining refactoring of hibernate code into
MI/MD parts. This also introduces a chunk placement routine that was
originally developed at c2k11 with help from drahn and ariane.

There are still a few more things to do for hibernate, but those can be
worked on in-tree. This code is disabled by default, and not yet called.

ok deraadt@ (and deraadt@ said kettenis@ also ok'ed it :) )

Revision 1.12 / (download) - annotate - [select for diffs], Mon Jul 11 03:30:32 2011 UTC (12 years, 11 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.11: +2 -1 lines
Diff to previous 1.11 (colored)



Add hibernate_read_block and fix a couple of typos in the previous commit.

Revision 1.11 / (download) - annotate - [select for diffs], Sat Jul 9 03:10:27 2011 UTC (12 years, 11 months ago) by mlarkin
Branch: MAIN
Changes since 1.10: +3 -1 lines
Diff to previous 1.10 (colored)



Call (temporarily, until we have RLE page encoding) uvm_pmr_zero_everything
on suspend to ensure we get good zlib compression.

Add MI signature block (hibernate_info) comparison routine

Revision 1.10 / (download) - annotate - [select for diffs], Sat Jul 9 01:30:39 2011 UTC (12 years, 11 months ago) by mlarkin
Branch: MAIN
Changes since 1.9: +6 -1 lines
Diff to previous 1.9 (colored)



Extract hibernate_write_signature and hibernate_clear_signature to the MI
hibernate code, and add chunk range overlap checking.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Jul 9 00:55:00 2011 UTC (12 years, 11 months ago) by mlarkin
Branch: MAIN
Changes since 1.8: +3 -1 lines
Diff to previous 1.8 (colored)



Extract MI pmap function hibernate_enter_resume_mapping, refactor old i386
resume pmap code to match.

Add hibernate deflater and inflater and cache flush routines.

Code is not presently called or automatically built.

Revision 1.8 / (download) - annotate - [select for diffs], Sat Jul 9 00:27:31 2011 UTC (12 years, 11 months ago) by mlarkin
Branch: MAIN
Changes since 1.7: +4 -1 lines
Diff to previous 1.7 (colored)



Add zlib reset, alloc, and free functions for hibernate image compression

Revision 1.7 / (download) - annotate - [select for diffs], Sat Jul 9 00:08:04 2011 UTC (12 years, 11 months ago) by mlarkin
Branch: MAIN
Changes since 1.6: +71 -1 lines
Diff to previous 1.6 (colored)



Separate some MD and MI bits and a bit of refactoring to make subsequent
commits easier.

Work in progress, hibernate will still not work for you.

ok deraadt@

Revision 1.6 / (download) - annotate - [select for diffs], Fri Jul 8 21:00:53 2011 UTC (12 years, 11 months ago) by ariane
Branch: MAIN
Changes since 1.5: +2 -1 lines
Diff to previous 1.5 (colored)

Ensure all pages in pmemrange can be marked as dirty.
It'd be a very bad idea to hand out dirty pages as zeroed, just because
we came back from hibernate.

No callers at the moment, will be called on hibernate resume path.

Revision 1.5 / (download) - annotate - [select for diffs], Fri Jul 8 18:34:46 2011 UTC (12 years, 11 months ago) by ariane
Branch: MAIN
Changes since 1.4: +2 -1 lines
Diff to previous 1.4 (colored)

Put in RLE logic for hibernate compressor.

These have the potential to compress 1MB of physmem into 1 byte.
This works by noting the page is not in use and therefor skipping it.

Needed by mlarkin@ for hibernate.  No callers yet.

Revision 1.4 / (download) - annotate - [select for diffs], Fri Jul 8 18:31:16 2011 UTC (12 years, 11 months ago) by ariane
Branch: MAIN
Changes since 1.3: +3 -2 lines
Diff to previous 1.3 (colored)

Change pig allocator to a highest-address selection.
Add piglet allocator, which does a lowest-address selection.

No callers yet, needed by mlarkin@ for hibernate voodoo.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Jul 8 18:25:56 2011 UTC (12 years, 11 months ago) by ariane
Branch: MAIN
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

Move uvm_pmr_alloc_pig to kern/subr_hibernate.c

No callers, no functional change.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Jul 8 18:20:10 2011 UTC (12 years, 11 months ago) by ariane
Branch: MAIN
Changes since 1.1: +2 -1 lines
Diff to previous 1.1 (colored)

Move uvm_pmr_zero_everything() to subr_hibernate.

This function will probably die before ever being called
from the in-tree code, since hibernate will move to RLE encoding.

No functional change, function had no callers.

Revision 1.1 / (download) - annotate - [select for diffs], Fri Jul 8 17:58:16 2011 UTC (12 years, 11 months ago) by ariane
Branch: MAIN

Move hiballoc to hibernate.h, subr_hibernate.c
Next few commits will move other hibernate-specific functionality,
like the pig-allocator, to subr_hibernate.

No functional change, no callers either.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.