SlideShare una empresa de Scribd logo
1 de 43
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Similar 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
 

Similar 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

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 

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