1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
.. SPDX-License-Identifier: GPL-2.0+
============================
DRM RAS over Generic Netlink
============================
The DRM RAS (Reliability, Availability, Serviceability) interface provides a
standardized way for GPU/accelerator drivers to expose error counters and
other reliability nodes to user space via Generic Netlink. This allows
diagnostic tools, monitoring daemons, or test infrastructure to query hardware
health in a uniform way across different DRM drivers.
Key Goals:
* Provide a standardized RAS solution for GPU and accelerator drivers, enabling
data center monitoring and reliability operations.
* Implement a single drm-ras Generic Netlink family to meet modern Netlink YAML
specifications and centralize all RAS-related communication in one namespace.
* Support a basic error counter interface, addressing the immediate, essential
monitoring needs.
* Offer a flexible, future-proof interface that can be extended to support
additional types of RAS data in the future.
* Allow multiple nodes per driver, enabling drivers to register separate
nodes for different IP blocks, sub-blocks, or other logical subdivisions
as applicable.
.. contents::
Nodes
=====
Nodes are logical abstractions representing an error type or error source within
the device. Currently, only error counter nodes is supported.
Drivers are responsible for registering and unregistering nodes via the
`drm_ras_node_register()` and `drm_ras_node_unregister()` APIs.
Node Management
-------------------
.. kernel-doc:: drivers/gpu/drm/drm_ras.c
:doc: DRM RAS Node Management
.. kernel-doc:: drivers/gpu/drm/drm_ras.c
:internal:
Generic Netlink Usage
=====================
The interface is implemented as a Generic Netlink family named ``drm-ras``.
User space tools can:
* List registered nodes with the ``list-nodes`` command.
* List all error counters in an node with the ``get-error-counter`` command with ``node-id``
as a parameter.
* Query specific error counter values with the ``get-error-counter`` command, using both
``node-id`` and ``error-id`` as parameters.
* Clear specific error counters with the ``clear-error-counter`` command, using both
``node-id`` and ``error-id`` as parameters.
* Subscribe to the ``error-report`` multicast group to receive ``error-event``.
* Query specific error counter threshold with the ``get-error-threshold`` command, using both
``node-id`` and ``error-id`` as parameters.
* Set specific error counter threshold with the ``set-error-threshold`` command, using
``node-id``, ``error-id`` and ``error-threshold`` as parameters.
YAML-based Interface
--------------------
The interface is described in a YAML specification ``Documentation/netlink/specs/drm_ras.yaml``
This YAML is used to auto-generate user space bindings via
``tools/net/ynl/pyynl/ynl_gen_c.py``, and drives the structure of netlink
attributes and operations.
Usage Notes
-----------
* User space must first enumerate nodes to obtain their IDs.
* Node IDs or Node names can be used for all further queries, such as error counters.
* Error counters can be queried by either the Error ID or Error name.
* Query Parameters should be defined as part of the uAPI to ensure user interface stability.
* The interface supports future extension by adding new node types and
additional attributes.
Example: List nodes using ynl
.. code-block:: bash
sudo ynl --family drm_ras --dump list-nodes
[{'device-name': '0000:03:00.0',
'node-id': 0,
'node-name': 'correctable-errors',
'node-type': 'error-counter'},
{'device-name': '0000:03:00.0',
'node-id': 1,
'node-name': 'uncorrectable-errors',
'node-type': 'error-counter'}]
Example: List all error counters using ynl
.. code-block:: bash
sudo ynl --family drm_ras --dump get-error-counter --json '{"node-id":0}'
[{'error-id': 1, 'error-name': 'error_name1', 'error-value': 0},
{'error-id': 2, 'error-name': 'error_name2', 'error-value': 0}]
Example: Query an error counter for a given node
.. code-block:: bash
sudo ynl --family drm_ras --do get-error-counter --json '{"node-id":0, "error-id":1}'
{'error-id': 1, 'error-name': 'error_name1', 'error-value': 0}
Example: Clear an error counter for a given node
.. code-block:: bash
sudo ynl --family drm_ras --do clear-error-counter --json '{"node-id":0, "error-id":1}'
None
Example: Subscribe to ``error-report`` multicast group
.. code-block:: bash
sudo ynl --family drm_ras --output-json --subscribe error-report
.. code-block:: json
{
"name": "error-event",
"msg": {
"device-name": "0000:03:00.0",
"node-id": 1,
"node-name": "uncorrectable-errors",
"error-id": 1,
"error-name": "error_name1",
"error-value": 1
}
}
Example: Query error threshold of a given counter
.. code-block:: bash
sudo ynl --family drm_ras --do get-error-threshold --json '{"node-id":0, "error-id":1}'
{'error-id': 1, 'error-name': 'error_name1', 'error-threshold': 16}
Example: Set error threshold of a given counter
.. code-block:: bash
sudo ynl --family drm_ras --do set-error-threshold --json '{"node-id":0, "error-id":1, "error-threshold":8}'
None
|