xref: /linux/Documentation/trace/events-pci.rst (revision c17ee635fd3a482b2ad2bf5e269755c2eae5f25e)
1.. SPDX-License-Identifier: GPL-2.0
2
3===========================
4Subsystem Trace Points: PCI
5===========================
6
7Overview
8========
9The PCI tracing system provides tracepoints to monitor critical hardware events
10that can impact system performance and reliability. These events normally show
11up here:
12
13	/sys/kernel/tracing/events/pci
14
15Cf. include/trace/events/pci.h for the events definitions.
16
17Available Tracepoints
18=====================
19
20pci_hp_event
21------------
22
23Monitors PCI hotplug events including card insertion/removal and link
24state changes.
25::
26
27    pci_hp_event  "%s slot:%s, event:%s\n"
28
29**Event Types**:
30
31* ``LINK_UP`` - PCIe link established
32* ``LINK_DOWN`` - PCIe link lost
33* ``CARD_PRESENT`` - Card detected in slot
34* ``CARD_NOT_PRESENT`` - Card removed from slot
35
36**Example Usage**::
37
38    # Enable the tracepoint
39    echo 1 > /sys/kernel/debug/tracing/events/pci/pci_hp_event/enable
40
41    # Monitor events (the following output is generated when a device is hotplugged)
42    cat /sys/kernel/debug/tracing/trace_pipe
43       irq/51-pciehp-88      [001] .....  1311.177459: pci_hp_event: 0000:00:02.0 slot:10, event:CARD_PRESENT
44
45       irq/51-pciehp-88      [001] .....  1311.177566: pci_hp_event: 0000:00:02.0 slot:10, event:LINK_UP
46
47pcie_link_event
48---------------
49
50Monitors PCIe link speed changes and provides detailed link status information.
51::
52
53    pcie_link_event  "%s type:%d, reason:%d, cur_bus_speed:%d, max_bus_speed:%d, width:%u, flit_mode:%u, status:%s\n"
54
55**Parameters**:
56
57* ``type`` - PCIe device type (4=Root Port, etc.)
58* ``reason`` - Reason for link change:
59
60  - ``0`` - Link retrain
61  - ``1`` - Bus enumeration
62  - ``2`` - Bandwidth notification enable
63  - ``3`` - Bandwidth notification IRQ
64  - ``4`` - Hotplug event
65
66
67**Example Usage**::
68
69    # Enable the tracepoint
70    echo 1 > /sys/kernel/debug/tracing/events/pci/pcie_link_event/enable
71
72    # Monitor events (the following output is generated when a device is hotplugged)
73    cat /sys/kernel/debug/tracing/trace_pipe
74       irq/51-pciehp-88      [001] .....   381.545386: pcie_link_event: 0000:00:02.0 type:4, reason:4, cur_bus_speed:20, max_bus_speed:23, width:1, flit_mode:0, status:DLLLA
75