€•BQŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ/translations/zh_CN/trace/stm”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/zh_TW/trace/stm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/it_IT/trace/stm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/ja_JP/trace/stm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/ko_KR/trace/stm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/sp_SP/trace/stm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh£sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1h¡hhhžhhŸŒ7/var/lib/git/docbuild/linux/Documentation/trace/stm.rst”h KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒSystem Trace Module”h]”hŒSystem Trace Module”…””}”(hh»hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hh¶hžhhŸh³h KubhŒ paragraph”“”)”}”(hX÷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.”h]”hX÷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.”…””}”(hhËhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khh¶hžhubhÊ)”}”(hXGOn 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.”h]”hXGOn 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.”…””}”(hhÙhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khh¶hžhubhÊ)”}”(hŒ§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.”h]”hŒ§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.”…””}”(hhçhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khh¶hžhubhÊ)”}”(hX-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.”h]”hX-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.”…””}”(hhõhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khh¶hžhubhÊ)”}”(hX«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::”h]”hX°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:”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K hh¶hžhubhŒ literal_block”“”)”}”(hŒÂ$ 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”h]”hŒÂ$ 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”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”h±h²uh1jhŸh³h K(hh¶hžhubhÊ)”}”(hX0which 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.”h]”hX4which 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.”…””}”(hj!hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K/hh¶hžhubhÊ)”}”(hŒÈ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".”h]”hŒÔ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â€.”…””}”(hj/hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K5hh¶hžhubhÊ)”}”(hŒkTrace sources have to open the stm class device's node and write their trace data into its file descriptor.”h]”hŒmTrace sources have to open the stm class device’s node and write their trace data into its file descriptor.”…””}”(hj=hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K9hh¶hžhubhÊ)”}”(hXà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).”h]”hXî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).”…””}”(hjKhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K /sys/class/stm_source/console/stm_source_link”h]”hŒB$ echo dummy_stm.0 > /sys/class/stm_source/console/stm_source_link”…””}”hj¢sbah}”(h]”h ]”h"]”h$]”h&]”h±h²uh1jhŸh³h KhhjƒhžhubhÊ)”}”(hŒyFor examples on how to use stm_source interface in the kernel, refer to stm_console, stm_heartbeat or stm_ftrace drivers.”h]”hŒyFor examples on how to use stm_source interface in the kernel, refer to stm_console, stm_heartbeat or stm_ftrace drivers.”…””}”(hj°hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KjhjƒhžhubhÊ)”}”(hX3Each 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.”h]”hXAEach 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.”…””}”(hj¾hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Kmhjƒhžhubeh}”(h]”Œ stm-source”ah ]”h"]”Œ stm_source”ah$]”h&]”uh1h´hh¶hžhhŸh³h Kaubhµ)”}”(hhh]”(hº)”}”(hŒ stm_console”h]”hŒ stm_console”…””}”(hj×hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjÔhžhhŸh³h KxubhÊ)”}”(hŒ³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.”h]”hŒ·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.”…””}”(hjåhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KzhjÔhžhubhÊ)”}”(hŒà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.”h]”hŒä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.”…””}”(hjóhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K~hjÔhžhubeh}”(h]”Œ stm-console”ah ]”h"]”Œ stm_console”ah$]”h&]”uh1h´hh¶hžhhŸh³h Kxubhµ)”}”(hhh]”(hº)”}”(hŒ stm_ftrace”h]”hŒ stm_ftrace”…””}”(hj hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj hžhhŸh³h K„ubhÊ)”}”(hXThis 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.”h]”hX 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.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K†hj hžhubhÊ)”}”(hŒ5Currently only Ftrace "function" tracer is supported.”h]”hŒ9Currently only Ftrace “function†tracer is supported.”…””}”(hj(hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KŒhj hžhubhŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ^[1] https://software.intel.com/sites/default/files/managed/d3/3c/intel-th-developer-manual.pdf”h]”hÊ)”}”(hj?h]”(hŒ[1] ”…””}”(hjAhžhhŸNh NubhŒ reference”“”)”}”(hŒZhttps://software.intel.com/sites/default/files/managed/d3/3c/intel-th-developer-manual.pdf”h]”hŒZhttps://software.intel.com/sites/default/files/managed/d3/3c/intel-th-developer-manual.pdf”…””}”(hjJhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jLuh1jHhjAubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KŽhj=ubah}”(h]”h ]”h"]”h$]”h&]”uh1j;hj8hžhhŸh³h Nubj<)”}”(hŒS[2] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0444b/index.html”h]”hÊ)”}”(hjgh]”(hŒ[2] ”…””}”(hjihžhhŸNh NubjI)”}”(hŒOhttp://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0444b/index.html”h]”hŒOhttp://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0444b/index.html”…””}”(hjphžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jruh1jHhjiubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khjeubah}”(h]”h ]”h"]”h$]”h&]”uh1j;hj8hžhhŸh³h Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ*”uh1j6hŸh³h KŽhj hžhubeh}”(h]”Œ stm-ftrace”ah ]”h"]”Œ stm_ftrace”ah$]”h&]”uh1h´hh¶hžhhŸh³h K„ubeh}”(h]”Œsystem-trace-module”ah ]”h"]”Œsystem trace module”ah$]”h&]”uh1h´hhhžhhŸh³h Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”h³uh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(h¹NŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jÆŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”h³Œ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j jjÑjÎjjj˜j•uŒ nametypes”}”(j ‰jщj‰j˜‰uh}”(jh¶jÎjƒjjÔj•j uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nhžhub.