SlideShare uma empresa Scribd logo
1 de 48
Baixar para ler offline
Lessons learnt in boot 
time reduction 
Embedded Linux Conference Europe 2014 
Andrew Murray 
Embedded Bits 
12
1 
Understand why and how 
Embedded Linux Conference Europe 2014
Why minimal boot times? 
• There are lots of good reasons, why are you here? 
• Common reasons are: 
• To improve user experience in mobile devices 
• To respond quickly after power loss 
Embedded Linux Conference Europe 2014
How 
• Starting point: 
• We have a product that achieves required functionality after an unacceptable 
delay 
• The required functionality is achieved through a number of software tasks 
that we’ve defined and so can change 
• We can’t change the hardware or the required functionality 
• Software is generalised 
• We reduce the cold boot time by: 
• Ensuring that we perform nothing more than the essential tasks required to 
achieve the required functionality whilst making efficient use of the 
hardware resources. 
• Thus: 
• Remove tasks that aren’t required 
• Optimise tasks that are required 
• Use all the hardware all the time 
• Challenge how we provide the functionality 
Embedded Linux Conference Europe 2014
2 
Know your hardware 
Embedded Linux Conference Europe 2014
Know your hardware 
• Understand the performance limits of the hardware 
• Determine what you can expect to achieve and strive to achieve it 
• How quickly can you expect to execute instructions? read data from 
storage? send I2C/SPI commands? 
• Software will rarely already be optimised for your hardware 
• Focus on I/O 
• I/O is always a bottleneck 
Embedded Linux Conference Europe 2014
How much data? 
• Use /proc/diskstats to measure userspace I/O at the end of 
boot 
cat /proc/diskstats | grep mmcblk0p6 
179 6 mmcblk0p6 1366 871 122870 42690 0 0 0 0 4 4590 42650 
122870 sectors read x 512 = 60MB 
• Data needed for boot is read from your hardware and takes time 
• If you can read at 10MB/S, then your boot will certainly be greater than 6 
seconds. 
• Ignoring compression for now 
• Thus we optimise by maximising I/O rate and minimising data amount 
Embedded Linux Conference Europe 2014
Optimise I/O 
• Read the specs for your hardware 
• Calculate any necessary timings 
• Ensure the driver is optimal 
• Consider supporting additional hardware features 
• You will need to do this for both kernel and boot loader 
• Optimising I/O comes first – later optimisations will depend on 
the performance of I/O. 
Embedded Linux Conference Europe 2014
Know your hardware 
• Ensure you can use: 
• DMA 
• Hardware accelerators 
• Additional CPU cores 
• Caches 
• Utilise maximum bus/clock rates 
• CPU 
• I2C/SPI 
Embedded Linux Conference Europe 2014
3 
Use compression wisely 
Embedded Linux Conference Europe 2014
Use compression wisely 
• I/O is often a bottle neck – it’s slow to read data from storage 
• Compression is a trade off between CPU and I/O use 
• Determine throughput of reading data directly and reading 
data with compression to determine optimal solution 
• Performance of I/O and algorithms may vary between kernel 
and bootloader 
• Compression is littered everywhere: 
• Compressed kernels (self decompressed, boot loader decompressed) 
• Filesystems 
• Applications 
• Compressibility? 
Embedded Linux Conference Europe 2014
The 4 future is quicker 
Embedded Linux Conference Europe 2014
The future is quicker 
• Your product development may not be using the latest versions 
of open source components 
• This wouldn’t be uncommon 
• The platform vendors version of software is often used 
• It probably ‘just works’ 
• It probably demonstrates the key hardware features you will use 
• It’s probably old 
Embedded Linux Conference Europe 2014
Vendor provided BSPs 
Platform Linux version U-Boot version 
Mainline v3.17 (Oct ‘14) v2014.07 (Jul ‘14) 
Freescale i.MX6 v3.0.35 (Jul ‘11) 
Embedded Linux Conference Europe 2014 
v3.10.17 (Jun ‘13) 
v2009.08 (Aug ‘09) 
v2013.04 (Apr ‘13) 
Variscite OMAP4 v3.4.x (May ‘12) v2012.07 (Jul ‘12) 
Gumstix Oveo 
DM37xx/OMAP35xx 
v3.5.x (Jul ‘12) v2013.10 (Oct ‘13) 
Gumstix DuoVero 
OMAP4430 
v3.6.x (Sep ‘12) 
Gumstix Verdex Pro 
PXA270 
v2.6.37 (Jan ‘11) 
DVSDK 4 02 
DM3730 OMAPL-138 
v2.6.37 (Jan ‘11) v2010.12 (Dec ’10) 
As of Oct ‘14
Take from the future 
• Software often gets optimized over time 
• Upstream versions may be quicker with fewer bugs 
• Upstream versions may be slower with more bugs 
• Look to the future and backport before reinventing the wheel 
• Example… 
Embedded Linux Conference Europe 2014
Embedded Linux Conference Europe 2014
The usual suspects 
• String routines get called a lot 
• mem[chr|cpy|move|set|zero] 
• OMAP4 Linux boot statistics: 
• 133,356 times transferring 34MB 
• Over time these functions have improved 
• Other functions in the kernel 
• memcpy_fromio 
• See arch/sh/kernel/io.c 
• See arch/powerpc/kernel/io.c 
Embedded Linux Conference Europe 2014
5 
Ignore FS benchmarks 
Embedded Linux Conference Europe 2014
Ignore filesystem benchmarks 
• Benchmarks are valuable but shouldn’t be used exclusively to 
determine choice 
• It’s not easy to find a relevant benchmark 
• Software evolves over time 
• Benchmark may not be relevant to your filesystem version – optimisations 
may be missing/present 
• Lots of filesystem choice 
• Filesystem type 
• Block size 
• Use of compression 
• There isn’t a best – each option balances CPU vs I/O in some way 
• So it depends on how fast/slow your CPU and I/O is (or how busy your system 
is) 
Embedded Linux Conference Europe 2014
Ignore filesystem benchmarks 
• Boot time consists of: 
• Init time 
• Mount time 
• Read/write time 
• Thus depends on your use case 
• Of course your usecase, I/O and possibly CPU performance may 
improve over the course of optimisation effecting your 
filesystem choice 
• Thus measure yourself – you can automate it 
Embedded Linux Conference Europe 2014
6 
The right approach 
Embedded Linux Conference Europe 2014
The right approach 
• Measure, measure, measure 
• Instrument your software 
• Printk timestamps, host timestamps, initcall_debug, printk’s, tracing 
• But watch out for unintended side effects 
• Identify long delays and tackle them first 
• Change one thing at a time and measure the full effect 
• Make notes, keep log and be prepared to start over 
• Order is important 
• Goal: 
• 1. Ensure I/O and CPU is 100% utilised during boot 
• 2. Ensure the I/O and CPU utilisation is efficient and necessary 
• Consider full effect of a change 
Embedded Linux Conference Europe 2014
Don’t focus on the kernel 
• If you perform any measurement you’ll quickly realise that the 
kernel is rarely the worse offender 
• Typically the bootloader and userspace take up the majority of 
boot time 
Embedded Linux Conference Europe 2014
8 
Low hanging fruit 
Embedded Linux Conference Europe 2014
Low Hanging Fruit 
• There are trivial changes that generally always improve the 
boot time of the majority of devices 
• These are applied to the majority of boot time reduction projects 
• No boot time presentation would be complete without these 
Embedded Linux Conference Europe 2014
U-Boot delay 
• Eliminate boot delay with CONFIG_BOOTDELAY 
• Allow development with CONFIG_ZERO_BOOTDELAY_CHECK 
• Use CONFIG_AUTOBOOT_KEYED to prevent accidents 
Embedded Linux Conference Europe 2014
Precalculated LPJ 
• Use the ‘lpj’ argument in the kernel command line to prevent 
calibrating a delay loop on each boot 
Calibrating delay loop... 1590.23 BogoMIPS (lpj=6213632) 
Embedded Linux Conference Europe 2014
Disable console output 
• Add ‘quiet’ to the kernel command line to supress kernel 
output during boot 
• Supress U-Boot output with: 
• CONFIG_SILENT_CONSOLE 
• CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC 
• CONFIG_SILENT_U_BOOT_ONLY 
Embedded Linux Conference Europe 2014
U-Boot scripts 
#define CONFIG_BOOTCOMMAND  
"if mmc rescan ${mmcdev}; then "  
"if run loadbootenv; then "  
"echo Loaded environment from ${bootenv};"  
"run importbootenv;"  
"if test -n $uenvcmd; then "  
Embedded Linux Conference Europe 2014 
"echo Running uenvcmd ...;"  
"run uenvcmd;"  
"fi;"  
"elif run loadbootscript; then "  
"echo Loaded script from ${bootscr};"  
"run bootscript; "  
"else "  
"if run loaduimage; then "  
"run mmcboot; "  
"fi; "  
"fi; "  
"fi; "  
"if usb start; then "  
"set autoload no; " 
"bootp; "
More fruit 
• Reduce U-Boot environment size 
• Ensure U-Boot reads the right amount of data and puts it in the 
right place 
• ‘nboot’ can help 
• Image verification 
• Optimise memset/memcpy 
• Reduce size of binaries 
• Kernel (KALLSYMS, IKCONFIG), strip binaries, mklibs, etc 
• Device node creation 
• Init.d style boot 
• Sleeps 
Embedded Linux Conference Europe 2014
9 
Make it stick 
Embedded Linux Conference Europe 2014
Make it stick 
• Boot time is likely to increase through subsequent 
development 
• And so boot time reduction can be a repeating exercise 
• Reasons boot time doesn't stick: 
• Development of new features doesn’t consider boot time 
• Boot time enhancements can be inflexible, inconvenient and limiting 
• Inconvenient optimisations have a habit of disappearing 
• No one ever removes a ‘no side effect’ optimisation such as improved 
NAND timings 
• Maintaining a minimal boot time is difficult 
Embedded Linux Conference Europe 2014
Bad solutions 
• Delay: Ethernet initialisation in U-Boot 
• Bad solution: Ethernet not used in U-Boot so remove support 
• Impact: No-one can TFTP – annoying for development 
• Better solution: 
• Defer initialisation 
• Add a custom U-Boot command that re-enables Ethernet 
• Developers can add this command to their ‘bootcmd’ 
• If U-Boot size is an issue – it can be conditionally removed for a release 
build 
• Run time options such as this that default to quick boot are great 
• Compile/Config time options may result in git commit fights 
• Don’t replace - complement 
Embedded Linux Conference Europe 2014
Bad solutions 
• Delay: Udev 
• Bad solution: Remove it and use hard coded device nodes 
• Impact: It works great until the moment the kernel changes 
then everyone gets odd errors, eventually udev shows up again 
• Better solution: 
• Use devtmpfs 
• Update drivers to use hard coded device number (if you must) 
Embedded Linux Conference Europe 2014
Make it stick 
• Make boot time enhancements less annoying 
• It’s easy to use a sledge hammer 
• Find good solutions that preserve or replace ‘unneeded’ functionality 
• Sometimes unavoidable for tiny boot times 
• Aim for run time switches to enable them 
• Maybe use a hardware switch 
• Automate boot time measurement 
• Use automation to build, deploy, boot and measure your boot time 
• Tie this in with git hooks 
• Find out at the earliest moment when your boot time increases 
• Helps share ownership of boot time reduction 
Embedded Linux Conference Europe 2014
11 
Look in the right places 
Embedded Linux Conference Europe 2014
Look in the right places 
• You’ll get to a point where… 
• You’ve read the internet and implemented its suggestions 
• You’ve implemented the low hanging fruit 
• You’ve think everything left is needed and it does what it needs to do 
• Where next? 
Embedded Linux Conference Europe 2014
Look in the right places 
• You’ve probably been looking at big delays 
• Don’t forget the small delays that happen all the time 
• Harder to find – you need to consider both time and frequency 
• Profiling tools helps here 
• This is probably where the hard work begins 
• Google ‘instrumentation/tracing’ instead of ‘reduce boot time’ 
• Don’t forget to group related delays to truly see impact 
• You need to do that fsck because you have chosen a file system that 
needs it 
• Ask yourself if the tasks are really needed? 
• Do they directly contribute to achieving the boot time functionality? 
• Bootloaders, start up scripts, dynamic device nodes – nice but not essential 
Embedded Linux Conference Europe 2014
GStreamer example 
• Gstreamer heavily uses plugins (shared libraries) 
• When a Gstreamer application starts (gst_init) it will scan 
GST_PLUGIN_PATH for plugins and populate a registry used to 
find plugins 
• This takes time 
• This isn’t needed on every boot 
• Example of a task that isn’t needed 
• Used GST_REGISTRY_UPDATE to prevent scan and used a pre-provided 
registry 
• Reduced data transfer during boot by 20MB saved 4 seconds 
• Found by littering printf’s through the application 
Embedded Linux Conference Europe 2014
Look in the right places 
• Look at: 
• Code you’ve written 
• Code your team has written 
• Code the board provider has written 
• Code the silicon vendor has written 
• Everything else 
Embedded Linux Conference Europe 2014
10 
Find good tools 
Embedded Linux Conference Europe 2014
Tools can help 
• Tools can save you time and provide clarity 
• There are a lot of tools available 
• Sometimes they can overwhelm you with information 
• Use them towards end of project 
• You can do a lot with printk/printf and timestamps 
• Perf, oprofile, strace are helpful too 
• Lots of presentations on these topics 
• “Linux Performance Tools” – Brendan Gregg, Netflix 
• Bootchart can help visualise userspace performance 
Embedded Linux Conference Europe 2014
Bootchart 
Embedded Linux Conference Europe 2014
11 
Create an illusion 
Embedded Linux Conference Europe 2014
Create an illusion 
• Why do you want a minimal boot time anyway? 
• Can you achieve it without a minimal boot time? 
• Small boot time can be difficult to achieve 
• So why not create an illusion of a small boot time instead 
• ‘Smoke and Mirrors’ have a place 
• Defer functionality that isn’t needed straight away 
Embedded Linux Conference Europe 2014
12 
Expect disruption 
Embedded Linux Conference Europe 2014
Expect disruption 
• Minimal boot times often result in a compromise 
• This effects everyone that is developing the product 
• Changes you wish to make may conflict with other parts of the 
product development 
• Your changes may have knock on effects 
• Be prepared to make and justify your case 
• How important is a minimal boot time? 
• You may find out that minimal boot time isn’t everything after all 
Embedded Linux Conference Europe 2014
Embedded Linux Conference Europe 2014 
Thank you 
Questions? 
Andrew Murray 
Embedded Bits <amurray@embedded-bits.co.uk>

