~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/trace/stm.rst

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/trace/stm.rst (Version linux-6.11.5) and /Documentation/trace/stm.rst (Version linux-4.18.20)


  1 .. SPDX-License-Identifier: GPL-2.0            << 
  2                                                << 
  3 ===================                                 1 ===================
  4 System Trace Module                                 2 System Trace Module
  5 ===================                                 3 ===================
  6                                                     4 
  7 System Trace Module (STM) is a device describe      5 System Trace Module (STM) is a device described in MIPI STP specs as
  8 STP trace stream generator. STP (System Trace       6 STP trace stream generator. STP (System Trace Protocol) is a trace
  9 protocol multiplexing data from multiple trace      7 protocol multiplexing data from multiple trace sources, each one of
 10 which is assigned a unique pair of master and       8 which is assigned a unique pair of master and channel. While some of
 11 these masters and channels are statically allo      9 these masters and channels are statically allocated to certain
 12 hardware trace sources, others are available t     10 hardware trace sources, others are available to software. Software
 13 trace sources are usually free to pick for the     11 trace sources are usually free to pick for themselves any
 14 master/channel combination from this pool.         12 master/channel combination from this pool.
 15                                                    13 
 16 On the receiving end of this STP stream (the d     14 On the receiving end of this STP stream (the decoder side), trace
 17 sources can only be identified by master/chann     15 sources can only be identified by master/channel combination, so in
 18 order for the decoder to be able to make sense     16 order for the decoder to be able to make sense of the trace that
 19 involves multiple trace sources, it needs to b     17 involves multiple trace sources, it needs to be able to map those
 20 master/channel pairs to the trace sources that     18 master/channel pairs to the trace sources that it understands.
 21                                                    19 
 22 For instance, it is helpful to know that syslo     20 For instance, it is helpful to know that syslog messages come on
 23 master 7 channel 15, while arbitrary user appl     21 master 7 channel 15, while arbitrary user applications can use masters
 24 48 to 63 and channels 0 to 127.                    22 48 to 63 and channels 0 to 127.
 25                                                    23 
 26 To solve this mapping problem, stm class provi     24 To solve this mapping problem, stm class provides a policy management
 27 mechanism via configfs, that allows defining r     25 mechanism via configfs, that allows defining rules that map string
 28 identifiers to ranges of masters and channels.     26 identifiers to ranges of masters and channels. If these rules (policy)
 29 are consistent with what decoder expects, it w     27 are consistent with what decoder expects, it will be able to properly
 30 process the trace data.                            28 process the trace data.
 31                                                    29 
 32 This policy is a tree structure containing rul     30 This policy is a tree structure containing rules (policy_node) that
 33 have a name (string identifier) and a range of     31 have a name (string identifier) and a range of masters and channels
 34 associated with it, located in "stp-policy" su     32 associated with it, located in "stp-policy" subsystem directory in
 35 configfs. The topmost directory's name (the po     33 configfs. The topmost directory's name (the policy) is formatted as
 36 the STM device name to which this policy appli !!  34 the STM device name to which this policy applies and and arbitrary
 37 string identifier separated by a stop. From th !!  35 string identifier separated by a stop. From the examle above, a rule
 38 may look like this::                               36 may look like this::
 39                                                    37 
 40         $ ls /config/stp-policy/dummy_stm.my-p     38         $ ls /config/stp-policy/dummy_stm.my-policy/user
 41         channels masters                           39         channels masters
 42         $ cat /config/stp-policy/dummy_stm.my-     40         $ cat /config/stp-policy/dummy_stm.my-policy/user/masters
 43         48 63                                      41         48 63
 44         $ cat /config/stp-policy/dummy_stm.my-     42         $ cat /config/stp-policy/dummy_stm.my-policy/user/channels
 45         0 127                                      43         0 127
 46                                                    44 
 47 which means that the master allocation pool fo     45 which means that the master allocation pool for this rule consists of
 48 masters 48 through 63 and channel allocation p     46 masters 48 through 63 and channel allocation pool has channels 0
 49 through 127 in it. Now, any producer (trace so     47 through 127 in it. Now, any producer (trace source) identifying itself
 50 with "user" identification string will be allo     48 with "user" identification string will be allocated a master and
 51 channel from within these ranges.                  49 channel from within these ranges.
 52                                                    50 
 53 These rules can be nested, for example, one ca     51 These rules can be nested, for example, one can define a rule "dummy"
 54 under "user" directory from the example above      52 under "user" directory from the example above and this new rule will
 55 be used for trace sources with the id string o     53 be used for trace sources with the id string of "user/dummy".
 56                                                    54 
 57 Trace sources have to open the stm class devic     55 Trace sources have to open the stm class device's node and write their
 58 trace data into its file descriptor.           !!  56 trace data into its file descriptor. In order to identify themselves
 59                                                !!  57 to the policy, they need to do a STP_POLICY_ID_SET ioctl on this file
 60 In order to find an appropriate policy node fo !!  58 descriptor providing their id string. Otherwise, they will be
 61 several mechanisms can be used. First, a trace !!  59 automatically allocated a master/channel pair upon first write to this
 62 identify itself by calling an STP_POLICY_ID_SE !!  60 file descriptor according to the "default" rule of the policy, if such
 63 device's file descriptor, providing their id s !!  61 exists.
 64 any data there. Secondly, if they chose not to << 
 65 identification (because you may not want to pa << 
 66 to do this), they can just start writing the d << 
 67 stm core will try to find a policy node with t << 
 68 task's name (e.g., "syslogd") and if one exist << 
 69 Thirdly, if the task name can't be found among << 
 70 catch-all entry "default" will be used, if it  << 
 71 needs to be created and configured by the syst << 
 72 whatever tools are taking care of the policy c << 
 73 if all the above steps failed, the write() to  << 
 74 will return a error (EINVAL).                  << 
 75                                                << 
 76 Previously, if no policy nodes were found for  << 
 77 class would silently fall back to allocating t << 
 78 contiguous range of master/channels from the b << 
 79 master/channel range. The new requirement for  << 
 80 will help programmers and sysadmins identify g << 
 81 and have better control over the un-identified << 
 82                                                    62 
 83 Some STM devices may allow direct mapping of t     63 Some STM devices may allow direct mapping of the channel mmio regions
 84 to userspace for zero-copy writing. One mappab     64 to userspace for zero-copy writing. One mappable page (in terms of
 85 mmu) will usually contain multiple channels' m     65 mmu) will usually contain multiple channels' mmios, so the user will
 86 need to allocate that many channels to themsel     66 need to allocate that many channels to themselves (via the
 87 aforementioned ioctl() call) to be able to do      67 aforementioned ioctl() call) to be able to do this. That is, if your
 88 stm device's channel mmio region is 64 bytes a     68 stm device's channel mmio region is 64 bytes and hardware page size is
 89 4096 bytes, after a successful STP_POLICY_ID_S     69 4096 bytes, after a successful STP_POLICY_ID_SET ioctl() call with
 90 width==64, you should be able to mmap() one pa     70 width==64, you should be able to mmap() one page on this file
 91 descriptor and obtain direct access to an mmio     71 descriptor and obtain direct access to an mmio region for 64 channels.
 92                                                    72 
 93 Examples of STM devices are Intel(R) Trace Hub     73 Examples of STM devices are Intel(R) Trace Hub [1] and Coresight STM
 94 [2].                                               74 [2].
 95                                                    75 
 96 stm_source                                         76 stm_source
 97 ==========                                         77 ==========
 98                                                    78 
 99 For kernel-based trace sources, there is "stm_     79 For kernel-based trace sources, there is "stm_source" device
100 class. Devices of this class can be connected      80 class. Devices of this class can be connected and disconnected to/from
101 stm devices at runtime via a sysfs attribute c     81 stm devices at runtime via a sysfs attribute called "stm_source_link"
102 by writing the name of the desired stm device      82 by writing the name of the desired stm device there, for example::
103                                                    83 
104         $ echo dummy_stm.0 > /sys/class/stm_so     84         $ echo dummy_stm.0 > /sys/class/stm_source/console/stm_source_link
105                                                    85 
106 For examples on how to use stm_source interfac     86 For examples on how to use stm_source interface in the kernel, refer
107 to stm_console, stm_heartbeat or stm_ftrace dr     87 to stm_console, stm_heartbeat or stm_ftrace drivers.
108                                                    88 
109 Each stm_source device will need to assume a m     89 Each stm_source device will need to assume a master and a range of
110 channels, depending on how many channels it re     90 channels, depending on how many channels it requires. These are
111 allocated for the device according to the poli     91 allocated for the device according to the policy configuration. If
112 there's a node in the root of the policy direc     92 there's a node in the root of the policy directory that matches the
113 stm_source device's name (for example, "consol     93 stm_source device's name (for example, "console"), this node will be
114 used to allocate master and channel numbers. I     94 used to allocate master and channel numbers. If there's no such policy
115 node, the stm core will use the catch-all entr !!  95 node, the stm core will pick the first contiguous chunk of channels
116 exists. If neither policy nodes exist, the wri !!  96 within the first available master. Note that the node must exist
117 will return an error.                          !!  97 before the stm_source device is connected to its stm device.
118                                                    98 
119 stm_console                                        99 stm_console
120 ===========                                       100 ===========
121                                                   101 
122 One implementation of this interface also used    102 One implementation of this interface also used in the example above is
123 the "stm_console" driver, which basically prov    103 the "stm_console" driver, which basically provides a one-way console
124 for kernel messages over an stm device.           104 for kernel messages over an stm device.
125                                                   105 
126 To configure the master/channel pair that will    106 To configure the master/channel pair that will be assigned to this
127 console in the STP stream, create a "console"     107 console in the STP stream, create a "console" policy entry (see the
128 beginning of this text on how to do that). Whe    108 beginning of this text on how to do that). When initialized, it will
129 consume one channel.                              109 consume one channel.
130                                                   110 
131 stm_ftrace                                        111 stm_ftrace
132 ==========                                        112 ==========
133                                                   113 
134 This is another "stm_source" device, once the     114 This is another "stm_source" device, once the stm_ftrace has been
135 linked with an stm device, and if "function" t    115 linked with an stm device, and if "function" tracer is enabled,
136 function address and parent function address w    116 function address and parent function address which Ftrace subsystem
137 would store into ring buffer will be exported     117 would store into ring buffer will be exported via the stm device at
138 the same time.                                    118 the same time.
139                                                   119 
140 Currently only Ftrace "function" tracer is sup    120 Currently only Ftrace "function" tracer is supported.
141                                                   121 
142 * [1] https://software.intel.com/sites/default    122 * [1] https://software.intel.com/sites/default/files/managed/d3/3c/intel-th-developer-manual.pdf
143 * [2] http://infocenter.arm.com/help/index.jsp    123 * [2] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0444b/index.html
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php