Tracing your virtual machines



Similar documents
<Insert Picture Here> Tracing on Linux Updates

Module I-7410 Advanced Linux FS-11 Part1: Virtualization with KVM

Date: December 2009 Version: 1.0. How Does Xen Work?

<Insert Picture Here> Tracing on Linux: the Old, the New, and the Ugly

LiveBackup. Jagane Sundar

HPC performance applications on Virtual Clusters

Virtualization System Vulnerability Discovery Framework. Speaker: Qinghao Tang Title:360 Marvel Team Leader

VM Application Debugging via JTAG: Android TRACE32 JTAG Debug Bridge ADB Architecture Stop-Mode implications for ADB JTAG Transport Outlook

Virtualization Technologies

<Insert Picture Here> Tracing on Linux

Forming a P2P System In order to form a P2P system, the 'central-server' should be created by the following command.

Network File System (NFS) Pradipta De

Real-time KVM from the ground up

Operating Systems Virtualization mechanisms

EXPLORING LINUX KERNEL: THE EASY WAY!

The QEMU/KVM Hypervisor

RPM Brotherhood: KVM VIRTUALIZATION TECHNOLOGY

2972 Linux Options and Best Practices for Scaleup Virtualization

virtio-vsock Zero-configuration host/guest communication Stefan Hajnoczi KVM Forum 2015 KVM FORUM 2015 STEFAN HAJNOCZI

Cloud^H^H^H^H^H Virtualization Technology. Andrew Jones May 2011

High-Density Network Flow Monitoring

Virtual Machine Migration NSRC

Exploration of Large Scale Virtual Networks. Open Network Summit 2016

Real-Time KVM for the Masses Unrestricted Siemens AG All rights reserved

Chapter 10 Case Study 1: LINUX

PARALLELS SERVER BARE METAL 5.0 README

Virtualization in Linux KVM + QEMU

Basics in Energy Information (& Communication) Systems Virtualization / Virtual Machines

Network Packet Analysis and Scapy Introduction

Enabling Technologies for Distributed Computing

Example of Standard API

BF2CC Daemon Linux Installation Guide

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

Architecture of the Kernel-based Virtual Machine (KVM)

IOS110. Virtualization 5/27/2014 1

CSE 120 Principles of Operating Systems. Modules, Interfaces, Structure

Hardware Based Virtualization Technologies. Elsie Wahlig Platform Software Architect

Introduction To Computer Networking

Virtualization. Types of Interfaces

Virtualization. Dr. Yingwu Zhu

Virtual Switching Without a Hypervisor for a More Secure Cloud

SPICE and desktop virtualization

Networks. Inter-process Communication. Pipes. Inter-process Communication

VMware Server 2.0 Essentials. Virtualization Deployment and Management

Cloud.com CloudStack Community Edition 2.1 Beta Installation Guide

ZEN LOAD BALANCER EE v3.04 DATASHEET The Load Balancing made easy

Pen Test Tips 2. Shell vs. Terminal

Enabling Technologies for Distributed and Cloud Computing

File Transfer Examples. Running commands on other computers and transferring files between computers

SEP Packet Capturing Using the Linux Netfilter Framework Ivan Pronchev

Network Attached Storage. Jinfeng Yang Oct/19/2015

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

DEVICE DRIVERS AND TERRUPTS SERVICE MECHANISM Lesson-14: Device types, Physical and Virtual device functions

CS5460: Operating Systems. Lecture: Virtualization 2. Anton Burtsev March, 2013

Distributed Systems. Virtualization. Paul Krzyzanowski

Gluster Filesystem 3.3 Beta 2 Hadoop Compatible Storage

NFS File Sharing. Peter Lo. CP582 Peter Lo

Programming for GCSE Topic H: Operating Systems

Deploy and test ovirt using nested virtualization environments. Mark Wu

Oracle Linux Advanced Administration

Practical Applications of Virtualization. Mike Phillips IAP 2008 SIPB IAP Series

Using Network Attached Storage with Linux. by Andy Pepperdine

ELEC 377. Operating Systems. Week 1 Class 3

Using SmartOS as a Hypervisor

Enterprise-Class Virtualization with Open Source Technologies

Datacenter Operating Systems

Cloud Operating Systems for Servers

HelpSystems Web Server User Guide

Increasing XenServer s VM density

Chapter 2 System Structures

Gigabit Ethernet Design

Secure Network Filesystem (Secure NFS) By Travis Zigler

Product Overview. Initial Seeding

Next Generation Now: Red Hat Enterprise Linux 6 Virtualization A Unique Cloud Approach. Jeff Ruby Channel Manager jruby@redhat.com

