Documentation/arch/powerpc/htm.rst
.. SPDX-License-Identifier: GPL-2.0 .. _htm:
Athira Rajeev, 2 Mar 2025
.. contents:: :depth: 3
H_HTM is used as an interface for executing Hardware Trace Macro (HTM) functions, including setup, configuration, control and dumping of the HTM data. For using HTM, it is required to setup HTM buffers and HTM operations can be controlled using the H_HTM hcall. The hcall can be invoked for any core/chip of the system from within a partition itself. To use this feature, a debugfs folder called "htmdump" is present under /sys/kernel/debug/powerpc.
.. code-block:: sh
coreindexonchip htmcaps htmconfigure htmflags htminfo htmsetup htmstart htmstatus htmtype nodalchipindex nodeindex trace
Details on each file:
To see the system processor configuration details:
.. code-block:: sh
The result can be interpreted using hexdump.
To collect HTM traces for a partition represented by nodeindex as zero, nodalchipindex as 1 and coreindexonchip as 12
.. code-block:: sh
This requires a CEC reboot to get the HTM buffers allocated.
.. code-block:: sh
Above will set the htmtype and core details, followed by executing respective HTM operation.
After starting the trace collection, run the workload of interest. Stop the trace collection after required period of time, and read the trace file.
.. code-block:: sh
This trace file will contain the relevant instruction traces collected during the workload execution. And can be used as input file for trace decoders to understand data.
It is now possible to collect traces for a particular core/chip from within any partition of the system and decode it. Through this enablement, a small partition can be dedicated to collect the trace data and analyze to provide important information for Performance analysis, Software tuning, or Hardware debug.