SlideShare a Scribd company logo
1 of 30
Download to read offline
Eco-friendly Linux kernel development
Minimizing energy consumption during CI/CD
Andrea Righi - Kernel Engineer at Canonical
Email: andrea.righi@canonical.com
5th
OSPM summit – Ancona - 2023
Agenda
●
Overview
●
Cost of CI/CD in the kernel
●
Use KernelCraft for fast and efficient CI/CD
●
Results
●
Demo
●
Q&A
Overview
●
Lines of code:
$ find ( -name '*.[chS]' -o -name '*.rs' ) -exec wc -l {} ; | awk 'BEGIN{sum=0}{sum+=$1}END{print sum}'
32,190,298
●
Amount of patches applied last week:
$ git log --oneline v6.3-rc4..v6.3-rc5 | wc -l
244
●
Lines of code changed last week:
$ git diff --stat v6.3-rc4..v6.3-rc5 | tail -1
201 files changed, 1811 insertions(+), 913 deletions(-)
Linux kernel is big
Kernel development is difficult
● How can I reproduce a bug?
● How long does it take to build the kernel on my machine?
● How do I test this fix?
● Does my change cause problems on another arch?
● Does my change introduce a vulnerability?
● 😱
It’s not easy being a maintainer, either
● End users expect Linux distros to do proper testing
● Volume is massive
Cost of CI/CD in the kernel
Linux CI projects
● kselftests
● Syzbot
● 0-Day
● KernelCI
● CKI
● LKFT
● Fuego
● ...
Kernel CI workflow
●
Tests triggered periodically or by events (git push, patch on the ML, ...)
●
Create a source artifact
●
Build a fully-featured general-purpose kernel... 😴
●
Create packages for the new kernel (distro)
●
Deploy a test system (VM or bare metal)
●
Run tests
●
Collect results
●
Decommission a system
The problem of custom kernels
●
Ubuntu has a lot of custom kernels
●
Custom changes need to be tested (more than upstream changes)
●
Lots of kernels, systems and devices
Scalability
●
This approach doesn’t scale very well
●
More hardware! (expensive and not very energy efficient...)
Proposed solution
Proposed solution (in a nutshell)
●
Build minimal kernel to test individual features
●
Deploy a single golden system
●
Virtualize it among multiple VMs (in a CoW way)
●
Run tests in VM
Pros and cons
● Pros
●
A minimal kernel still allows to run tests effectively
●
More efficient in terms of time and energy
● Cons
●
Doesn’t work to test specific hardware
●
Kernel config coverage can be challenging
●
Identify the minimum subset of configs required to run the test(s)
KernelCraft
What is KernelCraft (kc)?
●
Build a kernel from source
●
Run it inside a virtualized snapshot of your live system
●
Based on virtme (by Andrew Lutomirski) and qemu / kvm
How does it work?
●
Generate a minimal kernel .config
●
Build the kernel from source in a couple of minutes
●
Run it inside a VM that is a snapshot of your live system (safe)
●
Host fs is exported to guest via 9p fs
●
Local changes are handled by overlayfs / tmpfs
●
Output is captured and can be fed to other tools
Results
Test
●
Hardware
●
Dell XPS 13
●
Test
●
Build kernel and run `uname -r` (avg of 10 kernel builds)
●
Metrics:
●
Elapsed time (sec)
●
Total power consumption (Joule)
●
Average power consumption (Watt)
Result: time (sec)
KernelCraft
Ubuntu
0 500 1000 1500 2000 2500 3000 3500 4000
Time (sec)
Result: total power consumption (Joule)
KernelCraft
Ubuntu
0 20000 40000 60000 80000 100000 120000
Power (J)
Result: average power (Watt)
KernelCraft
Ubuntu
0 5 10 15 20 25 30 35
Avg Power (W)
Result (summary)
●
v6.2-rc7 using kc
●
Time=371.749s, power=10,854.843 J (avg=29.19W)
●
2.6 kcal =~ half leaf of lettuce
●
v6.2-rc7 w/ Ubuntu config using make
●
Time=3481.965s, power=104,504.228 J (avg=30.013W)
●
25 kcal =~ half hard-boiled egg
Demo
commit 154e07c164859fc90bf4e8143f2f6c1af9f3a35e
Author: Andrea Righi <andrea.righi@canonical.com>
Date: Thu Mar 30 11:54:42 2023 +0200
l2tp: generate correct module alias strings
Commit 65b32f801bfb ("uapi: move IPPROTO_L2TP to in.h") moved the
definition of IPPROTO_L2TP from a define to an enum, but since
__stringify doesn't work properly with enums, we ended up breaking the
modalias strings for the l2tp modules:
$ modinfo l2tp_ip l2tp_ip6 | grep alias
alias: net-pf-2-proto-IPPROTO_L2TP
alias: net-pf-2-proto-2-type-IPPROTO_L2TP
alias: net-pf-10-proto-IPPROTO_L2TP
alias: net-pf-10-proto-2-type-IPPROTO_L2TP
Use the resolved number directly in MODULE_ALIAS_*() macros (as we
already do with SOCK_DGRAM) to fix the alias strings:
$ modinfo l2tp_ip l2tp_ip6 | grep alias
alias: net-pf-2-proto-115
alias: net-pf-2-proto-115-type-2
alias: net-pf-10-proto-115
alias: net-pf-10-proto-115-type-2
Moreover, fix the ordering of the parameters passed to
MODULE_ALIAS_NET_PF_PROTO_TYPE() by switching proto and type.
Fixes: 65b32f801bfb ("uapi: move IPPROTO_L2TP to in.h")
Link: https://lore.kernel.org/lkml/ZCQt7hmodtUaBlCP@righiandr-XPS-13-7390
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Tested-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
What’s next?
Open issues
●
Test coverage:
●
Minimal kernel doesn’t allow to test everything
●
We can’t easily perform tests that require to start services via systemd
●
fs performance over 9p is still not ideal
●
Nice improvement with:
●
00833408bb16 ("Merge tag '9p-for-6.1' of https://github.com/martinetd/linux")
●
virtme is almost an abandoned project
●
We are considering to fork and create a virtme-ng project
References
References
●
KernelCraft
https://github.com/arighi/kernelcraft
●
Virtme
https://github.com/arighi/virtme
https://github.com/amluto/virtme
●
All the benefits of CI/CD but “Greener”
https://www.perforce.com/blog/kw/green-software-development-ci-cd
●
Usage, Costs and Benefits of Continuous Integration in Open-Source Projects
http://cope.eecs.oregonstate.edu/papers/OpenSourceCIUsage.pdf
Questions?

