lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1652860121-24092-1-git-send-email-quic_vivekuma@quicinc.com>
Date:   Wed, 18 May 2022 13:18:35 +0530
From:   Vivek Kumar <quic_vivekuma@...cinc.com>
To:     <corbet@....net>, <catalin.marinas@....com>, <will@...nel.org>,
        <tglx@...utronix.de>, <maz@...nel.org>, <axboe@...nel.dk>,
        <rafael@...nel.org>, <akpm@...ux-foundation.org>,
        <linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-block@...r.kernel.org>, <linux-pm@...r.kernel.org>,
        <linux-mm@...ck.org>
CC:     <len.brown@...el.com>, <pavel@....cz>, <paulmck@...nel.org>,
        <bp@...e.de>, <keescook@...omium.org>, <songmuchun@...edance.com>,
        <rdunlap@...radead.org>, <damien.lemoal@...nsource.wdc.com>,
        <pasha.tatashin@...een.com>, <tabba@...gle.com>, <ardb@...nel.org>,
        <tsoni@...cinc.com>, <quic_psodagud@...cinc.com>,
        <quic_svaddagi@...cinc.com>,
        Vivek Kumar <quic_vivekuma@...cinc.com>
Subject: [RFC 0/6] Bootloader based hibernation

Kernel Hibernation

Linux Kernel has been already supporting hibernation, a process which
involves freezing of all userspace tasks, followed by quiescing of all
kernel device drivers and then a DDR snapshot is taken which is saved
to disc-swap partition, after the save, the system can either shutdown
or continue further. Generally during the next power cycle when kernel
boots and after probing almost all of the drivers, in the late_init()
part, it checks if a hibernation image is present in the specified swap
slot, if a valid hibernation image is found, it superimposes the currently
executing Kernel with an older kernel from the snapshot, moving further,
it calls the restore of the drivers and unfreezes the userspace tasks.
CONFIG_HIBERNATION and a designated swap partition needs to be present
for to enable Hibernation.

Bootloader Based Hibernation:

Automotive usecases require better boot KPIs, Hence we are proposing a
bootloader based hibernation restore. Purpose of bootloader based
hibernation is to improve the overall boot time till the first display
frame is seen on the screen or a camera application can be launched from
userspace after the power on reset key is pressed. This RFC patchset
implements a slightly tweaked version of hibernation in which the
restoration of an older snapshot into DDR is being carried out from the
bootloader (ABL) itself, by doing this we are saving some time
(1 second measured on msm-4.14 Kernel) by not running a
temporary kernel and figuring out the hibernation image at late_init().
In order to achieve the same bootloader checks for the hibernation
image at a very early stage from swap partition, it parses the image and
loads it in the DDR instead of loading boot image form boot partition.
Since we are not running the temporary kernel,which would have done some
basic ARM related setup like, MMU enablement, EL2 setup, CPU setup etc,
entry point into hibernation snapshot image directly from bootloader is
different, on similar lines, all device drivers are now re-programming
the IO-mapped registers as part of the restore callback (which is
triggered from the hibernation framework) to bring back the HW/SW sync.

Other factors like, read-speed of the secondary storage device and
organization of the hibernation image in the swap partition effects the
total image restore time and the overall boot time. In our current
implementation we have serialized the allocation of swap-partition's slots
in kernel, so when hibernation image is being saved to disc, each page is
not scattered across various swap-slot offsets, rather it in a serial
manner. For example, if a DDR page at Page frame number 0x8005 is
located at a swap-slot offset 50, the next valid DDR page at PFN 0x8005
will be preset at the swap-slot offset 51. With this optimization in
place, bootloader can utilize the max capacity of issuing a disc-read
for reading a bigger chunk (~50 MBs at once) from the swap slot,
and also parsing of the image becomes simpler as it is available
contiguously.



Vivek Kumar (6):
  arm64: hibernate: Introduce new entry point to kernel
  PM: Hibernate: Add option to disable disk offset randomization
  block: gendisk: Add a new genhd capability flag
  mm: swap: Add randomization check for swapon/off calls
  Hibernate: Add check for pte_valid in saveable page
  irqchip/gic-v3: Re-init GIC hardware upon hibernation restore

 Documentation/admin-guide/kernel-parameters.txt |  11 ++
 arch/arm64/kernel/hibernate.c                   |   9 ++
 drivers/irqchip/irq-gic-v3.c                    | 138 ++++++++++++++++-
 include/linux/blkdev.h                          |   1 +
 kernel/power/snapshot.c                         |  43 ++++++++
 kernel/power/swap.c                             |  12 +++
 mm/swapfile.c                                   |   6 +-
 7 files changed, 216 insertions(+), 4 deletions(-)

-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