Mais conteúdo relacionado

Mais procurados

XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information Security
XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information SecurityXPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information Security
XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information SecurityThe Linux Foundation
 
Reducing boot time in embedded Linux
Reducing boot time in embedded LinuxReducing boot time in embedded Linux
Reducing boot time in embedded LinuxChris Simmonds
 
Quick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIOQuick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIOChris Simmonds
 
2016-jenkins-world-jenkins_and_load_sharing_facility_lsf_enables_rapid_delive...
2016-jenkins-world-jenkins_and_load_sharing_facility_lsf_enables_rapid_delive...2016-jenkins-world-jenkins_and_load_sharing_facility_lsf_enables_rapid_delive...
2016-jenkins-world-jenkins_and_load_sharing_facility_lsf_enables_rapid_delive...Brian Vandegriend
 
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORSDEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORSFelipe Prado
 
10 ways hardware engineers can make software integration easier
10 ways hardware engineers can make software integration easier10 ways hardware engineers can make software integration easier
10 ways hardware engineers can make software integration easierChris Simmonds
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 1
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 1Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 1
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 1Qualcomm Developer Network
 
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...ManageEngine, Zoho Corporation
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3Qualcomm Developer Network
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2Qualcomm Developer Network
 
ELC_NA-2015-AFT_for_CI-Igor.Stoppa
ELC_NA-2015-AFT_for_CI-Igor.StoppaELC_NA-2015-AFT_for_CI-Igor.Stoppa
ELC_NA-2015-AFT_for_CI-Igor.StoppaIgor Stoppa
 
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...Raul Chong
 