More Related Content

Similar to Eco-friendly Linux kernel development

AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...
AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...
AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...Amazon Web Services
 
AWS re:Invent 2016: Deep Dive on Amazon EC2 Instances, Featuring Performance ...
AWS re:Invent 2016: Deep Dive on Amazon EC2 Instances, Featuring Performance ...AWS re:Invent 2016: Deep Dive on Amazon EC2 Instances, Featuring Performance ...
AWS re:Invent 2016: Deep Dive on Amazon EC2 Instances, Featuring Performance ...Amazon Web Services
 
Architectural Optimizations for High Performance and Energy Efficient Smith-W...
Architectural Optimizations for High Performance and Energy Efficient Smith-W...Architectural Optimizations for High Performance and Energy Efficient Smith-W...
Architectural Optimizations for High Performance and Energy Efficient Smith-W...NECST Lab @ Politecnico di Milano
 
An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS Erik Osterman
 
Deep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instancesDeep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instancesAmazon Web Services
 
Accelerating microbiome research with OpenACC
Accelerating microbiome research with OpenACCAccelerating microbiome research with OpenACC
Accelerating microbiome research with OpenACCIgor Sfiligoi
 
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...Amazon Web Services
 
[GS네오텍] Google Kubernetes Engine
[GS네오텍]  Google Kubernetes Engine [GS네오텍]  Google Kubernetes Engine
[GS네오텍] Google Kubernetes Engine GS Neotek
 
6.3 DatacenterService Laporan Juni .pptx
6.3 DatacenterService Laporan Juni .pptx6.3 DatacenterService Laporan Juni .pptx
6.3 DatacenterService Laporan Juni .pptxAndreWirawan14
 
Container orchestration and microservices world
Container orchestration and microservices worldContainer orchestration and microservices world
Container orchestration and microservices worldKarol Chrapek
 
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker ContainersDockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker ContainersDocker, Inc.
 
Distributed Checkpointing on an Enterprise Desktop Grid
Distributed Checkpointing on an Enterprise Desktop GridDistributed Checkpointing on an Enterprise Desktop Grid
Distributed Checkpointing on an Enterprise Desktop Gridbrent.wilson
 
