Linux Plumbers Conference 2010 Converging towards a unified Lockless - - PowerPoint PPT Presentation

linux plumbers conference 2010
SMART_READER_LITE
LIVE PREVIEW

Linux Plumbers Conference 2010 Converging towards a unified Lockless - - PowerPoint PPT Presentation

Linux Plumbers Conference 2010 Converging towards a unified Lockless Ring Buffer Library E-mail: mathieu.desnoyers@efficios.com Mathieu Desnoyers Nov. 4th, 2010 1 > Presenter Mathieu Desnoyers EfficiOS Inc.


slide-1
SLIDE 1
  • Nov. 4th, 2010

Mathieu Desnoyers 1

Linux Plumbers Conference 2010

Converging towards a unified Lockless Ring Buffer Library E-mail: mathieu.desnoyers@efficios.com

slide-2
SLIDE 2
  • Nov. 4th, 2010

Mathieu Desnoyers 2

> Presenter

  • Mathieu Desnoyers
  • EfficiOS Inc.
  • http://www.efficios.com
  • Author/Maintainer of
  • LTTng, LTTV, Userspace RCU
slide-3
SLIDE 3
  • Nov. 4th, 2010

Mathieu Desnoyers 3

> Plan

  • Tracing User Requirements
  • Generic Ring Buffer Library
  • Standard Trace Format
  • Modular Instrumentation
  • Fast Global Trace Clock

– Hypervisor, kernel, userland (vDSO)

  • Discussion
slide-4
SLIDE 4
  • Nov. 4th, 2010

Mathieu Desnoyers 4

> State of Linux tracers

  • Ftrace, Perf

– Opening the Linux kernel developer community

to tracing

– Centered on kernel developers requirements – Still missing the point for companies developing

  • n top of Linux (end users)
  • Telecommunication companies
  • Embedded systems
  • Enterprise servers
  • And many many more .......................................
slide-5
SLIDE 5
  • Nov. 4th, 2010

Mathieu Desnoyers 5

> User requirements (1)

Reflects the needs of the following users:

– Monta Vista – Autodesk – Cisco – Mentor Graphics – Texas Instruments – IBM – Ericsson – Nokia – Siemens – Freescale – Wind River

slide-6
SLIDE 6
  • Nov. 4th, 2010

Mathieu Desnoyers 6

> User requirements (2)

  • Compactness of traces

– e.g. 96 bits per event (including typical 64-bit

payload), no PID saved per event

  • Production-grade tracer reliability

– Trace clock accuracy within 100ns, ordering

based on lock/interrupt handler knowledge, ability to know when ordering might be wrong

  • Scalability to multi-core and multi-processor

– Per-CPU buffers, time-stamp reading scalable

slide-7
SLIDE 7
  • Nov. 4th, 2010

Mathieu Desnoyers 7

> User requirements (3)

  • Low-overhead is key

– 150 ns per event (cache-hot) – Zero-copy (splice to disk/network, mmap for

zero-copy data analysis)

  • Flight recorder mode

– Support concurrent read while writer is

  • verwriting buffer data (snapshots)
slide-8
SLIDE 8
  • Nov. 4th, 2010

Mathieu Desnoyers 8

> User requirements (4)

  • Availability of trace buffers for crash diagnosis

– Save to disk, network

  • Support multiple trace sessions in parallel

– Engineer + Operator + flight recorder for

automated bug reports

slide-9
SLIDE 9
  • Nov. 4th, 2010

Mathieu Desnoyers 9

> User requirements (5)

  • Heterogeneous environment support

– Portability – Distinct host/target environment support – Management of multiple target kernel versions – No dependency on kernel image to analyze

traces (traces contain complete information)

slide-10
SLIDE 10
  • Nov. 4th, 2010

Mathieu Desnoyers 10

> User requirements (6)

  • Live view/analysis of trace streams via the

network

– Impact on buffer flushing, power saving, idle, ...

  • System-wide (kernel and user-space) traces
  • Scalability of analysis tools to very large data

sets (> 10GB)

  • Standardization of trace format across analysis

tools (MCA TIWG, Eclipse viewer/analyzer, kernelshark, LTTV)

slide-11
SLIDE 11

August 11th, 2010 Mathieu Desnoyers 11

> Generic Ring Buffer Library

  • Input

– Data received as parameter from ring buffer

library clients

  • Output

– Data available through a global or per-CPU file

descriptor with splice, mmap or read.

– Or data available internally to the ring buffer

client for reading

slide-12
SLIDE 12

August 11th, 2010 Mathieu Desnoyers 12

> Genericity and Flexibility

  • Target Ftrace, LTTng, Perf and drivers
  • Not only tracer-specific

– Ring buffer sits in /lib

  • Achieve genericity without hurting performance

– Ring buffer clients – Instantiate client-specific configurations – Express configuration into a constant client

structure passed as parameter to inline functions

slide-13
SLIDE 13

August 11th, 2010 Mathieu Desnoyers 13

> Common Trace Format (CTF)

  • Effort undertaken in collaboration with Multi-

Core Association Tool and Infrastructure Workgroup

  • Target a standard trace format for Application,

Kernel and Hardware tracing

  • Linux CTF (Common Trace Format) can

influence this standard by being a reference implementation

  • Posted many rounds of requirement RFCs, one

proposal RFC to LKML

slide-14
SLIDE 14

August 11th, 2010 Mathieu Desnoyers 14

> BabelTrace

  • Trace converter to/from CTF
  • Aims to help interoperability between tracers

and trace analysis tools

– Without requiring tracers to change their ABIs

immediately

slide-15
SLIDE 15

August 11th, 2010 Mathieu Desnoyers 15

> Modular Instrumentation

  • At the very least, each tracer should share the

instrumentation infrastructure

  • Modularization of instrumentation sources, API

standardization

– Tracers register with trace session private data – Tracepoints, function tracing – Dynamic probes, kprobes, performance

counters, ...

slide-16
SLIDE 16

August 11th, 2010 Mathieu Desnoyers 16

> Fast Trace Clock

  • Currently:

– Global trace clock non-scalable and slow – "Medium" trace clock too coarse (1HZ) precision

  • Need a fast trace clock cpufreq and PM-aware,

drift dealt by periodically synchronizing on external clock, readable in NMI context.

slide-17
SLIDE 17

August 11th, 2010 Mathieu Desnoyers 17

> Fast Trace Clock

  • Available (and synchronized) across host OS,

guest OS and userspace

  • Should export through vDSO for user-space

tracing

  • Should have "get/put" refcounting to

activate/deactivate trace clock on ARM

slide-18
SLIDE 18
  • Nov. 4th, 2010

Mathieu Desnoyers 18

> Discussion

?

– http://www.efficios.com – CTF/BabelTrace

  • http://www.efficios.com/ctf

– Generic Ring Buffer Library

  • http://www.efficios.com/ringbuffer