SlideShare a Scribd company logo
IRQ next prediction
Daniel Lezcano
ENGINEERS
AND DEVICES WORKING
TOGETHER
Introduction
“Idle” opposed to “Running”, in between an event occurred
● We want a cpu to be idle as much as possible without impacting the
performance of the system
● The cpuidle framework takes care of entering the idle state depending
on the predictable events on the system
● The depth of the sleep will depend on the next event on the system
and the latency constraints
● An event makes a CPU to exit its idle state
● Some lecture:
− Computing a target residency: https://goo.gl/aywVSI
− Sources of wake up: https://goo.gl/zXpQfW
ENGINEERS
AND DEVICES WORKING
TOGETHER
The idle task
● The idle task is the last task executed on the CPU
● The idle task is an infinite loop
− Scheduled out when ‘need_resched’ is set
− Otherwise enters the idle function
need_resched()
idle()
schedule()no
yes
ENGINEERS
AND DEVICES WORKING
TOGETHER
Sources of wake up
● Three kinds of interruption:
− Inter processor interrupts (IPI)
− I/O interrupts
− Timer interrupts
ENGINEERS AND DEVICES
WORKING TOGETHER
Inter Processor Interrupt
● Used conveniently to inform or remotely execute an action on another processor
● Very few relevant:
− Timer broadcasting: used to notify another CPU a timer expired. Pointless if
there is an always-on per cpu timer or negligible if the FEAT_DYNIRQ is set
for the timer
− Rescheduling interrupt: the most important IPI, basically used to wake up an
idle CPU when there is a task in the runqueue, mastered by the scheduler.
● Pitfall: it could be a wakeup resulting from an IO completion where the
interrupt was received on another CPU
ENGINEERS AND DEVICES
WORKING TOGETHER
Timer
● Per cpu timer:
− a private irq line
● Global timer:
− Can wakeup any CPUs randomly but:
● in practical the DYNIRQ feat will make it to expire on the CPU with the
earliest timer
● the cpumask is usually set to CPU0
● The next event is predictable on this device
ENGINEERS AND DEVICES
WORKING TOGETHER
I/O interrupt
● Some are coming from devices with internals communication:
− MMC, I2C, SATA, GPU, …
− May be they have repeating patterns ?
● And others from external events:
− Keyboard, network, mouse, …
− May be they can have repeating patterns ?
● Intuitively the former can have a burst of interrupt activity followed by long
quiescent point, the latter can be considered as slow devices and a prediction
failure has a negligible impact
ENGINEERS
AND DEVICES WORKING
TOGETHER
Current approach : the glitch
● Measures how long it has been in the idle function
● Statistics are done on the idle durations
● Reminder: a CPU is woken up by:
− Timers, IPI and device interrupts
● So the statistics are trying to predict the next interrupt but
that includes:
○ The next timer expiration !?
○ The next scheduler decision !?
ENGINEERS
AND DEVICES WORKING
TOGETHER
Current approach: the soup
● The governors are mixing different kind of information
○ Deterministic and non deterministic
● It is impossible to identify the source of the wake up and:
− Discard some events like the timer ones
− Identify if the observed interrupt is the expected one
− Create a feedback loop prediction vs observation
ENGINEERS AND DEVICES
WORKING TOGETHER
Let’s analyze the devices
● Recipe:
− Using well known benchmarks
− Pin the observed interrupt on a specific CPU
− Used trace-cmd with the sequence ‘start’, <cmd>, ‘stop’, ‘extract’ in order to
prevent writes to the disk during the test
− For the observed interrupt, measure the interval between the occurrences and
their frequencies
● Intervals representation gives the chronology of the events and the
repeating patterns
● Frequencies give the probabilities
− A peak means is a high probability
ENGINEERS AND DEVICES
WORKING TOGETHER
MMC / SD card
● Writing on the SD card with sysbench test
− sysbench --test=fileio --file-test-mode=seqrewr --file-total-size=128M run
ENGINEERS AND DEVICES
WORKING TOGETHER
SATA / SDD
● Writing on the SSD 6Gb/s with sysbench test
− sysbench --test=fileio --file-test-mode=seqrewr --file-total-size=128M run
ENGINEERS AND DEVICES
WORKING TOGETHER
WiFi
● Copying a file with WiFi from Internet
− ketchup v4.10
ENGINEERS AND DEVICES
WORKING TOGETHER
Ethernet / Gb
● Copying a file 1,8GB with a 1Gb/s ethernet on a local network via NFS
− cp /net/shared/myfile /tmp
ENGINEERS AND DEVICES
WORKING TOGETHER
Console / UART
● Writing to the console via UART
− dmesg
ENGINEERS AND DEVICES
WORKING TOGETHER
SATA / HDD
● Writing on a HDD 3Gb/s with sysbench test
− sysbench --test=fileio --file-test-mode=seqrewr --file-total-size=128M run
ENGINEERS
AND DEVICES WORKING
TOGETHER
Observation
● The frequencies show the peaks
− Several peaks => there is a pattern
− A single peak => averaging and discarding anomalies is
enough
● The intervals are stable, we can see a pattern for some devices
− Visible with kernelshark and on the graphics
ENGINEERS
AND DEVICES WORKING
TOGETHER
Hypothesis
● If we can find the pattern of the interrupts, then we can predict
the next event more accurately for each interrupt
− What algorithm ?
● Single peak can be computed with a simple average on the last
32 samples (rule of thumb) assuming it is a normal law
● Taking the earliest next events from all interrupts gives the next
event
ENGINEERS
AND DEVICES WORKING
TOGETHER
Challenges
● A pattern rather than a periodic interval could be hard to predict
● The implementation is full of pitfalls
− Missing information (IPI IO, per cpu timer flag, etc ...)
− Mathematic with large numbers
− The idle place is very special (lock, rcu, interrupt, ...)
● Statistics computation consumes energy and takes time
− What is the best trade-off ?
● New tools to do an instrumentation (prediction accuracy, spot
where the problem is, …)
ENGINEERS
AND DEVICES WORKING
TOGETHER
Status
TBD
● Video
● Audio
● Idle
● User Interface
● Browsing
ENGINEERS
AND DEVICES WORKING
TOGETHER
What’s next ?
● Change the scheduler to be more energy aggressive
● Prevent to wake up an idle CPU which did not reach its target
residency
● IPI are also used to wake up a CPU after an IO completion
○ How to discriminate ?
○ Change the blocked task on IO wake up path