Deep Dive on Amazon EC2 Instances (March 2017)
Deep Dive on Amazon EC2 Instances (March 2017)Deep Dive on Amazon EC2 Instances (March 2017)
Deep Dive on Amazon EC2 Instances (March 2017)Julien SIMON
 
淺談 Live patching technology
淺談 Live patching technology淺談 Live patching technology
淺談 Live patching technologySZ Lin
 
How to Puppetize Google Cloud Platform - PuppetConf 2014
How to Puppetize Google Cloud Platform - PuppetConf 2014How to Puppetize Google Cloud Platform - PuppetConf 2014
How to Puppetize Google Cloud Platform - PuppetConf 2014Puppet
 
Exploring the Performance Impact of Virtualization on an HPC Cloud
Exploring the Performance Impact of Virtualization on an HPC CloudExploring the Performance Impact of Virtualization on an HPC Cloud
Exploring the Performance Impact of Virtualization on an HPC CloudRyousei Takano
 
Reproducible Computational Pipelines with Docker and Nextflow
Reproducible Computational Pipelines with Docker and NextflowReproducible Computational Pipelines with Docker and Nextflow
Reproducible Computational Pipelines with Docker and Nextflowinside-BigData.com
 
Bdc from bare metal to k8s
Bdc   from bare metal to k8sBdc   from bare metal to k8s
Bdc from bare metal to k8sChris Adkin
 
Kubernetes: Managed or Not Managed?
Kubernetes: Managed or Not Managed?Kubernetes: Managed or Not Managed?
Kubernetes: Managed or Not Managed?Mathieu Herbert
 

Similar to Eco-friendly Linux kernel development (20)

AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...
AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...
AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...
 
AWS re:Invent 2016: Deep Dive on Amazon EC2 Instances, Featuring Performance ...
AWS re:Invent 2016: Deep Dive on Amazon EC2 Instances, Featuring Performance ...AWS re:Invent 2016: Deep Dive on Amazon EC2 Instances, Featuring Performance ...
AWS re:Invent 2016: Deep Dive on Amazon EC2 Instances, Featuring Performance ...
 
Architectural Optimizations for High Performance and Energy Efficient Smith-W...
Architectural Optimizations for High Performance and Energy Efficient Smith-W...Architectural Optimizations for High Performance and Energy Efficient Smith-W...
Architectural Optimizations for High Performance and Energy Efficient Smith-W...
 
An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS An Ensemble Core with Docker - Solving a Real Pain in the PaaS
An Ensemble Core with Docker - Solving a Real Pain in the PaaS
 
Deep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instancesDeep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instances
 
Accelerating microbiome research with OpenACC
Accelerating microbiome research with OpenACCAccelerating microbiome research with OpenACC
Accelerating microbiome research with OpenACC
 
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
 
[GS네오텍] Google Kubernetes Engine
[GS네오텍]  Google Kubernetes Engine [GS네오텍]  Google Kubernetes Engine
[GS네오텍] Google Kubernetes Engine
 
Aks: k8s e azure
Aks:  k8s e azureAks:  k8s e azure
Aks: k8s e azure
 
6.3 DatacenterService Laporan Juni .pptx
6.3 DatacenterService Laporan Juni .pptx6.3 DatacenterService Laporan Juni .pptx
6.3 DatacenterService Laporan Juni .pptx
 
Container orchestration and microservices world
Container orchestration and microservices worldContainer orchestration and microservices world
Container orchestration and microservices world
 
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker ContainersDockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
DockerCon14 Performance Characteristics of Traditional VMs vs. Docker Containers
 
Distributed Checkpointing on an Enterprise Desktop Grid
Distributed Checkpointing on an Enterprise Desktop GridDistributed Checkpointing on an Enterprise Desktop Grid
Distributed Checkpointing on an Enterprise Desktop Grid
 
Deep Dive on Amazon EC2 Instances (March 2017)
Deep Dive on Amazon EC2 Instances (March 2017)Deep Dive on Amazon EC2 Instances (March 2017)
Deep Dive on Amazon EC2 Instances (March 2017)
 
淺談 Live patching technology
淺談 Live patching technology淺談 Live patching technology
淺談 Live patching technology
 
How to Puppetize Google Cloud Platform - PuppetConf 2014
How to Puppetize Google Cloud Platform - PuppetConf 2014How to Puppetize Google Cloud Platform - PuppetConf 2014
How to Puppetize Google Cloud Platform - PuppetConf 2014
 