How to Backup XenServer VM with VirtualIQ

short introduction to linux high availability description of problem and solution possibilities linux tools

ICS 351: Today's plan

CS312 Solutions #6. March 13, 2015

Configuring and Managing a Private Cloud with Enterprise Manager 12c

One Server Per City: C Using TCP for Very Large SIP Servers. Kumiko Ono Henning Schulzrinne {kumiko, hgs}@cs.columbia.edu

Linux Tools for Monitoring and Performance. Khalid Baheyeldin November 2009 KWLUG

ZEN LOAD BALANCER EE v3.02 DATASHEET The Load Balancing made easy

Xen Project 4.4: Features and Futures. Russell Pavlicek Xen Project Evangelist Citrix Systems

Efficient and Large-Scale Infrastructure Monitoring with Tracing

TCP Labs. WACREN Network Monitoring and Measurement Workshop Antoine Delvaux perfsonar developer

Small is Better: Avoiding Latency Traps in Virtualized DataCenters

[VADP OVERVIEW FOR NETBACKUP]

Learning about Informix and the Open Admin Tool (OAT)

Enhancing Hypervisor and Cloud Solutions Using Embedded Linux Iisko Lappalainen MontaVista

Oracle VM Server Recovery Guide. Version 8.2

KVM Security Comparison

Monitoring the Oracle VM Server

Linstantiation of applications. Docker accelerate

Masters Project Proposal

Performance Evaluation of VMXNET3 Virtual Network Device VMware vsphere 4 build

Streaming Stored Audio & Video

MODULE 3 VIRTUALIZED DATA CENTER COMPUTE

Chapter 14 Virtual Machines

Rackspace Cloud Databases and Container-based Virtualization

A general-purpose virtualization service for HPC on cloud computing: an application to GPUs

Transcription:

trace-cmd virt-server Tracing your virtual machines Steven Rostedt rostedt@goodmis.org srostedt@redhat.com

ftrace - review The official tracer of the Linux kernel Located in the tracefs/debugfs directory /sys/kernel/debug/tracing /sys/kernel/tracing Access and controlled via normal shell commands cat, echo

ftrace - review Traces events schedule context changes interrupts IO etc Traces functions plugin tracers for special tracing interrupt / preemption latency schedule wake up latency etc

ftrace - review # ls /sys/kernel/tracing available_events max_graph_depth stack_trace available_filter_functions options stack_trace_filter available_tracers per_cpu trace buffer_size_kb printk_formats trace_clock buffer_total_size_kb README trace_marker current_tracer saved_cmdlines trace_options dyn_ftrace_total_info saved_cmdlines_size trace_pipe enabled_functions set_event trace_stat enum_map set_ftrace_filter tracing_cpumask events set_ftrace_notrace tracing_max_latency free_buffer set_ftrace_pid tracing_on function_profile_enabled set_graph_function tracing_thresh instances set_graph_notrace uprobe_events kprobe_events snapshot uprobe_profile kprobe_profile stack_max_size

trace-cmd - review Command Line Interface for ftrace Automatically mounts tracefs file system Can read the binary data directly Uses splice to directly write from kernel buffer to file You don't need to worry about the tracefs files!

trace-cmd / ftrace flow trace-cmd (echo/cat) <splice> trace.dat user space kernel tracefs ftrace events ring buffer disk

trace-cmd listen A daemon to read traces from other machines Can use either TCP or UDP UDP is faster, but may lose events without notice TCP is the same as file system, but guaranteed Can read from multiple computers trace-cmd record -N <host>:<port> --date will map a time of day timestamp used with multiple machines to sync events

trace-cmd listen / ftrace flow trace-cmd listen trace-cmd record -N trace.dat tracefs disk network ring buffer ftrace events Host Client

trace-cmd listen Used to send trace data to a server Uses the network Can also work for virtual machines

trace-cmd listen / ftrace flow Host trace-cmd listen VM trace-cmd record -N tracefs trace.dat ring buffer ftrace events socket virt net Network disk

trace-cmd listen Goes via the network Added networking headers UDP IP Should be a better way

