Kernel Tracing David Ferry, Chris Gill

Slides:



Advertisements
Similar presentations
Debugging code with limited system resource. Minheng Tan Oct
Advertisements

Kernel module programming and debugging Advanced Operating Systems.
Process Description and Control A process is sometimes called a task, it is a program in execution.
Cortex-M3 Debugging System
Spring 2014 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University.
Debugging techniques in Linux Debugging Techniques in Linux Chetan Kumar S Wipro Technologies.
Chocolate Bar! luqili. Milestone 3 Speed 11% of final mark 7%: path quality and speed –Some cleverness required for full marks –Implement some A* techniques.
© Imagination TechnologiesInternal Only – Not to be released externally p1 David Lau June 2015 Debugging & MIPS VZ.
Self stabilizing Linux Kernel Mechanism Doron Mishali, Alex Plits Supervisors: Prof. Shlomi Dolev Dr. Reuven Yagel.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Tami Meredith, Ph.D. CSCI  Devices need CPU access  E.g., NIC has a full buffer it needs to empty  These device needs are often asynchronous.
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
Module 6: Debugging a Windows CE Image.  Overview Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging.
CSE 332: C++ debugging Why Debug a Program? When your program crashes –Finding out where it crashed –Examining program memory at that point When a bug.
Debugging parallel programs. Breakpoint debugging Probably the most widely familiar method of debugging programs is breakpoint debugging. In this method,
1 Chapter 4 Processes R. C. Chang. 2 Linux Processes n Each process is represented by a task_struct data structure (task and process are terms that Linux.
4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING SUSE Lab.
Debugging TI RTOS TEAM 4 JORGE JIMENEZ JHONY MEDRANO ALBIEN FEZGA.
DSP/BIOS for C6000/C5000. What is DSP/BIOS Real-time Environment –Thread execution model Threads, Mailboxes, Semaphores –Device independent I/O Logging,
Unit - V. Debugging GNU Debugger helps you in getting information about the following: 1.If a core dump happened, then what statement or expression did.
Course Introduction David Ferry, Chris Gill Department of Computer Science and Engineering Washington University, St. Louis MO 1E81.
How & When The Kernel Runs David Ferry, Chris Gill Department of Computer Science and Engineering Washington University, St. Louis MO
© 2002 IBM Corporation Confidential | Date | Other Information, if necessary Copyright © 2009 Ericsson, Made available under the Eclipse Public License.
CSE 332: C++ expressions Expressions: Operators and Operands Operators obey arity, associativity, and precedence int result = 2 * 3 + 5; // assigns 11.
Linux Boot Process on the Raspberry Pi 2 1 David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis,
Scheduling Classes and Real-Time Scheduling in Linux David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St.
Interrupts and Interrupt Handling David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
HP-SEE Debugging with GDB Vladimir Slavnic Research Assistant SCL, Institute of Physics Belgrade The HP-SEE initiative.
Kernel Tracing David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Processes David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
© 2013 MontaVista Software, LLC. MontaVista Confidential and Proprietary. CGE7 DevRocket7 Feature Demo Divya Vyas.
Program Execution in Linux David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Kernel Synchronization David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Real Time Linux Who Needs It? Presented by: Steven Rostedt
Tracing for Hardware, Driver and Binary Reverse Engineering in Linux Mathieu Desnoyers Recon 2006.
REAL-TIME OPERATING SYSTEMS
How & When The Kernel Runs
Midterm Review Chris Gill CSE 422S - Operating Systems Organization
Time Sources and Timing
Midterm Review David Ferry, Chris Gill
Chapter 2: System Structures
Department of Computer Science and Engineering
Processes David Ferry, Chris Gill
Program Execution in Linux
Time Sources and Timing
Semester Review Chris Gill CSE 422S - Operating Systems Organization
Interrupts and Interrupt Handling
CS703 - Advanced Operating Systems
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
CSE 403 Lecture 17 Coding.
Lecture Topics: 11/1 General Operating System Concepts Processes
System Calls David Ferry CSCI 3500 – Operating Systems
Top Half / Bottom Half Processing
Kernel Synchronization I
Overview of the Lab 2 Assignment: Multicore Real-Time Tasks
Midterm Review Brian Kocoloski
How & When The Kernel Runs
Time Sources and Timing
Processes David Ferry CSCI 3500 – Operating Systems
Program Execution in Linux
Kernel Tracing David Ferry, Chris Gill, Brian Kocoloski
CS703 - Advanced Operating Systems
Scheduling Classes and Real-Time Scheduling in Linux
Department of Computer Science and Engineering
Interrupts and Interrupt Handling
Processes David Ferry, Chris Gill, Brian Kocoloski
Lecture 12 Input/Output (programmer view)
Dynamic Binary Translators and Instrumenters
Shared Memory David Ferry, Chris Gill
Presentation transcript:

Kernel Tracing David Ferry, Chris Gill CSE 422S - Operating Systems Organization Washington University in St. Louis St. Louis, MO 63143

Things Happen: Kernel Oops vs Panic A kernel panic is unrecoverable and results in an instant halt An oops communicates something bad happened but the kernel tries to continue executing An oops means the kernel is not totally broken, but is probably in an inconsistent state An oops in interrupt context, the idle task (pid 0), or the init task (pid 1) results in a panic How to figure out what went wrong? "Kernel-panic" by Kevin http://flickr.com/photos/kevincollins/74279815/ CSE 422S – Operating Systems Organization

Debugging on/within Linux Debuggers mostly target debugging user programs gdb kgdb For kernel issues they have some key limitations Full debugging requires specialized, two machine setup Limited ability to do execution stepping However they can be useful to see part of the overall picture Can still do breakpoints Can still inspect memory contents Can still inspect call stack User space and kernel tracing is often useful to augment them CSE 422S – Operating Systems Organization

Simplest “Tracer”: printk() printk() prints information to the system log Messages stored in circular buffer Can be read with dmesg Eight possible log levels (set with dmesg –n) Example: printk(KERN_ALERT “bad thing %ld”, bad_thing); Uses same format as printf() Note there is no comma after log level (KERN_ALERT) CSE 422S – Operating Systems Organization

Userspace Tracing: Strace Allows one userspace process (tracer) to inspect the system calls made by another thread (tracee). Tracer calls ptrace() on tracee Tracee halts at every system call, system call return, and signal (except SIGKILL) Tracer records info, and releases tracee to continue Note: Tracing is per-thread Seriously warps program timing CSE 422S – Operating Systems Organization

Ftrace – the Function Tracer Not just functions! Many features: Event tracepoints (scheduler, interrupts, etc.) Trace any kernel function Call graphs Kernel stack size Latency tracing How long interrupts disabled How long preemption disabled Has a user interface called trace-cmd Very nice graphical trace browser called Kernelshark CSE 422S – Operating Systems Organization

CSE 422S – Operating Systems Organization Ftrace Internals When tracing is enabled, the kernel maintains: Per-CPU ring buffer for holding events Per-CPU kernel thread that empties ring buffer If readers can’t keep up, data is lost (dropped) Tracepoints in kernel: Kernel maintains list of tracepoint locations Locations normally converted to no-ops (ftrace_make_nop()) Trace code is runtime-patched into kernel code when activated (ftrace_make_call()) CSE 422S – Operating Systems Organization

Redirecting and Comparing Output Capture the results of runs by redirecting the standard error and output streams to a file strace ./dense_mm 100 &> dense100trace.txt strace ./dense_mm 300 &> dense300trace.txt Then compare the files using diff and less diff dense100trace.txt dense300trace.txt | less CSE 422S –Operating Systems Organization