fast boot and suspend/resume zhang rui [email protected] beijing october 18 th 2008

21
Fast boot and Fast boot and suspend/resume suspend/resume Zhang Rui Zhang Rui [email protected] [email protected] Beijing October 18 Beijing October 18 th th 2008 2008

Upload: emma-macgregor

Post on 26-Mar-2015

218 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

Fast boot and Fast boot and suspend/resumesuspend/resume

Zhang RuiZhang [email protected]@intel.com

Beijing October 18Beijing October 18thth 2008 2008

Page 2: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

2

AgendaAgenda Fast bootFast boot

– Current State of the Art Current State of the Art

– Splash ScreensSplash Screens

– Budget & Resource SchedulingBudget & Resource Scheduling

– KernelKernel

– Early UserspaceEarly Userspace

– X.orgX.org

Fast suspend/resumeFast suspend/resume– Driver optimizationDriver optimization

– Device asynchronous resumeDevice asynchronous resume

–More aggressive attemptsMore aggressive attempts

Page 3: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

3

Current state Current state

boot to be completely done in 5 secondsboot to be completely done in 5 seconds

Page 4: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

4

We hate splash screensWe hate splash screensBy the time you see it.... we want to be done!By the time you see it.... we want to be done!

23/4/104

Splash screens

Page 5: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

5

Time budgets, Resource Time budgets, Resource schedulingscheduling

boot to be completely done in 5 secondsboot to be completely done in 5 seconds

ComponentComponent Allocated timeAllocated time

KernelKernel 1 second1 second

Early bootEarly boot 1 second1 second

XX 1 second1 second

GUI/DesktopGUI/Desktop 2 seconds2 seconds

Page 6: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

6

sReadAheadsReadAhead read used portions of files in read used portions of files in

"use order" as early as possible "use order" as early as possible to prime the pagecacheto prime the pagecache

"idle" IO scheduler class"idle" IO scheduler class

Page 7: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

7

KernelKernelBudget: 1 secondBudget: 1 second All system components built into the All system components built into the

kernel imagekernel image

–Modules are slow, synchronous, and not Modules are slow, synchronous, and not needed for core componentsneeded for core components

No initrdNo initrd

–All key drivers are in the kernelAll key drivers are in the kernel

– /dev is populated with the fixed device /dev is populated with the fixed device nodesnodes

– initrd management just plain takes too initrd management just plain takes too longlong

Page 8: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

8

KernelKernelBudget: 1 secondBudget: 1 second Asynchronous initialization of non-Asynchronous initialization of non-

essential components with a new, essential components with a new, asynchronous initcall asynchronous initcall levellevel

Reference: Reference: git://git.kernel.org/pub/scm/linux/kernel/git/arjan/linux-git://git.kernel.org/pub/scm/linux/kernel/git/arjan/linux-2.6-fastboot.git2.6-fastboot.git

Page 9: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

9

Early boot / InitEarly boot / InitBudget: 1 secondBudget: 1 second sysvinitsysvinit, not , not upstartupstart: :

Asynchronous, not ParallelAsynchronous, not Parallel UdevUdev–Persistent /dev reduces overhead Persistent /dev reduces overhead

enormouslyenormously

Page 10: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

10

Early boot / InitEarly boot / InitBudget: 1 secondBudget: 1 second Asynchronous for non-critical path

Page 11: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

11

X.orgX.orgBudget: 1 secondBudget: 1 second xorg-x11-drv-intel driverxorg-x11-drv-intel driver–Program everything during probingProgram everything during probing– ... then restore it to standard... then restore it to standard– ... then program it again for final use... then program it again for final use–Various "extra" delays trimmed (after Various "extra" delays trimmed (after

fixing PCI posting bugs)fixing PCI posting bugs) XKBXKB–Calling CPP ??? <explicit language Calling CPP ??? <explicit language

removed>removed>–Caching the result – Compute once, use Caching the result – Compute once, use

foreverforever

Page 12: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

12

Page 13: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

13

Fast suspend/resumeFast suspend/resume Not as complex as fast bootNot as complex as fast boot–BIOS + kernel + X/applicationBIOS + kernel + X/application

–No critical disk I/O requestNo critical disk I/O request

Time budgetTime budget–Resume Kernel + X/application in 1 Resume Kernel + X/application in 1

secondsecond

Page 14: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

14

Driver optimizationDriver optimization non-critical work can be non-critical work can be

deferred during device resumedeferred during device resume–SerioSerio– offload resume to kseriodoffload resume to kseriod

Fix driver poor/wrong behaviorFix driver poor/wrong behavior–AHCIAHCI– HBA reset speed upHBA reset speed up

Page 15: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

15

Device asynchronous resumeDevice asynchronous resume Resume devices asynchronouslyResume devices asynchronously Sync before resume Sync before resume

X/applicationsX/applications

X/app

SCSI

ACPI

USB

… ACPI … ……SCSI USB X/app

Page 16: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

16

More aggressive attemptsMore aggressive attempts Device deferred resume instead Device deferred resume instead

of asynchronous resumeof asynchronous resume–don’t sync before resuming don’t sync before resuming

X/applicationsX/applications

–Screen is back before all the devices are Screen is back before all the devices are resumedresumed–works but may bring potential risksworks but may bring potential risks

X/app

SCSI

ACPI

USB

Page 17: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

17

More aggressive attemptsMore aggressive attempts Resume X with the highest Resume X with the highest

prioritiespriorities–Resume drm driver first to light the Resume drm driver first to light the

screenscreen

–Resume X process before the other Resume X process before the other kernel driverskernel drivers

–Works but not for upstream yetWorks but not for upstream yet

Page 18: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

18

S3 resume time MoblinS3 resume time Moblin

BIOS kernel X/app.

1.65s 0.25s0.20s

1.65s 0.25s 0.36s

1.65s 1.19s 0.36s

1.65s 1.78s 0.37sCurrent state

Asynchronous resume

deferred resume

resume X first

Page 19: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

19

TODOTODO push “deferred resume” push “deferred resume”

mechanism upstreammechanism upstream Fast suspendFast suspend Fast shutdownFast shutdown

Page 20: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

20

Acknowledgements Arjan van de Ven Auke Kok Li, Shaohua Zhao Yakui

Page 21: Fast boot and suspend/resume Zhang Rui rui.zhang@intel.com Beijing October 18 th 2008

21