linux suspend-to-disk objectives for consumer electronic devic · linux suspend-to-disk objectives...
TRANSCRIPT
![Page 1: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/1.jpg)
Linux Suspend-To-Disk Linux Suspend-To-Disk ObjectivesObjectives
for Consumer Electronic for Consumer Electronic DevicesDevices
Vitaly WoolVitaly WoolEmbeddedAlley Solutions Inc.EmbeddedAlley Solutions Inc.
![Page 2: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/2.jpg)
Suspend-To-Disk (STD)Suspend-To-Disk (STD)• suspend mode with the most power
saving• may be deployed on systems with
minimal PM• writes all the memory contents to disk
before going into suspend– swap or dedicated partition
• the kernel is re-started on resume– restores the information from STD image
![Page 3: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/3.jpg)
STD VS STRSTD VS STR• data saved to non-
volatile storage• userspace data is
saved• resume at kernel
entry point• devices are first put
into active state, then suspended/resumed
• data saved to RAM
• no userspace data is saved
• resume at kernel resume point
• devices are resumed directly
![Page 4: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/4.jpg)
STD ObjectivesSTD Objectives
• Pro– maximum power savings– easy to implement for a new platform
• Contra– long time to suspend– long time to resume– needs a lot of free space on disk– redundant data copying
• storage to allocated space, then to RAM
![Page 5: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/5.jpg)
STD for a CE deviceSTD for a CE device• CE device objectives
– usually no disk, only flash– struggle for space saving– slower than PC– usually powered even in OFF state (battery)
• “vanilla” STD not suitable– see the previous slide
• the resume time is not just long, it's VERY long
![Page 6: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/6.jpg)
STD for a CE device: how to STD for a CE device: how to adapt?adapt?
• boot time– more support from bootloader– parallel device init (separate topic :) )– skip kernel init stage
• space consumption– selectively save the information– compress the data
![Page 7: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/7.jpg)
STD example: swsusp for ARMSTD example: swsusp for ARM
• data saved on a swap partition– MTD usually– flushing takes quite a bit of time
• suspend using the standard means – 'echo disk > /sys/power/state'
• resume gets a bit of bootloader help– “resume=/dev/mtdblock2” or such
![Page 8: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/8.jpg)
STD example: suspend2 for ARMSTD example: suspend2 for ARM
• data saved on a swap partition– MTD usually– flushing takes quite a bit of time
• compression and encryption available• suspend using the standard means
– “hibernate” script
• resume gets a bit of bootloader help– “resume2=/dev/mtdblock2” or similar
![Page 9: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/9.jpg)
STD example: snapshot boot for STD example: snapshot boot for ARMARM
• data saved on a swap partition– MTD usually– flushing takes quite a bit of time
• suspend using the standard means– 'echo disk > /sys/power/state'
• resume needs bootloader help– 'bootss <address>' command
![Page 10: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/10.jpg)
snapshot boot VS STDsnapshot boot VS STD• direct data copying
– swap to RAM
• starts at kernel resume point
• devices are resumed directly
• redundant data copying– swap to allocated– allocated to original
• starts at kernel entry point
• devices are first put into active state, then suspended/resumed
![Page 11: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/11.jpg)
Example: PocketPC prototypeExample: PocketPC prototype
• ARM1136-based SoC• supports Deep Idle state
– the CPU is turned off, only RTC clock is running– most of the registers are lost– resumes on power button press, RTC alarm and
«battery low» signal– RAM self-refresh mode available
• battery always in– RAM contents are not lost on exit from self refresh
![Page 12: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/12.jpg)
Example: PocketPC prototypeExample: PocketPC prototype
• power management goals– aggressive power saving strategy– fast resume– state preservation if the battery is low
• STR?– fails the last goal– a lot of work to preserve CPU and devices’
registers/states
• STD?– fails the second goal
![Page 13: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/13.jpg)
Solution: “snapshot boot + STR” Solution: “snapshot boot + STR” hybridhybrid
• modify “snapshot boot” to cleanly separate saved kernel and userspace info
• use “snapshot boot” for suspend but save data in RAM
• wakeup on “battery low” event and flush data to flash or disk
![Page 14: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/14.jpg)
““snapshot boot + STR” hybrid: snapshot boot + STR” hybrid: how it workshow it works
• resume starts running bootloader either way
• bootloader to find out– normal boot– resume from Deep Sleep (data in RAM)
• restore only kernel-related data
– resume from poweroff (data in swap)• standard resume from snapshot boot
![Page 15: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/15.jpg)
0
1000
2000
3000
4000
5000
6000
Kernel Boot, ms
snapshot boot, ms
SB from RAM, ms
STR, ms
![Page 16: Linux Suspend-To-Disk Objectives for Consumer Electronic Devic · Linux Suspend-To-Disk Objectives for Consumer Electronic Devices Vitaly Wool EmbeddedAlley Solutions Inc](https://reader030.vdocuments.mx/reader030/viewer/2022041020/5ecf8450ebbc2c47d835409c/html5/thumbnails/16.jpg)
ConclusionsConclusions
• current Linux suspend states do not always match the CE devices’ PM goals– more flexibility is desired
• hybrid solutions can help in many cases– better matching the goals– existing code/framework reuse
• what about standardizing?– …