Exploring the Performance Impact of Virtualization on an HPC Cloud
Exploring the Performance Impact of Virtualization on an HPC CloudExploring the Performance Impact of Virtualization on an HPC Cloud
Exploring the Performance Impact of Virtualization on an HPC Cloud
 
Reproducible Computational Pipelines with Docker and Nextflow
Reproducible Computational Pipelines with Docker and NextflowReproducible Computational Pipelines with Docker and Nextflow
Reproducible Computational Pipelines with Docker and Nextflow
 
Bdc from bare metal to k8s
Bdc   from bare metal to k8sBdc   from bare metal to k8s
Bdc from bare metal to k8s
 
Kubernetes: Managed or Not Managed?
Kubernetes: Managed or Not Managed?Kubernetes: Managed or Not Managed?
Kubernetes: Managed or Not Managed?
 

More from Andrea Righi

Linux kernel bug hunting
Linux kernel bug huntingLinux kernel bug hunting
Linux kernel bug huntingAndrea Righi
 
Kernel bug hunting
Kernel bug huntingKernel bug hunting
Kernel bug huntingAndrea Righi
 
Spying on the Linux kernel for fun and profit
Spying on the Linux kernel for fun and profitSpying on the Linux kernel for fun and profit
Spying on the Linux kernel for fun and profitAndrea Righi
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudAndrea Righi
 
Understand and optimize Linux I/O
Understand and optimize Linux I/OUnderstand and optimize Linux I/O
Understand and optimize Linux I/OAndrea Righi
 

More from Andrea Righi (7)

Linux kernel bug hunting
Linux kernel bug huntingLinux kernel bug hunting
Linux kernel bug hunting
 
Kernel bug hunting
Kernel bug huntingKernel bug hunting
Kernel bug hunting
 
Spying on the Linux kernel for fun and profit
Spying on the Linux kernel for fun and profitSpying on the Linux kernel for fun and profit
Spying on the Linux kernel for fun and profit
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
 
Understand and optimize Linux I/O
Understand and optimize Linux I/OUnderstand and optimize Linux I/O
Understand and optimize Linux I/O
 
Debugging linux
Debugging linuxDebugging linux
Debugging linux
 
Linux boot-time
Linux boot-timeLinux boot-time
Linux boot-time
 

Recently uploaded

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 

Recently uploaded (20)

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 