Remote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesRemote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesVIA Embedded
 
The Theory and Implementation of DVFS on Linux
The Theory and Implementation of DVFS on LinuxThe Theory and Implementation of DVFS on Linux
The Theory and Implementation of DVFS on LinuxPicker Weng
 
Reducing the boot time of Linux devices
Reducing the boot time of Linux devicesReducing the boot time of Linux devices
Reducing the boot time of Linux devicesChris Simmonds
 
Lec 9-os-review
Lec 9-os-reviewLec 9-os-review
Lec 9-os-reviewMothi R
 
Lesson 1 introduction to real time
Lesson 1 introduction to real timeLesson 1 introduction to real time
Lesson 1 introduction to real timePramod Pbkr
 

Mais procurados (20)

Rt linux-lab1
Rt linux-lab1Rt linux-lab1
Rt linux-lab1
 
Hypervisors
HypervisorsHypervisors
Hypervisors
 
XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information Security
XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information SecurityXPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information Security
XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information Security
 
Reducing boot time in embedded Linux
Reducing boot time in embedded LinuxReducing boot time in embedded Linux
Reducing boot time in embedded Linux
 
Quick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIOQuick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIO
 
2016-jenkins-world-jenkins_and_load_sharing_facility_lsf_enables_rapid_delive...
2016-jenkins-world-jenkins_and_load_sharing_facility_lsf_enables_rapid_delive...2016-jenkins-world-jenkins_and_load_sharing_facility_lsf_enables_rapid_delive...
2016-jenkins-world-jenkins_and_load_sharing_facility_lsf_enables_rapid_delive...
 
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORSDEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
 
