SlideShare a Scribd company logo
1 of 36
Download to read offline
Persistent log with UBI
Matthieu CASTET - www.parrot.com

25 September 2013

Persistent log with UBI
Persistent log with UBI

ulog
Goal

Log must be persistent on product : Nand flash
Can be used to trace system updates

Has to be independent/hidden of application filesystem
not on / filesystem

Has to be usable on shipped products
difficult to resize all partitions

Persistent log with UBI

ulog
Which interface to use ?

Raw flash (MTD)
UBI
Nand filesystem (UBIFS, ...)

Persistent log with UBI

ulog
Flash device vs block device 1/2

Block device
Consists of sectors
Sectors are small (512, 1024 B)
Maintains 2 main operations:

Flash device
Consists of eraseblocks
Eraseblocks are larger ( typically
128KB)
Maintains 3 main operations:

read sector

read from eraseblock

write sector

write to eraseblock
erase eraseblock

Persistent log with UBI

ulog
Flash device vs block device 2/2

Block device
Bad sectors are re-mapped and
hidden by hardware (at least in
modern LBA hard drives)
Sectors are devoid of the wear-out
property

Flash device
Bad eraseblocks are not hidden
and should be dealt with in software
Eraseblocks wear-out and become
bad and unusable after about 103
(for MLC NAND) - 105 (NOR, SLC
NAND) erase cycles

Flash device is more difficult to handle (ecc, bad block,
eraseblock, ...)

Persistent log with UBI

ulog
MTD

MTD stands for "Memory Technology Devices"
Provides an abstraction of flash devices
Hides many aspects specific to particular flash
technologies
Provides uniform API to access various types of flashes
E.g., MTD supports NAND, NOR, ECC-ed NOR,
DataFlash, OneNAND, etc
Provides partitioning capabilities

Persistent log with UBI

ulog
UBI

Stands for "Unsorted Block Images"
Provides an abstraction of "UBI volume"
Has kernel API and user space API (/dev/ubi0)
Provides wear-leveling
Hides bad eraseblocks
Allows run-time volume creation, deletion, and re-size
Is somewhat similar to LVM, but for MTD devices

Persistent log with UBI

ulog
UBI volume vs MTD device
MTD device
Consists of physical
(PEB), typically 128 KB
Has 3 main operations

eraseblocks

UBI device
Consists of logical eraseblocks (LEB),
slightly smaller than PEB (e.g 126/124
KB)
Has 3 main operations

read from PEB

read from LEB

write to PEB

write to LEB

erase PEB

erase LEB

May have bad PEBs
PEBs wear out
MTD devices are static

Persistent log with UBI

ulog

Does not have bad LEB (handle a certain amount of bad PEB)
LEBs do not wear out - UBI spread the
I/O load across the whole flash
UBI volumes are dynamic
Main idea behind UBI
Maps LEBs to PEBs
Any LEB may be mapped to any PEB
Eraseblock headers store mapping information and erase
count

Persistent log with UBI

ulog
Other
Handle bit-flips by moving data to a different PEB
Configurable wear-leveling threshold
Atomic LEB change
Volume update/rename operation
Suitable for MLC NAND
Performs operations in background
Works on NAND, NOR and other flash types
Tolerant to power cuts
Simple and robust design
easy support in bootloader

Persistent log with UBI

ulog
UBIFS

Filesystem on top of UBI (2.6.27 2008-10)
Needs a minimal number of LEBs to work : 17
http://www.linuxmtd.infradead.org/faq/ubifs.html#L_few_lebs

Complex filesystem : few (rare) corruptions seen on
products

Persistent log with UBI

ulog
log over UBI

we have a UBI device (for linux kernel) with free space
UBIFS has too much overhead

Persistent log with UBI

ulog
UBI user API
include/mtd/ubi-user.h
device attach
device detach
volume create
volume delete
volume resize
volume rename
volume update (static volume)
LEB erase
LEB atomic change
LEB map
LEB unmap
lseek
read
write

Persistent log with UBI

ulog
ulog

A log entry is much smaller than a page size (512B-4KB)
A cache is needed (in flash)
ulog uses a dynamic volume to have per LEB write

Persistent log with UBI

ulog
ulog

Persistent log with UBI

ulog
ulog : flush 1

Persistent log with UBI

ulog
ulog : flush 2

Persistent log with UBI

ulog
ulog : flush 2