More Related Content

PDF
BUD17-300: Journey of a packet
Linaro
 
PDF
BUD17-214: Bus scaling QoS update
Linaro
 
PDF
Las16 200 - firmware summit - ras what is it- why do we need it
Linaro
 
PDF
LAS16-405:OpenDataPlane: Software Defined Dataplane leader
Linaro
 
PDF
BUD17-510: Power management in Linux together with secure firmware
Linaro
 
PDF
BUD17-416: Benchmark and profiling in OP-TEE
Linaro
 
PDF
LAS16-101: Efficient kernel backporting
Linaro
 
PDF
Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120
Linaro
 
BUD17-300: Journey of a packet
Linaro
 
BUD17-214: Bus scaling QoS update
Linaro
 
Las16 200 - firmware summit - ras what is it- why do we need it
Linaro
 
LAS16-405:OpenDataPlane: Software Defined Dataplane leader
Linaro
 
BUD17-510: Power management in Linux together with secure firmware
Linaro
 
BUD17-416: Benchmark and profiling in OP-TEE
Linaro
 
LAS16-101: Efficient kernel backporting
Linaro
 
Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120
Linaro
 

What's hot (20)

PDF
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203
Linaro
 
PDF
LAS16-209: Finished and Upcoming Projects in LMG
Linaro
 