10 ways hardware engineers can make software integration easier
10 ways hardware engineers can make software integration easier10 ways hardware engineers can make software integration easier
10 ways hardware engineers can make software integration easier
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 1
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 1Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 1
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 1
 
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 3
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
 
ELC_NA-2015-AFT_for_CI-Igor.Stoppa
ELC_NA-2015-AFT_for_CI-Igor.StoppaELC_NA-2015-AFT_for_CI-Igor.Stoppa
ELC_NA-2015-AFT_for_CI-Igor.Stoppa
 
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
 
Remote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesRemote Management of Embedded Android Devices
Remote Management of Embedded Android Devices
 
The Theory and Implementation of DVFS on Linux
The Theory and Implementation of DVFS on LinuxThe Theory and Implementation of DVFS on Linux
The Theory and Implementation of DVFS on Linux
 
Reducing the boot time of Linux devices
Reducing the boot time of Linux devicesReducing the boot time of Linux devices
Reducing the boot time of Linux devices
 
Lec 9-os-review
Lec 9-os-reviewLec 9-os-review
Lec 9-os-review
 
Lesson 1 introduction to real time
Lesson 1 introduction to real timeLesson 1 introduction to real time
Lesson 1 introduction to real time
 
Jpcm
JpcmJpcm
Jpcm
 

