<!DOCTYPE html>
<html lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>AMDGPU RAS Support — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=3918102e" />
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=9bcbadda"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="GPU Power/Thermal Controls and Monitoring" href="thermal.html" />
<link rel="prev" title="AMDGPU XGMI Support" href="xgmi.html" />
<link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../subsystem-apis.html#human-interfaces">Human interfaces</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../../input/index.html">Input Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../hid/index.html">Human Interface Devices (HID)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../sound/index.html">Sound Subsystem Documentation</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../index.html">GPU Driver Developer’s Guide</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../fb/index.html">Frame Buffer</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../leds/index.html">LEDs</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#networking-interfaces">Networking interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#storage-interfaces">Storage interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#other-subsystems">Other subsystems</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/gpu/amdgpu/ras.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="amdgpu-ras-support">
<h1>AMDGPU RAS Support<a class="headerlink" href="#amdgpu-ras-support" title="Link to this heading">¶</a></h1>
<p>The AMDGPU RAS interfaces are exposed via sysfs (for informational queries) and
debugfs (for error injection).</p>
<section id="ras-debugfs-sysfs-control-and-error-injection-interfaces">
<h2>RAS debugfs/sysfs Control and Error Injection Interfaces<a class="headerlink" href="#ras-debugfs-sysfs-control-and-error-injection-interfaces" title="Link to this heading">¶</a></h2>
<p>The control interface accepts <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">ras_debug_if</span></code> which has two members.</p>
<p>First member: ras_debug_if::head or ras_debug_if::inject.</p>
<p>head is used to indicate which IP block will be under control.</p>
<p>head has four members, they are block, type, sub_block_index, name.
block: which IP will be under control.
type: what kind of error will be enabled/disabled/injected.
sub_block_index: some IPs have subcomponets. say, GFX, sDMA.
name: the name of IP.</p>
<p>inject has three more members than head, they are address, value and mask.
As their names indicate, inject operation will write the
value to the address.</p>
<p>The second member: <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">ras_debug_if</span></code>::op.
It has three kinds of operations.</p>
<ul class="simple">
<li><p>0: disable RAS on the block. Take ::head as its data.</p></li>
<li><p>1: enable RAS on the block. Take ::head as its data.</p></li>
<li><p>2: inject errors on the block. Take ::inject as its data.</p></li>
</ul>
<p>How to use the interface?</p>
<p>In a program</p>
<p>Copy the <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">ras_debug_if</span></code> in your code and initialize it.
Write the <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">to</span></code> the control interface.</p>
<p>From shell</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">echo</span><span class="w"> </span><span class="s2">"disable <block>"</span><span class="w"> </span>><span class="w"> </span>/sys/kernel/debug/dri/<N>/ras/ras_ctrl
<span class="nb">echo</span><span class="w"> </span><span class="s2">"enable <block> <error>"</span><span class="w"> </span>><span class="w"> </span>/sys/kernel/debug/dri/<N>/ras/ras_ctrl
<span class="nb">echo</span><span class="w"> </span><span class="s2">"inject <block> <error> <sub-block> <address> <value> <mask>"</span><span class="w"> </span>><span class="w"> </span>/sys/kernel/debug/dri/<N>/ras/ras_ctrl
</pre></div>
</div>
<p>Where N, is the card which you want to affect.</p>
<p>“disable” requires only the block.
“enable” requires the block and error type.
“inject” requires the block, error type, address, and value.</p>
<dl class="simple">
<dt>The block is one of: umc, sdma, gfx, etc.</dt><dd><p>see ras_block_string[] for details</p>
</dd>
<dt>The error type is one of: ue, ce and poison where,</dt><dd><p>ue is multi-uncorrectable
ce is single-correctable
poison is poison</p>
</dd>
</dl>
<p>The sub-block is a the sub-block index, pass 0 if there is no sub-block.
The address and value are hexadecimal numbers, leading 0x is optional.
The mask means instance mask, is optional, default value is 0x1.</p>
<p>For instance,</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">echo</span><span class="w"> </span>inject<span class="w"> </span>umc<span class="w"> </span>ue<span class="w"> </span>0x0<span class="w"> </span>0x0<span class="w"> </span>0x0<span class="w"> </span>><span class="w"> </span>/sys/kernel/debug/dri/0/ras/ras_ctrl
<span class="nb">echo</span><span class="w"> </span>inject<span class="w"> </span>umc<span class="w"> </span>ce<span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="m">3</span><span class="w"> </span>><span class="w"> </span>/sys/kernel/debug/dri/0/ras/ras_ctrl
<span class="nb">echo</span><span class="w"> </span>disable<span class="w"> </span>umc<span class="w"> </span>><span class="w"> </span>/sys/kernel/debug/dri/0/ras/ras_ctrl
</pre></div>
</div>
<p>How to check the result of the operation?</p>
<p>To check disable/enable, see “ras” features at,
/sys/class/drm/card[0/1/2...]/device/ras/features</p>
<p>To check inject, see the corresponding error count at,
/sys/class/drm/card[0/1/2...]/device/ras/[gfx|sdma|umc|...]_err_count</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Operations are only allowed on blocks which are supported.
Check the “ras” mask at /sys/module/amdgpu/parameters/ras_mask
to see which blocks support RAS on a particular asic.</p>
</div>
</section>
<section id="ras-reboot-behavior-for-unrecoverable-errors">
<h2>RAS Reboot Behavior for Unrecoverable Errors<a class="headerlink" href="#ras-reboot-behavior-for-unrecoverable-errors" title="Link to this heading">¶</a></h2>
<p>Normally when there is an uncorrectable error, the driver will reset
the GPU to recover. However, in the event of an unrecoverable error,
the driver provides an interface to reboot the system automatically
in that event.</p>
<p>The following file in debugfs provides that interface:
/sys/kernel/debug/dri/[0/1/2...]/ras/auto_reboot</p>
<p>Usage:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">echo</span><span class="w"> </span><span class="nb">true</span><span class="w"> </span>><span class="w"> </span>.../ras/auto_reboot
</pre></div>
</div>
</section>
<section id="ras-error-count-sysfs-interface">
<h2>RAS Error Count sysfs Interface<a class="headerlink" href="#ras-error-count-sysfs-interface" title="Link to this heading">¶</a></h2>
<p>It allows the user to read the error count for each IP block on the gpu through
/sys/class/drm/card[0/1/2...]/device/ras/[gfx/sdma/...]_err_count</p>
<p>It outputs the multiple lines which report the uncorrected (ue) and corrected
(ce) error counts.</p>
<p>The format of one line is below,</p>
<p>[ce|ue]: count</p>
<p>Example:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>ue:<span class="w"> </span><span class="m">0</span>
ce:<span class="w"> </span><span class="m">1</span>
</pre></div>
</div>
</section>
<section id="ras-eeprom-debugfs-interface">
<h2>RAS EEPROM debugfs Interface<a class="headerlink" href="#ras-eeprom-debugfs-interface" title="Link to this heading">¶</a></h2>
<p>Some boards contain an EEPROM which is used to persistently store a list of
bad pages which experiences ECC errors in vram. This interface provides
a way to reset the EEPROM, e.g., after testing error injection.</p>
<p>Usage:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">echo</span><span class="w"> </span><span class="m">1</span><span class="w"> </span>><span class="w"> </span>../ras/ras_eeprom_reset
</pre></div>
</div>
<p>will reset EEPROM table to 0 entries.</p>
</section>
<section id="ras-vram-bad-pages-sysfs-interface">
<h2>RAS VRAM Bad Pages sysfs Interface<a class="headerlink" href="#ras-vram-bad-pages-sysfs-interface" title="Link to this heading">¶</a></h2>
<p>It allows user to read the bad pages of vram on the gpu through
/sys/class/drm/card[0/1/2...]/device/ras/gpu_vram_bad_pages</p>
<p>It outputs multiple lines, and each line stands for one gpu page.</p>
<p>The format of one line is below,
gpu pfn : gpu page size : flags</p>
<p>gpu pfn and gpu page size are printed in hex format.
flags can be one of below character,</p>
<p>R: reserved, this gpu page is reserved and not able to use.</p>
<p>P: pending for reserve, this gpu page is marked as bad, will be reserved
in next window of page_reserve.</p>
<p>F: unable to reserve. this gpu page can’t be reserved due to some reasons.</p>
<p>Examples:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>0x00000001<span class="w"> </span>:<span class="w"> </span>0x00001000<span class="w"> </span>:<span class="w"> </span>R
0x00000002<span class="w"> </span>:<span class="w"> </span>0x00001000<span class="w"> </span>:<span class="w"> </span>P
</pre></div>
</div>
</section>
<section id="sample-code">
<h2>Sample Code<a class="headerlink" href="#sample-code" title="Link to this heading">¶</a></h2>
<p>Sample code for testing error injection can be found here:
<a class="reference external" href="https://cgit.freedesktop.org/mesa/drm/tree/tests/amdgpu/ras_tests.c">https://cgit.freedesktop.org/mesa/drm/tree/tests/amdgpu/ras_tests.c</a></p>
<p>This is part of the libdrm amdgpu unit tests which cover several areas of the GPU.
There are four sets of tests:</p>
<p>RAS Basic Test</p>
<p>The test verifies the RAS feature enabled status and makes sure the necessary sysfs and debugfs files
are present.</p>
<p>RAS Query Test</p>
<p>This test checks the RAS availability and enablement status for each supported IP block as well as
the error counts.</p>
<p>RAS Inject Test</p>
<p>This test injects errors for each IP.</p>
<p>RAS Disable Test</p>
<p>This test tests disabling of RAS features for each IP block.</p>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../../_sources/gpu/amdgpu/ras.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>