SlideShare uma empresa Scribd logo
1 de 43
Baixar para ler offline
Embedded Linux Conference Europe 2013

Bridging the gap between hardware
and software tracing
christian.babeux@efficios.com 
1
@c_bab 
Source: arm.com [1] 2
ARM Cortex A9

Source: arm.com [1] 3
ARM Cortex A9
PTM
Program Trace
Macrocell

Source: arm.com [1] 4
whoami


Christian Babeux, Software Developer, EfficiOS,



Background in embedded and ASIC tools,



Active contributor to the LTTng projects:
●
●



lttng-tools, lttng-ust, babeltrace,
CI infra, Website, Twitter.

AUR package maintainer for Arch Linux.
5
Content


What is hardware tracing?,



Why is it useful?,



ARM Coresight & ETM,



Freescale QorIQ & Nexus tracing,



LTTng & hardware tracing.
6
What is hardware tracing?


7
What is hardware tracing?
 Hardware component(s) used to traces instructions
and data movement of a processing device

 Real-time observation
Low intrusiveness

8
What is hardware tracing? Cont.
●

External trace

9
What is hardware tracing? Cont.
●

Pros
–
–

●

Can accommodate high data bandwidth
Minimal impact on system performance

–

Trace port not always available

–

Custom hardware needed

Cons

10
What is hardware tracing? Cont.
●

Self-hosted trace

11
What is hardware tracing? Cont.
●

Pros
–
–

●

Self-contained, facilities can be used by host OS
No need for special hardware

–

Limited internal buffer space

–

Might impact system performance

Cons

12
Hardware tracing support
●

ARM
–
–

Program Trace Flow Macrocell (PTM),

–
●

Embedded Trace Macrocell (ETM),
System Trace Macrocell (STM)

PowerPC
–
–

●

Freescale QorIQ with Nexus tracing
Branch History Rolling Buffer (BHRB)

–

Intel Processor Tracing (PT)

–

Last Branch Record (LBR), Branch Trace Store (BTS)

Intel

13
Hardware tracing vs. software tracing
●

Software tracing:
–
–

Can be intrusive

–

Can be slow

–

●

Static instrumentation or dynamic code patching

Tracepoint level granularity

Hardware tracing:
–

Tracing done on hardware

–

Instrumentation not required

–

Instruction level granularity
14
Why hardware tracing is useful


15
Why hardware tracing is useful
 Profiling
–

Very fine granularity profiling

 Performance measurement
 Code coverage
 Monitoring
–

Statistics on application currently running?
16
Why hardware tracing is useful cont.
 Snapshot on crash/anomaly
–

Trace overwrites old data until anomaly detected

 Event trigger trace
 Hardware-assisted software tracing
–

Use hardware facility (ringbuffer)

17
ARM Coresight & ETM


18
ARM Coresight
●

Coresight
–
–

Trace and debug a complete SoC

–

●

Collection of hardware components
Open architecture

Trace source
–

Processing elements (CPU, DSP, etc.)

–

Buses

–

System trace (generated from software)
19
ARM ETM
●

ETM
–

Monitor the core internal bus

–

Instructions + data trace

–

Hardware filters and triggers

–

Trace stream compression

–

Traces can be saved in internal buffer (ETB) or shared
system memory

20
ARM Coresight

Source: arm.com [2] 21
State of Coresight & ETM in Linux
●

ETM tracer implementation available in Linux
–

●

Coresight support status
–

●

Seems to work only on specific hardware

Framework patchset proposed by Pratik Pratel [3]

Trace decoder availability?

22
Interested about Coresight/ETM?

“Hardware Trace in the Kernel” BoF
by Pawel Moll from ARM
Today, 4:30 PM in Pentland

23
Freescale QorIQ & Nexus tracing


24
Freescale QorIQ
●

PowerPC based platform targeted for high-performance
communications usage
–

Multiple e500mc processors,

–

DPAA support (packet processing offloading),

–

Support the Nexus debugging & tracing standard.

Source: radiolocman 25
[4]
Nexus standard
●

●

●