Semelhante a 12 Lessons Learnt in Boot Time Reduction

Cognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & TricksCognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & TricksSenturus
 
Basics of micro controllers for biginners
Basics of  micro controllers for biginnersBasics of  micro controllers for biginners
Basics of micro controllers for biginnersGerwin Makanyanga
 
Putting Compilers to Work
Putting Compilers to WorkPutting Compilers to Work
Putting Compilers to WorkSingleStore
 
Compilers and interpreters
Compilers and interpretersCompilers and interpreters
Compilers and interpretersRAJU KATHI
 
The end of embedded Linux (as we know it)
The end of embedded Linux (as we know it)The end of embedded Linux (as we know it)
The end of embedded Linux (as we know it)Chris Simmonds
 
Developing a Ceph Appliance for Secure Environments
Developing a Ceph Appliance for Secure EnvironmentsDeveloping a Ceph Appliance for Secure Environments
Developing a Ceph Appliance for Secure EnvironmentsCeph Community
 
LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...
LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...
LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...Linaro
 
LCE13: Test and Validation Summit: The future of testing at Linaro
LCE13: Test and Validation Summit: The future of testing at LinaroLCE13: Test and Validation Summit: The future of testing at Linaro
LCE13: Test and Validation Summit: The future of testing at LinaroLinaro
 
Opening last bits of the infrastructure
Opening last bits of the infrastructureOpening last bits of the infrastructure
Opening last bits of the infrastructureErwan Velu
 
SOA Suite Administration from OUGN 2014
SOA Suite Administration from OUGN 2014SOA Suite Administration from OUGN 2014
SOA Suite Administration from OUGN 2014Jon Petter Hjulstad
 
Progress OE performance management
Progress OE performance managementProgress OE performance management
Progress OE performance managementYassine MOALLA
 
Progress Openedge performance management
Progress Openedge performance managementProgress Openedge performance management
Progress Openedge performance managementYassine MOALLA
 
Introducing Container Technology to TSUBAME3.0 Supercomputer
Introducing Container Technology to TSUBAME3.0 SupercomputerIntroducing Container Technology to TSUBAME3.0 Supercomputer
Introducing Container Technology to TSUBAME3.0 SupercomputerAkihiro Nomura
 
Performance Benchmarking: Tips, Tricks, and Lessons Learned
Performance Benchmarking: Tips, Tricks, and Lessons LearnedPerformance Benchmarking: Tips, Tricks, and Lessons Learned
Performance Benchmarking: Tips, Tricks, and Lessons LearnedTim Callaghan
 
OpenStack Cinder Best Practices - Meet Up
OpenStack Cinder Best Practices - Meet UpOpenStack Cinder Best Practices - Meet Up
OpenStack Cinder Best Practices - Meet UpAaron Delp
 

Semelhante a 12 Lessons Learnt in Boot Time Reduction (20)

Cognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & TricksCognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & Tricks
 
Basics of micro controllers for biginners
Basics of  micro controllers for biginnersBasics of  micro controllers for biginners
Basics of micro controllers for biginners
 
Putting Compilers to Work
Putting Compilers to WorkPutting Compilers to Work
Putting Compilers to Work
 
Compilers and interpreters
Compilers and interpretersCompilers and interpreters
Compilers and interpreters
 
The end of embedded Linux (as we know it)
The end of embedded Linux (as we know it)The end of embedded Linux (as we know it)
The end of embedded Linux (as we know it)
 
Developing a Ceph Appliance for Secure Environments
Developing a Ceph Appliance for Secure EnvironmentsDeveloping a Ceph Appliance for Secure Environments
Developing a Ceph Appliance for Secure Environments
 
LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...
LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...
LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...
 
LCE13: Test and Validation Summit: The future of testing at Linaro
LCE13: Test and Validation Summit: The future of testing at LinaroLCE13: Test and Validation Summit: The future of testing at Linaro
LCE13: Test and Validation Summit: The future of testing at Linaro
 
Optimizing Linux Servers
Optimizing Linux ServersOptimizing Linux Servers
Optimizing Linux Servers
 
Opening last bits of the infrastructure
Opening last bits of the infrastructureOpening last bits of the infrastructure
Opening last bits of the infrastructure
 
How We Test Linux
How We Test LinuxHow We Test Linux
How We Test Linux
 
SOA Suite Administration from OUGN 2014
SOA Suite Administration from OUGN 2014SOA Suite Administration from OUGN 2014
SOA Suite Administration from OUGN 2014
 
Progress OE performance management
Progress OE performance managementProgress OE performance management
Progress OE performance management
 
Progress Openedge performance management
Progress Openedge performance managementProgress Openedge performance management
Progress Openedge performance management
 
Introducing Container Technology to TSUBAME3.0 Supercomputer
Introducing Container Technology to TSUBAME3.0 SupercomputerIntroducing Container Technology to TSUBAME3.0 Supercomputer
Introducing Container Technology to TSUBAME3.0 Supercomputer
 
