SlideShare a Scribd company logo
Power Management and
Linux (3.4.25)
Padmanabha S
<treasure4paddy@gmail.com>
Objective
 Discussing power management in Linux and it's usage
in Embedded Systems
Agenda
 A brief overview on PC power management
 A brief overview on suspand to RAM “STR” and suspend
to disk “SWSUSP” (aka hibernation)
 Fast boot of Embedded Linux using suspend to disk
(aka snapshot booting)
A overview on PC Power
Management
Major motivational factors for Power
management in computer systems
 In earlier days (90's) due to long boot time people left
their desktop PCs on all the time, this led to wastage of
energy
 Once Laptop and battery powered device arrived
(where battery life is a key feature) the need for power
management took commercial incentive
A overview on PC Power
Management
The motivation for POWER Management in
computer system led to multi-vendor
interoperability standards (listed below)
 Advanced Power Management (APM)
➢ Legacy method, also known as BIOS method where
Operating system has no knowledge about APM
➢ Uses device activity time-outs to determine when to
transaction of device into low power states
➢ Vendor specific implementation and maintenance
A overview on PC Power
Management
 Advanced Configuration and Power Interface
(ACPI)
➢ An interface specification which is OS-
controlled/directed Power management (OSPM)
➢ Power management is global in system unlike APM
where it is hidden
➢ ACPI defines power management states and
required functionality at multiple levels of
system as shown in next slide
A brief over view on ACPI
system states
➔ Global view : Gx states
➔ System : Sx states
➔ Processor : Cx states
➔ Devices : Dx states
 State numbers are interpreted as below
➢
“0” indicates system is active and available to user
➢ “1-n” indicates sleep states; higher number corresponds
to lower power usage (and from user prescriptive
system is “OFF” for all this power states)
A brief over view on ACPI
system states
 Global states reflects user's perception of the
machine
➢ G0 Working (S0): A system is fully operational / working
➢ G1 Sleeping (S1-S4): A system appears to be off and
power consumption is small and work can be resumed
without rebooting the OS (system context is save by
hardware and system software)
➢ G2 Soft off (S5): A system consumes minimal power, as
system context will not be saved which result in large
latency to return in working state (needs system restart)
➢ G3 Mechanical off: A system is mechanically off with zero
power consumption (except for RTC), OS must be restarted
and no hardware context is retained
A brief over view on ACPI
system states
➢ S0 Working State: Fully powered and operational.
➢ S1 Standby: System context (registers, caches) is retained,
RAM will is idle, but refreshed; less wake latency.
➢ S2 Standby: Same as S1 (a faster RAM refresh) except CPU
and cache context are lost; Can be viewed as intermediate
state between S1 and S3.
➢ S3 “Suspend to RAM”: Low wake latency, memory's context
and power is retained; CPU, chip-set and I/O devices context
are lost, RAM will be refreshed (not faster refresh).
➢ S4 “Suspend to Disk”: All hardware is in off state and
maintains no context, platform context is maintained in non-
volatile medium (contents of RAM are saved on disks and
retained while resuming) and all devices are powered off.
➢ S5 Shut-down: Similar to S4 but OS doesn't save any context
and system needs complete boot when it wakes up.
A brief over view on ACPI
system states
A brief over view on ACPI
system states
 Device power states are characterized by the following
attributes:
 Power consumption, how much it consumes?
 Device context, how much of its operational context does the device
retain in these states?
 Device driver behaviour , what must drivers for the device do to restore
the device to fully operational state
 Restore time, how long does it takes to restore the device to the fully
operational state?
 Wake-up capability, can the device request wake-up from a given power
state?
 The power state of a device need not match the system
power state, devices can be in the off (D3) state even
though the system is in the working state (S0).
 Exact definition of the device power states are device-
specific.
A brief over view on ACPI
system states
(Device State)
➢ D0 “ON”: Device is active and responsive
➢ D1, D2: No universal definition for these intermediate
states (and rarely used); D1 is expected to preserve
device context (saves less power) when compared to
D2
➢ D3 “OFF”:
➢ D3hot primary power is not yet removed from
the device;
➢ D3cold primary power is removed from the
device
A brief over view on ACPI
system states
(Processor state)
➢ C0 “Operating state”: In this state processor
executes instructions
➢ C1 “Halt”: CPU in non executing state; Platform
scales the CPU frequency; returns instantaneously
to executing state.
➢ C2 “Stop clock”: CPU in non executing state;
Platform scales the CPU frequency & voltage; takes
longer time to return in executing state.
➢ C3 “Sleep”: CPU's cache maintains state but ignores
any snoops (no cache coherency)
Linux sleep states
 Linux supports below sleep states:
➢ Standby
➢ Suspend to RAM ( standby with memory sleep state,
STR)
➢ Suspend to Disk (aka hibernation)
 When compared to STR, standby saves less power and
resume latency is almost similar with STR. Thus standby
support is usually not provided in computer systems.
Suspend to RAM (STR)
● The system main memory context will
be retained (powered and refreshed
appropriately)
● Power will be partially removed from
devices to save energy
● Hardware has to provide an
mechanism (or interface) to wakeup
system from STR state and pass
control to OS
● Platform has to export low level
routines for Linux Kernel (PM core,
platform independent) to carry out
platform-specific low-level suspend and
resume operations.
● Platform driver (ex: arch/arm/mach-
omap2/pm.h) exports those routines
via struct platform_suspend_ops
Suspend to RAM (STR)
 In 3.4.25:
➢ Platform registers platform_suspend_ops (ex:
arch/arm/mach-omap2/pm.c)
➢ Platform independent code creates sysfs entries
(kernel/power/main.c) with state attributes
(state_show and state_store)
➢ When user stores “disk” (echo disk > /sys/power/state), if
hibernation is supported, hibernation() is invoked.
➢ When user stores “mem” (echo mem > /sys/power/state),
if STR is supported, pm_suspend() is invoked with
appropriate flag (PM_SUSPEND_MEM)
➢ pm_suspend() (kernel/power/suspend.c) than invokes
enter_state() with appropriate state to initate STR
Suspend to RAM (STR)
Suspend to RAM (STR)
Raise notifer event
PM_SUSPEND_PREPARE
Freeze processes &
kernel threads
“freeze_process”
“freeze_kernel_threads”
Disable printk
“suspend_console”
Prepare devices forPM transistion
( .prepare callaback in dev_pm_ops)
“device_prepare(dev, PMSG_SUSPEND”
.is_prepared=true
&
Suspend the devices
(.suspend callaback in dev_pm_ops)
“dev_suspend(dev)”
.is_suspend=true
Precedence:
dev->pm_domain->ops
dev->type->pm
dev->class->pm
dev->bus->pm
dev->driver->pm
Sync file system
“sys_sync”
Switch to text console
“pm_prepare_console”
PM_SUSPEND_MEM ?
Acquire lock
“pm_mutex”
Prepare the platform to enter the given sleep state
(platform_suspend_ops callback .prepare)
Save the device state “.suspend_late”
Prevent device drivers from receiving interrupts
“.suspend_noirq”
And put the device in appropriate low power state
Finish preparing the platform for entering the given
sleep state
Disable none boot cpu
“disable_nonboot_cpu”
Disable local irqs
“local_irq_disable”
With one cpu online &
Disabled interrupts
Start
executing registered
System core
suspend callbacks
“syscore_suspend”
To complete suspend,
PM core invokes
“.enter”
Callback from
Platform suspend
operations
echo mem >
/sys/power/state
Initalize a transistion to
respective sleep state
platform_pm_ops
“.begin”
Restrict physical IO &
access to low levelFS
“pm_restrict_gfp_mask”
STR

More Related Content

What's hot

BKK16-317 How to generate power models for EAS and IPA
BKK16-317 How to generate power models for EAS and IPABKK16-317 How to generate power models for EAS and IPA
BKK16-317 How to generate power models for EAS and IPALinaro
 
LCA14: LCA14-306: CPUidle & CPUfreq integration with scheduler
LCA14: LCA14-306: CPUidle & CPUfreq integration with schedulerLCA14: LCA14-306: CPUidle & CPUfreq integration with scheduler
LCA14: LCA14-306: CPUidle & CPUfreq integration with schedulerLinaro
 
AIXpert - AIX Security expert
AIXpert - AIX Security expertAIXpert - AIX Security expert
AIXpert - AIX Security expertdlfrench
 
Akfiler12 upgrade advisor
Akfiler12 upgrade advisorAkfiler12 upgrade advisor
Akfiler12 upgrade advisorAccenture
 
Ch1 Operating System
Ch1 Operating System Ch1 Operating System
Ch1 Operating System ChhayaShelake
 
Controlling processor c-state_usage_in_linux_nov2012
Controlling processor c-state_usage_in_linux_nov2012Controlling processor c-state_usage_in_linux_nov2012
Controlling processor c-state_usage_in_linux_nov2012sprdd
 
XPDDS18: Intel Processor Trace for Xen Hypervisor - Luwei Kang, Intel
XPDDS18: Intel Processor Trace for Xen Hypervisor - Luwei Kang, IntelXPDDS18: Intel Processor Trace for Xen Hypervisor - Luwei Kang, Intel
XPDDS18: Intel Processor Trace for Xen Hypervisor - Luwei Kang, IntelThe Linux Foundation
 
Как «вправить» автомобилю «мозги»
Как «вправить» автомобилю «мозги»Как «вправить» автомобилю «мозги»
Как «вправить» автомобилю «мозги»Positive Hack Days
 
HKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyHKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyLinaro
 
The e820 trap of Linux kernel hibernation
The e820 trap of Linux kernel hibernationThe e820 trap of Linux kernel hibernation
The e820 trap of Linux kernel hibernationjoeylikernel
 
Signature verification of hibernate snapshot
Signature verification of hibernate snapshotSignature verification of hibernate snapshot
Signature verification of hibernate snapshotjoeylikernel
 
cynapspro endpoint data protection - installation guide
cynapspro endpoint data protection - installation guidecynapspro endpoint data protection - installation guide
cynapspro endpoint data protection - installation guidecynapspro GmbH
 
Intel speed-select-technology-base-frequency-enhancing-performance
Intel speed-select-technology-base-frequency-enhancing-performanceIntel speed-select-technology-base-frequency-enhancing-performance
Intel speed-select-technology-base-frequency-enhancing-performanceVijaianand Sundaramoorthy
 
VIO LPAR Introduction | Basics | Demo
VIO LPAR Introduction | Basics | DemoVIO LPAR Introduction | Basics | Demo
VIO LPAR Introduction | Basics | DemoKernel Training
 

What's hot (20)

BKK16-317 How to generate power models for EAS and IPA
BKK16-317 How to generate power models for EAS and IPABKK16-317 How to generate power models for EAS and IPA
BKK16-317 How to generate power models for EAS and IPA
 
LCA14: LCA14-306: CPUidle & CPUfreq integration with scheduler
LCA14: LCA14-306: CPUidle & CPUfreq integration with schedulerLCA14: LCA14-306: CPUidle & CPUfreq integration with scheduler
LCA14: LCA14-306: CPUidle & CPUfreq integration with scheduler
 
Lesson 9 Device Management
Lesson 9 Device ManagementLesson 9 Device Management
Lesson 9 Device Management
 
AIXpert - AIX Security expert
AIXpert - AIX Security expertAIXpert - AIX Security expert
AIXpert - AIX Security expert
 
Akfiler12 upgrade advisor
Akfiler12 upgrade advisorAkfiler12 upgrade advisor
Akfiler12 upgrade advisor
 
Ch1 Operating System
Ch1 Operating System Ch1 Operating System
Ch1 Operating System
 
Controlling processor c-state_usage_in_linux_nov2012
Controlling processor c-state_usage_in_linux_nov2012Controlling processor c-state_usage_in_linux_nov2012
Controlling processor c-state_usage_in_linux_nov2012
 
XPDDS18: Intel Processor Trace for Xen Hypervisor - Luwei Kang, Intel
XPDDS18: Intel Processor Trace for Xen Hypervisor - Luwei Kang, IntelXPDDS18: Intel Processor Trace for Xen Hypervisor - Luwei Kang, Intel
XPDDS18: Intel Processor Trace for Xen Hypervisor - Luwei Kang, Intel
 
Как «вправить» автомобилю «мозги»
Как «вправить» автомобилю «мозги»Как «вправить» автомобилю «мозги»
Как «вправить» автомобилю «мозги»
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded Systems
 
HKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyHKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case study
 
Data recovery glossary a
Data recovery glossary   aData recovery glossary   a
Data recovery glossary a
 
The e820 trap of Linux kernel hibernation
The e820 trap of Linux kernel hibernationThe e820 trap of Linux kernel hibernation
The e820 trap of Linux kernel hibernation
 
Signature verification of hibernate snapshot
Signature verification of hibernate snapshotSignature verification of hibernate snapshot
Signature verification of hibernate snapshot
 
cynapspro endpoint data protection - installation guide
cynapspro endpoint data protection - installation guidecynapspro endpoint data protection - installation guide
cynapspro endpoint data protection - installation guide
 
Intel speed-select-technology-base-frequency-enhancing-performance
Intel speed-select-technology-base-frequency-enhancing-performanceIntel speed-select-technology-base-frequency-enhancing-performance
Intel speed-select-technology-base-frequency-enhancing-performance
 
Os
OsOs
Os
 
Plc tg fi
Plc tg fiPlc tg fi
Plc tg fi
 
Hypervisors
HypervisorsHypervisors
Hypervisors
 
VIO LPAR Introduction | Basics | Demo
VIO LPAR Introduction | Basics | DemoVIO LPAR Introduction | Basics | Demo
VIO LPAR Introduction | Basics | Demo
 

Viewers also liked

Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6Workhorse Computing
 
zigoto pine rudement la chatte toute lisse d'une suceuse de petits oiseaux ch...
zigoto pine rudement la chatte toute lisse d'une suceuse de petits oiseaux ch...zigoto pine rudement la chatte toute lisse d'une suceuse de petits oiseaux ch...
zigoto pine rudement la chatte toute lisse d'une suceuse de petits oiseaux ch...wiryshame4094
 
Rio Info 2015 - O Clube Digital - Botafogo digital
Rio Info 2015 - O Clube Digital - Botafogo digitalRio Info 2015 - O Clube Digital - Botafogo digital
Rio Info 2015 - O Clube Digital - Botafogo digitalRio Info
 
Academic Specialization 2015
Academic Specialization 2015Academic Specialization 2015
Academic Specialization 2015Dilan Wijesooriya
 
Sistem informasi akutansi
Sistem informasi akutansiSistem informasi akutansi
Sistem informasi akutansiMarhadi adi
 
Fisiopatologia dell’Edema Polmonare, Terapia Farmacologica e NIMV
Fisiopatologia dell’Edema Polmonare, Terapia Farmacologica e NIMVFisiopatologia dell’Edema Polmonare, Terapia Farmacologica e NIMV
Fisiopatologia dell’Edema Polmonare, Terapia Farmacologica e NIMVStefano Picciolo
 
Valutazione multidimensionale geriatrica. Dott. Mauro Zanocchi
Valutazione multidimensionale geriatrica. Dott. Mauro ZanocchiValutazione multidimensionale geriatrica. Dott. Mauro Zanocchi
Valutazione multidimensionale geriatrica. Dott. Mauro ZanocchiMedicina Geriatrica Zanocchi
 
Le APP e i disturbi respiratori nel sonno: dove siamo
Le APP e i disturbi respiratori nel sonno: dove siamoLe APP e i disturbi respiratori nel sonno: dove siamo
Le APP e i disturbi respiratori nel sonno: dove siamoStefano Picciolo
 
Geocapabilties leadership questions
Geocapabilties leadership questionsGeocapabilties leadership questions
Geocapabilties leadership questionsKarl Donert
 
Geocapabilties: leaders and managers
Geocapabilties: leaders and managersGeocapabilties: leaders and managers
Geocapabilties: leaders and managersKarl Donert
 
Puorto Antonella. Diagnosi della BPCO: Caso clinico con Televoter. ASMaD 2010
Puorto Antonella. Diagnosi della BPCO: Caso clinico con Televoter. ASMaD 2010Puorto Antonella. Diagnosi della BPCO: Caso clinico con Televoter. ASMaD 2010
Puorto Antonella. Diagnosi della BPCO: Caso clinico con Televoter. ASMaD 2010Gianfranco Tammaro
 
Device Driver - Chapter 6字元驅動程式的進階作業
Device Driver - Chapter 6字元驅動程式的進階作業Device Driver - Chapter 6字元驅動程式的進階作業
Device Driver - Chapter 6字元驅動程式的進階作業ZongYing Lyu
 
Ciamarra Ida. Le OSAS. ASMaD 2010
Ciamarra Ida. Le OSAS. ASMaD 2010Ciamarra Ida. Le OSAS. ASMaD 2010
Ciamarra Ida. Le OSAS. ASMaD 2010Gianfranco Tammaro
 
Ciuffreda Marcello. Gestione della BPCO: Caso clinico con Televoter. ASMaD 2010
Ciuffreda Marcello. Gestione della BPCO: Caso clinico con Televoter. ASMaD 2010Ciuffreda Marcello. Gestione della BPCO: Caso clinico con Televoter. ASMaD 2010
Ciuffreda Marcello. Gestione della BPCO: Caso clinico con Televoter. ASMaD 2010Gianfranco Tammaro
 

Viewers also liked (20)

Paranormal stats
Paranormal statsParanormal stats
Paranormal stats
 
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
Neatly Hashing a Tree: FP tree-fold in Perl5 & Perl6
 
zigoto pine rudement la chatte toute lisse d'une suceuse de petits oiseaux ch...
zigoto pine rudement la chatte toute lisse d'une suceuse de petits oiseaux ch...zigoto pine rudement la chatte toute lisse d'une suceuse de petits oiseaux ch...
zigoto pine rudement la chatte toute lisse d'une suceuse de petits oiseaux ch...
 
Rio Info 2015 - O Clube Digital - Botafogo digital
Rio Info 2015 - O Clube Digital - Botafogo digitalRio Info 2015 - O Clube Digital - Botafogo digital
Rio Info 2015 - O Clube Digital - Botafogo digital
 
S6 presentation6
S6 presentation6S6 presentation6
S6 presentation6
 
Academic Specialization 2015
Academic Specialization 2015Academic Specialization 2015
Academic Specialization 2015
 
Light my-fuse
Light my-fuseLight my-fuse
Light my-fuse
 
Learning gypsies story
Learning gypsies storyLearning gypsies story
Learning gypsies story
 
Gypsy Girls
Gypsy GirlsGypsy Girls
Gypsy Girls
 
Sistem informasi akutansi
Sistem informasi akutansiSistem informasi akutansi
Sistem informasi akutansi
 
Fisiopatologia dell’Edema Polmonare, Terapia Farmacologica e NIMV
Fisiopatologia dell’Edema Polmonare, Terapia Farmacologica e NIMVFisiopatologia dell’Edema Polmonare, Terapia Farmacologica e NIMV
Fisiopatologia dell’Edema Polmonare, Terapia Farmacologica e NIMV
 
I disturbi del sonno. Dott. Mauro Zanocchi
I disturbi del sonno. Dott. Mauro ZanocchiI disturbi del sonno. Dott. Mauro Zanocchi
I disturbi del sonno. Dott. Mauro Zanocchi
 
Valutazione multidimensionale geriatrica. Dott. Mauro Zanocchi
Valutazione multidimensionale geriatrica. Dott. Mauro ZanocchiValutazione multidimensionale geriatrica. Dott. Mauro Zanocchi
Valutazione multidimensionale geriatrica. Dott. Mauro Zanocchi
 
Le APP e i disturbi respiratori nel sonno: dove siamo
Le APP e i disturbi respiratori nel sonno: dove siamoLe APP e i disturbi respiratori nel sonno: dove siamo
Le APP e i disturbi respiratori nel sonno: dove siamo
 
Geocapabilties leadership questions
Geocapabilties leadership questionsGeocapabilties leadership questions
Geocapabilties leadership questions
 
Geocapabilties: leaders and managers
Geocapabilties: leaders and managersGeocapabilties: leaders and managers
Geocapabilties: leaders and managers
 
Puorto Antonella. Diagnosi della BPCO: Caso clinico con Televoter. ASMaD 2010
Puorto Antonella. Diagnosi della BPCO: Caso clinico con Televoter. ASMaD 2010Puorto Antonella. Diagnosi della BPCO: Caso clinico con Televoter. ASMaD 2010
Puorto Antonella. Diagnosi della BPCO: Caso clinico con Televoter. ASMaD 2010
 
Device Driver - Chapter 6字元驅動程式的進階作業
Device Driver - Chapter 6字元驅動程式的進階作業Device Driver - Chapter 6字元驅動程式的進階作業
Device Driver - Chapter 6字元驅動程式的進階作業
 
Ciamarra Ida. Le OSAS. ASMaD 2010
Ciamarra Ida. Le OSAS. ASMaD 2010Ciamarra Ida. Le OSAS. ASMaD 2010
Ciamarra Ida. Le OSAS. ASMaD 2010
 
Ciuffreda Marcello. Gestione della BPCO: Caso clinico con Televoter. ASMaD 2010
Ciuffreda Marcello. Gestione della BPCO: Caso clinico con Televoter. ASMaD 2010Ciuffreda Marcello. Gestione della BPCO: Caso clinico con Televoter. ASMaD 2010
Ciuffreda Marcello. Gestione della BPCO: Caso clinico con Televoter. ASMaD 2010
 

Similar to Linux_swspnd_v0.3_pub1

Q2.12: Idle Power States Nomenclature
Q2.12: Idle Power States NomenclatureQ2.12: Idle Power States Nomenclature
Q2.12: Idle Power States NomenclatureLinaro
 
Windows server power_efficiency___robben_and_worthington__final
Windows server power_efficiency___robben_and_worthington__finalWindows server power_efficiency___robben_and_worthington__final
Windows server power_efficiency___robben_and_worthington__finalBruce Worthington
 
Unit 1 intro-embedded
Unit 1 intro-embeddedUnit 1 intro-embedded
Unit 1 intro-embeddedPavithra S
 
computer organization and architecture notes
computer organization and architecture notescomputer organization and architecture notes
computer organization and architecture notesUpasana Talukdar
 
Computer Architecture and Organization
Computer Architecture and OrganizationComputer Architecture and Organization
Computer Architecture and Organizationssuserdfc773
 
Presentation aix performance updates &amp; issues
Presentation   aix performance updates &amp; issuesPresentation   aix performance updates &amp; issues
Presentation aix performance updates &amp; issuessolarisyougood
 
My First 100 days with an Exadata (PPT)
My First 100 days with an Exadata (PPT)My First 100 days with an Exadata (PPT)
My First 100 days with an Exadata (PPT)Gustavo Rene Antunez
 
Hardware
HardwareHardware
HardwareMuuluu
 
Presentation aix performance updates & issues
Presentation   aix performance updates & issuesPresentation   aix performance updates & issues
Presentation aix performance updates & issuesxKinAnx
 
Run time, frequently, non-frequently reconfigurable system &
Run time, frequently, non-frequently reconfigurable system &Run time, frequently, non-frequently reconfigurable system &
Run time, frequently, non-frequently reconfigurable system &Sudhanshu Janwadkar
 
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxUNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxLeahRachael
 
Android 电源管理 power_management_(英文版)
Android 电源管理 power_management_(英文版)Android 电源管理 power_management_(英文版)
Android 电源管理 power_management_(英文版)borderj
 
Android power management
Android power managementAndroid power management
Android power managementJerrin George
 
1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf
1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf
1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdfaniyathikitchen
 
LCA13: CPUIDLE: One driver to rule them all?
LCA13: CPUIDLE: One driver to rule them all?LCA13: CPUIDLE: One driver to rule them all?
LCA13: CPUIDLE: One driver to rule them all?Linaro
 
Embedded systems 101 final
Embedded systems 101 finalEmbedded systems 101 final
Embedded systems 101 finalKhalid Elmeadawy
 
Track d more performance less power - freescale final
Track d   more performance less power  - freescale finalTrack d   more performance less power  - freescale final
Track d more performance less power - freescale finalchiportal
 

Similar to Linux_swspnd_v0.3_pub1 (20)

Q2.12: Idle Power States Nomenclature
Q2.12: Idle Power States NomenclatureQ2.12: Idle Power States Nomenclature
Q2.12: Idle Power States Nomenclature
 
PowerManagement
PowerManagementPowerManagement
PowerManagement
 
Windows server power_efficiency___robben_and_worthington__final
Windows server power_efficiency___robben_and_worthington__finalWindows server power_efficiency___robben_and_worthington__final
Windows server power_efficiency___robben_and_worthington__final
 
Unit 1 intro-embedded
Unit 1 intro-embeddedUnit 1 intro-embedded
Unit 1 intro-embedded
 
computer organization and architecture notes
computer organization and architecture notescomputer organization and architecture notes
computer organization and architecture notes
 
Cpu
CpuCpu
Cpu
 
Computer Architecture and Organization
Computer Architecture and OrganizationComputer Architecture and Organization
Computer Architecture and Organization
 
Presentation aix performance updates &amp; issues
Presentation   aix performance updates &amp; issuesPresentation   aix performance updates &amp; issues
Presentation aix performance updates &amp; issues
 
My First 100 days with an Exadata (PPT)
My First 100 days with an Exadata (PPT)My First 100 days with an Exadata (PPT)
My First 100 days with an Exadata (PPT)
 
ARM AAE - System Issues
ARM AAE - System IssuesARM AAE - System Issues
ARM AAE - System Issues
 
Hardware
HardwareHardware
Hardware
 
Presentation aix performance updates & issues
Presentation   aix performance updates & issuesPresentation   aix performance updates & issues
Presentation aix performance updates & issues
 
Run time, frequently, non-frequently reconfigurable system &
Run time, frequently, non-frequently reconfigurable system &Run time, frequently, non-frequently reconfigurable system &
Run time, frequently, non-frequently reconfigurable system &
 
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxUNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
 
Android 电源管理 power_management_(英文版)
Android 电源管理 power_management_(英文版)Android 电源管理 power_management_(英文版)
Android 电源管理 power_management_(英文版)
 
Android power management
Android power managementAndroid power management
Android power management
 
1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf
1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf
1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf
 
LCA13: CPUIDLE: One driver to rule them all?
LCA13: CPUIDLE: One driver to rule them all?LCA13: CPUIDLE: One driver to rule them all?
LCA13: CPUIDLE: One driver to rule them all?
 
Embedded systems 101 final
Embedded systems 101 finalEmbedded systems 101 final
Embedded systems 101 final
 
Track d more performance less power - freescale final
Track d   more performance less power  - freescale finalTrack d   more performance less power  - freescale final
Track d more performance less power - freescale final
 

Linux_swspnd_v0.3_pub1

  • 1. Power Management and Linux (3.4.25) Padmanabha S <treasure4paddy@gmail.com>
  • 2. Objective  Discussing power management in Linux and it's usage in Embedded Systems Agenda  A brief overview on PC power management  A brief overview on suspand to RAM “STR” and suspend to disk “SWSUSP” (aka hibernation)  Fast boot of Embedded Linux using suspend to disk (aka snapshot booting)
  • 3. A overview on PC Power Management Major motivational factors for Power management in computer systems  In earlier days (90's) due to long boot time people left their desktop PCs on all the time, this led to wastage of energy  Once Laptop and battery powered device arrived (where battery life is a key feature) the need for power management took commercial incentive
  • 4. A overview on PC Power Management The motivation for POWER Management in computer system led to multi-vendor interoperability standards (listed below)  Advanced Power Management (APM) ➢ Legacy method, also known as BIOS method where Operating system has no knowledge about APM ➢ Uses device activity time-outs to determine when to transaction of device into low power states ➢ Vendor specific implementation and maintenance
  • 5. A overview on PC Power Management  Advanced Configuration and Power Interface (ACPI) ➢ An interface specification which is OS- controlled/directed Power management (OSPM) ➢ Power management is global in system unlike APM where it is hidden ➢ ACPI defines power management states and required functionality at multiple levels of system as shown in next slide
  • 6. A brief over view on ACPI system states ➔ Global view : Gx states ➔ System : Sx states ➔ Processor : Cx states ➔ Devices : Dx states  State numbers are interpreted as below ➢ “0” indicates system is active and available to user ➢ “1-n” indicates sleep states; higher number corresponds to lower power usage (and from user prescriptive system is “OFF” for all this power states)
  • 7. A brief over view on ACPI system states  Global states reflects user's perception of the machine ➢ G0 Working (S0): A system is fully operational / working ➢ G1 Sleeping (S1-S4): A system appears to be off and power consumption is small and work can be resumed without rebooting the OS (system context is save by hardware and system software) ➢ G2 Soft off (S5): A system consumes minimal power, as system context will not be saved which result in large latency to return in working state (needs system restart) ➢ G3 Mechanical off: A system is mechanically off with zero power consumption (except for RTC), OS must be restarted and no hardware context is retained
  • 8. A brief over view on ACPI system states ➢ S0 Working State: Fully powered and operational. ➢ S1 Standby: System context (registers, caches) is retained, RAM will is idle, but refreshed; less wake latency. ➢ S2 Standby: Same as S1 (a faster RAM refresh) except CPU and cache context are lost; Can be viewed as intermediate state between S1 and S3. ➢ S3 “Suspend to RAM”: Low wake latency, memory's context and power is retained; CPU, chip-set and I/O devices context are lost, RAM will be refreshed (not faster refresh). ➢ S4 “Suspend to Disk”: All hardware is in off state and maintains no context, platform context is maintained in non- volatile medium (contents of RAM are saved on disks and retained while resuming) and all devices are powered off. ➢ S5 Shut-down: Similar to S4 but OS doesn't save any context and system needs complete boot when it wakes up.
  • 9. A brief over view on ACPI system states
  • 10. A brief over view on ACPI system states  Device power states are characterized by the following attributes:  Power consumption, how much it consumes?  Device context, how much of its operational context does the device retain in these states?  Device driver behaviour , what must drivers for the device do to restore the device to fully operational state  Restore time, how long does it takes to restore the device to the fully operational state?  Wake-up capability, can the device request wake-up from a given power state?  The power state of a device need not match the system power state, devices can be in the off (D3) state even though the system is in the working state (S0).  Exact definition of the device power states are device- specific.
  • 11. A brief over view on ACPI system states (Device State) ➢ D0 “ON”: Device is active and responsive ➢ D1, D2: No universal definition for these intermediate states (and rarely used); D1 is expected to preserve device context (saves less power) when compared to D2 ➢ D3 “OFF”: ➢ D3hot primary power is not yet removed from the device; ➢ D3cold primary power is removed from the device
  • 12. A brief over view on ACPI system states (Processor state) ➢ C0 “Operating state”: In this state processor executes instructions ➢ C1 “Halt”: CPU in non executing state; Platform scales the CPU frequency; returns instantaneously to executing state. ➢ C2 “Stop clock”: CPU in non executing state; Platform scales the CPU frequency & voltage; takes longer time to return in executing state. ➢ C3 “Sleep”: CPU's cache maintains state but ignores any snoops (no cache coherency)
  • 13. Linux sleep states  Linux supports below sleep states: ➢ Standby ➢ Suspend to RAM ( standby with memory sleep state, STR) ➢ Suspend to Disk (aka hibernation)  When compared to STR, standby saves less power and resume latency is almost similar with STR. Thus standby support is usually not provided in computer systems.
  • 14. Suspend to RAM (STR) ● The system main memory context will be retained (powered and refreshed appropriately) ● Power will be partially removed from devices to save energy ● Hardware has to provide an mechanism (or interface) to wakeup system from STR state and pass control to OS ● Platform has to export low level routines for Linux Kernel (PM core, platform independent) to carry out platform-specific low-level suspend and resume operations. ● Platform driver (ex: arch/arm/mach- omap2/pm.h) exports those routines via struct platform_suspend_ops
  • 15. Suspend to RAM (STR)  In 3.4.25: ➢ Platform registers platform_suspend_ops (ex: arch/arm/mach-omap2/pm.c) ➢ Platform independent code creates sysfs entries (kernel/power/main.c) with state attributes (state_show and state_store) ➢ When user stores “disk” (echo disk > /sys/power/state), if hibernation is supported, hibernation() is invoked. ➢ When user stores “mem” (echo mem > /sys/power/state), if STR is supported, pm_suspend() is invoked with appropriate flag (PM_SUSPEND_MEM) ➢ pm_suspend() (kernel/power/suspend.c) than invokes enter_state() with appropriate state to initate STR
  • 16. Suspend to RAM (STR)
  • 17. Suspend to RAM (STR) Raise notifer event PM_SUSPEND_PREPARE Freeze processes & kernel threads “freeze_process” “freeze_kernel_threads” Disable printk “suspend_console” Prepare devices forPM transistion ( .prepare callaback in dev_pm_ops) “device_prepare(dev, PMSG_SUSPEND” .is_prepared=true & Suspend the devices (.suspend callaback in dev_pm_ops) “dev_suspend(dev)” .is_suspend=true Precedence: dev->pm_domain->ops dev->type->pm dev->class->pm dev->bus->pm dev->driver->pm Sync file system “sys_sync” Switch to text console “pm_prepare_console” PM_SUSPEND_MEM ? Acquire lock “pm_mutex” Prepare the platform to enter the given sleep state (platform_suspend_ops callback .prepare) Save the device state “.suspend_late” Prevent device drivers from receiving interrupts “.suspend_noirq” And put the device in appropriate low power state Finish preparing the platform for entering the given sleep state Disable none boot cpu “disable_nonboot_cpu” Disable local irqs “local_irq_disable” With one cpu online & Disabled interrupts Start executing registered System core suspend callbacks “syscore_suspend” To complete suspend, PM core invokes “.enter” Callback from Platform suspend operations echo mem > /sys/power/state Initalize a transistion to respective sleep state platform_pm_ops “.begin” Restrict physical IO & access to low levelFS “pm_restrict_gfp_mask” STR