Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Debugging Linux Kernel in Deep - Part 1
Rating: 4.3 out of 5(296 ratings)
4,409 students

Debugging Linux Kernel in Deep - Part 1

Linux Kernel Debugging Techniques
Created byLinux Trainer
Last updated 11/2020
English
English [Auto],

What you'll learn

  • Linux Kernel Debugging Techniques

Course content

6 sections70 lectures6h 18m total length
  • Introduction to Tracing2:09

    Explore how tracing complements debugging by capturing low-level runtime events to restore context and analyze system activity, contrasting tracing with logging.

  • Introduction to ftrace2:14

    Explore ftrace, the Linux kernel function tracer, and its capabilities for tracing function calls, events, memory, and function graphs to aid debugging and latency analysis.

  • Check Whether ftrace is enabled in kernel5:44

    Learn to verify that ftrace is enabled in the kernel by checking config options like function and function_graph, locating tracing directory, and mounting the tracing filesystem to access trace files.

  • Important files in tracefs3:44

    Explore tracefs in the kernel, listing traces and configuring them with echo and cat, and learn how function and function_graph tracers reveal driver–hardware interactions in embedded linux images.

  • Enabling a different tracer5:09

    Enable a different tracer in the Linux kernel by echoing the tracer name into current_tracer, verifying the change, and inspecting the trace buffer for function calls and the function graph.

  • Function Graph Tracer5:34

    Enable the function graph tracer to monitor function entry and exit, record return addresses, and measure execution time in the trace file using timestamps and durations.

  • Filtering functions11:28

    Filter functions to simplify search in kernel tracing, using include and exclude lists, wildcards, and field filters to trace specific functions and measure latency with the function graph tracer.

  • Wildcard Characters in filters2:54

    Explore wildcard characters such as the asterisk and question mark to filter linux kernel functions by start, end, or containment, with examples like lock and mutex.

  • Question and Answer1:04

    Explain how exported symbols and kernel functions are exposed and traced, and how two functions with the same name in different files can both be enabled and seen.

  • ftrace on simple kernel module11:15

    Use ftrace to trace a simple character device driver, enabling the function tracer and filtering by open, read, write, and release to verify functions as the module loads.

  • Enabling and Disabling tracing2:52

    Learn how to enable and disable tracing to monitor a specific test, control ring buffer writing, and use function graph tracing to narrow data to the test application.

  • trace vs trace_pipe3:45

    Explore how a large ring buffer stores trace data, compare trace and trace_pipe readings (consuming vs non-consuming), and observe how reading affects data while tracing continues.

  • Find out what calls made by a kernel function5:52

    Explore how function graph tracing reveals the calls a kernel function makes by enabling the function graph tracer and inspecting which functions are invoked, such as device_open and print calls.

  • Tracing a specific process6:32

    Trace a specific process by enabling tracing in the shell to capture all system calls, then disable tracing and verify the observed calls with filters.

  • Tracing functions of specific module3:38

    Trace all functions of a specific kernel module using the module name and a filter, then enable tracing with the script to review the module's function calls.

  • trace_printk6:32

    Switch from traditional debuggers to trace_printk for kernel tracing, recording sensitive areas with minimal overhead by writing to a ring buffer and reading traces from text files.

  • Tracing kernel functions with a particular duration2:49

    Trace kernel functions by duration with the tracing thresholding file to log only those exceeding a chosen threshold into the tracing ring buffer, using microseconds for the unit.

  • Finding out how user space code gets into kernel2:29

    Trace how userspace code enters kernel space via colonoscope 64, the first function in the flow, and use the max graph depth to reveal subsequent kernel functions.

Requirements

  • Should have knowledge in Linux Kernel

Description

A traditional debugger allows you to inspect the system state once the system is halted

i.e., after an error has been detected, but doesn’t reveal the events leading to the error.

To understand why an event took place, the relevant context has to be restored. This requires tracing

Tracing is the process of collecting information on the activity in a working system

With tracing, program execution is recorded during run-time, allowing for later analysis of the trace

Tracing provides developers with information useful for debugging.

In this course, we will be learning ftrace, which is the official tracer of Linux Kernel in deep

What can we do using ftrace?

-----------------------------

Debugging Linux Kernel

Analyzing Latencies in Linux Kernel

Learn and observe the flow of Linux Kernel

Trace context switches

Length of the time the interrupts are disabled

       And many more

Who this course is for:

  • Kernel developers interested to learn various debugging techniques