Embedded Operating System - Linux
Embedded Operating System - LinuxEmbedded Operating System - Linux
Embedded Operating System - Linux
 
Performance Benchmarking: Tips, Tricks, and Lessons Learned
Performance Benchmarking: Tips, Tricks, and Lessons LearnedPerformance Benchmarking: Tips, Tricks, and Lessons Learned
Performance Benchmarking: Tips, Tricks, and Lessons Learned
 
Hands on OpenCL
Hands on OpenCLHands on OpenCL
Hands on OpenCL
 
OpenStack Cinder Best Practices - Meet Up
OpenStack Cinder Best Practices - Meet UpOpenStack Cinder Best Practices - Meet Up
OpenStack Cinder Best Practices - Meet Up
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 

Último

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Último (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

12 Lessons Learnt in Boot Time Reduction

  • 1. Lessons learnt in boot time reduction Embedded Linux Conference Europe 2014 Andrew Murray Embedded Bits 12
  • 2. 1 Understand why and how Embedded Linux Conference Europe 2014
  • 3. Why minimal boot times? • There are lots of good reasons, why are you here? • Common reasons are: • To improve user experience in mobile devices • To respond quickly after power loss Embedded Linux Conference Europe 2014
  • 4. How • Starting point: • We have a product that achieves required functionality after an unacceptable delay • The required functionality is achieved through a number of software tasks that we’ve defined and so can change • We can’t change the hardware or the required functionality • Software is generalised • We reduce the cold boot time by: • Ensuring that we perform nothing more than the essential tasks required to achieve the required functionality whilst making efficient use of the hardware resources. • Thus: • Remove tasks that aren’t required • Optimise tasks that are required • Use all the hardware all the time • Challenge how we provide the functionality Embedded Linux Conference Europe 2014
  • 5. 2 Know your hardware Embedded Linux Conference Europe 2014
  • 6. Know your hardware • Understand the performance limits of the hardware • Determine what you can expect to achieve and strive to achieve it • How quickly can you expect to execute instructions? read data from storage? send I2C/SPI commands? • Software will rarely already be optimised for your hardware • Focus on I/O • I/O is always a bottleneck Embedded Linux Conference Europe 2014
  • 7. How much data? • Use /proc/diskstats to measure userspace I/O at the end of boot cat /proc/diskstats | grep mmcblk0p6 179 6 mmcblk0p6 1366 871 122870 42690 0 0 0 0 4 4590 42650 122870 sectors read x 512 = 60MB • Data needed for boot is read from your hardware and takes time • If you can read at 10MB/S, then your boot will certainly be greater than 6 seconds. • Ignoring compression for now • Thus we optimise by maximising I/O rate and minimising data amount Embedded Linux Conference Europe 2014
  • 8. Optimise I/O • Read the specs for your hardware • Calculate any necessary timings • Ensure the driver is optimal • Consider supporting additional hardware features • You will need to do this for both kernel and boot loader • Optimising I/O comes first – later optimisations will depend on the performance of I/O. Embedded Linux Conference Europe 2014
  • 9. Know your hardware • Ensure you can use: • DMA • Hardware accelerators • Additional CPU cores • Caches • Utilise maximum bus/clock rates • CPU • I2C/SPI Embedded Linux Conference Europe 2014
  • 10. 3 Use compression wisely Embedded Linux Conference Europe 2014
  • 11. Use compression wisely • I/O is often a bottle neck – it’s slow to read data from storage • Compression is a trade off between CPU and I/O use • Determine throughput of reading data directly and reading data with compression to determine optimal solution • Performance of I/O and algorithms may vary between kernel and bootloader • Compression is littered everywhere: • Compressed kernels (self decompressed, boot loader decompressed) • Filesystems • Applications • Compressibility? Embedded Linux Conference Europe 2014
  • 12. The 4 future is quicker Embedded Linux Conference Europe 2014
  • 13. The future is quicker • Your product development may not be using the latest versions of open source components • This wouldn’t be uncommon • The platform vendors version of software is often used • It probably ‘just works’ • It probably demonstrates the key hardware features you will use • It’s probably old Embedded Linux Conference Europe 2014
  • 14. Vendor provided BSPs Platform Linux version U-Boot version Mainline v3.17 (Oct ‘14) v2014.07 (Jul ‘14) Freescale i.MX6 v3.0.35 (Jul ‘11) Embedded Linux Conference Europe 2014 v3.10.17 (Jun ‘13) v2009.08 (Aug ‘09) v2013.04 (Apr ‘13) Variscite OMAP4 v3.4.x (May ‘12) v2012.07 (Jul ‘12) Gumstix Oveo DM37xx/OMAP35xx v3.5.x (Jul ‘12) v2013.10 (Oct ‘13) Gumstix DuoVero OMAP4430 v3.6.x (Sep ‘12) Gumstix Verdex Pro PXA270 v2.6.37 (Jan ‘11) DVSDK 4 02 DM3730 OMAPL-138 v2.6.37 (Jan ‘11) v2010.12 (Dec ’10) As of Oct ‘14
  • 15. Take from the future • Software often gets optimized over time • Upstream versions may be quicker with fewer bugs • Upstream versions may be slower with more bugs • Look to the future and backport before reinventing the wheel • Example… Embedded Linux Conference Europe 2014
  • 17. The usual suspects • String routines get called a lot • mem[chr|cpy|move|set|zero] • OMAP4 Linux boot statistics: • 133,356 times transferring 34MB • Over time these functions have improved • Other functions in the kernel • memcpy_fromio • See arch/sh/kernel/io.c • See arch/powerpc/kernel/io.c Embedded Linux Conference Europe 2014
  • 18. 5 Ignore FS benchmarks Embedded Linux Conference Europe 2014
  • 19. Ignore filesystem benchmarks • Benchmarks are valuable but shouldn’t be used exclusively to determine choice • It’s not easy to find a relevant benchmark • Software evolves over time • Benchmark may not be relevant to your filesystem version – optimisations may be missing/present • Lots of filesystem choice • Filesystem type • Block size • Use of compression • There isn’t a best – each option balances CPU vs I/O in some way • So it depends on how fast/slow your CPU and I/O is (or how busy your system is) Embedded Linux Conference Europe 2014
  • 20. Ignore filesystem benchmarks • Boot time consists of: • Init time • Mount time • Read/write time • Thus depends on your use case • Of course your usecase, I/O and possibly CPU performance may improve over the course of optimisation effecting your filesystem choice • Thus measure yourself – you can automate it Embedded Linux Conference Europe 2014
  • 21. 6 The right approach Embedded Linux Conference Europe 2014
  • 22. The right approach • Measure, measure, measure • Instrument your software • Printk timestamps, host timestamps, initcall_debug, printk’s, tracing • But watch out for unintended side effects • Identify long delays and tackle them first • Change one thing at a time and measure the full effect • Make notes, keep log and be prepared to start over • Order is important • Goal: • 1. Ensure I/O and CPU is 100% utilised during boot • 2. Ensure the I/O and CPU utilisation is efficient and necessary • Consider full effect of a change Embedded Linux Conference Europe 2014
  • 23. Don’t focus on the kernel • If you perform any measurement you’ll quickly realise that the kernel is rarely the worse offender • Typically the bootloader and userspace take up the majority of boot time Embedded Linux Conference Europe 2014
  • 24. 8 Low hanging fruit Embedded Linux Conference Europe 2014
  • 25. Low Hanging Fruit • There are trivial changes that generally always improve the boot time of the majority of devices • These are applied to the majority of boot time reduction projects • No boot time presentation would be complete without these Embedded Linux Conference Europe 2014
  • 26. U-Boot delay • Eliminate boot delay with CONFIG_BOOTDELAY • Allow development with CONFIG_ZERO_BOOTDELAY_CHECK • Use CONFIG_AUTOBOOT_KEYED to prevent accidents Embedded Linux Conference Europe 2014
  • 27. Precalculated LPJ • Use the ‘lpj’ argument in the kernel command line to prevent calibrating a delay loop on each boot Calibrating delay loop... 1590.23 BogoMIPS (lpj=6213632) Embedded Linux Conference Europe 2014
  • 28. Disable console output • Add ‘quiet’ to the kernel command line to supress kernel output during boot • Supress U-Boot output with: • CONFIG_SILENT_CONSOLE • CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC • CONFIG_SILENT_U_BOOT_ONLY Embedded Linux Conference Europe 2014
  • 29. U-Boot scripts #define CONFIG_BOOTCOMMAND "if mmc rescan ${mmcdev}; then " "if run loadbootenv; then " "echo Loaded environment from ${bootenv};" "run importbootenv;" "if test -n $uenvcmd; then " Embedded Linux Conference Europe 2014 "echo Running uenvcmd ...;" "run uenvcmd;" "fi;" "elif run loadbootscript; then " "echo Loaded script from ${bootscr};" "run bootscript; " "else " "if run loaduimage; then " "run mmcboot; " "fi; " "fi; " "fi; " "if usb start; then " "set autoload no; " "bootp; "
  • 30. More fruit • Reduce U-Boot environment size • Ensure U-Boot reads the right amount of data and puts it in the right place • ‘nboot’ can help • Image verification • Optimise memset/memcpy • Reduce size of binaries • Kernel (KALLSYMS, IKCONFIG), strip binaries, mklibs, etc • Device node creation • Init.d style boot • Sleeps Embedded Linux Conference Europe 2014
  • 31. 9 Make it stick Embedded Linux Conference Europe 2014
  • 32. Make it stick • Boot time is likely to increase through subsequent development • And so boot time reduction can be a repeating exercise • Reasons boot time doesn't stick: • Development of new features doesn’t consider boot time • Boot time enhancements can be inflexible, inconvenient and limiting • Inconvenient optimisations have a habit of disappearing • No one ever removes a ‘no side effect’ optimisation such as improved NAND timings • Maintaining a minimal boot time is difficult Embedded Linux Conference Europe 2014
  • 33. Bad solutions • Delay: Ethernet initialisation in U-Boot • Bad solution: Ethernet not used in U-Boot so remove support • Impact: No-one can TFTP – annoying for development • Better solution: • Defer initialisation • Add a custom U-Boot command that re-enables Ethernet • Developers can add this command to their ‘bootcmd’ • If U-Boot size is an issue – it can be conditionally removed for a release build • Run time options such as this that default to quick boot are great • Compile/Config time options may result in git commit fights • Don’t replace - complement Embedded Linux Conference Europe 2014
  • 34. Bad solutions • Delay: Udev • Bad solution: Remove it and use hard coded device nodes • Impact: It works great until the moment the kernel changes then everyone gets odd errors, eventually udev shows up again • Better solution: • Use devtmpfs • Update drivers to use hard coded device number (if you must) Embedded Linux Conference Europe 2014
  • 35. Make it stick • Make boot time enhancements less annoying • It’s easy to use a sledge hammer • Find good solutions that preserve or replace ‘unneeded’ functionality • Sometimes unavoidable for tiny boot times • Aim for run time switches to enable them • Maybe use a hardware switch • Automate boot time measurement • Use automation to build, deploy, boot and measure your boot time • Tie this in with git hooks • Find out at the earliest moment when your boot time increases • Helps share ownership of boot time reduction Embedded Linux Conference Europe 2014
  • 36. 11 Look in the right places Embedded Linux Conference Europe 2014
  • 37. Look in the right places • You’ll get to a point where… • You’ve read the internet and implemented its suggestions • You’ve implemented the low hanging fruit • You’ve think everything left is needed and it does what it needs to do • Where next? Embedded Linux Conference Europe 2014
  • 38. Look in the right places • You’ve probably been looking at big delays • Don’t forget the small delays that happen all the time • Harder to find – you need to consider both time and frequency • Profiling tools helps here • This is probably where the hard work begins • Google ‘instrumentation/tracing’ instead of ‘reduce boot time’ • Don’t forget to group related delays to truly see impact • You need to do that fsck because you have chosen a file system that needs it • Ask yourself if the tasks are really needed? • Do they directly contribute to achieving the boot time functionality? • Bootloaders, start up scripts, dynamic device nodes – nice but not essential Embedded Linux Conference Europe 2014
  • 39. GStreamer example • Gstreamer heavily uses plugins (shared libraries) • When a Gstreamer application starts (gst_init) it will scan GST_PLUGIN_PATH for plugins and populate a registry used to find plugins • This takes time • This isn’t needed on every boot • Example of a task that isn’t needed • Used GST_REGISTRY_UPDATE to prevent scan and used a pre-provided registry • Reduced data transfer during boot by 20MB saved 4 seconds • Found by littering printf’s through the application Embedded Linux Conference Europe 2014
  • 40. Look in the right places • Look at: • Code you’ve written • Code your team has written • Code the board provider has written • Code the silicon vendor has written • Everything else Embedded Linux Conference Europe 2014
  • 41. 10 Find good tools Embedded Linux Conference Europe 2014
  • 42. Tools can help • Tools can save you time and provide clarity • There are a lot of tools available • Sometimes they can overwhelm you with information • Use them towards end of project • You can do a lot with printk/printf and timestamps • Perf, oprofile, strace are helpful too • Lots of presentations on these topics • “Linux Performance Tools” – Brendan Gregg, Netflix • Bootchart can help visualise userspace performance Embedded Linux Conference Europe 2014
  • 43. Bootchart Embedded Linux Conference Europe 2014
  • 44. 11 Create an illusion Embedded Linux Conference Europe 2014
  • 45. Create an illusion • Why do you want a minimal boot time anyway? • Can you achieve it without a minimal boot time? • Small boot time can be difficult to achieve • So why not create an illusion of a small boot time instead • ‘Smoke and Mirrors’ have a place • Defer functionality that isn’t needed straight away Embedded Linux Conference Europe 2014
  • 46. 12 Expect disruption Embedded Linux Conference Europe 2014
  • 47. Expect disruption • Minimal boot times often result in a compromise • This effects everyone that is developing the product • Changes you wish to make may conflict with other parts of the product development • Your changes may have knock on effects • Be prepared to make and justify your case • How important is a minimal boot time? • You may find out that minimal boot time isn’t everything after all Embedded Linux Conference Europe 2014
  • 48. Embedded Linux Conference Europe 2014 Thank you Questions? Andrew Murray Embedded Bits <amurray@embedded-bits.co.uk>