splice_from_pipe() { splice_from_pipe_next(); generic_pipe_buf_confirm(); pipe_to_sendpage() { sock_sendpage() { kernel_sendpage() { inet_sendpage() { udp_sendpage() { udp_sendmsg() { sk_dst_check() { ipv4_dst_check(); lock_sock_nested() { _cond_resched(); _raw_spin_lock_bh(); local_bh_enable_ip(); ip_append_data() { ip_append_data.part.42() { ip_setup_cork() { ipv4_mtu(); ip_append_data.isra.41() { sock_alloc_send_skb() { sock_alloc_send_pskb() { alloc_skb_with_frags() { alloc_skb() { kmem_cache_alloc_node() { _cond_resched(); kmalloc_reserve.isra.31() { kmalloc_node_track_caller() { kmalloc_slab(); _cond_resched(); ksize(); skb_put(); release_sock() { _raw_spin_lock_bh(); ip4_datagram_release_cb() { ipv4_dst_check(); _raw_spin_unlock_bh() { local_bh_enable_ip(); dst_release(); lock_sock_nested() { _cond_resched(); _raw_spin_lock_bh(); local_bh_enable_ip(); ip_append_page() { skb_append_pagefrags(); udp_push_pending_frames() { ip_make_skb() { ipv4_mtu(); ip_select_ident() { ip_idents_reserve(); kfree(); dst_release(); udp_send_skb() { udp4_hwcsum(); ip_send_skb() { ip_local_out_sk() { ip_local_out_sk() { nf_hook_slow() { nf_iterate() { ipv4_conntrack_defrag(); ipv4_conntrack_local() { nf_conntrack_in() { ipv4_get_l4proto(); nf_ct_l4proto_find(); udp_error(); nf_ct_get_tuple() { ipv4_pkt_to_tuple(); udp_pkt_to_tuple(); hash_conntrack_raw(); nf_conntrack_find_get() { local_bh_enable_ip(); nf_ct_invert_tuple() { ipv4_invert_tuple(); udp_invert_tuple(); nf_conntrack_alloc() { kmem_cache_alloc(); init_timer_key(); udp_get_timeouts(); udp_new(); nf_ct_ext_add_length() { kmalloc() { kmalloc_slab(); nf_ct_try_assign_helper(); _raw_spin_lock(); local_bh_enable_ip(); udp_get_timeouts(); udp_packet() { nf_ct_refresh_acct(); iptable_mangle_hook() { ipt_do_table() { local_bh_enable_ip(); iptable_filter_hook() { ipt_do_table() { local_bh_enable_ip(); ip_output() { nf_hook_slow() { nf_iterate() { iptable_mangle_hook() { ipt_do_table() { local_bh_enable_ip(); ipv4_helper(); ipv4_confirm() { nf_conntrack_confirm() { hash_conntrack_raw(); nf_conntrack_double_lock() { _raw_spin_lock(); _raw_spin_lock(); nf_ct_del_from_dying_or_unconfirmed_list() { _raw_spin_lock(); add_timer() { mod_timer() { lock_timer_base.isra.35() { _raw_spin_lock_irqsave(); detach_if_pending(); get_nohz_timer_target(); internal_add_timer() {

internal_add_timer(); wake_up_nohz_cpu(); _raw_spin_unlock_irqrestore(); nf_conntrack_hash_insert(); local_bh_enable_ip(); nf_ct_deliver_cached_events(); ip_finish_output() { ipv4_mtu(); ip_finish_output2() { neigh_resolve_output() { eth_header() { skb_push(); dev_queue_xmit_sk() { dev_queue_xmit() { dst_release(); netdev_pick_tx(); _raw_spin_lock(); sch_direct_xmit() { validate_xmit_skb_list() { validate_xmit_skb.isra.103.part.104() { netif_skb_features() { skb_network_protocol(); _raw_spin_lock(); dev_hard_start_xmit() { skb_clone() { kmem_cache_alloc(); skb_clone() { copy_skb_header(); ktime_get_with_offset(); packet_rcv() { skb_push(); bpf_prog_run(); consume_skb() { skb_release_all() { skb_release_head_state(); skb_release_data(); kfree_skbmem() { kmem_cache_free(); start_xmit() { free_old_xmit_skbs.isra.39() { virtqueue_get_buf() { detach_buf(); dev_kfree_skb_any() { consume_skb() { skb_release_all() { skb_release_head_state(); skb_release_data() { kfree() { slab_free(); kfree_skbmem() { kmem_cache_free() { slab_free(); virtqueue_get_buf(); skb_clone_tx_timestamp() { classify(); skb_to_sgvec() { skb_to_sgvec(); virtqueue_add_outbuf() { alloc_indirect.isra.4() { kmalloc() { kmalloc_slab(); sock_wfree() { sock_def_write_space(); virtqueue_kick() { virtqueue_kick_prepare(); vp_notify(); _raw_spin_lock(); local_bh_enable_ip(); local_bh_enable_ip();

trace-cmd virt-server Introducing virt-server! Host interacts directly with virtual machines No going through the network layer Fast transactions of events Consistent time stamps Interleaving of events between host and guest.

splice_from_pipe() { splice_from_pipe_next(); generic_pipe_buf_confirm(); pipe_to_sg() { generic_pipe_buf_steal() { _cond_resched(); } unlock_page() { wake_up_bit(); } }

trace-cmd virt-server / ftrace flow Host trace-cmd virt-server VM trace-cmd record --virt tracefs trace.dat ring buffer ftrace events pipe socket unix socket disk

trace-cmd virt-server [setup] trace-cmd virt-server --dom <guest> -c <cpus> Creates (if does not exist) /var/lib/trace-cmd/virt/agent-ctl-path socket /var/lib/trace-cmd/virt/<guest>/trace-path-cpu0.in /var/lib/trace-cmd/virt/<guest>/trace-path-cpu0.out FIFO Needs to be done only once (FIFO not deleted) agent-ctr-path only exists when running trace-cmd virt-server Creates agent-ctr-path while running

trace-cmd virt-server [setup] qemu -device virtio-serial-pci,id=virtio-serial0,bus=pci.0 -chardev socket,id=charchannel0,path=/var/lib/trace-cmd/virt/agent-ctl-path -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0, name=agent-ctl-path -chardev pipe,id=charchannel1,path=/var/lib/trace-cmd/virt/merry/trace-path-cpu0 -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1, name=trace-path-cpu0

trace-cmd virt-server [setup] libvirt /etc/libvirt/qemu/<guest>.xml <channel type='unix'> <source mode='connect' path='/var/lib/trace-cmd/virt/agent-ctl-path'/> <target type='virtio' name='agent-ctl-path'/> <address type='virtio-serial' controller='0' bus='0' port='3'/> </channel> <channel type='pipe'> <source path='/var/lib/trace-cmd/virt/merry/trace-path-cpu0'/> <target type='virtio' name='trace-path-cpu0'/> <address type='virtio-serial' controller='0' bus='0' port='4'/> </channel>

trace-cmd virt-server [setup] libvirt Make sure to include all CPUs <channel type='pipe'> <source path='/var/lib/trace-cmd/virt/merry/trace-path-cpu1'/> <target type='virtio' name='trace-path-cpu1'/> <address type='virtio-serial' controller='0' bus='0' port='5'/> </channel> <channel type='pipe'> <source path='/var/lib/trace-cmd/virt/merry/trace-path-cpu2'/> <target type='virtio' name='trace-path-cpu2'/> <address type='virtio-serial' controller='0' bus='0' port='6'/> </channel> <channel type='pipe'> <source path='/var/lib/trace-cmd/virt/merry/trace-path-cpu3'/> <target type='virtio' name='trace-path-cpu3'/> <address type='virtio-serial' controller='0' bus='0' port='7'/> </channel>

trace-cmd virt-server / ftrace flow trace-cmd record --virt CPU 0 ring buffer CPU 1 ring buffer VM Host socket (agent-ctl-path) FIFO (trace-path-cpu0) FIFO (trace-path-cpu1) trace-cmd virt-server disk trace.dat

Welcome to the CLOUD! Welcome

Welcome to the CLOUD! to

Welcome to the CLOUD! the

Welcome to the CLOUD! Vaporware!

Coming soon to trace-cmd virt-sever Everything up to now has been implemented But that stuff is boring The cool stuff is yet to be created It's still under design YOU can influence the results!!!!

trace-cmd virt-server (what I want) trace-cmd virt-server --client Run from the guest Will let the host start tracing trace-cmd record --dom <guest> Run from the host Connects to the guest through virt-server running on the host Can connect to more than one guest Can start tracing on host too!

trace-cmd virt-server (what I want) trace-cmd record -e kvm \ --dom guest1 -e all --exec guest-app1 foo \; \ --dom guest2 -p function --exec guest2-app \; \ hostapp

trace-cmd virt-server / ftrace flow trace-cmd virt-server --client guest1 trace-cmd virt-server --client guest2 App ring buffer App ring buffer socket FIFO socket FIFO trace-cmd virt-server Host trace-cmd record disk trace.dat

trace-cmd virt-server --client Issues! #1 is security Client should only allow executing if explicit trace-cmd virt-server --client --allow-exec trace-cmd virt-server --client --no-exec? Who do we trust? Host files access by anyone with group permissions How paranoid should the guest be? trace-cmd virt-server must always run Is there a better method Can we start virt-server after guest? Can guest run without virt-server?

Questions?