Persistent log with UBI

ulog
ulog : flush 3

Persistent log with UBI

ulog
ulog : flush 4

Persistent log with UBI

ulog
Data flush

Copy data from level N to level N+1
Merge pages to try to fill pages from level N+1
if level 0 has 64 entries of about 20 B, it can be merged in a
page of 2 KB.

Can be recursive !
flush of L0, but L1 is full
flush of L1 needed
...

Persistent log with UBI

ulog
ulog : rotate 1

Persistent log with UBI

ulog
ulog : rotate 2

Persistent log with UBI

ulog
ulog : rotate 3

Persistent log with UBI

ulog
ulog : rotate 4

Persistent log with UBI

ulog
ulog : rotate 5

Persistent log with UBI

ulog
Data rotate

Clean next LEB (if not empty)
Write data on it

Persistent log with UBI

ulog
Data format

Header (32 bits)
size (24 bits)
version (3 bits) (relevant for first page)

Log data

Persistent log with UBI

ulog
Scan

Parse header for all LEBs
LEB version
LEB index (which pages have data)

For last level (L2), find current LEB
All empty use first (L2) LEB
Use LEB version

Persistent log with UBI

ulog
Scan

Parse header for all LEBs
LEB version
LEB index (which pages have data)

For last level (L2), find current LEB
All empty use first (L2) LEB
Use LEB version

Persistent log with UBI

ulog
ulog API

ulog_init
ulog_destroy
ulog_read
ulog_printf
ulog_vprintf
ulog_flush

Persistent log with UBI

ulog
ulog demo

Persistent log with UBI

ulog
TODO

any remark?

Persistent log with UBI

ulog
TODO

any remark?
Need to correctly handle all power failure cases during a
flush
Can be complex in case of cascaded flush

Some data are currently duplicated

Persistent log with UBI

ulog
Questions ?

Merci pour votre attention !
Thanks for your attention!
Questions?

Persistent log with UBI

ulog

More Related Content

Viewers also liked

Kernel Recipes 2013 - Automating source code evolutions using Coccinelle
Kernel Recipes 2013 - Automating source code evolutions using CoccinelleKernel Recipes 2013 - Automating source code evolutions using Coccinelle
Kernel Recipes 2013 - Automating source code evolutions using CoccinelleAnne Nicolas
 
Developping drivers on small machines
Developping drivers on small machinesDevelopping drivers on small machines
Developping drivers on small machinesAnne Nicolas
 
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...Anne Nicolas
 
Kernel Recipes 2013 - Nftables, what motivations and what solutions
Kernel Recipes 2013 - Nftables, what motivations and what solutionsKernel Recipes 2013 - Nftables, what motivations and what solutions
Kernel Recipes 2013 - Nftables, what motivations and what solutionsAnne Nicolas
 
Introduction to UBI
Introduction to UBIIntroduction to UBI
Introduction to UBIRoy Lee
 
Linux I/O path_20070116
Linux I/O path_20070116Linux I/O path_20070116
Linux I/O path_20070116Roy Lee
 

Viewers also liked (6)

Kernel Recipes 2013 - Automating source code evolutions using Coccinelle
Kernel Recipes 2013 - Automating source code evolutions using CoccinelleKernel Recipes 2013 - Automating source code evolutions using Coccinelle
Kernel Recipes 2013 - Automating source code evolutions using Coccinelle
 
Developping drivers on small machines
Developping drivers on small machinesDevelopping drivers on small machines
Developping drivers on small machines
 
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...
 
Kernel Recipes 2013 - Nftables, what motivations and what solutions
Kernel Recipes 2013 - Nftables, what motivations and what solutionsKernel Recipes 2013 - Nftables, what motivations and what solutions
Kernel Recipes 2013 - Nftables, what motivations and what solutions
 
Introduction to UBI
Introduction to UBIIntroduction to UBI
Introduction to UBI
 
Linux I/O path_20070116
Linux I/O path_20070116Linux I/O path_20070116
Linux I/O path_20070116
 