PDF
BUD17-TR02: Upstreaming 101
Linaro
 
PDF
LAS16-504: Secure Storage updates in OP-TEE
Linaro
 
PDF
LAS16-207: Bus scaling QoS
Linaro
 
PDF
LAS16-403: GDB Linux Kernel Awareness
Linaro
 
PDF
LAS16-TR03: Upstreaming 201
Linaro
 
PDF
LAS16-500: The Rise and Fall of Assembler and the VGIC from Hell
Linaro
 
PDF
Kernel Recipes 2015: Greybus
Anne Nicolas
 
PDF
Deploy STM32 family on Zephyr - SFO17-102
Linaro
 
PDF
Secure storage updates - SFO17-309
Linaro
 
PDF
Luca Abeni - Real-Time Virtual Machines with Linux and kvm
linuxlab_conf
 
PDF
LAS16-501: Introduction to LLVM - Projects, Components, Integration, Internals
Linaro
 
PDF
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
Linaro
 
PDF
BKK16-304 The State of GDB on AArch64
Linaro
 
PDF
LAS16-201: ART JIT in Android N
Linaro
 
PDF
BKK16-502 Suspend to Idle
Linaro
 
PDF
LAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
Linaro
 
PDF
LAS16-200: SCMI - System Management and Control Interface
Linaro
 
PDF
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
Linaro
 
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203
Linaro
 
LAS16-209: Finished and Upcoming Projects in LMG
Linaro
 
BUD17-TR02: Upstreaming 101
Linaro
 
LAS16-504: Secure Storage updates in OP-TEE
Linaro
 
LAS16-207: Bus scaling QoS
Linaro
 
LAS16-403: GDB Linux Kernel Awareness
Linaro
 
LAS16-TR03: Upstreaming 201
Linaro
 
LAS16-500: The Rise and Fall of Assembler and the VGIC from Hell
Linaro
 
Kernel Recipes 2015: Greybus
Anne Nicolas
 
Deploy STM32 family on Zephyr - SFO17-102
Linaro
 
Secure storage updates - SFO17-309
Linaro
 
Luca Abeni - Real-Time Virtual Machines with Linux and kvm
linuxlab_conf
 
LAS16-501: Introduction to LLVM - Projects, Components, Integration, Internals
Linaro
 
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
Linaro
 
BKK16-304 The State of GDB on AArch64
Linaro
 
LAS16-201: ART JIT in Android N
Linaro
 
BKK16-502 Suspend to Idle
Linaro
 
LAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
Linaro
 
LAS16-200: SCMI - System Management and Control Interface
Linaro
 
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
Linaro
 
Ad

Viewers also liked (6)

PDF
BUD17-310: Introducing LLDB for linux on Arm and AArch64
Linaro
 
PDF
BUD17-218: Scheduler Load tracking update and improvement
Linaro
 
PDF
BUD17-400: Secure Data Path with OPTEE
Linaro
 
PDF
BUD17-405: Building a reference IoT product with Zephyr
Linaro
 
PDF
BUD17-302: LLVM Internals #2
Linaro
 
PDF
BUD17-209: Reliability, Availability, and Serviceability (RAS) on ARM64
Linaro
 
BUD17-310: Introducing LLDB for linux on Arm and AArch64
Linaro
 
BUD17-218: Scheduler Load tracking update and improvement
Linaro
 
BUD17-400: Secure Data Path with OPTEE
Linaro
 
BUD17-405: Building a reference IoT product with Zephyr
Linaro
 
BUD17-302: LLVM Internals #2
Linaro
 
BUD17-209: Reliability, Availability, and Serviceability (RAS) on ARM64
Linaro
 
Ad

Similar to BUD17-309: IRQ prediction (20)

PDF
When the OS gets in the way
Mark Price
 
PDF
Hardware Assisted Latency Investigations
ScyllaDB
 
