Improvement of startup time using Software Suspend - Project Update Sony Corporation Hiroki KAMINAGA kaminaga@sm.sony.co.jp 2006/MAR/24 JapanTechnicalJamboree7 1 Contents: • aim • swsusp functionality in detail • use of swsusp for snapshot boot 2006/MAR/24 JapanTechnicalJamboree7 2 AIM: • System startup time reduction – By using image of known system state, we try to accomplish kernel, module, and application startup time reduction • Other aspect – By using system image as a file, we can trace system development progress and error. 2006/MAR/24 JapanTechnicalJamboree7 3 Target envirionment: • Target hardware – OMAP OSK 5912 starter kit • Hardware Features: ARM9 core operating at 192 Mhz. DSP core operating at 192 Mhz. Target software TLV320AIC23 Stereo Codec – Linux kernel 2.6.11 32 Mbyte DDR SDRAM 32 Mbyte Flash ROM – Omap patch RS-232 Serial Port – U-boot 10 MBPS Ethernet port USB Host Port – Arm swsusp support patch Compact flash connector (developed and posted to ML) On board IEEE 1149.1 JTAG 2006/MAR/24 JapanTechnicalJamboree7 4 Swsusp (1): • 3 states supported by linux – Standby state • Minimal power savings, low latency to working system. Cpu retains power. ACPI S1 – Suspend to ram • Sufficient power savings, system in low-power. Memory in self refresh mod. ACPI S3 – Suspend to disk • Greatest power savings, similar to suspend to ram, mem contents written to disk. ACPI S4 2006/MAR/24 JapanTechnicalJamboree7 5 Swsusp (2): • Swsusp is suspend to disk (or suspend to swap, `sw` stands for swap) • Save image to nor flash instead of disk • On resume, read from nor flash instead of disk 2006/MAR/24 JapanTechnicalJamboree7 6 Swsusp (3): • Basic flow of swsusp (suspend phase) – – – – – – – Freeze processes Free unnecessary memory Suspend devices Make snapshot image (in memory) Resume devices Write snapshot image to swap Powerdown machine Note: swsusp needs half of total memory 2006/MAR/24 JapanTechnicalJamboree7 7 Swsusp (4): • Basic flow of swsusp (resume) – – – – – – – Resume begin at `late_initcall` Read image from swap to mem Freeze process Suspend devices Restore snapshot image Resume devices Thaw processes 2006/MAR/24 JapanTechnicalJamboree7 8 Swsusp (5): • Swsusp resume takes time. – Swsusp procedure is kicked at late_initcall • Almost before init process starts – Doing I/O twice • Swap to mem (allocated mem) • Mem to mem (allocated mem to orig mem addr) – Redundant device state transitions • Device gets setup, suspend, and resume again. 2006/MAR/24 JapanTechnicalJamboree7 9 Snapshot boot (1): • Co-operate kernel side suspend/resume and boot loader side init setups • Use snapshot image created by kernel • Boot loader does: – – – – Power up board Load snapshot image to original memory Initialize and do setups for resume Jump to resume entry point (not normal entry point) 2006/MAR/24 JapanTechnicalJamboree7 10 Snapshot boot (2): restore resume regs dev KERNEL LAND init BOOT LOADER board copy image continue process setup dev ON 2006/MAR/24 JapanTechnicalJamboree7 11 Snapshot boot (3): • Implemented in u-boot boot loader – new command: • bootss <image addr> <resume entry point> – Procedure: • Load snapshot image in flash to mem • Initialization and setups – – – – Setup clock speed Setup timer Setup various MMIO registers Enable MMU • Jump to resume entry point 2006/MAR/24 JapanTechnicalJamboree7 12 DEMO: • [[[demo of swsusp and snapshot boot]]] 2006/MAR/24 JapanTechnicalJamboree7 13 Reference: • Swsusp.txt – Documentation/power/swsusp.txt • Uboot – http://sourceforge.net/projects/u-boot/ • Suspend2 – http://www.suspend2.net 2006/MAR/24 JapanTechnicalJamboree7 14 EOF 2006/MAR/24 JapanTechnicalJamboree7 15