Similar to Persistent log with UBI (UBI

TokuDB internals / Лесин Владислав (Percona)
TokuDB internals / Лесин Владислав (Percona)TokuDB internals / Лесин Владислав (Percona)
TokuDB internals / Лесин Владислав (Percona)Ontico
 
cPanelCon 2014: InnoDB Anatomy
cPanelCon 2014: InnoDB AnatomycPanelCon 2014: InnoDB Anatomy
cPanelCon 2014: InnoDB AnatomyRyan Robson
 
Burst Buffer: From Alpha to Omega
Burst Buffer: From Alpha to OmegaBurst Buffer: From Alpha to Omega
Burst Buffer: From Alpha to OmegaGeorge Markomanolis
 
Ceph Day Berlin: Ceph on All Flash Storage - Breaking Performance Barriers
Ceph Day Berlin: Ceph on All Flash Storage - Breaking Performance BarriersCeph Day Berlin: Ceph on All Flash Storage - Breaking Performance Barriers
Ceph Day Berlin: Ceph on All Flash Storage - Breaking Performance BarriersCeph Community
 
Efficient logging in multithreaded C++ server
Efficient logging in multithreaded C++ serverEfficient logging in multithreaded C++ server
Efficient logging in multithreaded C++ serverShuo Chen
 
Life Of A Dirty Page Inno Db Disk Io
Life Of A Dirty Page Inno Db Disk IoLife Of A Dirty Page Inno Db Disk Io
Life Of A Dirty Page Inno Db Disk IoSky Jian
 
Block I/O Layer Tracing: blktrace
Block I/O Layer Tracing: blktraceBlock I/O Layer Tracing: blktrace
Block I/O Layer Tracing: blktraceBabak Farrokhi
 
SAQIB ALI.pptx
SAQIB ALI.pptxSAQIB ALI.pptx
SAQIB ALI.pptxastik11
 

Similar to Persistent log with UBI (UBI (12)

TokuDB internals / Лесин Владислав (Percona)
TokuDB internals / Лесин Владислав (Percona)TokuDB internals / Лесин Владислав (Percona)
TokuDB internals / Лесин Владислав (Percona)
 
logfs
logfslogfs
logfs
 
cPanelCon 2014: InnoDB Anatomy
cPanelCon 2014: InnoDB AnatomycPanelCon 2014: InnoDB Anatomy
cPanelCon 2014: InnoDB Anatomy
 
Burst Buffer: From Alpha to Omega
Burst Buffer: From Alpha to OmegaBurst Buffer: From Alpha to Omega
Burst Buffer: From Alpha to Omega
 
Ceph Day Berlin: Ceph on All Flash Storage - Breaking Performance Barriers
Ceph Day Berlin: Ceph on All Flash Storage - Breaking Performance BarriersCeph Day Berlin: Ceph on All Flash Storage - Breaking Performance Barriers
Ceph Day Berlin: Ceph on All Flash Storage - Breaking Performance Barriers
 
Memory Mapping Cache
Memory Mapping CacheMemory Mapping Cache
Memory Mapping Cache
 
Efficient logging in multithreaded C++ server
Efficient logging in multithreaded C++ serverEfficient logging in multithreaded C++ server
Efficient logging in multithreaded C++ server
 
Write behind logging
Write behind loggingWrite behind logging
Write behind logging
 
Life Of A Dirty Page Inno Db Disk Io
Life Of A Dirty Page Inno Db Disk IoLife Of A Dirty Page Inno Db Disk Io
Life Of A Dirty Page Inno Db Disk Io
 
8086 microprocessor
8086 microprocessor8086 microprocessor
8086 microprocessor
 
Block I/O Layer Tracing: blktrace
Block I/O Layer Tracing: blktraceBlock I/O Layer Tracing: blktrace
Block I/O Layer Tracing: blktrace
 
SAQIB ALI.pptx
SAQIB ALI.pptxSAQIB ALI.pptx
SAQIB ALI.pptx
 

More from Anne Nicolas

Kernel Recipes 2019 - Driving the industry toward upstream first
Kernel Recipes 2019 - Driving the industry toward upstream firstKernel Recipes 2019 - Driving the industry toward upstream first
Kernel Recipes 2019 - Driving the industry toward upstream firstAnne Nicolas
 
Kernel Recipes 2019 - No NMI? No Problem! – Implementing Arm64 Pseudo-NMI
Kernel Recipes 2019 - No NMI? No Problem! – Implementing Arm64 Pseudo-NMIKernel Recipes 2019 - No NMI? No Problem! – Implementing Arm64 Pseudo-NMI
Kernel Recipes 2019 - No NMI? No Problem! – Implementing Arm64 Pseudo-NMIAnne Nicolas
 
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernelKernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernelAnne Nicolas
 
Kernel Recipes 2019 - Metrics are money
Kernel Recipes 2019 - Metrics are moneyKernel Recipes 2019 - Metrics are money
Kernel Recipes 2019 - Metrics are moneyAnne Nicolas
 
Kernel Recipes 2019 - Kernel documentation: past, present, and future
Kernel Recipes 2019 - Kernel documentation: past, present, and futureKernel Recipes 2019 - Kernel documentation: past, present, and future
Kernel Recipes 2019 - Kernel documentation: past, present, and futureAnne Nicolas
 
Embedded Recipes 2019 - Knowing your ARM from your ARSE: wading through the t...
Embedded Recipes 2019 - Knowing your ARM from your ARSE: wading through the t...Embedded Recipes 2019 - Knowing your ARM from your ARSE: wading through the t...
Embedded Recipes 2019 - Knowing your ARM from your ARSE: wading through the t...Anne Nicolas
 
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataKernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataAnne Nicolas
 
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...Anne Nicolas
 
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and BareboxEmbedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and BareboxAnne Nicolas
 
Embedded Recipes 2019 - Making embedded graphics less special
Embedded Recipes 2019 - Making embedded graphics less specialEmbedded Recipes 2019 - Making embedded graphics less special
Embedded Recipes 2019 - Making embedded graphics less specialAnne Nicolas
 
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre SiliconEmbedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre SiliconAnne Nicolas
 
Embedded Recipes 2019 - From maintaining I2C to the big (embedded) picture
Embedded Recipes 2019 - From maintaining I2C to the big (embedded) pictureEmbedded Recipes 2019 - From maintaining I2C to the big (embedded) picture
Embedded Recipes 2019 - From maintaining I2C to the big (embedded) pictureAnne Nicolas
 
Embedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops wayEmbedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops wayAnne Nicolas
 
Embedded Recipes 2019 - Herd your socs become a matchmaker
Embedded Recipes 2019 - Herd your socs become a matchmakerEmbedded Recipes 2019 - Herd your socs become a matchmaker
Embedded Recipes 2019 - Herd your socs become a matchmakerAnne Nicolas
 
Embedded Recipes 2019 - LLVM / Clang integration
Embedded Recipes 2019 - LLVM / Clang integrationEmbedded Recipes 2019 - LLVM / Clang integration
Embedded Recipes 2019 - LLVM / Clang integrationAnne Nicolas
 
Embedded Recipes 2019 - Introduction to JTAG debugging
Embedded Recipes 2019 - Introduction to JTAG debuggingEmbedded Recipes 2019 - Introduction to JTAG debugging
Embedded Recipes 2019 - Introduction to JTAG debuggingAnne Nicolas
 
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimediaEmbedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimediaAnne Nicolas
 
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all startedKernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all startedAnne Nicolas
 
Kernel Recipes 2019 - Suricata and XDP
Kernel Recipes 2019 - Suricata and XDPKernel Recipes 2019 - Suricata and XDP
Kernel Recipes 2019 - Suricata and XDPAnne Nicolas
 
Kernel Recipes 2019 - Marvels of Memory Auto-configuration (SPD)
Kernel Recipes 2019 - Marvels of Memory Auto-configuration (SPD)Kernel Recipes 2019 - Marvels of Memory Auto-configuration (SPD)
Kernel Recipes 2019 - Marvels of Memory Auto-configuration (SPD)Anne Nicolas
 

More from Anne Nicolas (20)

Kernel Recipes 2019 - Driving the industry toward upstream first
Kernel Recipes 2019 - Driving the industry toward upstream firstKernel Recipes 2019 - Driving the industry toward upstream first
Kernel Recipes 2019 - Driving the industry toward upstream first
 
Kernel Recipes 2019 - No NMI? No Problem! – Implementing Arm64 Pseudo-NMI
Kernel Recipes 2019 - No NMI? No Problem! – Implementing Arm64 Pseudo-NMIKernel Recipes 2019 - No NMI? No Problem! – Implementing Arm64 Pseudo-NMI
Kernel Recipes 2019 - No NMI? No Problem! – Implementing Arm64 Pseudo-NMI
 
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernelKernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
 
Kernel Recipes 2019 - Metrics are money
Kernel Recipes 2019 - Metrics are moneyKernel Recipes 2019 - Metrics are money
Kernel Recipes 2019 - Metrics are money
 
Kernel Recipes 2019 - Kernel documentation: past, present, and future
Kernel Recipes 2019 - Kernel documentation: past, present, and futureKernel Recipes 2019 - Kernel documentation: past, present, and future
Kernel Recipes 2019 - Kernel documentation: past, present, and future
 
Embedded Recipes 2019 - Knowing your ARM from your ARSE: wading through the t...
Embedded Recipes 2019 - Knowing your ARM from your ARSE: wading through the t...Embedded Recipes 2019 - Knowing your ARM from your ARSE: wading through the t...
Embedded Recipes 2019 - Knowing your ARM from your ARSE: wading through the t...
 
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataKernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
 
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
 
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and BareboxEmbedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
 
Embedded Recipes 2019 - Making embedded graphics less special
Embedded Recipes 2019 - Making embedded graphics less specialEmbedded Recipes 2019 - Making embedded graphics less special
Embedded Recipes 2019 - Making embedded graphics less special
 
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre SiliconEmbedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
 
Embedded Recipes 2019 - From maintaining I2C to the big (embedded) picture
Embedded Recipes 2019 - From maintaining I2C to the big (embedded) pictureEmbedded Recipes 2019 - From maintaining I2C to the big (embedded) picture
Embedded Recipes 2019 - From maintaining I2C to the big (embedded) picture
 
Embedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops wayEmbedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops way
 
Embedded Recipes 2019 - Herd your socs become a matchmaker
Embedded Recipes 2019 - Herd your socs become a matchmakerEmbedded Recipes 2019 - Herd your socs become a matchmaker
Embedded Recipes 2019 - Herd your socs become a matchmaker
 
Embedded Recipes 2019 - LLVM / Clang integration
Embedded Recipes 2019 - LLVM / Clang integrationEmbedded Recipes 2019 - LLVM / Clang integration
Embedded Recipes 2019 - LLVM / Clang integration
 
Embedded Recipes 2019 - Introduction to JTAG debugging
Embedded Recipes 2019 - Introduction to JTAG debuggingEmbedded Recipes 2019 - Introduction to JTAG debugging
Embedded Recipes 2019 - Introduction to JTAG debugging
 
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimediaEmbedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
 
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all startedKernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
 
Kernel Recipes 2019 - Suricata and XDP
Kernel Recipes 2019 - Suricata and XDPKernel Recipes 2019 - Suricata and XDP
Kernel Recipes 2019 - Suricata and XDP
 
Kernel Recipes 2019 - Marvels of Memory Auto-configuration (SPD)
Kernel Recipes 2019 - Marvels of Memory Auto-configuration (SPD)Kernel Recipes 2019 - Marvels of Memory Auto-configuration (SPD)
Kernel Recipes 2019 - Marvels of Memory Auto-configuration (SPD)
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Persistent log with UBI (UBI

  • 1. Persistent log with UBI Matthieu CASTET - www.parrot.com 25 September 2013 Persistent log with UBI
  • 3. Goal Log must be persistent on product : Nand flash Can be used to trace system updates Has to be independent/hidden of application filesystem not on / filesystem Has to be usable on shipped products difficult to resize all partitions Persistent log with UBI ulog
  • 4. Which interface to use ? Raw flash (MTD) UBI Nand filesystem (UBIFS, ...) Persistent log with UBI ulog
  • 5. Flash device vs block device 1/2 Block device Consists of sectors Sectors are small (512, 1024 B) Maintains 2 main operations: Flash device Consists of eraseblocks Eraseblocks are larger ( typically 128KB) Maintains 3 main operations: read sector read from eraseblock write sector write to eraseblock erase eraseblock Persistent log with UBI ulog
  • 6. Flash device vs block device 2/2 Block device Bad sectors are re-mapped and hidden by hardware (at least in modern LBA hard drives) Sectors are devoid of the wear-out property Flash device Bad eraseblocks are not hidden and should be dealt with in software Eraseblocks wear-out and become bad and unusable after about 103 (for MLC NAND) - 105 (NOR, SLC NAND) erase cycles Flash device is more difficult to handle (ecc, bad block, eraseblock, ...) Persistent log with UBI ulog
  • 7. MTD MTD stands for "Memory Technology Devices" Provides an abstraction of flash devices Hides many aspects specific to particular flash technologies Provides uniform API to access various types of flashes E.g., MTD supports NAND, NOR, ECC-ed NOR, DataFlash, OneNAND, etc Provides partitioning capabilities Persistent log with UBI ulog
  • 8. UBI Stands for "Unsorted Block Images" Provides an abstraction of "UBI volume" Has kernel API and user space API (/dev/ubi0) Provides wear-leveling Hides bad eraseblocks Allows run-time volume creation, deletion, and re-size Is somewhat similar to LVM, but for MTD devices Persistent log with UBI ulog
  • 9. UBI volume vs MTD device MTD device Consists of physical (PEB), typically 128 KB Has 3 main operations eraseblocks UBI device Consists of logical eraseblocks (LEB), slightly smaller than PEB (e.g 126/124 KB) Has 3 main operations read from PEB read from LEB write to PEB write to LEB erase PEB erase LEB May have bad PEBs PEBs wear out MTD devices are static Persistent log with UBI ulog Does not have bad LEB (handle a certain amount of bad PEB) LEBs do not wear out - UBI spread the I/O load across the whole flash UBI volumes are dynamic
  • 10. Main idea behind UBI Maps LEBs to PEBs Any LEB may be mapped to any PEB Eraseblock headers store mapping information and erase count Persistent log with UBI ulog
  • 11. Other Handle bit-flips by moving data to a different PEB Configurable wear-leveling threshold Atomic LEB change Volume update/rename operation Suitable for MLC NAND Performs operations in background Works on NAND, NOR and other flash types Tolerant to power cuts Simple and robust design easy support in bootloader Persistent log with UBI ulog
  • 12. UBIFS Filesystem on top of UBI (2.6.27 2008-10) Needs a minimal number of LEBs to work : 17 http://www.linuxmtd.infradead.org/faq/ubifs.html#L_few_lebs Complex filesystem : few (rare) corruptions seen on products Persistent log with UBI ulog
  • 13. log over UBI we have a UBI device (for linux kernel) with free space UBIFS has too much overhead Persistent log with UBI ulog
  • 14. UBI user API include/mtd/ubi-user.h device attach device detach volume create volume delete volume resize volume rename volume update (static volume) LEB erase LEB atomic change LEB map LEB unmap lseek read write Persistent log with UBI ulog
  • 15. ulog A log entry is much smaller than a page size (512B-4KB) A cache is needed (in flash) ulog uses a dynamic volume to have per LEB write Persistent log with UBI ulog
  • 17. ulog : flush 1 Persistent log with UBI ulog
  • 18. ulog : flush 2 Persistent log with UBI ulog
  • 19. ulog : flush 2 Persistent log with UBI ulog
  • 20. ulog : flush 3 Persistent log with UBI ulog
  • 21. ulog : flush 4 Persistent log with UBI ulog
  • 22. Data flush Copy data from level N to level N+1 Merge pages to try to fill pages from level N+1 if level 0 has 64 entries of about 20 B, it can be merged in a page of 2 KB. Can be recursive ! flush of L0, but L1 is full flush of L1 needed ... Persistent log with UBI ulog
  • 23. ulog : rotate 1 Persistent log with UBI ulog
  • 24. ulog : rotate 2 Persistent log with UBI ulog
  • 25. ulog : rotate 3 Persistent log with UBI ulog
  • 26. ulog : rotate 4 Persistent log with UBI ulog
  • 27. ulog : rotate 5 Persistent log with UBI ulog
  • 28. Data rotate Clean next LEB (if not empty) Write data on it Persistent log with UBI ulog
  • 29. Data format Header (32 bits) size (24 bits) version (3 bits) (relevant for first page) Log data Persistent log with UBI ulog
  • 30. Scan Parse header for all LEBs LEB version LEB index (which pages have data) For last level (L2), find current LEB All empty use first (L2) LEB Use LEB version Persistent log with UBI ulog
  • 31. Scan Parse header for all LEBs LEB version LEB index (which pages have data) For last level (L2), find current LEB All empty use first (L2) LEB Use LEB version Persistent log with UBI ulog
  • 33. ulog demo Persistent log with UBI ulog
  • 35. TODO any remark? Need to correctly handle all power failure cases during a flush Can be complex in case of cascaded flush Some data are currently duplicated Persistent log with UBI ulog
  • 36. Questions ? Merci pour votre attention ! Thanks for your attention! Questions? Persistent log with UBI ulog