PPTX
Arduino
mahalakshmimalini
 
PDF
Micro-controllers (PIC) based Application Development
Emertxe Information Technologies Pvt Ltd
 
PDF
Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...
Anne Nicolas
 
PPT
Interrupts.ppt
SasiBhushan22
 
PDF
Module 3-cpu-scheduling
Hesham Elmasry
 
PDF
Computer organization and architecture|KTU
ashlinpj36
 
PDF
Computer organization and architecture|KTU
ashlinpj36
 
PPTX
The central processing unit by group 5 2015
Tendai Karuma
 
ODP
Optimizing Linux Servers
Davor Guttierrez
 
PPT
Wk 4 top_level_view_of_computer_function_and_interconnection
limyamahgoub
 
PPTX
I/O systems chapter 12 OS
ssuser45ae56
 
PPTX
ARDUINO BASED HEART BEAT MONITORING SYSTEM
MOHAMMAD HANNAN
 
PPTX
ch 2_Component and function of computer .pptx
Toyba2
 
PPTX
Computer Architecture and Organization
ssuserdfc773
 
PPT
5120224.ppt
dedanndege
 
PPT
Os introduction
Kanika Garg
 
PPT
Os introduction
Ravi Ramchandani
 
ODP
Hardware block diagram
gopartheredbuff
 
When the OS gets in the way
Mark Price
 
Hardware Assisted Latency Investigations
ScyllaDB
 
Micro-controllers (PIC) based Application Development
Emertxe Information Technologies Pvt Ltd
 
Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...
Anne Nicolas
 
Interrupts.ppt
SasiBhushan22
 
Module 3-cpu-scheduling
Hesham Elmasry
 
Computer organization and architecture|KTU
ashlinpj36
 
Computer organization and architecture|KTU
ashlinpj36
 
The central processing unit by group 5 2015
Tendai Karuma
 
Optimizing Linux Servers
Davor Guttierrez
 
Wk 4 top_level_view_of_computer_function_and_interconnection
limyamahgoub
 
I/O systems chapter 12 OS
ssuser45ae56
 
ARDUINO BASED HEART BEAT MONITORING SYSTEM
MOHAMMAD HANNAN
 
ch 2_Component and function of computer .pptx
Toyba2
 
Computer Architecture and Organization
ssuserdfc773
 
5120224.ppt
dedanndege
 
Os introduction
Kanika Garg
 
Os introduction
Ravi Ramchandani
 
Hardware block diagram
gopartheredbuff
 

More from Linaro (20)

PDF
Deep Learning Neural Network Acceleration at the Edge - Andrea Gallo
Linaro
 
PDF
Arm Architecture HPC Workshop Santa Clara 2018 - Kanta Vekaria
Linaro
 
PDF
Huawei’s requirements for the ARM based HPC solution readiness - Joshua Mora
Linaro
 
PDF
Bud17 113: distribution ci using qemu and open qa
Linaro
 
PDF
OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018
Linaro
 
PDF
HPC network stack on ARM - Linaro HPC Workshop 2018
Linaro
 
PDF
It just keeps getting better - SUSE enablement for Arm - Linaro HPC Workshop ...
Linaro
 
PDF
Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...
Linaro
 
PDF
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Linaro
 
PDF
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Linaro
 
PDF
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro
 
PDF
HKG18-100K1 - George Grey: Opening Keynote
Linaro
 
PDF
HKG18-318 - OpenAMP Workshop
Linaro
 
PDF
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro
 
PDF
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
Linaro
 
PDF
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
Linaro
 
PDF
HKG18-TR08 - Upstreaming SVE in QEMU
Linaro
 
PDF
HKG18-113- Secure Data Path work with i.MX8M
Linaro
 
PPTX
HKG18-120 - Devicetree Schema Documentation and Validation
Linaro
 
PPTX
HKG18-223 - Trusted FirmwareM: Trusted boot
Linaro
 
