Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe: Improve devcoredump documentation

Let the introduction be useful for both userspace and kernel. Also
improve the formatting to wire up later to the documentation build.

Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241102161254.1818604-2-lucas.demarchi@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

+30 -21
+30 -21
drivers/gpu/drm/xe/xe_devcoredump.c
··· 29 29 /** 30 30 * DOC: Xe device coredump 31 31 * 32 - * Devices overview: 33 32 * Xe uses dev_coredump infrastructure for exposing the crash errors in a 34 - * standardized way. 35 - * devcoredump exposes a temporary device under /sys/class/devcoredump/ 36 - * which is linked with our card device directly. 37 - * The core dump can be accessed either from 38 - * /sys/class/drm/card<n>/device/devcoredump/ or from 39 - * /sys/class/devcoredump/devcd<m> where 40 - * /sys/class/devcoredump/devcd<m>/failing_device is a link to 41 - * /sys/class/drm/card<n>/device/. 33 + * standardized way. Once a crash occurs, devcoredump exposes a temporary 34 + * node under ``/sys/class/devcoredump/devcd<m>/``. The same node is also 35 + * accessible in ``/sys/class/drm/card<n>/device/devcoredump/``. The 36 + * ``failing_device`` symlink points to the device that crashed and created the 37 + * coredump. 42 38 * 43 - * Snapshot at hang: 44 - * The 'data' file is printed with a drm_printer pointer at devcoredump read 45 - * time. For this reason, we need to take snapshots from when the hang has 46 - * happened, and not only when the user is reading the file. Otherwise the 47 - * information is outdated since the resets might have happened in between. 39 + * The following characteristics are observed by xe when creating a device 40 + * coredump: 48 41 * 49 - * 'First' failure snapshot: 50 - * In general, the first hang is the most critical one since the following hangs 51 - * can be a consequence of the initial hang. For this reason we only take the 52 - * snapshot of the 'first' failure and ignore subsequent calls of this function, 53 - * at least while the coredump device is alive. Dev_coredump has a delayed work 54 - * queue that will eventually delete the device and free all the dump 55 - * information. 42 + * **Snapshot at hang**: 43 + * The 'data' file contains a snapshot of the HW and driver states at the time 44 + * the hang happened. Due to the driver recovering from resets/crashes, it may 45 + * not correspond to the state of the system when the file is read by 46 + * userspace. 47 + * 48 + * **Coredump release**: 49 + * After a coredump is generated, it stays in kernel memory until released by 50 + * userpace by writing anything to it, or after an internal timer expires. The 51 + * exact timeout may vary and should not be relied upon. Example to release 52 + * a coredump: 53 + * 54 + * .. code-block:: shell 55 + * 56 + * $ > /sys/class/drm/card0/device/devcoredump/data 57 + * 58 + * **First failure only**: 59 + * In general, the first hang is the most critical one since the following 60 + * hangs can be a consequence of the initial hang. For this reason a snapshot 61 + * is taken only for the first failure. Until the devcoredump is released by 62 + * userspace or kernel, all subsequent hangs do not override the snapshot nor 63 + * create new ones. Devcoredump has a delayed work queue that will eventually 64 + * delete the file node and free all the dump information. 56 65 */ 57 66 58 67 #ifdef CONFIG_DEV_COREDUMP