=== Hibernate (aka Suspend-to-disk)

Links: +
link:https://github.com/OlCe2/freebsd-src/tree/oc-hibernate[Image saving prototype] URL: https://github.com/OlCe2/freebsd-src/tree/oc-hibernate +
link:https://github.com/OlCe2/freebsd-src/tree/for_kib-hiber[EFI loader] URL: https://github.com/OlCe2/freebsd-src/tree/for_kib-hiber

Contact: Olivier Certner <olce@FreeBSD.org> +
Contact: Konstantin Belousov <kib@FreeBSD.org>

Work is ongoing to have FreeBSD support hibernate (suspend-to-disk), without BIOS/firmware assistance to save the current machine state, for `amd64` UEFI-booted machines.
See also the link:../report-2026-01-2026-03/#_hibernate_aka_suspend_to_disk[previous report].

After a pause of almost two months, we fixed some bugs in the image saving prototype, rebased it on recent code, and revised the interface between the kernel and the resume EFI loader, requiring some changes on both sides.
This lead to a number of changes in ACPI general suspend/resume code and in-passing fixes.
Work is in progress in the EFI loader (stage 1).
A sketch of the kernel resume part (stage 2) was devised.

Some more discussion happened about how to save the system image while preserving its consistency, as the dump operation itself modifies kernel memory.
The aim is to narrow down which components can interfere with the dump, and how to prevent that interference.
In particular, it appears that low-level DMA and IOMMU code could perform memory allocations in certain circumstances, and it is yet unclear if that could happen during a dump.
Once determined, we will pursue eliminating these circumstances if possible, else will work on a snapshot-like mechanism.
Beyond that aspect, a live snapshot mechanism could be beneficial as it allows to use any kernel facility without restriction to perform the dump, and in particular alleviates the need to have one dump routine per disk driver.

We presented the current status of this work, associated challenges and possible implementation of a snapshot-like mechanism at BSDCan in June, and will do so again at EuroBSDCon in September.

Sponsor: The FreeBSD Foundation