Deep Learning Neural Network Acceleration at the Edge - Andrea Gallo
Linaro
 
Arm Architecture HPC Workshop Santa Clara 2018 - Kanta Vekaria
Linaro
 
Huawei’s requirements for the ARM based HPC solution readiness - Joshua Mora
Linaro
 
Bud17 113: distribution ci using qemu and open qa
Linaro
 
OpenHPC Automation with Ansible - Renato Golin - Linaro Arm HPC Workshop 2018
Linaro
 
HPC network stack on ARM - Linaro HPC Workshop 2018
Linaro
 
It just keeps getting better - SUSE enablement for Arm - Linaro HPC Workshop ...
Linaro
 
Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...
Linaro
 
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Linaro
 
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Linaro
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro
 
HKG18-100K1 - George Grey: Opening Keynote
Linaro
 
HKG18-318 - OpenAMP Workshop
Linaro
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
Linaro
 
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
Linaro
 
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
Linaro
 
HKG18-TR08 - Upstreaming SVE in QEMU
Linaro
 
HKG18-113- Secure Data Path work with i.MX8M
Linaro
 
HKG18-120 - Devicetree Schema Documentation and Validation
Linaro
 
HKG18-223 - Trusted FirmwareM: Trusted boot
Linaro
 

Recently uploaded (20)

PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
The Future of Artificial Intelligence (AI)
Mukul
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 

