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