ISO standard for debugging embedded systems (IEEEISTO-5001-2003),
Designed for low pin count, standard set of connectors
(JTAG or Debug port),
Multiple level of Nexus “compliance”.

26
Nexus standard level
●

Level 1:
–
–

●

Run time control only (run, stop, breakpoints, etc.)
Tracing not supported

Level 2:
–

●

Level 3:
–

●

Ownership and program trace
Data write trace & memory read/write on the fly

Level 4:
–

Memory substitution

–

Trace triggering via a watchpoint
27
Nexus standard format
●

Packet based output format,
–

Standard defines public messages, vendors can define
extensions (TCODES)

–

Fixed packet size per message, last packet can be of
variable length

–

Message can have an optional timestamp

28
Example decoded Nexus message
Message # 328
TCODE : 2 Ownership Trace Message
SRC ID : 0 Core0 / CPU0 (Clst0:Core0:Thread0)
PID INDEX : 0x02 - Sync PID
PID VALUE : 0x01e01bf59c - LPIDR, MSR[GS],
PID/NPIDR (ref:DC1[OTS]), MSR[PR]
TIMESTAMP : 1140061 (0x11655d)
Message # 329
TCODE : 27 Resource Full Message
SRC ID : 0 Core0 / CPU0 (Clst0:Core0:Thread0)
RCODE : 0x8 - Timestamp counter
RDATA : 0x00ffffff
TIMESTAMP : 0 (0x0)
29
State of Nexus in Linux
●

Nexus qoriq-debug kernel module,
–

Available in Freescale QorIQ SDK Yocto Layer

–

Implements a debugfs with memory mapped access to
Nexus control register

–

cat /sys/kernel/debug/npc/trace_buffer > trace

30
Nexus debugfs
root@p3041ds:~# ls -al /sys/kernel/debug/qoriq-dbg
[...]
drwxr-xr-x 2 root root 0 Aug 6 20:22 cpu0
drwxr-xr-x 2 root root 0 Aug 6 20:22 cpu1
drwxr-xr-x 2 root root 0 Aug 6 20:22 cpu2
drwxr-xr-x 2 root root 0 Aug 6 20:22 cpu3
drwxr-xr-x 2 root root 0 Aug 6 20:22 ddr1
drwxr-xr-x 2 root root 0 Aug 6 20:22 dpaa
[...]
drwxr-xr-x 2 root root 0 Aug 6 20:22 npc
drwxr-xr-x 2 root root 0 Aug 6 20:22 nxc
[...]
root@p3041ds:~# ls -al /sys/kernel/debug/qoriq-dbg/cpu0
[...]
-rw-rw-rw- 1 root root 0 Aug 6 20:22 dc1
-rw-rw-rw- 1 root root 0 Aug 6 20:22 dc2
-rw-rw-rw- 1 root root 0 Aug 6 20:22 dc4
--w--w--w- 1 root root 0 Aug 6 20:22 ddam
[...]

31
State of Nexus in Linux
●

Nexus decoder availability
–

●

Released as part of the babeltrace project

Open-source software to reconstruct program flow not
yet developed
–

Integrate such functionality in an IDE ? perf?

32
LTTng & Hardware tracing


33
Project overview




34
Tracers

●

●

lttng-modules: kernel tracer module, compatible
with kernels from 2.6.38* to 3.11,
lttng-ust: user-space tracer, in-process library.

* Kernel tracing is now possible on 2.6.32 to 2.6.37 by backport of 3
Linux Kernel patches [1].
35
Utilities


●

lttng-tools: cli utilities and daemons for trace control,
–

lttng: cli utility for tracing control,

–

lttng-sessiond: tracing registry daemon,

–

lttng-consumerd: consume trace data,

–

lttng-relayd: network streaming daemon.
36
Viewers


●

●
●

babeltrace: cli text viewer, trace converter, plugin
system,
lttngtop: ncurse top-like viewer,
Eclipse lttng plugin: front-end for lttng, collect,
visualize and analyze traces, highly extensible.
37
Hardware tracing support
●

Initial attempt to support hardware tracing:
–
–

●

Babeltrace Nexus to CTF converter [5]
Goal: Leverage existing traces visualizer

Encountered issues:
–

