SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
Low-latency and
power-efficient audio
applications on Linux
Tommaso Cucinotta
tommaso.cucinotta@santannapisa.it
About me
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 2 / 22
■ 2016-present: Associate Professor at the Real-Time Systems
Laboratory (RETIS) of Scuola Superiore Sant’Anna: teaching
Component-Based Software Design, Cloud Computing, Big-Data, . . .
■ 2014-2016: Software Development Engineer at AWS, improving
the real-time performance and scalability of DynamoDB
■ 2012-2014: Researcher at Alcatel-Lucent Bell Labs, investigating
on security and real-time performance of cloud infrastructures with
focus on IMS and NFV
■ 2005-2012: Researcher at the RETIS, investigating on adaptive
real-time scheduling for multimedia applications on Linux
■ 2001-2004: PhD in Computer Security & Smart-Card Based
Authentication, RETIS
About the RETIS
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 3 / 22
■ Belongs to the Institute of Communications, Information and Perception
Technologies of Scuola Superiore Sant’Anna in Pisa
■ Research specialties
◆ predictable execution of software through
■ mechanisms at operating system and kernel level
■ design methodologies and tools
■ performance and timing analysis
◆ provide real-time support for emerging computing platforms
■ multi-core and heterogeneous platforms (big.LITTLE, GPGPU, FPGA)
■ distributed infrastructures for cloud & big-data computing and NFV
◆ make real-time systems resource- and energy- efficient
◆ hard real-time use-cases: automotive, industrial automation, railroads
◆ soft real-time use-cases: multimedia, health-care, telecommunications
Introduction
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 4 / 22
Common multimedia processing case: audio playback and
video streaming
■ Works without particular precautions
■ No interactivity nor low-latency requirements
■ 100s of ms, or even seconds of data can be pre-buffered
and pre-processed
■ run-time platform (user-space + kernel) needs only
ensure presenting pre-processed A/V frames timely to
the underlying hardware
Introduction
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 4 / 22
Common multimedia processing case: audio playback and
video streaming
■ Works without particular precautions
■ No interactivity nor low-latency requirements
■ 100s of ms, or even seconds of data can be pre-buffered
and pre-processed
■ run-time platform (user-space + kernel) needs only
ensure presenting pre-processed A/V frames timely to
the underlying hardware
What about interactivity ?
Problem
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 5 / 22
Interactive multimedia processing
■ low-latency requirement from when a user interaction
happens, to when it is reflected in the output A/V stream
Problem
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 5 / 22
Interactive multimedia processing
■ low-latency requirement from when a user interaction
happens, to when it is reflected in the output A/V stream
Examples
■ video editing: change filter(s) and/or parameters in a
real-time video processing pipeline
■ on-line interactive services: eg, office automation,
etc.
■ gaming, VR, AR: user interacts with environment
and/or other users (eg, multi-player shooting)
■ software-based sound synthesis: user presses one or
more instrument keys / controllers
Problem
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 6 / 22
Interactive multimedia processing: how can we achieve low
latency ?
■ Digital Audio Workstation (DAW)
◆ DSPs do the real-time work
◆ the general-purpose OS and software just takes care
of configuring its pipeline and parameters
Problem
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 6 / 22
Interactive multimedia processing: how can we achieve low
latency ?
■ Digital Audio Workstation (DAW)
◆ DSPs do the real-time work
◆ the general-purpose OS and software just takes care
of configuring its pipeline and parameters
■ EXPENSIVE ! → Software-based solutions
Problem
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 6 / 22
Interactive multimedia processing: how can we achieve low
latency ?
■ Digital Audio Workstation (DAW)
◆ DSPs do the real-time work
◆ the general-purpose OS and software just takes care
of configuring its pipeline and parameters
■ EXPENSIVE ! → Software-based solutions
■ “1-system 1-function” paradigm
◆ device dedicated to a single application
◆ nothing else runs with real-time requirements
◆ we can use priorities to minimize interferences
Real-time audio processing
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 7 / 22
Commonly found guidelines for low-latency, skip-free
interactive audio processing
eg, from http://jackaudio.org/faq/linux_rt_config.html
■ create group of users who can gain RT priority
groupadd audio
cat /etc/security/limits.d/99-realtime.conf
audio - rtprio 99
audio - memlock unlimited
■ add unprivileged user to the new group
usermod -a -G audio yourUserID
■ install a “real-time / low-latency” kernel
Real-time audio processing
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 7 / 22
Commonly found guidelines for low-latency, skip-free
interactive audio processing
eg, from http://jackaudio.org/faq/linux_rt_config.html
■ create group of users who can gain RT priority
groupadd audio
cat /etc/security/limits.d/99-realtime.conf
audio - rtprio 99
audio - memlock unlimited
■ add unprivileged user to the new group
usermod -a -G audio yourUserID
■ install a “real-time / low-latency” kernel
So, problem solved ?
What about energy?
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 8 / 22
Plenty of energy saving features in the hardware
■ Dynamic Voltage and Frequency Scaling (DVFS)
■ Performance states (P-states),
Operating Performance Points (OPP)
■ Core idle states (C-states)
■ Turbo Boosting (hmmm....): spike-up CPU frequency
when/if possible
What about energy?
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 8 / 22
Plenty of energy saving features in the hardware
■ Dynamic Voltage and Frequency Scaling (DVFS)
■ Performance states (P-states),
Operating Performance Points (OPP)
■ Core idle states (C-states)
■ Turbo Boosting (hmmm....): spike-up CPU frequency
when/if possible
Useful in a number of cases (both battery-operated and not)
■ laptops, tablets, smartphones
■ desktop PCs, servers
What about energy?
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 8 / 22
Plenty of energy saving features in the hardware
■ Dynamic Voltage and Frequency Scaling (DVFS)
■ Performance states (P-states),
Operating Performance Points (OPP)
■ Core idle states (C-states)
■ Turbo Boosting (hmmm....): spike-up CPU frequency
when/if possible
Useful in a number of cases (both battery-operated and not)
■ laptops, tablets, smartphones
■ desktop PCs, servers
All bad for performance stability!
Platform stability
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 9 / 22
Energy saving features in the hardware adverseley impact
performance stability and software predictability
■ DVFS → CPUs run at different frequencies over time
◆ frequency islands: groups of CPUs are constrained to
the same frequency
■ P-states → even less control on what frequency CPU(s)
are running at
◆ frequency control in hardware, high-level tunable
exposed to software (minPct, maxPct)
■ C-states → time to enter and exit idle state is variable
◆ going to a deep-idle state is worth only if staying
there for a minimum residency time
C-states
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 10 / 22
wake-up resid.
C-state latency time
POLL 0 0
C1 2 2
C1E 10 20
C3 70 100
C6 85 200
C7s 124 800
C8 200 800
C9 480 5000
C10 890 5000
Making the platform stable
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 11 / 22
How users typically make the computing platform (more)
stable/predictable
■ turn-off Turbo Boosting
■ disable DVFS (leverage it to fix frequency), eg:
◆ performance governor or
◆ userspace governor if/when available
■ fix performance % with P-state driver (minPct=maxPct)
■ inhibit deep-idle states
◆ echo 1 > /sys/devices/system/cpu/cpu<n>/cpuidle/state<s>/disable
◆ echo 1 > /sys/devices/system/cpu/cpu0/power/pm qos resume latency us
Making the platform stable
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 11 / 22
How users typically make the computing platform (more)
stable/predictable
■ turn-off Turbo Boosting
■ disable DVFS (leverage it to fix frequency), eg:
◆ performance governor or
◆ userspace governor if/when available
■ fix performance % with P-state driver (minPct=maxPct)
■ inhibit deep-idle states
◆ echo 1 > /sys/devices/system/cpu/cpu<n>/cpuidle/state<s>/disable
◆ echo 1 > /sys/devices/system/cpu/cpu0/power/pm qos resume latency us
■ or, just run:
◆ yes > /dev/null & [times # of CPUs]
Making the platform stable
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 11 / 22
How users typically make the computing platform (more)
stable/predictable
■ turn-off Turbo Boosting
■ disable DVFS (leverage it to fix frequency), eg:
◆ performance governor or
◆ userspace governor if/when available
■ fix performance % with P-state driver (minPct=maxPct)
■ inhibit deep-idle states
◆ echo 1 > /sys/devices/system/cpu/cpu<n>/cpuidle/state<s>/disable
◆ echo 1 > /sys/devices/system/cpu/cpu0/power/pm qos resume latency us
■ or, just run:
◆ yes > /dev/null & [times # of CPUs]
■ Bad for energy consumption!
Why audio skips
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 12 / 22
∎ audio burst in playback (top)
∎ fill-level of audio ring buffer (middle)
∎ RT app thread (bottom)
∎ big ring buffer → high latency!
∎ empty ring buffer → audible glitch!
∎ small ring buffer periodically refilled
→ low latency, glitch-free playback!
Android audio architecture
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 13 / 22
Android audio applications
∎ android.media APIs
◇ playing/recording
audio files, Internet
streaming
◇ use of large buffers (no
low-latency use-cases)
◇ regular mixer thread
Low-latency audio applications
∎ native APIs
(OpenSL ES, AAudio)
◇ low-latency audio pro-
cessing
◇ rely on FastMixer and
ALSA
∎ critically low-latency
◇ exclusive mode in
AAudio / ALSA
Android audio architecture
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 14 / 22
Power management in Android
■ schedutil selects the minimum operating performance point (OPP)
able to satisfy demand
■ based on CPU utilization statistics
◆ Per-Entity Load-Tracking (PELT)
■ exponentially weighted task utilization
■ slow to detect workload changes (ramp-up, cool-down)
eg, it may take 50–100 ms to detect a 90% increase of CPU % demand
◆ Window-Assisted Load-Tracking (WALT)
■ max{last window util., avg util. over past N windows}
eg, over 3 past 10 ms windows, we have a 10 ms spike detection latency, and a 30 ms
cool-down one
■ it forgets quickly a task demand when the task is off the rq
■ WALT more reactive than PELT, but ...
Android audio architecture
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 14 / 22
Power management in Android
■ schedutil selects the minimum operating performance point (OPP)
able to satisfy demand
■ based on CPU utilization statistics
◆ Per-Entity Load-Tracking (PELT)
■ exponentially weighted task utilization
■ slow to detect workload changes (ramp-up, cool-down)
eg, it may take 50–100 ms to detect a 90% increase of CPU % demand
◆ Window-Assisted Load-Tracking (WALT)
■ max{last window util., avg util. over past N windows}
eg, over 3 past 10 ms windows, we have a 10 ms spike detection latency, and a 30 ms
cool-down one
■ it forgets quickly a task demand when the task is off the rq
■ WALT more reactive than PELT, but ... not enough for very
dynamic workloads
■ can we improve on that?
SCHED DEADLINE
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 15 / 22
SCHED DEADLINE from RETIS+Evidence
(ACTORS EU project)
■ mainline since v3.14 (2013)
■ reservation-based scheduling
■ a task is reserved a given runtime within a deadline
every period
struct sched attr attr = {
.size = sizeof(struct sched attr),
.sched policy = SCHED DEADLINE,
.sched flags = 0, // RECLAIM | RESET ON FORK
.sched runtime = runtime us * 1000,
.sched deadline = deadline us * 1000,
.sched period = period us * 1000
};
if (sched setattr(0, &attr, 0) < 0) {
perror("setattr() failed");
exit(-1);
}
SCHED DEADLINE
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 16 / 22
How is SCHED DEADLINE w.r.t. POSIX RT?
■ any SCHED DEADLINE task runs before any
POSIX RT or CFS task
◆ based on resource reservations (next slide)
◆ throttling safeguard to avoid locking the CPU
(can be disabled if needed)
■ any POSIX RT (FIFO/RR) task runs before any
CFS task
◆ based on priorities
◆ throttling safeguard to avoid locking the CPU
(can be disabled if needed)
■ Completely Fair Scheduler (CFS) tasks run when
no SCHED DEADLINE nor RT tasks can
◆ based on weights (weighted fair scheduler)
SCHED DEADLINE
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 17 / 22
Main SCHED DEADLINE properties
■ based on EDF (optimum on uni-processors) and (Hard)
Costant Bandwidth Server (CBS)
■ temporal isolation: a task inability to respect its
runtime doesn’t affect others
■ on multi-processors: anything from G-EDF (tardiness
bound) to P-EDF
When trying to exceed the runtime
■ task gets throttled (original)
■ opportunistically get extra runtime (GRUB), if
RECLAIM used
SCHED DEADLINE and schedutil
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 18 / 22
schedutil decided OPP depends on overall system
utilization, in which we have:
■ SCHED DEADLINE tasks’ utilization: runtime
period
dynamic workload demand changes via sched setattr():
■ readily accounted for, by schedutil
SCHED DEADLINE and schedutil
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 18 / 22
schedutil decided OPP depends on overall system
utilization, in which we have:
■ SCHED DEADLINE tasks’ utilization: runtime
period
dynamic workload demand changes via sched setattr():
■ readily accounted for, by schedutil
Does it work?
SCHED DEADLINE and schedutil
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 18 / 22
schedutil decided OPP depends on overall system
utilization, in which we have:
■ SCHED DEADLINE tasks’ utilization: runtime
period
dynamic workload demand changes via sched setattr():
■ readily accounted for, by schedutil
Does it work? Results on a HiKey 960 board:
■ energy-efficient set-up: glitch-free playback at 2.67ms latency, vs
26.67ms of mainline Android using SCHED FIFO and WALT, at the
cost of +6.25% power consumption
■ low-latency set-up: at 2.67ms latency, saved 40% energy wrt
mainline Android using SCHED FIFO and WALT
Heterogeneous Architectures
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 19 / 22
ARM big.LITTLE (and DynamIQ) architectures
■ tasks can migrate among big and LITTLE cores (same
ISA)
■ big cores: high-performance workloads
■ LITTLE cores: energy-efficient workloads
ARM Energy Aware Scheduling (EAS)
■ give kernel awareness of the CPU capacity associated
with big and LITTLE cores
■ give kernel clues as to how capacity of big and LITTLE
cores scales with CPU frequency
■ provide CFS with more informed task placement and
migration decisions
Capacity enhancement patches
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 20 / 22
SCHED DEADLINE improvements to account for CPU
capacity
■ runtime is specified in terms of the fastest CPU at the
fastest frequency
◆ it gets automatically rescaled using the CPU capacity
figures
■ if there’s a choice, prefer LITTLE cores before going to
big ones
■ proper consideration of CPU capacity in schedutil
Related publications
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 21 / 22
∎ A. Balsini, Towards Hard and Soft Real-time Operating Systems for Multicore Heterogeneous
Architectures, PhD dissertation, 2018
∎ A. Balsini et al., Modeling and simulation of power consumption and execution times for
real-time tasks on embedded heterogeneous architectures, EWILI 2018
∎ T. Cucinotta et al., Improving Responsiveness of Time-Sensitive Applications by Exploiting
Dynamic Task Dependencies, Wiley SPE 2018
∎ C. Scordino et al., Energy-aware real-time scheduling in the linux kernel, ACM SAC 2018
∎ D. B. de Oliveira et al., Nested Locks in the Lock Implementation: The Real-Time
Read-Write Semaphores on Linux, RTSOPS 2018
∎ M. Marinoni et al., Allocation and control of computing resources for real-time Virtual
Network Functions, SOFTNETWORKING 2018
∎ T. Cucinotta et al., Adaptive Real-Time Scheduling for Legacy Multimedia Applications, ACM
TECS 2012
∎ J. Lelli et al., An Experimental Comparison of Different Real-Time Schedulers on Multicore
Systems, Elsevier JSS 2012
∎ T. Cucinotta et al., Virtualised e-Learning on the IRMOS Real-time Cloud, Springer SOCA’12
∎ T. Cucinotta et al., A robust mechanism for adaptive scheduling of multimedia applications,
ACM TECS 2011
∎ T. Cucinotta et al., Low-Latency Audio on Linux by Means of Real-Time Scheduling, LAC’11
∎ T. Cucinotta et al., Virtualised e-Learning with Real-Time Guarantees on the IRMOS
Platform, IEEE SOCA 2010
∎ T. Cucinotta and L. Palopoli, QoS Control for Pipelines of Tasks Using Multiple Resources,
IEEE TOC 2010
∎ L. Palopoli et al, AQuoSA - Adaptive Quality of Service Architecture, Wiley SPE 2008
∎ L. Abeni et al, QoS Management through adaptive reservations, Springer RTSJ 2005
Q&A
LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 22 / 22
Thanks for listening!
Questions ?
http://retis.santannapisa.it/˜tommaso
tommaso.cucinotta@santannapisa.it

Mais conteúdo relacionado

Mais procurados

BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr
Linaro
 
Angelo Compagnucci - Upgrading buildroot based devices with swupdate
Angelo Compagnucci - Upgrading buildroot based devices with swupdateAngelo Compagnucci - Upgrading buildroot based devices with swupdate
Angelo Compagnucci - Upgrading buildroot based devices with swupdate
linuxlab_conf
 

Mais procurados (20)

LAS16-106: GNU Toolchain Development Lifecycle
LAS16-106: GNU Toolchain Development LifecycleLAS16-106: GNU Toolchain Development Lifecycle
LAS16-106: GNU Toolchain Development Lifecycle
 
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSDLAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
 
Mirko Damiani - An Embedded soft real time distributed system in Go
Mirko Damiani - An Embedded soft real time distributed system in GoMirko Damiani - An Embedded soft real time distributed system in Go
Mirko Damiani - An Embedded soft real time distributed system in Go
 
LAS16-209: Finished and Upcoming Projects in LMG
LAS16-209: Finished and Upcoming Projects in LMGLAS16-209: Finished and Upcoming Projects in LMG
LAS16-209: Finished and Upcoming Projects in LMG
 
Kernel Recipes 2015: Kernel packet capture technologies
Kernel Recipes 2015: Kernel packet capture technologiesKernel Recipes 2015: Kernel packet capture technologies
Kernel Recipes 2015: Kernel packet capture technologies
 
LAS16-TR03: Upstreaming 201
LAS16-TR03: Upstreaming 201LAS16-TR03: Upstreaming 201
LAS16-TR03: Upstreaming 201
 
LAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome KeynoteLAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome Keynote
 
LAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android NLAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android N
 
LAS16-207: Bus scaling QoS
LAS16-207: Bus scaling QoSLAS16-207: Bus scaling QoS
LAS16-207: Bus scaling QoS
 
LAS16-101: Efficient kernel backporting
LAS16-101: Efficient kernel backportingLAS16-101: Efficient kernel backporting
LAS16-101: Efficient kernel backporting
 
BKK16-211 Internet of Tiny Linux (io tl)- Status and Progress
BKK16-211 Internet of Tiny Linux (io tl)- Status and ProgressBKK16-211 Internet of Tiny Linux (io tl)- Status and Progress
BKK16-211 Internet of Tiny Linux (io tl)- Status and Progress
 
LAS16-407: Internet of Tiny Linux (IoTL): the sequel.
LAS16-407: Internet of Tiny Linux (IoTL): the sequel.LAS16-407: Internet of Tiny Linux (IoTL): the sequel.
LAS16-407: Internet of Tiny Linux (IoTL): the sequel.
 
Kernel Recipes 2015: Speed up your kernel development cycle with QEMU
Kernel Recipes 2015: Speed up your kernel development cycle with QEMUKernel Recipes 2015: Speed up your kernel development cycle with QEMU
Kernel Recipes 2015: Speed up your kernel development cycle with QEMU
 
BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr
 
Angelo Compagnucci - Upgrading buildroot based devices with swupdate
Angelo Compagnucci - Upgrading buildroot based devices with swupdateAngelo Compagnucci - Upgrading buildroot based devices with swupdate
Angelo Compagnucci - Upgrading buildroot based devices with swupdate
 
LAS16-200: SCMI - System Management and Control Interface
LAS16-200:  SCMI - System Management and Control InterfaceLAS16-200:  SCMI - System Management and Control Interface
LAS16-200: SCMI - System Management and Control Interface
 
Stefano Cordibella - An introduction to Yocto Project
Stefano Cordibella - An introduction to Yocto ProjectStefano Cordibella - An introduction to Yocto Project
Stefano Cordibella - An introduction to Yocto Project
 
Libpcap
LibpcapLibpcap
Libpcap
 
Kernel Recipes 2015: Greybus
Kernel Recipes 2015: GreybusKernel Recipes 2015: Greybus
Kernel Recipes 2015: Greybus
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 

Semelhante a Tommaso Cucinotta - Low-latency and power-efficient audio applications on Linux

Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Michael Christofferson
 
MingLiuResume2016
MingLiuResume2016MingLiuResume2016
MingLiuResume2016
Ming Liu
 
Acceleration_and_Security_draft_v2
Acceleration_and_Security_draft_v2Acceleration_and_Security_draft_v2
Acceleration_and_Security_draft_v2
Srinivasa Addepalli
 
Hardware Assisted Latency Investigations
Hardware Assisted Latency InvestigationsHardware Assisted Latency Investigations
Hardware Assisted Latency Investigations
ScyllaDB
 

Semelhante a Tommaso Cucinotta - Low-latency and power-efficient audio applications on Linux (20)

Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
 
NS-HPDCA
NS-HPDCANS-HPDCA
NS-HPDCA
 
Mastering Real-time Linux
Mastering Real-time LinuxMastering Real-time Linux
Mastering Real-time Linux
 
Debugging Numerical Simulations on Accelerated Architectures - TotalView fo...
 Debugging Numerical Simulations on Accelerated Architectures  - TotalView fo... Debugging Numerical Simulations on Accelerated Architectures  - TotalView fo...
Debugging Numerical Simulations on Accelerated Architectures - TotalView fo...
 
Pristine glif 2015
Pristine glif 2015Pristine glif 2015
Pristine glif 2015
 
High Performance & High Throughput Computing - EUDAT Summer School (Giuseppe ...
High Performance & High Throughput Computing - EUDAT Summer School (Giuseppe ...High Performance & High Throughput Computing - EUDAT Summer School (Giuseppe ...
High Performance & High Throughput Computing - EUDAT Summer School (Giuseppe ...
 
Using Embedded Linux for Infrastructure Systems
Using Embedded Linux for Infrastructure SystemsUsing Embedded Linux for Infrastructure Systems
Using Embedded Linux for Infrastructure Systems
 
Embedded Intro India05
Embedded Intro India05Embedded Intro India05
Embedded Intro India05
 
MingLiuResume2016
MingLiuResume2016MingLiuResume2016
MingLiuResume2016
 
Onnc intro
Onnc introOnnc intro
Onnc intro
 
Irati goals and achievements - 3rd RINA Workshop
Irati goals and achievements - 3rd RINA WorkshopIrati goals and achievements - 3rd RINA Workshop
Irati goals and achievements - 3rd RINA Workshop
 
FIWARE Tech Summit - Stream Processing with Kurento Media Server
FIWARE Tech Summit - Stream Processing with Kurento Media ServerFIWARE Tech Summit - Stream Processing with Kurento Media Server
FIWARE Tech Summit - Stream Processing with Kurento Media Server
 
Acceleration_and_Security_draft_v2
Acceleration_and_Security_draft_v2Acceleration_and_Security_draft_v2
Acceleration_and_Security_draft_v2
 
Continuous Performance Testing
Continuous Performance TestingContinuous Performance Testing
Continuous Performance Testing
 
Webinar: OpenEBS - Still Free and now FASTEST Kubernetes storage
Webinar: OpenEBS - Still Free and now FASTEST Kubernetes storageWebinar: OpenEBS - Still Free and now FASTEST Kubernetes storage
Webinar: OpenEBS - Still Free and now FASTEST Kubernetes storage
 
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitch
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitchDPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitch
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitch
 
Hardware Assisted Latency Investigations
Hardware Assisted Latency InvestigationsHardware Assisted Latency Investigations
Hardware Assisted Latency Investigations
 
Locationless data science on a modern secure edge
Locationless data science on a modern secure edgeLocationless data science on a modern secure edge
Locationless data science on a modern secure edge
 
Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013
Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013
Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013
 
linux monitoring and performance tunning
linux monitoring and performance tunning linux monitoring and performance tunning
linux monitoring and performance tunning
 

Mais de linuxlab_conf

Bruno Verachten - The Android device farm that fits in a (cloudy) pocket
Bruno Verachten - The Android device farm that fits in a (cloudy) pocketBruno Verachten - The Android device farm that fits in a (cloudy) pocket
Bruno Verachten - The Android device farm that fits in a (cloudy) pocket
linuxlab_conf
 
Jacopo Mondi - Complex cameras are complex
Jacopo Mondi - Complex cameras are complexJacopo Mondi - Complex cameras are complex
Jacopo Mondi - Complex cameras are complex
linuxlab_conf
 

Mais de linuxlab_conf (9)

Jonathan Corbet - Keynote: The Kernel Report
Jonathan Corbet - Keynote: The Kernel ReportJonathan Corbet - Keynote: The Kernel Report
Jonathan Corbet - Keynote: The Kernel Report
 
Marco Cavallini - Yocto Project, an automatic generator of embedded Linux dis...
Marco Cavallini - Yocto Project, an automatic generator of embedded Linux dis...Marco Cavallini - Yocto Project, an automatic generator of embedded Linux dis...
Marco Cavallini - Yocto Project, an automatic generator of embedded Linux dis...
 
Bruno Verachten - The Android device farm that fits in a (cloudy) pocket
Bruno Verachten - The Android device farm that fits in a (cloudy) pocketBruno Verachten - The Android device farm that fits in a (cloudy) pocket
Bruno Verachten - The Android device farm that fits in a (cloudy) pocket
 
Jacopo Mondi - Complex cameras are complex
Jacopo Mondi - Complex cameras are complexJacopo Mondi - Complex cameras are complex
Jacopo Mondi - Complex cameras are complex
 
Alessio Lama - Development and testing of a safety network protocol
Alessio Lama - Development and testing of a safety network protocolAlessio Lama - Development and testing of a safety network protocol
Alessio Lama - Development and testing of a safety network protocol
 
Dario Faggioli - Virtualization in the age of speculative execution HW bugs
Dario Faggioli - Virtualization in the age of speculative execution HW bugsDario Faggioli - Virtualization in the age of speculative execution HW bugs
Dario Faggioli - Virtualization in the age of speculative execution HW bugs
 
Luca Cipriani - Control your Embedded Linux remotely by using MQTT and a web ...
Luca Cipriani - Control your Embedded Linux remotely by using MQTT and a web ...Luca Cipriani - Control your Embedded Linux remotely by using MQTT and a web ...
Luca Cipriani - Control your Embedded Linux remotely by using MQTT and a web ...
 
Davide Berardi - Linux hardening and security measures against Memory corruption
Davide Berardi - Linux hardening and security measures against Memory corruptionDavide Berardi - Linux hardening and security measures against Memory corruption
Davide Berardi - Linux hardening and security measures against Memory corruption
 
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily JobLuca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
 

Último

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Último (20)

%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 

Tommaso Cucinotta - Low-latency and power-efficient audio applications on Linux

  • 1. Low-latency and power-efficient audio applications on Linux Tommaso Cucinotta tommaso.cucinotta@santannapisa.it
  • 2. About me LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 2 / 22 ■ 2016-present: Associate Professor at the Real-Time Systems Laboratory (RETIS) of Scuola Superiore Sant’Anna: teaching Component-Based Software Design, Cloud Computing, Big-Data, . . . ■ 2014-2016: Software Development Engineer at AWS, improving the real-time performance and scalability of DynamoDB ■ 2012-2014: Researcher at Alcatel-Lucent Bell Labs, investigating on security and real-time performance of cloud infrastructures with focus on IMS and NFV ■ 2005-2012: Researcher at the RETIS, investigating on adaptive real-time scheduling for multimedia applications on Linux ■ 2001-2004: PhD in Computer Security & Smart-Card Based Authentication, RETIS
  • 3. About the RETIS LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 3 / 22 ■ Belongs to the Institute of Communications, Information and Perception Technologies of Scuola Superiore Sant’Anna in Pisa ■ Research specialties ◆ predictable execution of software through ■ mechanisms at operating system and kernel level ■ design methodologies and tools ■ performance and timing analysis ◆ provide real-time support for emerging computing platforms ■ multi-core and heterogeneous platforms (big.LITTLE, GPGPU, FPGA) ■ distributed infrastructures for cloud & big-data computing and NFV ◆ make real-time systems resource- and energy- efficient ◆ hard real-time use-cases: automotive, industrial automation, railroads ◆ soft real-time use-cases: multimedia, health-care, telecommunications
  • 4. Introduction LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 4 / 22 Common multimedia processing case: audio playback and video streaming ■ Works without particular precautions ■ No interactivity nor low-latency requirements ■ 100s of ms, or even seconds of data can be pre-buffered and pre-processed ■ run-time platform (user-space + kernel) needs only ensure presenting pre-processed A/V frames timely to the underlying hardware
  • 5. Introduction LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 4 / 22 Common multimedia processing case: audio playback and video streaming ■ Works without particular precautions ■ No interactivity nor low-latency requirements ■ 100s of ms, or even seconds of data can be pre-buffered and pre-processed ■ run-time platform (user-space + kernel) needs only ensure presenting pre-processed A/V frames timely to the underlying hardware What about interactivity ?
  • 6. Problem LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 5 / 22 Interactive multimedia processing ■ low-latency requirement from when a user interaction happens, to when it is reflected in the output A/V stream
  • 7. Problem LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 5 / 22 Interactive multimedia processing ■ low-latency requirement from when a user interaction happens, to when it is reflected in the output A/V stream Examples ■ video editing: change filter(s) and/or parameters in a real-time video processing pipeline ■ on-line interactive services: eg, office automation, etc. ■ gaming, VR, AR: user interacts with environment and/or other users (eg, multi-player shooting) ■ software-based sound synthesis: user presses one or more instrument keys / controllers
  • 8. Problem LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 6 / 22 Interactive multimedia processing: how can we achieve low latency ? ■ Digital Audio Workstation (DAW) ◆ DSPs do the real-time work ◆ the general-purpose OS and software just takes care of configuring its pipeline and parameters
  • 9. Problem LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 6 / 22 Interactive multimedia processing: how can we achieve low latency ? ■ Digital Audio Workstation (DAW) ◆ DSPs do the real-time work ◆ the general-purpose OS and software just takes care of configuring its pipeline and parameters ■ EXPENSIVE ! → Software-based solutions
  • 10. Problem LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 6 / 22 Interactive multimedia processing: how can we achieve low latency ? ■ Digital Audio Workstation (DAW) ◆ DSPs do the real-time work ◆ the general-purpose OS and software just takes care of configuring its pipeline and parameters ■ EXPENSIVE ! → Software-based solutions ■ “1-system 1-function” paradigm ◆ device dedicated to a single application ◆ nothing else runs with real-time requirements ◆ we can use priorities to minimize interferences
  • 11. Real-time audio processing LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 7 / 22 Commonly found guidelines for low-latency, skip-free interactive audio processing eg, from http://jackaudio.org/faq/linux_rt_config.html ■ create group of users who can gain RT priority groupadd audio cat /etc/security/limits.d/99-realtime.conf audio - rtprio 99 audio - memlock unlimited ■ add unprivileged user to the new group usermod -a -G audio yourUserID ■ install a “real-time / low-latency” kernel
  • 12. Real-time audio processing LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 7 / 22 Commonly found guidelines for low-latency, skip-free interactive audio processing eg, from http://jackaudio.org/faq/linux_rt_config.html ■ create group of users who can gain RT priority groupadd audio cat /etc/security/limits.d/99-realtime.conf audio - rtprio 99 audio - memlock unlimited ■ add unprivileged user to the new group usermod -a -G audio yourUserID ■ install a “real-time / low-latency” kernel So, problem solved ?
  • 13. What about energy? LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 8 / 22 Plenty of energy saving features in the hardware ■ Dynamic Voltage and Frequency Scaling (DVFS) ■ Performance states (P-states), Operating Performance Points (OPP) ■ Core idle states (C-states) ■ Turbo Boosting (hmmm....): spike-up CPU frequency when/if possible
  • 14. What about energy? LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 8 / 22 Plenty of energy saving features in the hardware ■ Dynamic Voltage and Frequency Scaling (DVFS) ■ Performance states (P-states), Operating Performance Points (OPP) ■ Core idle states (C-states) ■ Turbo Boosting (hmmm....): spike-up CPU frequency when/if possible Useful in a number of cases (both battery-operated and not) ■ laptops, tablets, smartphones ■ desktop PCs, servers
  • 15. What about energy? LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 8 / 22 Plenty of energy saving features in the hardware ■ Dynamic Voltage and Frequency Scaling (DVFS) ■ Performance states (P-states), Operating Performance Points (OPP) ■ Core idle states (C-states) ■ Turbo Boosting (hmmm....): spike-up CPU frequency when/if possible Useful in a number of cases (both battery-operated and not) ■ laptops, tablets, smartphones ■ desktop PCs, servers All bad for performance stability!
  • 16. Platform stability LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 9 / 22 Energy saving features in the hardware adverseley impact performance stability and software predictability ■ DVFS → CPUs run at different frequencies over time ◆ frequency islands: groups of CPUs are constrained to the same frequency ■ P-states → even less control on what frequency CPU(s) are running at ◆ frequency control in hardware, high-level tunable exposed to software (minPct, maxPct) ■ C-states → time to enter and exit idle state is variable ◆ going to a deep-idle state is worth only if staying there for a minimum residency time
  • 17. C-states LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 10 / 22 wake-up resid. C-state latency time POLL 0 0 C1 2 2 C1E 10 20 C3 70 100 C6 85 200 C7s 124 800 C8 200 800 C9 480 5000 C10 890 5000
  • 18. Making the platform stable LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 11 / 22 How users typically make the computing platform (more) stable/predictable ■ turn-off Turbo Boosting ■ disable DVFS (leverage it to fix frequency), eg: ◆ performance governor or ◆ userspace governor if/when available ■ fix performance % with P-state driver (minPct=maxPct) ■ inhibit deep-idle states ◆ echo 1 > /sys/devices/system/cpu/cpu<n>/cpuidle/state<s>/disable ◆ echo 1 > /sys/devices/system/cpu/cpu0/power/pm qos resume latency us
  • 19. Making the platform stable LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 11 / 22 How users typically make the computing platform (more) stable/predictable ■ turn-off Turbo Boosting ■ disable DVFS (leverage it to fix frequency), eg: ◆ performance governor or ◆ userspace governor if/when available ■ fix performance % with P-state driver (minPct=maxPct) ■ inhibit deep-idle states ◆ echo 1 > /sys/devices/system/cpu/cpu<n>/cpuidle/state<s>/disable ◆ echo 1 > /sys/devices/system/cpu/cpu0/power/pm qos resume latency us ■ or, just run: ◆ yes > /dev/null & [times # of CPUs]
  • 20. Making the platform stable LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 11 / 22 How users typically make the computing platform (more) stable/predictable ■ turn-off Turbo Boosting ■ disable DVFS (leverage it to fix frequency), eg: ◆ performance governor or ◆ userspace governor if/when available ■ fix performance % with P-state driver (minPct=maxPct) ■ inhibit deep-idle states ◆ echo 1 > /sys/devices/system/cpu/cpu<n>/cpuidle/state<s>/disable ◆ echo 1 > /sys/devices/system/cpu/cpu0/power/pm qos resume latency us ■ or, just run: ◆ yes > /dev/null & [times # of CPUs] ■ Bad for energy consumption!
  • 21. Why audio skips LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 12 / 22 ∎ audio burst in playback (top) ∎ fill-level of audio ring buffer (middle) ∎ RT app thread (bottom) ∎ big ring buffer → high latency! ∎ empty ring buffer → audible glitch! ∎ small ring buffer periodically refilled → low latency, glitch-free playback!
  • 22. Android audio architecture LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 13 / 22 Android audio applications ∎ android.media APIs ◇ playing/recording audio files, Internet streaming ◇ use of large buffers (no low-latency use-cases) ◇ regular mixer thread Low-latency audio applications ∎ native APIs (OpenSL ES, AAudio) ◇ low-latency audio pro- cessing ◇ rely on FastMixer and ALSA ∎ critically low-latency ◇ exclusive mode in AAudio / ALSA
  • 23. Android audio architecture LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 14 / 22 Power management in Android ■ schedutil selects the minimum operating performance point (OPP) able to satisfy demand ■ based on CPU utilization statistics ◆ Per-Entity Load-Tracking (PELT) ■ exponentially weighted task utilization ■ slow to detect workload changes (ramp-up, cool-down) eg, it may take 50–100 ms to detect a 90% increase of CPU % demand ◆ Window-Assisted Load-Tracking (WALT) ■ max{last window util., avg util. over past N windows} eg, over 3 past 10 ms windows, we have a 10 ms spike detection latency, and a 30 ms cool-down one ■ it forgets quickly a task demand when the task is off the rq ■ WALT more reactive than PELT, but ...
  • 24. Android audio architecture LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 14 / 22 Power management in Android ■ schedutil selects the minimum operating performance point (OPP) able to satisfy demand ■ based on CPU utilization statistics ◆ Per-Entity Load-Tracking (PELT) ■ exponentially weighted task utilization ■ slow to detect workload changes (ramp-up, cool-down) eg, it may take 50–100 ms to detect a 90% increase of CPU % demand ◆ Window-Assisted Load-Tracking (WALT) ■ max{last window util., avg util. over past N windows} eg, over 3 past 10 ms windows, we have a 10 ms spike detection latency, and a 30 ms cool-down one ■ it forgets quickly a task demand when the task is off the rq ■ WALT more reactive than PELT, but ... not enough for very dynamic workloads ■ can we improve on that?
  • 25. SCHED DEADLINE LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 15 / 22 SCHED DEADLINE from RETIS+Evidence (ACTORS EU project) ■ mainline since v3.14 (2013) ■ reservation-based scheduling ■ a task is reserved a given runtime within a deadline every period struct sched attr attr = { .size = sizeof(struct sched attr), .sched policy = SCHED DEADLINE, .sched flags = 0, // RECLAIM | RESET ON FORK .sched runtime = runtime us * 1000, .sched deadline = deadline us * 1000, .sched period = period us * 1000 }; if (sched setattr(0, &attr, 0) < 0) { perror("setattr() failed"); exit(-1); }
  • 26. SCHED DEADLINE LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 16 / 22 How is SCHED DEADLINE w.r.t. POSIX RT? ■ any SCHED DEADLINE task runs before any POSIX RT or CFS task ◆ based on resource reservations (next slide) ◆ throttling safeguard to avoid locking the CPU (can be disabled if needed) ■ any POSIX RT (FIFO/RR) task runs before any CFS task ◆ based on priorities ◆ throttling safeguard to avoid locking the CPU (can be disabled if needed) ■ Completely Fair Scheduler (CFS) tasks run when no SCHED DEADLINE nor RT tasks can ◆ based on weights (weighted fair scheduler)
  • 27. SCHED DEADLINE LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 17 / 22 Main SCHED DEADLINE properties ■ based on EDF (optimum on uni-processors) and (Hard) Costant Bandwidth Server (CBS) ■ temporal isolation: a task inability to respect its runtime doesn’t affect others ■ on multi-processors: anything from G-EDF (tardiness bound) to P-EDF When trying to exceed the runtime ■ task gets throttled (original) ■ opportunistically get extra runtime (GRUB), if RECLAIM used
  • 28. SCHED DEADLINE and schedutil LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 18 / 22 schedutil decided OPP depends on overall system utilization, in which we have: ■ SCHED DEADLINE tasks’ utilization: runtime period dynamic workload demand changes via sched setattr(): ■ readily accounted for, by schedutil
  • 29. SCHED DEADLINE and schedutil LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 18 / 22 schedutil decided OPP depends on overall system utilization, in which we have: ■ SCHED DEADLINE tasks’ utilization: runtime period dynamic workload demand changes via sched setattr(): ■ readily accounted for, by schedutil Does it work?
  • 30. SCHED DEADLINE and schedutil LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 18 / 22 schedutil decided OPP depends on overall system utilization, in which we have: ■ SCHED DEADLINE tasks’ utilization: runtime period dynamic workload demand changes via sched setattr(): ■ readily accounted for, by schedutil Does it work? Results on a HiKey 960 board: ■ energy-efficient set-up: glitch-free playback at 2.67ms latency, vs 26.67ms of mainline Android using SCHED FIFO and WALT, at the cost of +6.25% power consumption ■ low-latency set-up: at 2.67ms latency, saved 40% energy wrt mainline Android using SCHED FIFO and WALT
  • 31. Heterogeneous Architectures LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 19 / 22 ARM big.LITTLE (and DynamIQ) architectures ■ tasks can migrate among big and LITTLE cores (same ISA) ■ big cores: high-performance workloads ■ LITTLE cores: energy-efficient workloads ARM Energy Aware Scheduling (EAS) ■ give kernel awareness of the CPU capacity associated with big and LITTLE cores ■ give kernel clues as to how capacity of big and LITTLE cores scales with CPU frequency ■ provide CFS with more informed task placement and migration decisions
  • 32. Capacity enhancement patches LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 20 / 22 SCHED DEADLINE improvements to account for CPU capacity ■ runtime is specified in terms of the fastest CPU at the fastest frequency ◆ it gets automatically rescaled using the CPU capacity figures ■ if there’s a choice, prefer LITTLE cores before going to big ones ■ proper consideration of CPU capacity in schedutil
  • 33. Related publications LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 21 / 22 ∎ A. Balsini, Towards Hard and Soft Real-time Operating Systems for Multicore Heterogeneous Architectures, PhD dissertation, 2018 ∎ A. Balsini et al., Modeling and simulation of power consumption and execution times for real-time tasks on embedded heterogeneous architectures, EWILI 2018 ∎ T. Cucinotta et al., Improving Responsiveness of Time-Sensitive Applications by Exploiting Dynamic Task Dependencies, Wiley SPE 2018 ∎ C. Scordino et al., Energy-aware real-time scheduling in the linux kernel, ACM SAC 2018 ∎ D. B. de Oliveira et al., Nested Locks in the Lock Implementation: The Real-Time Read-Write Semaphores on Linux, RTSOPS 2018 ∎ M. Marinoni et al., Allocation and control of computing resources for real-time Virtual Network Functions, SOFTNETWORKING 2018 ∎ T. Cucinotta et al., Adaptive Real-Time Scheduling for Legacy Multimedia Applications, ACM TECS 2012 ∎ J. Lelli et al., An Experimental Comparison of Different Real-Time Schedulers on Multicore Systems, Elsevier JSS 2012 ∎ T. Cucinotta et al., Virtualised e-Learning on the IRMOS Real-time Cloud, Springer SOCA’12 ∎ T. Cucinotta et al., A robust mechanism for adaptive scheduling of multimedia applications, ACM TECS 2011 ∎ T. Cucinotta et al., Low-Latency Audio on Linux by Means of Real-Time Scheduling, LAC’11 ∎ T. Cucinotta et al., Virtualised e-Learning with Real-Time Guarantees on the IRMOS Platform, IEEE SOCA 2010 ∎ T. Cucinotta and L. Palopoli, QoS Control for Pipelines of Tasks Using Multiple Resources, IEEE TOC 2010 ∎ L. Palopoli et al, AQuoSA - Adaptive Quality of Service Architecture, Wiley SPE 2008 ∎ L. Abeni et al, QoS Management through adaptive reservations, Springer RTSJ 2005
  • 34. Q&A LinuxLab 2018 T. Cucinotta – Real-Time Systems Laboratory (RETIS) – 22 / 22 Thanks for listening! Questions ? http://retis.santannapisa.it/˜tommaso tommaso.cucinotta@santannapisa.it