BUD17-309: IRQ prediction

  • 2. ENGINEERS AND DEVICES WORKING TOGETHER Introduction “Idle” opposed to “Running”, in between an event occurred ● We want a cpu to be idle as much as possible without impacting the performance of the system ● The cpuidle framework takes care of entering the idle state depending on the predictable events on the system ● The depth of the sleep will depend on the next event on the system and the latency constraints ● An event makes a CPU to exit its idle state ● Some lecture: − Computing a target residency: https://goo.gl/aywVSI − Sources of wake up: https://goo.gl/zXpQfW
  • 3. ENGINEERS AND DEVICES WORKING TOGETHER The idle task ● The idle task is the last task executed on the CPU ● The idle task is an infinite loop − Scheduled out when ‘need_resched’ is set − Otherwise enters the idle function need_resched() idle() schedule()no yes
  • 4. ENGINEERS AND DEVICES WORKING TOGETHER Sources of wake up ● Three kinds of interruption: − Inter processor interrupts (IPI) − I/O interrupts − Timer interrupts
  • 5. ENGINEERS AND DEVICES WORKING TOGETHER Inter Processor Interrupt ● Used conveniently to inform or remotely execute an action on another processor ● Very few relevant: − Timer broadcasting: used to notify another CPU a timer expired. Pointless if there is an always-on per cpu timer or negligible if the FEAT_DYNIRQ is set for the timer − Rescheduling interrupt: the most important IPI, basically used to wake up an idle CPU when there is a task in the runqueue, mastered by the scheduler. ● Pitfall: it could be a wakeup resulting from an IO completion where the interrupt was received on another CPU
  • 6. ENGINEERS AND DEVICES WORKING TOGETHER Timer ● Per cpu timer: − a private irq line ● Global timer: − Can wakeup any CPUs randomly but: ● in practical the DYNIRQ feat will make it to expire on the CPU with the earliest timer ● the cpumask is usually set to CPU0 ● The next event is predictable on this device
  • 7. ENGINEERS AND DEVICES WORKING TOGETHER I/O interrupt ● Some are coming from devices with internals communication: − MMC, I2C, SATA, GPU, … − May be they have repeating patterns ? ● And others from external events: − Keyboard, network, mouse, … − May be they can have repeating patterns ? ● Intuitively the former can have a burst of interrupt activity followed by long quiescent point, the latter can be considered as slow devices and a prediction failure has a negligible impact
  • 8. ENGINEERS AND DEVICES WORKING TOGETHER Current approach : the glitch ● Measures how long it has been in the idle function ● Statistics are done on the idle durations ● Reminder: a CPU is woken up by: − Timers, IPI and device interrupts ● So the statistics are trying to predict the next interrupt but that includes: ○ The next timer expiration !? ○ The next scheduler decision !?
  • 9. ENGINEERS AND DEVICES WORKING TOGETHER Current approach: the soup ● The governors are mixing different kind of information ○ Deterministic and non deterministic ● It is impossible to identify the source of the wake up and: − Discard some events like the timer ones − Identify if the observed interrupt is the expected one − Create a feedback loop prediction vs observation
  • 10. ENGINEERS AND DEVICES WORKING TOGETHER Let’s analyze the devices ● Recipe: − Using well known benchmarks − Pin the observed interrupt on a specific CPU − Used trace-cmd with the sequence ‘start’, <cmd>, ‘stop’, ‘extract’ in order to prevent writes to the disk during the test − For the observed interrupt, measure the interval between the occurrences and their frequencies ● Intervals representation gives the chronology of the events and the repeating patterns ● Frequencies give the probabilities − A peak means is a high probability
  • 11. ENGINEERS AND DEVICES WORKING TOGETHER MMC / SD card ● Writing on the SD card with sysbench test − sysbench --test=fileio --file-test-mode=seqrewr --file-total-size=128M run
  • 12. ENGINEERS AND DEVICES WORKING TOGETHER SATA / SDD ● Writing on the SSD 6Gb/s with sysbench test − sysbench --test=fileio --file-test-mode=seqrewr --file-total-size=128M run
  • 13. ENGINEERS AND DEVICES WORKING TOGETHER WiFi ● Copying a file with WiFi from Internet − ketchup v4.10
  • 14. ENGINEERS AND DEVICES WORKING TOGETHER Ethernet / Gb ● Copying a file 1,8GB with a 1Gb/s ethernet on a local network via NFS − cp /net/shared/myfile /tmp
  • 15. ENGINEERS AND DEVICES WORKING TOGETHER Console / UART ● Writing to the console via UART − dmesg
  • 16. ENGINEERS AND DEVICES WORKING TOGETHER SATA / HDD ● Writing on a HDD 3Gb/s with sysbench test − sysbench --test=fileio --file-test-mode=seqrewr --file-total-size=128M run
  • 17. ENGINEERS AND DEVICES WORKING TOGETHER Observation ● The frequencies show the peaks − Several peaks => there is a pattern − A single peak => averaging and discarding anomalies is enough ● The intervals are stable, we can see a pattern for some devices − Visible with kernelshark and on the graphics
  • 18. ENGINEERS AND DEVICES WORKING TOGETHER Hypothesis ● If we can find the pattern of the interrupts, then we can predict the next event more accurately for each interrupt − What algorithm ? ● Single peak can be computed with a simple average on the last 32 samples (rule of thumb) assuming it is a normal law ● Taking the earliest next events from all interrupts gives the next event
  • 19. ENGINEERS AND DEVICES WORKING TOGETHER Challenges ● A pattern rather than a periodic interval could be hard to predict ● The implementation is full of pitfalls − Missing information (IPI IO, per cpu timer flag, etc ...) − Mathematic with large numbers − The idle place is very special (lock, rcu, interrupt, ...) ● Statistics computation consumes energy and takes time − What is the best trade-off ? ● New tools to do an instrumentation (prediction accuracy, spot where the problem is, …)
  • 20. ENGINEERS AND DEVICES WORKING TOGETHER Status TBD ● Video ● Audio ● Idle ● User Interface ● Browsing
  • 21. ENGINEERS AND DEVICES WORKING TOGETHER What’s next ? ● Change the scheduler to be more energy aggressive ● Prevent to wake up an idle CPU which did not reach its target residency ● IPI are also used to wake up a CPU after an IO completion ○ How to discriminate ? ○ Change the blocked task on IO wake up path