Traces are not self-contained, need sideband
information

–

Internal trace buffer size limitation

–

Synchronization with other traces can be tricky
38
Hardware tracing support demo

DEMO
39
Future work
●

●

●

Decoder/Converter for ARM ETM?
Control hardware tracing facilities with the lttngtools command-line?
Custom views for hardware traces in Eclipse plugin

40
Conclusion
●

Availability and usefulness of hardware tracing

●

Initial support for self-hosted hardware tracing

●

Common abstraction for hardware tracing in the
Linux kernel?

41
Questions ?

?



www.efficios.com

 lttng.org
 lttng-dev@lists.lttng.org
 @lttng_project

42
References
[1] - http://www.arm.com/images/processor/Cortex-A9-osprey.jpg
[2] - http://www.arm.com/images/CoreSight_Diagram_Tiny.jpg
[3] - https://lkml.org/lkml/2012/12/19/331
[4] - http://www.rlocman.ru/i/Image/2010/06/24/2.jpg
[5] - https://github.com/cbab/babeltrace/tree/nexus

43

Mais conteúdo relacionado

Mais procurados

Linuxconeurope2011.ext4btrfs.talk
Linuxconeurope2011.ext4btrfs.talkLinuxconeurope2011.ext4btrfs.talk
Linuxconeurope2011.ext4btrfs.talkUdo Seidel
 
New Zephyr features: LWM2M / FOTA Framework - SFO17-113
New Zephyr features: LWM2M / FOTA Framework - SFO17-113New Zephyr features: LWM2M / FOTA Framework - SFO17-113
New Zephyr features: LWM2M / FOTA Framework - SFO17-113Linaro
 
Mac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityMac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityAndrew Case
 
Netmap presentation
Netmap presentationNetmap presentation
Netmap presentationAmir Razmjou
 
LAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel AwarenessLAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel AwarenessLinaro
 
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityOMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityAndrew Case
 
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Linaro
 
Hunting Mac Malware with Memory Forensics
Hunting Mac Malware with Memory ForensicsHunting Mac Malware with Memory Forensics
Hunting Mac Malware with Memory ForensicsAndrew Case
 
Alessio Lama - Development and testing of a safety network protocol
Alessio Lama - Development and testing of a safety network protocolAlessio Lama - Development and testing of a safety network protocol
Alessio Lama - Development and testing of a safety network protocollinuxlab_conf
 
Nodes and Networks for HPC computing
Nodes and Networks for HPC computingNodes and Networks for HPC computing
Nodes and Networks for HPC computingrinnocente
 