Eco-friendly Linux kernel development

  • 1. Eco-friendly Linux kernel development Minimizing energy consumption during CI/CD Andrea Righi - Kernel Engineer at Canonical Email: andrea.righi@canonical.com 5th OSPM summit – Ancona - 2023
  • 2. Agenda ● Overview ● Cost of CI/CD in the kernel ● Use KernelCraft for fast and efficient CI/CD ● Results ● Demo ● Q&A
  • 4. ● Lines of code: $ find ( -name '*.[chS]' -o -name '*.rs' ) -exec wc -l {} ; | awk 'BEGIN{sum=0}{sum+=$1}END{print sum}' 32,190,298 ● Amount of patches applied last week: $ git log --oneline v6.3-rc4..v6.3-rc5 | wc -l 244 ● Lines of code changed last week: $ git diff --stat v6.3-rc4..v6.3-rc5 | tail -1 201 files changed, 1811 insertions(+), 913 deletions(-) Linux kernel is big
  • 5. Kernel development is difficult ● How can I reproduce a bug? ● How long does it take to build the kernel on my machine? ● How do I test this fix? ● Does my change cause problems on another arch? ● Does my change introduce a vulnerability? ● 😱
  • 6. It’s not easy being a maintainer, either ● End users expect Linux distros to do proper testing ● Volume is massive
  • 7. Cost of CI/CD in the kernel
  • 8. Linux CI projects ● kselftests ● Syzbot ● 0-Day ● KernelCI ● CKI ● LKFT ● Fuego ● ...
  • 9. Kernel CI workflow ● Tests triggered periodically or by events (git push, patch on the ML, ...) ● Create a source artifact ● Build a fully-featured general-purpose kernel... 😴 ● Create packages for the new kernel (distro) ● Deploy a test system (VM or bare metal) ● Run tests ● Collect results ● Decommission a system
  • 10. The problem of custom kernels ● Ubuntu has a lot of custom kernels ● Custom changes need to be tested (more than upstream changes) ● Lots of kernels, systems and devices
  • 11. Scalability ● This approach doesn’t scale very well ● More hardware! (expensive and not very energy efficient...)
  • 13. Proposed solution (in a nutshell) ● Build minimal kernel to test individual features ● Deploy a single golden system ● Virtualize it among multiple VMs (in a CoW way) ● Run tests in VM
  • 14. Pros and cons ● Pros ● A minimal kernel still allows to run tests effectively ● More efficient in terms of time and energy ● Cons ● Doesn’t work to test specific hardware ● Kernel config coverage can be challenging ● Identify the minimum subset of configs required to run the test(s)
  • 16. What is KernelCraft (kc)? ● Build a kernel from source ● Run it inside a virtualized snapshot of your live system ● Based on virtme (by Andrew Lutomirski) and qemu / kvm
  • 17. How does it work? ● Generate a minimal kernel .config ● Build the kernel from source in a couple of minutes ● Run it inside a VM that is a snapshot of your live system (safe) ● Host fs is exported to guest via 9p fs ● Local changes are handled by overlayfs / tmpfs ● Output is captured and can be fed to other tools
  • 19. Test ● Hardware ● Dell XPS 13 ● Test ● Build kernel and run `uname -r` (avg of 10 kernel builds) ● Metrics: ● Elapsed time (sec) ● Total power consumption (Joule) ● Average power consumption (Watt)
  • 20. Result: time (sec) KernelCraft Ubuntu 0 500 1000 1500 2000 2500 3000 3500 4000 Time (sec)
  • 21. Result: total power consumption (Joule) KernelCraft Ubuntu 0 20000 40000 60000 80000 100000 120000 Power (J)
  • 22. Result: average power (Watt) KernelCraft Ubuntu 0 5 10 15 20 25 30 35 Avg Power (W)
  • 23. Result (summary) ● v6.2-rc7 using kc ● Time=371.749s, power=10,854.843 J (avg=29.19W) ● 2.6 kcal =~ half leaf of lettuce ● v6.2-rc7 w/ Ubuntu config using make ● Time=3481.965s, power=104,504.228 J (avg=30.013W) ● 25 kcal =~ half hard-boiled egg
  • 24. Demo
  • 25. commit 154e07c164859fc90bf4e8143f2f6c1af9f3a35e Author: Andrea Righi <andrea.righi@canonical.com> Date: Thu Mar 30 11:54:42 2023 +0200 l2tp: generate correct module alias strings Commit 65b32f801bfb ("uapi: move IPPROTO_L2TP to in.h") moved the definition of IPPROTO_L2TP from a define to an enum, but since __stringify doesn't work properly with enums, we ended up breaking the modalias strings for the l2tp modules: $ modinfo l2tp_ip l2tp_ip6 | grep alias alias: net-pf-2-proto-IPPROTO_L2TP alias: net-pf-2-proto-2-type-IPPROTO_L2TP alias: net-pf-10-proto-IPPROTO_L2TP alias: net-pf-10-proto-2-type-IPPROTO_L2TP Use the resolved number directly in MODULE_ALIAS_*() macros (as we already do with SOCK_DGRAM) to fix the alias strings: $ modinfo l2tp_ip l2tp_ip6 | grep alias alias: net-pf-2-proto-115 alias: net-pf-2-proto-115-type-2 alias: net-pf-10-proto-115 alias: net-pf-10-proto-115-type-2 Moreover, fix the ordering of the parameters passed to MODULE_ALIAS_NET_PF_PROTO_TYPE() by switching proto and type. Fixes: 65b32f801bfb ("uapi: move IPPROTO_L2TP to in.h") Link: https://lore.kernel.org/lkml/ZCQt7hmodtUaBlCP@righiandr-XPS-13-7390 Signed-off-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: Andrea Righi <andrea.righi@canonical.com> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com> Tested-by: Wojciech Drewek <wojciech.drewek@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
  • 27. Open issues ● Test coverage: ● Minimal kernel doesn’t allow to test everything ● We can’t easily perform tests that require to start services via systemd ● fs performance over 9p is still not ideal ● Nice improvement with: ● 00833408bb16 ("Merge tag '9p-for-6.1' of https://github.com/martinetd/linux") ● virtme is almost an abandoned project ● We are considering to fork and create a virtme-ng project
  • 29. References ● KernelCraft https://github.com/arighi/kernelcraft ● Virtme https://github.com/arighi/virtme https://github.com/amluto/virtme ● All the benefits of CI/CD but “Greener” https://www.perforce.com/blog/kw/green-software-development-ci-cd ● Usage, Costs and Benefits of Continuous Integration in Open-Source Projects http://cope.eecs.oregonstate.edu/papers/OpenSourceCIUsage.pdf