[Wroclaw #3] Trusted Computing
[Wroclaw #3] Trusted Computing[Wroclaw #3] Trusted Computing
[Wroclaw #3] Trusted ComputingOWASP
 
U-boot and Android Verified Boot 2.0
U-boot and Android Verified Boot 2.0U-boot and Android Verified Boot 2.0
U-boot and Android Verified Boot 2.0GlobalLogic Ukraine
 
Developing TI RTOS Applications and BLE Profiles
Developing TI RTOS Applications and BLE ProfilesDeveloping TI RTOS Applications and BLE Profiles
Developing TI RTOS Applications and BLE ProfilesSumit Sapra
 
Valerio Di Giampietro - Introduction To IoT Reverse Engineering with an examp...
Valerio Di Giampietro - Introduction To IoT Reverse Engineering with an examp...Valerio Di Giampietro - Introduction To IoT Reverse Engineering with an examp...
Valerio Di Giampietro - Introduction To IoT Reverse Engineering with an examp...linuxlab_conf
 
Linux Kernel Platform Development: Challenges and Insights
 Linux Kernel Platform Development: Challenges and Insights Linux Kernel Platform Development: Challenges and Insights
Linux Kernel Platform Development: Challenges and InsightsGlobalLogic Ukraine
 
Claudio Scordino - Handling mixed criticality on embedded multi-core systems
Claudio Scordino - Handling mixed criticality on embedded multi-core systemsClaudio Scordino - Handling mixed criticality on embedded multi-core systems
Claudio Scordino - Handling mixed criticality on embedded multi-core systemslinuxlab_conf
 
Demystifying Security Root of Trust Approaches for IoT/Embedded - SFO17-304
Demystifying Security Root of Trust Approaches for IoT/Embedded  - SFO17-304Demystifying Security Root of Trust Approaches for IoT/Embedded  - SFO17-304
Demystifying Security Root of Trust Approaches for IoT/Embedded - SFO17-304Linaro
 
An Essential Relationship between Real-time and Resource Partitioning
An Essential Relationship between Real-time and Resource PartitioningAn Essential Relationship between Real-time and Resource Partitioning
An Essential Relationship between Real-time and Resource PartitioningYoshitake Kobayashi
 

Mais procurados (20)

Linuxconeurope2011.ext4btrfs.talk
Linuxconeurope2011.ext4btrfs.talkLinuxconeurope2011.ext4btrfs.talk
Linuxconeurope2011.ext4btrfs.talk
 
New Zephyr features: LWM2M / FOTA Framework - SFO17-113
New Zephyr features: LWM2M / FOTA Framework - SFO17-113New Zephyr features: LWM2M / FOTA Framework - SFO17-113
New Zephyr features: LWM2M / FOTA Framework - SFO17-113
 
Mac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityMac Memory Analysis with Volatility
Mac Memory Analysis with Volatility
 
IPS_3M_eng
IPS_3M_engIPS_3M_eng
IPS_3M_eng
 
Netmap presentation
Netmap presentationNetmap presentation
Netmap presentation
 
LAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel AwarenessLAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel Awareness
 
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityOMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
 
Secure IoT Firmware for RISC-V
Secure IoT Firmware for RISC-VSecure IoT Firmware for RISC-V
Secure IoT Firmware for RISC-V
 
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
 
Hunting Mac Malware with Memory Forensics
Hunting Mac Malware with Memory ForensicsHunting Mac Malware with Memory Forensics
Hunting Mac Malware with Memory Forensics
 
Alessio Lama - Development and testing of a safety network protocol
Alessio Lama - Development and testing of a safety network protocolAlessio Lama - Development and testing of a safety network protocol
Alessio Lama - Development and testing of a safety network protocol
 
Nodes and Networks for HPC computing
Nodes and Networks for HPC computingNodes and Networks for HPC computing
Nodes and Networks for HPC computing
 
[Wroclaw #3] Trusted Computing
[Wroclaw #3] Trusted Computing[Wroclaw #3] Trusted Computing
[Wroclaw #3] Trusted Computing
 
U-boot and Android Verified Boot 2.0
U-boot and Android Verified Boot 2.0U-boot and Android Verified Boot 2.0
U-boot and Android Verified Boot 2.0
 
Developing TI RTOS Applications and BLE Profiles
Developing TI RTOS Applications and BLE ProfilesDeveloping TI RTOS Applications and BLE Profiles
Developing TI RTOS Applications and BLE Profiles
 
Valerio Di Giampietro - Introduction To IoT Reverse Engineering with an examp...
Valerio Di Giampietro - Introduction To IoT Reverse Engineering with an examp...Valerio Di Giampietro - Introduction To IoT Reverse Engineering with an examp...
Valerio Di Giampietro - Introduction To IoT Reverse Engineering with an examp...
 
Linux Kernel Platform Development: Challenges and Insights
 Linux Kernel Platform Development: Challenges and Insights Linux Kernel Platform Development: Challenges and Insights
Linux Kernel Platform Development: Challenges and Insights
 
Claudio Scordino - Handling mixed criticality on embedded multi-core systems
Claudio Scordino - Handling mixed criticality on embedded multi-core systemsClaudio Scordino - Handling mixed criticality on embedded multi-core systems
Claudio Scordino - Handling mixed criticality on embedded multi-core systems
 
Demystifying Security Root of Trust Approaches for IoT/Embedded - SFO17-304
Demystifying Security Root of Trust Approaches for IoT/Embedded  - SFO17-304Demystifying Security Root of Trust Approaches for IoT/Embedded  - SFO17-304
Demystifying Security Root of Trust Approaches for IoT/Embedded - SFO17-304
 
An Essential Relationship between Real-time and Resource Partitioning
An Essential Relationship between Real-time and Resource PartitioningAn Essential Relationship between Real-time and Resource Partitioning
An Essential Relationship between Real-time and Resource Partitioning
 

Semelhante a Bridging the gap between hardware and software tracing

LTTng-UST: Efficient System-Wide User-Space Tracing
LTTng-UST: Efficient System-Wide User-Space TracingLTTng-UST: Efficient System-Wide User-Space Tracing
LTTng-UST: Efficient System-Wide User-Space TracingChristian Babeux
 
BKK16-103 OpenCSD - Open for Business!
BKK16-103 OpenCSD - Open for Business!BKK16-103 OpenCSD - Open for Business!
BKK16-103 OpenCSD - Open for Business!Linaro
 
Lcu14 101- coresight overview
Lcu14 101- coresight overviewLcu14 101- coresight overview
Lcu14 101- coresight overviewLinaro
 
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSDLAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSDLinaro
 
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CanSecWest
 
Tank water level & monitoring solution based on the STM32L476 MCU
Tank water level & monitoring solution based on the STM32L476 MCUTank water level & monitoring solution based on the STM32L476 MCU
Tank water level & monitoring solution based on the STM32L476 MCUJulio César Carrasquel
 
AAME ARM Techcon2013 004v02 Debug and Optimization
AAME ARM Techcon2013 004v02 Debug and OptimizationAAME ARM Techcon2013 004v02 Debug and Optimization
AAME ARM Techcon2013 004v02 Debug and OptimizationAnh Dung NGUYEN
 
Blackhat USA 2016 - What's the DFIRence for ICS?
Blackhat USA 2016 - What's the DFIRence for ICS?Blackhat USA 2016 - What's the DFIRence for ICS?
Blackhat USA 2016 - What's the DFIRence for ICS?Chris Sistrunk
 
Microprocessor.ppt
Microprocessor.pptMicroprocessor.ppt
Microprocessor.pptsafia kalwar
 
Design of 32 Bit Processor Using 8051 and Leon3 (Progress Report)
Design of 32 Bit Processor Using 8051 and Leon3 (Progress Report)Design of 32 Bit Processor Using 8051 and Leon3 (Progress Report)
Design of 32 Bit Processor Using 8051 and Leon3 (Progress Report)Talal Khaliq
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOSICS
 
Track 5 session 5 - st dev con 2016 - stm32 hands on seminar - cloud connec...
Track 5   session 5 - st dev con 2016 - stm32 hands on seminar - cloud connec...Track 5   session 5 - st dev con 2016 - stm32 hands on seminar - cloud connec...
Track 5 session 5 - st dev con 2016 - stm32 hands on seminar - cloud connec...ST_World
 
Kernel Recipes 2015: Kernel packet capture technologies
Kernel Recipes 2015: Kernel packet capture technologiesKernel Recipes 2015: Kernel packet capture technologies
Kernel Recipes 2015: Kernel packet capture technologiesAnne Nicolas
 
microcontrollersstm32wlseriesproductwebinarpresentation1625231766205.pdf
microcontrollersstm32wlseriesproductwebinarpresentation1625231766205.pdfmicrocontrollersstm32wlseriesproductwebinarpresentation1625231766205.pdf
microcontrollersstm32wlseriesproductwebinarpresentation1625231766205.pdfadfadfadf
 
Intel® RDT Hands-on Lab
Intel® RDT Hands-on LabIntel® RDT Hands-on Lab
Intel® RDT Hands-on LabMichelle Holley
 
A Retasking Framework For Wireless Sensor Networks
A Retasking Framework For Wireless Sensor NetworksA Retasking Framework For Wireless Sensor Networks
A Retasking Framework For Wireless Sensor NetworksMichele Weigle
 

Semelhante a Bridging the gap between hardware and software tracing (20)

LTTng-UST: Efficient System-Wide User-Space Tracing
LTTng-UST: Efficient System-Wide User-Space TracingLTTng-UST: Efficient System-Wide User-Space Tracing
LTTng-UST: Efficient System-Wide User-Space Tracing
 
BKK16-103 OpenCSD - Open for Business!
BKK16-103 OpenCSD - Open for Business!BKK16-103 OpenCSD - Open for Business!
BKK16-103 OpenCSD - Open for Business!
 
Lcu14 101- coresight overview
Lcu14 101- coresight overviewLcu14 101- coresight overview
Lcu14 101- coresight overview
 
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSDLAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
 
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
 
Tank water level & monitoring solution based on the STM32L476 MCU
Tank water level & monitoring solution based on the STM32L476 MCUTank water level & monitoring solution based on the STM32L476 MCU
Tank water level & monitoring solution based on the STM32L476 MCU
 
No[1][1]
No[1][1]No[1][1]
No[1][1]
 
AAME ARM Techcon2013 004v02 Debug and Optimization
AAME ARM Techcon2013 004v02 Debug and OptimizationAAME ARM Techcon2013 004v02 Debug and Optimization
AAME ARM Techcon2013 004v02 Debug and Optimization
 
Blackhat USA 2016 - What's the DFIRence for ICS?
Blackhat USA 2016 - What's the DFIRence for ICS?Blackhat USA 2016 - What's the DFIRence for ICS?
Blackhat USA 2016 - What's the DFIRence for ICS?
 
Microprocessor.ppt
Microprocessor.pptMicroprocessor.ppt
Microprocessor.ppt
 
uCluster
uClusteruCluster
uCluster
 
Design of 32 Bit Processor Using 8051 and Leon3 (Progress Report)
Design of 32 Bit Processor Using 8051 and Leon3 (Progress Report)Design of 32 Bit Processor Using 8051 and Leon3 (Progress Report)
Design of 32 Bit Processor Using 8051 and Leon3 (Progress Report)
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOS
 
Track 5 session 5 - st dev con 2016 - stm32 hands on seminar - cloud connec...
Track 5   session 5 - st dev con 2016 - stm32 hands on seminar - cloud connec...Track 5   session 5 - st dev con 2016 - stm32 hands on seminar - cloud connec...
Track 5 session 5 - st dev con 2016 - stm32 hands on seminar - cloud connec...
 
Kernel Recipes 2015: Kernel packet capture technologies
Kernel Recipes 2015: Kernel packet capture technologiesKernel Recipes 2015: Kernel packet capture technologies
Kernel Recipes 2015: Kernel packet capture technologies
 
Tos tutorial
Tos tutorialTos tutorial
Tos tutorial
 
microcontrollersstm32wlseriesproductwebinarpresentation1625231766205.pdf
microcontrollersstm32wlseriesproductwebinarpresentation1625231766205.pdfmicrocontrollersstm32wlseriesproductwebinarpresentation1625231766205.pdf
microcontrollersstm32wlseriesproductwebinarpresentation1625231766205.pdf
 
Intel® RDT Hands-on Lab
Intel® RDT Hands-on LabIntel® RDT Hands-on Lab
Intel® RDT Hands-on Lab
 
A Retasking Framework For Wireless Sensor Networks
A Retasking Framework For Wireless Sensor NetworksA Retasking Framework For Wireless Sensor Networks
A Retasking Framework For Wireless Sensor Networks
 
K vector embedded_linux_workshop
K vector embedded_linux_workshopK vector embedded_linux_workshop
K vector embedded_linux_workshop
 

Último

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 

Último (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 

Bridging the gap between hardware and software tracing

  • 1. Embedded Linux Conference Europe 2013 Bridging the gap between hardware and software tracing christian.babeux@efficios.com  1 @c_bab 
  • 3. ARM Cortex A9 Source: arm.com [1] 3
  • 4. ARM Cortex A9 PTM Program Trace Macrocell Source: arm.com [1] 4
  • 5. whoami  Christian Babeux, Software Developer, EfficiOS,  Background in embedded and ASIC tools,  Active contributor to the LTTng projects: ● ●  lttng-tools, lttng-ust, babeltrace, CI infra, Website, Twitter. AUR package maintainer for Arch Linux. 5
  • 6. Content  What is hardware tracing?,  Why is it useful?,  ARM Coresight & ETM,  Freescale QorIQ & Nexus tracing,  LTTng & hardware tracing. 6
  • 7. What is hardware tracing?  7
  • 8. What is hardware tracing?  Hardware component(s) used to traces instructions and data movement of a processing device  Real-time observation Low intrusiveness 8
  • 9. What is hardware tracing? Cont. ● External trace 9
  • 10. What is hardware tracing? Cont. ● Pros – – ● Can accommodate high data bandwidth Minimal impact on system performance – Trace port not always available – Custom hardware needed Cons 10
  • 11. What is hardware tracing? Cont. ● Self-hosted trace 11
  • 12. What is hardware tracing? Cont. ● Pros – – ● Self-contained, facilities can be used by host OS No need for special hardware – Limited internal buffer space – Might impact system performance Cons 12
  • 13. Hardware tracing support ● ARM – – Program Trace Flow Macrocell (PTM), – ● Embedded Trace Macrocell (ETM), System Trace Macrocell (STM) PowerPC – – ● Freescale QorIQ with Nexus tracing Branch History Rolling Buffer (BHRB) – Intel Processor Tracing (PT) – Last Branch Record (LBR), Branch Trace Store (BTS) Intel 13
  • 14. Hardware tracing vs. software tracing ● Software tracing: – – Can be intrusive – Can be slow – ● Static instrumentation or dynamic code patching Tracepoint level granularity Hardware tracing: – Tracing done on hardware – Instrumentation not required – Instruction level granularity 14
  • 15. Why hardware tracing is useful  15
  • 16. Why hardware tracing is useful  Profiling – Very fine granularity profiling  Performance measurement  Code coverage  Monitoring – Statistics on application currently running? 16
  • 17. Why hardware tracing is useful cont.  Snapshot on crash/anomaly – Trace overwrites old data until anomaly detected  Event trigger trace  Hardware-assisted software tracing – Use hardware facility (ringbuffer) 17
  • 18. ARM Coresight & ETM  18
  • 19. ARM Coresight ● Coresight – – Trace and debug a complete SoC – ● Collection of hardware components Open architecture Trace source – Processing elements (CPU, DSP, etc.) – Buses – System trace (generated from software) 19
  • 20. ARM ETM ● ETM – Monitor the core internal bus – Instructions + data trace – Hardware filters and triggers – Trace stream compression – Traces can be saved in internal buffer (ETB) or shared system memory 20
  • 22. State of Coresight & ETM in Linux ● ETM tracer implementation available in Linux – ● Coresight support status – ● Seems to work only on specific hardware Framework patchset proposed by Pratik Pratel [3] Trace decoder availability? 22
  • 23. Interested about Coresight/ETM? “Hardware Trace in the Kernel” BoF by Pawel Moll from ARM Today, 4:30 PM in Pentland 23
  • 24. Freescale QorIQ & Nexus tracing  24
  • 25. Freescale QorIQ ● PowerPC based platform targeted for high-performance communications usage – Multiple e500mc processors, – DPAA support (packet processing offloading), – Support the Nexus debugging & tracing standard. Source: radiolocman 25 [4]
  • 26. Nexus standard ● ● ● ISO standard for debugging embedded systems (IEEEISTO-5001-2003), Designed for low pin count, standard set of connectors (JTAG or Debug port), Multiple level of Nexus “compliance”. 26
  • 27. Nexus standard level ● Level 1: – – ● Run time control only (run, stop, breakpoints, etc.) Tracing not supported Level 2: – ● Level 3: – ● Ownership and program trace Data write trace & memory read/write on the fly Level 4: – Memory substitution – Trace triggering via a watchpoint 27
  • 28. Nexus standard format ● Packet based output format, – Standard defines public messages, vendors can define extensions (TCODES) – Fixed packet size per message, last packet can be of variable length – Message can have an optional timestamp 28
  • 29. Example decoded Nexus message Message # 328 TCODE : 2 Ownership Trace Message SRC ID : 0 Core0 / CPU0 (Clst0:Core0:Thread0) PID INDEX : 0x02 - Sync PID PID VALUE : 0x01e01bf59c - LPIDR, MSR[GS], PID/NPIDR (ref:DC1[OTS]), MSR[PR] TIMESTAMP : 1140061 (0x11655d) Message # 329 TCODE : 27 Resource Full Message SRC ID : 0 Core0 / CPU0 (Clst0:Core0:Thread0) RCODE : 0x8 - Timestamp counter RDATA : 0x00ffffff TIMESTAMP : 0 (0x0) 29
  • 30. State of Nexus in Linux ● Nexus qoriq-debug kernel module, – Available in Freescale QorIQ SDK Yocto Layer – Implements a debugfs with memory mapped access to Nexus control register – cat /sys/kernel/debug/npc/trace_buffer > trace 30
  • 31. Nexus debugfs root@p3041ds:~# ls -al /sys/kernel/debug/qoriq-dbg [...] drwxr-xr-x 2 root root 0 Aug 6 20:22 cpu0 drwxr-xr-x 2 root root 0 Aug 6 20:22 cpu1 drwxr-xr-x 2 root root 0 Aug 6 20:22 cpu2 drwxr-xr-x 2 root root 0 Aug 6 20:22 cpu3 drwxr-xr-x 2 root root 0 Aug 6 20:22 ddr1 drwxr-xr-x 2 root root 0 Aug 6 20:22 dpaa [...] drwxr-xr-x 2 root root 0 Aug 6 20:22 npc drwxr-xr-x 2 root root 0 Aug 6 20:22 nxc [...] root@p3041ds:~# ls -al /sys/kernel/debug/qoriq-dbg/cpu0 [...] -rw-rw-rw- 1 root root 0 Aug 6 20:22 dc1 -rw-rw-rw- 1 root root 0 Aug 6 20:22 dc2 -rw-rw-rw- 1 root root 0 Aug 6 20:22 dc4 --w--w--w- 1 root root 0 Aug 6 20:22 ddam [...] 31
  • 32. State of Nexus in Linux ● Nexus decoder availability – ● Released as part of the babeltrace project Open-source software to reconstruct program flow not yet developed – Integrate such functionality in an IDE ? perf? 32
  • 33. LTTng & Hardware tracing  33
  • 35. Tracers ● ● lttng-modules: kernel tracer module, compatible with kernels from 2.6.38* to 3.11, lttng-ust: user-space tracer, in-process library. * Kernel tracing is now possible on 2.6.32 to 2.6.37 by backport of 3 Linux Kernel patches [1]. 35
  • 36. Utilities  ● lttng-tools: cli utilities and daemons for trace control, – lttng: cli utility for tracing control, – lttng-sessiond: tracing registry daemon, – lttng-consumerd: consume trace data, – lttng-relayd: network streaming daemon. 36
  • 37. Viewers  ● ● ● babeltrace: cli text viewer, trace converter, plugin system, lttngtop: ncurse top-like viewer, Eclipse lttng plugin: front-end for lttng, collect, visualize and analyze traces, highly extensible. 37
  • 38. Hardware tracing support ● Initial attempt to support hardware tracing: – – ● Babeltrace Nexus to CTF converter [5] Goal: Leverage existing traces visualizer Encountered issues: – Traces are not self-contained, need sideband information – Internal trace buffer size limitation – Synchronization with other traces can be tricky 38
  • 39. Hardware tracing support demo DEMO 39
  • 40. Future work ● ● ● Decoder/Converter for ARM ETM? Control hardware tracing facilities with the lttngtools command-line? Custom views for hardware traces in Eclipse plugin 40
  • 41. Conclusion ● Availability and usefulness of hardware tracing ● Initial support for self-hosted hardware tracing ● Common abstraction for hardware tracing in the Linux kernel? 41
  • 42. Questions ? ?  www.efficios.com  lttng.org  lttng-dev@lists.lttng.org  @lttng_project 42
  • 43. References [1] - http://www.arm.com/images/processor/Cortex-A9-osprey.jpg [2] - http://www.arm.com/images/CoreSight_Diagram_Tiny.jpg [3] - https://lkml.org/lkml/2012/12/19/331 [4] - http://www.rlocman.ru/i/Image/2010/06/24/2.jpg [5] - https://github.com/cbab/babeltrace/tree/nexus 43