All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] docs: tracing: use refs for cross-referencing
@ 2022-03-13 10:55 Roland Hieber
  2022-03-13 10:55 ` [PATCH 2/3] docs: trace: bring headings in order Roland Hieber
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Roland Hieber @ 2022-03-13 10:55 UTC (permalink / raw)
  To: Jonathan Corbet, Steven Rostedt, Ingo Molnar, Daniel Bristot de Oliveira
  Cc: linux-doc, Roland Hieber

Help cross-linking the documents by using the :ref: role.

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
PATCH v2:
 * new in v2

 Documentation/trace/events.rst          | 25 ++++++++++------
 Documentation/trace/ftrace.rst          | 38 ++++++++++++++++---------
 Documentation/trace/kprobetrace.rst     |  2 +-
 Documentation/trace/timerlat-tracer.rst |  6 ++--
 4 files changed, 46 insertions(+), 25 deletions(-)

diff --git a/Documentation/trace/events.rst b/Documentation/trace/events.rst
index c47f381d0c00..e83d0d5378be 100644
--- a/Documentation/trace/events.rst
+++ b/Documentation/trace/events.rst
@@ -20,6 +20,8 @@ tracing information should be printed.
 2. Using Event Tracing
 ======================
 
+.. _tracing_set_event_interface:
+
 2.1 Via the 'set_event' interface
 ---------------------------------
 
@@ -91,21 +93,23 @@ In order to facilitate early boot debugging, use boot option::
 
 	trace_event=[event-list]
 
-event-list is a comma separated list of events. See section 2.1 for event
-format.
+event-list is a comma separated list of events. See
+:ref:`tracing_set_event_interface` for event format.
 
 3. Defining an event-enabled tracepoint
 =======================================
 
 See The example provided in samples/trace_events
 
+.. _tracing_event_formats:
+
 4. Event formats
 ================
 
 Each trace event has a 'format' file associated with it that contains
 a description of each field in a logged event.  This information can
 be used to parse the binary trace stream, and is also the place to
-find the field names that can be used in event filters (see section 5).
+find the field names that can be used in :ref:`event filters <tracing_event_filters>`.
 
 It also displays the format string that will be used to print the
 event in text mode, along with the event name and ID used for
@@ -150,6 +154,8 @@ This event contains 10 fields, the first 5 common and the remaining 5
 event-specific.  All the fields for this event are numeric, except for
 'comm' which is a string, a distinction important for event filtering.
 
+.. _tracing_event_filters:
+
 5. Event filtering
 ==================
 
@@ -178,7 +184,7 @@ double-quotes can be used to prevent the shell from interpreting
 operators as shell metacharacters.
 
 The field-names available for use in filters can be found in the
-'format' files for trace events (see section 4).
+'format' files for trace events (see :ref:`tracing_event_filters`).
 
 The relational-operators depend on the type of the field being tested:
 
@@ -324,6 +330,7 @@ To add more PIDs without losing the PIDs already included, use '>>'.
 
 	# echo 123 244 1 >> set_event_pid
 
+.. _tracing_event_triggers:
 
 6. Event triggers
 =================
@@ -335,7 +342,7 @@ a stack trace whenever the trace event is hit.  Whenever a trace event
 with attached triggers is invoked, the set of trigger commands
 associated with that event is invoked.  Any given trigger can
 additionally have an event filter of the same form as described in
-section 5 (Event filtering) associated with it - the command will only
+:ref:`tracing_event_filters` associated with it - the command will only
 be invoked if the event being invoked passes the associated filter.
 If no filter is associated with the trigger, it always passes.
 
@@ -356,8 +363,8 @@ enabled, and also allows the current event filter implementation to be
 used for conditionally invoking triggers.
 
 The syntax for event triggers is roughly based on the syntax for
-set_ftrace_filter 'ftrace filter commands' (see the 'Filter commands'
-section of Documentation/trace/ftrace.rst), but there are major
+set_ftrace_filter 'ftrace filter commands' (see the section
+:ref:`ftrace_filter_commands`), but there are major
 differences and the implementation isn't currently tied to it in any
 way, so beware about making generalizations between the two.
 
@@ -382,8 +389,8 @@ The [if filter] part isn't used in matching commands when removing, so
 leaving that off in a '!' command will accomplish the same thing as
 having it in.
 
-The filter syntax is the same as that described in the 'Event
-filtering' section above.
+The filter syntax is the same as that described in the section
+:ref:`tracing_event_filters` above.
 
 For ease of use, writing to the trigger file using '>' currently just
 adds or removes a single trigger and there's no explicit '>>' support
diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst
index 45b8c56af67a..d018bd332200 100644
--- a/Documentation/trace/ftrace.rst
+++ b/Documentation/trace/ftrace.rst
@@ -42,6 +42,7 @@ Implementation Details
 
 See Documentation/trace/ftrace-design.rst for details for arch porters and such.
 
+.. _ftrace_the_file_system:
 
 The File System
 ---------------
@@ -223,7 +224,7 @@ of ftrace. Here is a list of some of the key files:
   set_ftrace_filter:
 
 	When dynamic ftrace is configured in (see the
-	section below "dynamic ftrace"), the code is dynamically
+	section :ref:`ftrace_dynamic_ftrace`), the code is dynamically
 	modified (code text rewrite) to disable calling of the
 	function profiler (mcount). This lets tracing be configured
 	in with practically no overhead in performance.  This also
@@ -237,7 +238,7 @@ of ftrace. Here is a list of some of the key files:
 	can be written into this file.
 
 	This interface also allows for commands to be used. See the
-	"Filter commands" section for more details.
+	:ref:`ftrace_dynamic_ftrace` section for more details.
 
 	As a speed up, since processing strings can be quite expensive
 	and requires a check of all functions registered to tracing, instead
@@ -305,7 +306,7 @@ of ftrace. Here is a list of some of the key files:
 
 	Functions listed in this file will cause the function graph
 	tracer to only trace these functions and the functions that
-	they call. (See the section "dynamic ftrace" for more details).
+	they call. (See the section :ref:`ftrace_dynamic_ftrace` for more details).
 	Note, set_ftrace_filter and set_ftrace_notrace still affects
 	what functions are being traced.
 
@@ -322,7 +323,7 @@ of ftrace. Here is a list of some of the key files:
 	These are the function names that you can pass to
 	"set_ftrace_filter", "set_ftrace_notrace",
 	"set_graph_function", or "set_graph_notrace".
-	(See the section "dynamic ftrace" below for more details.)
+	(See the section :ref:`ftrace_dynamic_ftrace` for more details.)
 
   dyn_ftrace_total_info:
 
@@ -426,19 +427,19 @@ of ftrace. Here is a list of some of the key files:
 
 	This displays the "snapshot" buffer and also lets the user
 	take a snapshot of the current running trace.
-	See the "Snapshot" section below for more details.
+	See the section :ref:`ftrace_snapshot` below for more details.
 
   stack_max_size:
 
 	When the stack tracer is activated, this will display the
 	maximum stack size it has encountered.
-	See the "Stack Trace" section below.
+	See the section :ref:`ftrace_stack_trace` below.
 
   stack_trace:
 
 	This displays the stack back trace of the largest stack
 	that was encountered when the stack tracer is activated.
-	See the "Stack Trace" section below.
+	See the section :ref:`ftrace_stack_trace` below.
 
   stack_trace_filter:
 
@@ -578,7 +579,7 @@ of ftrace. Here is a list of some of the key files:
 
 	This is a way to make multiple trace buffers where different
 	events can be recorded in different buffers.
-	See "Instances" section below.
+	See section :ref:`ftrace_instances` below.
 
   events:
 
@@ -630,7 +631,7 @@ of ftrace. Here is a list of some of the key files:
   hwlat_detector:
 
 	Directory for the Hardware Latency Detector.
-	See "Hardware Latency Detector" section below.
+	See section :ref:`ftrace_hardware_latency_detector` below.
 
   per_cpu:
 
@@ -739,7 +740,7 @@ Here is the list of current tracers that may be configured.
   "hwlat"
 
 	The Hardware Latency tracer is used to detect if the hardware
-	produces any latency. See "Hardware Latency Detector" section
+	produces any latency. See section :ref:`ftrace_hardware_latency_detector`
 	below.
 
   "irqsoff"
@@ -2156,6 +2157,8 @@ events.
     <idle>-0       2d..3    6us :      0:120:R ==> [002]  5882: 94:R sleep
 
 
+.. _ftrace_hardware_latency_detector:
+
 Hardware Latency Detector
 -------------------------
 
@@ -2258,7 +2261,7 @@ function
 This tracer is the function tracer. Enabling the function tracer
 can be done from the debug file system. Make sure the
 ftrace_enabled is set; otherwise this tracer is a nop.
-See the "ftrace_enabled" section below.
+See the :ref:`ftrace_ftrace_enabled` section below.
 ::
 
   # sysctl kernel.ftrace_enabled=1
@@ -2679,6 +2682,8 @@ You might find other useful features for this tracer in the
 following "dynamic ftrace" section such as tracing only specific
 functions or tasks.
 
+.. _ftrace_dynamic_ftrace:
+
 dynamic ftrace
 --------------
 
@@ -3029,6 +3034,7 @@ this special filter via::
 
  echo > set_graph_function
 
+.. _ftrace_ftrace_enabled:
 
 ftrace_enabled
 --------------
@@ -3053,6 +3059,7 @@ This can be disable (and enabled) with::
   echo 0 > /proc/sys/kernel/ftrace_enabled
   echo 1 > /proc/sys/kernel/ftrace_enabled
 
+.. _ftrace_filter_commands:
 
 Filter commands
 ---------------
@@ -3281,6 +3288,8 @@ This is where the buffer_total_size_kb is useful:
 Writing to the top level buffer_size_kb will reset all the buffers
 to be the same again.
 
+.. _ftrace_snapshot:
+
 Snapshot
 --------
 CONFIG_TRACER_SNAPSHOT makes a generic snapshot feature
@@ -3303,8 +3312,8 @@ feature:
 	of the snapshot. Echo 1 into this file to allocate a
 	spare buffer and to take a snapshot (swap), then read
 	the snapshot from this file in the same format as
-	"trace" (described above in the section "The File
-	System"). Both reads snapshot and tracing are executable
+	"trace" (described above in the section :ref:`ftrace_the_file_system`).
+	Both reads snapshot and tracing are executable
 	in parallel. When the spare buffer is allocated, echoing
 	0 frees it, and echoing else (positive) values clear the
 	snapshot contents.
@@ -3367,6 +3376,7 @@ one of the latency tracers, you will get the following results.
   # cat snapshot
   cat: snapshot: Device or resource busy
 
+.. _ftrace_instances:
 
 Instances
 ---------
@@ -3495,6 +3505,8 @@ Note, if a process has a trace file open in one of the instance
 directories, the rmdir will fail with EBUSY.
 
 
+.. _ftrace_stack_trace:
+
 Stack trace
 -----------
 Since the kernel has a fixed sized stack, it is important not to
diff --git a/Documentation/trace/kprobetrace.rst b/Documentation/trace/kprobetrace.rst
index b175d88f31eb..8c903e39bdf2 100644
--- a/Documentation/trace/kprobetrace.rst
+++ b/Documentation/trace/kprobetrace.rst
@@ -141,7 +141,7 @@ id:
 
 trigger:
   This allows to install trigger commands which are executed when the event is
-  hit (for details, see Documentation/trace/events.rst, section 6).
+  hit (for details, see :ref:`tracing_event_triggers`).
 
 Event Profiling
 ---------------
diff --git a/Documentation/trace/timerlat-tracer.rst b/Documentation/trace/timerlat-tracer.rst
index 64d1fe6e9b93..92bfc3729025 100644
--- a/Documentation/trace/timerlat-tracer.rst
+++ b/Documentation/trace/timerlat-tracer.rst
@@ -96,8 +96,8 @@ For example::
 
 In this case, the root cause of the timer latency does not point to a
 single cause but to multiple ones. Firstly, the timer IRQ was delayed
-for 13 us, which may point to a long IRQ disabled section (see IRQ
-stacktrace section). Then the timer interrupt that wakes up the timerlat
+for 13 us, which may point to a long IRQ disabled section (see section
+:ref:`timerlat_tracer_irq_stacktrace`). Then the timer interrupt that wakes up the timerlat
 thread took 7597 ns, and the qxl:21 device IRQ took 7139 ns. Finally,
 the cc1 thread noise took 9909 ns of time before the context switch.
 Such pieces of evidence are useful for the developer to use other
@@ -133,6 +133,8 @@ in the timelines means circa 1 us, and the time moves ==>::
                             |          +-> irq_noise: 6139 ns
                             +-> irq_noise: 7597 ns
 
+.. _timerlat_tracer_irq_stacktrace:
+
 IRQ stacktrace
 ---------------------------
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] docs: trace: bring headings in order
  2022-03-13 10:55 [PATCH 1/3] docs: tracing: use refs for cross-referencing Roland Hieber
@ 2022-03-13 10:55 ` Roland Hieber
  2022-03-14  0:01   ` Steven Rostedt
  2022-03-13 10:55 ` [PATCH 3/3] docs: trace: events: apply literal markup Roland Hieber
  2022-03-13 23:55 ` [PATCH 1/3] docs: tracing: use refs for cross-referencing Steven Rostedt
  2 siblings, 1 reply; 10+ messages in thread
From: Roland Hieber @ 2022-03-13 10:55 UTC (permalink / raw)
  To: Jonathan Corbet, Steven Rostedt, Ingo Molnar, Daniel Bristot de Oliveira
  Cc: linux-doc, Roland Hieber

First, apply the correct heading level based on the section numbering.

Then remove leading section numbers altogether, since they can quickly
get out of order when done manually (see the double "5.3" in events.rst,
and the out-of-order numbering in histogram.rst, where even some
sections are numbered and others are not). Finally, section numbers are
autogenerated anyways in the PDF builds, leading to strange doubly
numerated sections like "14.2.3 6.2 ‘hist’ trigger examples".

In kprobetrace.rst, the now dangling reference is in a literal section
where :ref: roles are not parsed (and the whole section could benefit
from being transformed into reST list syntax, which is however not the
focus of this patch); so replace the now invisible section number with
the section title instead.

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
PATCH v1: https://lore.kernel.org/all/20200609141027.21508-1-rhi@pengutronix.de

PATCH v1 -> v2:
 - rebase to current master
 - split up the patch into a three-patch series
 - introduce refs for cross-referencing (feedback by Jonathan Corbet)
   (see previous patch in this series)
 - dangling reference in kprobetrace.rst, see above

---
 Documentation/trace/events-kmem.rst         | 20 ++---
 Documentation/trace/events-power.rst        | 18 ++--
 Documentation/trace/events.rst              | 96 ++++++++++-----------
 Documentation/trace/ftrace.rst              |  2 +-
 Documentation/trace/histogram.rst           | 32 +++----
 Documentation/trace/kprobetrace.rst         |  3 +-
 Documentation/trace/tracepoint-analysis.rst | 56 ++++++------
 7 files changed, 114 insertions(+), 113 deletions(-)

diff --git a/Documentation/trace/events-kmem.rst b/Documentation/trace/events-kmem.rst
index 68fa75247488..0e8904be15a3 100644
--- a/Documentation/trace/events-kmem.rst
+++ b/Documentation/trace/events-kmem.rst
@@ -14,8 +14,8 @@ within the kernel. Broadly speaking there are five major subheadings.
 This document describes what each of the tracepoints is and why they
 might be useful.
 
-1. Slab allocation of small objects of unknown type
-===================================================
+Slab allocation of small objects of unknown type
+================================================
 ::
 
   kmalloc		call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s
@@ -29,8 +29,8 @@ kmalloc with kfree, it may be possible to identify memory leaks and where
 the allocation sites were.
 
 
-2. Slab allocation of small objects of known type
-=================================================
+Slab allocation of small objects of known type
+==============================================
 ::
 
   kmem_cache_alloc	call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s
@@ -42,8 +42,8 @@ it is likely easier to pin the event down to a specific cache. At the time
 of writing, no information is available on what slab is being allocated from,
 but the call_site can usually be used to extrapolate that information.
 
-3. Page allocation
-==================
+Page allocation
+===============
 ::
 
   mm_page_alloc		  page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s
@@ -71,8 +71,8 @@ freed in batch with a page list. Significant amounts of activity here could
 indicate that the system is under memory pressure and can also indicate
 contention on the lruvec->lru_lock.
 
-4. Per-CPU Allocator Activity
-=============================
+Per-CPU Allocator Activity
+==========================
 ::
 
   mm_page_alloc_zone_locked	page=%p pfn=%lu order=%u migratetype=%d cpu=%d percpu_refill=%d
@@ -100,8 +100,8 @@ and drains on another could be a factor in causing large amounts of cache
 line bounces due to writes between CPUs and worth investigating if pages
 can be allocated and freed on the same CPU through some algorithm change.
 
-5. External Fragmentation
-=========================
+External Fragmentation
+======================
 ::
 
   mm_page_alloc_extfrag		page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d
diff --git a/Documentation/trace/events-power.rst b/Documentation/trace/events-power.rst
index f45bf11fa88d..1f60cfd03c97 100644
--- a/Documentation/trace/events-power.rst
+++ b/Documentation/trace/events-power.rst
@@ -15,11 +15,11 @@ might be useful.
 
 Cf. include/trace/events/power.h for the events definitions.
 
-1. Power state switch events
+Power state switch events
 ============================
 
-1.1 Trace API
------------------
+Trace API
+---------
 
 A 'cpu' event class gathers the CPU-related events: cpuidle and
 cpufreq.
@@ -45,8 +45,8 @@ The event which has 'state=4294967295' in the trace is very important to the use
 space tools which are using it to detect the end of the current state, and so to
 correctly draw the states diagrams and to calculate accurate statistics etc.
 
-2. Clocks events
-================
+Clocks events
+=============
 The clock events are used for clock enable/disable and for
 clock rate change.
 ::
@@ -59,8 +59,8 @@ The first parameter gives the clock name (e.g. "gpio1_iclk").
 The second parameter is '1' for enable, '0' for disable, the target
 clock rate for set_rate.
 
-3. Power domains events
-=======================
+Power domains events
+====================
 The power domain events are used for power domains transitions
 ::
 
@@ -69,8 +69,8 @@ The power domain events are used for power domains transitions
 The first parameter gives the power domain name (e.g. "mpu_pwrdm").
 The second parameter is the power domain target state.
 
-4. PM QoS events
-================
+PM QoS events
+=============
 The PM QoS events are used for QoS add/update/remove request and for
 target/flags update.
 ::
diff --git a/Documentation/trace/events.rst b/Documentation/trace/events.rst
index e83d0d5378be..0d4f8f63236f 100644
--- a/Documentation/trace/events.rst
+++ b/Documentation/trace/events.rst
@@ -5,8 +5,8 @@ Event Tracing
 :Author: Theodore Ts'o
 :Updated: Li Zefan and Tom Zanussi
 
-1. Introduction
-===============
+Introduction
+============
 
 Tracepoints (see Documentation/trace/tracepoints.rst) can be used
 without creating custom kernel modules to register probe functions
@@ -17,13 +17,13 @@ the kernel developer must provide code snippets which define how the
 tracing information is saved into the tracing buffer, and how the
 tracing information should be printed.
 
-2. Using Event Tracing
-======================
+Using Event Tracing
+===================
 
 .. _tracing_set_event_interface:
 
-2.1 Via the 'set_event' interface
----------------------------------
+Via the 'set_event' interface
+-----------------------------
 
 The events which are available for tracing can be found in the file
 /sys/kernel/debug/tracing/available_events.
@@ -57,8 +57,8 @@ command::
 
 	# echo 'irq:*' > /sys/kernel/debug/tracing/set_event
 
-2.2 Via the 'enable' toggle
----------------------------
+Via the 'enable' toggle
+-----------------------
 
 The events available are also listed in /sys/kernel/debug/tracing/events/ hierarchy
 of directories.
@@ -86,8 +86,8 @@ When reading one of these enable files, there are four results:
  - X - there is a mixture of events enabled and disabled
  - ? - this file does not affect any event
 
-2.3 Boot option
----------------
+Boot option
+-----------
 
 In order to facilitate early boot debugging, use boot option::
 
@@ -96,15 +96,15 @@ In order to facilitate early boot debugging, use boot option::
 event-list is a comma separated list of events. See
 :ref:`tracing_set_event_interface` for event format.
 
-3. Defining an event-enabled tracepoint
-=======================================
+Defining an event-enabled tracepoint
+====================================
 
 See The example provided in samples/trace_events
 
 .. _tracing_event_formats:
 
-4. Event formats
-================
+Event formats
+=============
 
 Each trace event has a 'format' file associated with it that contains
 a description of each field in a logged event.  This information can
@@ -156,8 +156,8 @@ event-specific.  All the fields for this event are numeric, except for
 
 .. _tracing_event_filters:
 
-5. Event filtering
-==================
+Event filtering
+===============
 
 Trace events can be filtered in the kernel by associating boolean
 'filter expressions' with them.  As soon as an event is logged into
@@ -168,8 +168,8 @@ values don't match will be discarded.  An event with no filter
 associated with it matches everything, and is the default when no
 filter has been set for an event.
 
-5.1 Expression syntax
----------------------
+Expression syntax
+-----------------
 
 A filter expression consists of one or more 'predicates' that can be
 combined using the logical operators '&&' and '||'.  A predicate is
@@ -213,8 +213,8 @@ field name::
 As the kernel will have to know how to retrieve the memory that the pointer
 is at from user space.
 
-5.2 Setting filters
--------------------
+Setting filters
+---------------
 
 A filter for an individual event is set by writing a filter expression
 to the 'filter' file for the given event.
@@ -245,8 +245,8 @@ Currently the caret ('^') for an error always appears at the beginning of
 the filter string; the error message should still be useful though
 even without more accurate position info.
 
-5.2.1 Filter limitations
-------------------------
+Filter limitations
+------------------
 
 If a filter is placed on a string pointer ``(char *)`` that does not point
 to a string on the ring buffer, but instead points to kernel or user space
@@ -255,8 +255,8 @@ copied onto a temporary buffer to do the compare. If the copy of the memory
 faults (the pointer points to memory that should not be accessed), then the
 string compare will be treated as not matching.
 
-5.3 Clearing filters
---------------------
+Clearing filters
+----------------
 
 To clear the filter for an event, write a '0' to the event's filter
 file.
@@ -264,8 +264,8 @@ file.
 To clear the filters for all events in a subsystem, write a '0' to the
 subsystem's filter file.
 
-5.3 Subsystem filters
----------------------
+Subsystem filters
+-----------------
 
 For convenience, filters for every event in a subsystem can be set or
 cleared as a group by writing a filter expression into the filter file
@@ -311,8 +311,8 @@ their old filters)::
 	# cat sched_wakeup/filter
 	common_pid == 0
 
-5.4 PID filtering
------------------
+PID filtering
+-------------
 
 The set_event_pid file in the same directory as the top events directory
 exists, will filter all events from tracing any task that does not have the
@@ -332,8 +332,8 @@ To add more PIDs without losing the PIDs already included, use '>>'.
 
 .. _tracing_event_triggers:
 
-6. Event triggers
-=================
+Event triggers
+==============
 
 Trace events can be made to conditionally invoke trigger 'commands'
 which can take various forms and are described in detail below;
@@ -373,8 +373,8 @@ way, so beware about making generalizations between the two.
      can also enable triggers that are written into
      /sys/kernel/tracing/events/ftrace/print/trigger
 
-6.1 Expression syntax
----------------------
+Expression syntax
+-----------------
 
 Triggers are added by echoing the command to the 'trigger' file::
 
@@ -397,8 +397,8 @@ adds or removes a single trigger and there's no explicit '>>' support
 ('>' actually behaves like '>>') or truncation support to remove all
 triggers (you have to use '!' for each one added.)
 
-6.2 Supported trigger commands
-------------------------------
+Supported trigger commands
+--------------------------
 
 The following commands are supported:
 
@@ -553,8 +553,8 @@ The following commands are supported:
 
   See Documentation/trace/histogram.rst for details and examples.
 
-7. In-kernel trace event API
-============================
+In-kernel trace event API
+=========================
 
 In most cases, the command-line interface to trace events is more than
 sufficient.  Sometimes, however, applications might find the need for
@@ -586,8 +586,8 @@ following:
   - tracing synthetic events from in-kernel code
   - the low-level "dynevent_cmd" API
 
-7.1 Dyamically creating synthetic event definitions
----------------------------------------------------
+Dyamically creating synthetic event definitions
+-----------------------------------------------
 
 There are a couple ways to create a new synthetic event from a kernel
 module or other kernel code.
@@ -703,8 +703,8 @@ registered by calling the synth_event_gen_cmd_end() function::
 At this point, the event object is ready to be used for tracing new
 events.
 
-7.2 Tracing synthetic events from in-kernel code
-------------------------------------------------
+Tracing synthetic events from in-kernel code
+--------------------------------------------
 
 To trace a synthetic event, there are several options.  The first
 option is to trace the event in one call, using synth_event_trace()
@@ -715,8 +715,8 @@ synth_event_trace_start() and synth_event_trace_end() along with
 synth_event_add_next_val() or synth_event_add_val() to add the values
 piecewise.
 
-7.2.1 Tracing a synthetic event all at once
--------------------------------------------
+Tracing a synthetic event all at once
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 To trace a synthetic event all at once, the synth_event_trace() or
 synth_event_trace_array() functions can be used.
@@ -817,8 +817,8 @@ remove the event::
 
        ret = synth_event_delete("schedtest");
 
-7.2.2 Tracing a synthetic event piecewise
------------------------------------------
+Tracing a synthetic event piecewise
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 To trace a synthetic using the piecewise method described above, the
 synth_event_trace_start() function is used to 'open' the synthetic
@@ -901,8 +901,8 @@ Note that synth_event_trace_end() must be called at the end regardless
 of whether any of the add calls failed (say due to a bad field name
 being passed in).
 
-7.3 Dyamically creating kprobe and kretprobe event definitions
---------------------------------------------------------------
+Dyamically creating kprobe and kretprobe event definitions
+----------------------------------------------------------
 
 To create a kprobe or kretprobe trace event from kernel code, the
 kprobe_event_gen_cmd_start() or kretprobe_event_gen_cmd_start()
@@ -978,8 +978,8 @@ used to give the kprobe event file back and delete the event::
 
   ret = kprobe_event_delete("gen_kprobe_test");
 
-7.4 The "dynevent_cmd" low-level API
-------------------------------------
+The "dynevent_cmd" low-level API
+--------------------------------
 
 Both the in-kernel synthetic event and kprobe interfaces are built on
 top of a lower-level "dynevent_cmd" interface.  This interface is
diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst
index d018bd332200..7f9ec00d5748 100644
--- a/Documentation/trace/ftrace.rst
+++ b/Documentation/trace/ftrace.rst
@@ -2453,7 +2453,7 @@ Or this simple script!
 
 
 function graph tracer
----------------------------
+---------------------
 
 This tracer is similar to the function tracer except that it
 probes a function on its entry and its exit. This is done by
diff --git a/Documentation/trace/histogram.rst b/Documentation/trace/histogram.rst
index 859fd1b76c63..be1dcc7f84c4 100644
--- a/Documentation/trace/histogram.rst
+++ b/Documentation/trace/histogram.rst
@@ -4,16 +4,16 @@ Event Histograms
 
 Documentation written by Tom Zanussi
 
-1. Introduction
-===============
+Introduction
+============
 
   Histogram triggers are special event triggers that can be used to
   aggregate trace event data into histograms.  For information on
   trace events and event triggers, see Documentation/trace/events.rst.
 
 
-2. Histogram Trigger Command
-============================
+Histogram Trigger Command
+=========================
 
   A histogram trigger command is an event trigger command that
   aggregates event hits into a hash table keyed on one or more trace
@@ -203,8 +203,8 @@ Extended error information
   tracing/error_log file.  See Error Conditions in
   :file:`Documentation/trace/ftrace.rst` for details.
 
-6.2 'hist' trigger examples
----------------------------
+'hist' trigger examples
+-----------------------
 
   The first set of examples creates aggregations using the kmalloc
   event.  The fields that can be used for the hist trigger are listed
@@ -1599,8 +1599,8 @@ Extended error information
         Entries: 7
         Dropped: 0
 
-2.2 Inter-event hist triggers
------------------------------
+Inter-event hist triggers
+-------------------------
 
 Inter-event hist triggers are hist triggers that combine values from
 one or more other events and create a histogram using that data.  Data
@@ -1676,8 +1676,8 @@ pseudo-file.
 
 These features are described in more detail in the following sections.
 
-2.2.1 Histogram Variables
--------------------------
+Histogram Variables
+-------------------
 
 Variables are simply named locations used for saving and retrieving
 values between matching events.  A 'matching' event is defined as an
@@ -1778,8 +1778,8 @@ or assigned to a variable and referenced in a subsequent expression::
   # echo 'hist:keys=next_pid:us_per_sec=1000000 ...' >> event/trigger
   # echo 'hist:keys=next_pid:timestamp_secs=common_timestamp/$us_per_sec ...' >> event/trigger
 
-2.2.2 Synthetic Events
-----------------------
+Synthetic Events
+----------------
 
 Synthetic events are user-defined events generated from hist trigger
 variables or fields associated with one or more other events.  Their
@@ -1932,8 +1932,8 @@ the ".buckets" modifier and specify a size (in this case groups of 10).
       Entries: 16
       Dropped: 0
 
-2.2.3 Hist trigger 'handlers' and 'actions'
--------------------------------------------
+Hist trigger 'handlers' and 'actions'
+-------------------------------------
 
 A hist trigger 'action' is a function that's executed (in most cases
 conditionally) whenever a histogram entry is added or updated.
@@ -2364,8 +2364,8 @@ The following commonly-used handler.action pairs are available:
          kworker/3:2-135   [003] d..3    49.823123: sched_switch: prev_comm=kworker/3:2 prev_pid=135 prev_prio=120 prev_state=T ==> next_comm=swapper/3 next_pid=0 next_prio=120
               <idle>-0     [004] ..s7    49.823798: tcp_probe: src=10.0.0.10:54326 dest=23.215.104.193:80 mark=0x0 length=32 snd_nxt=0xe3ae2ff5 snd_una=0xe3ae2ecd snd_cwnd=10 ssthresh=2147483647 snd_wnd=28960 srtt=19604 rcv_wnd=29312
 
-3. User space creating a trigger
---------------------------------
+User space creating a trigger
+-----------------------------
 
 Writing into /sys/kernel/tracing/trace_marker writes into the ftrace
 ring buffer. This can also act like an event, by writing into the trigger
diff --git a/Documentation/trace/kprobetrace.rst b/Documentation/trace/kprobetrace.rst
index 8c903e39bdf2..fd5c2ef794fa 100644
--- a/Documentation/trace/kprobetrace.rst
+++ b/Documentation/trace/kprobetrace.rst
@@ -42,7 +42,8 @@ Synopsis of kprobe_events
  MEMADDR	: Address where the probe is inserted.
  MAXACTIVE	: Maximum number of instances of the specified function that
 		  can be probed simultaneously, or 0 for the default value
-		  as defined in Documentation/trace/kprobes.rst section 1.3.1.
+		  as defined in Documentation/trace/kprobes.rst section
+		  "How Does a Return Probe Work?"
 
  FETCHARGS	: Arguments. Each probe can have up to 128 args.
   %REG		: Fetch register REG
diff --git a/Documentation/trace/tracepoint-analysis.rst b/Documentation/trace/tracepoint-analysis.rst
index 716326b9f152..715896bf5f23 100644
--- a/Documentation/trace/tracepoint-analysis.rst
+++ b/Documentation/trace/tracepoint-analysis.rst
@@ -3,8 +3,8 @@ Notes on Analysing Behaviour Using Events and Tracepoints
 =========================================================
 :Author: Mel Gorman (PCL information heavily based on email from Ingo Molnar)
 
-1. Introduction
-===============
+Introduction
+============
 
 Tracepoints (see Documentation/trace/tracepoints.rst) can be used without
 creating custom kernel modules to register probe functions using the event
@@ -20,11 +20,11 @@ This document assumes that debugfs is mounted on /sys/kernel/debug and that
 the appropriate tracing options have been configured into the kernel. It is
 assumed that the PCL tool tools/perf has been installed and is in your path.
 
-2. Listing Available Events
-===========================
+Listing Available Events
+========================
 
-2.1 Standard Utilities
-----------------------
+Standard Utilities
+------------------
 
 All possible events are visible from /sys/kernel/debug/tracing/events. Simply
 calling::
@@ -33,8 +33,8 @@ calling::
 
 will give a fair indication of the number of events available.
 
-2.2 PCL (Performance Counters for Linux)
-----------------------------------------
+PCL (Performance Counters for Linux)
+------------------------------------
 
 Discovery and enumeration of all counters and events, including tracepoints,
 are available with the perf tool. Getting a list of available events is a
@@ -49,11 +49,11 @@ simple case of::
   [ .... remaining output snipped .... ]
 
 
-3. Enabling Events
-==================
+Enabling Events
+===============
 
-3.1 System-Wide Event Enabling
-------------------------------
+System-Wide Event Enabling
+--------------------------
 
 See Documentation/trace/events.rst for a proper description on how events
 can be enabled system-wide. A short example of enabling all events related
@@ -61,8 +61,8 @@ to page allocation would look something like::
 
   $ for i in `find /sys/kernel/debug/tracing/events -name "enable" | grep mm_`; do echo 1 > $i; done
 
-3.2 System-Wide Event Enabling with SystemTap
----------------------------------------------
+System-Wide Event Enabling with SystemTap
+-----------------------------------------
 
 In SystemTap, tracepoints are accessible using the kernel.trace() function
 call. The following is an example that reports every 5 seconds what processes
@@ -87,8 +87,8 @@ were allocating the pages.
           print_count()
   }
 
-3.3 System-Wide Event Enabling with PCL
----------------------------------------
+System-Wide Event Enabling with PCL
+-----------------------------------
 
 By specifying the -a switch and analysing sleep, the system-wide events
 for a duration of time can be examined.
@@ -109,14 +109,14 @@ for a duration of time can be examined.
 Similarly, one could execute a shell and exit it as desired to get a report
 at that point.
 
-3.4 Local Event Enabling
-------------------------
+Local Event Enabling
+--------------------
 
 Documentation/trace/ftrace.rst describes how to enable events on a per-thread
 basis using set_ftrace_pid.
 
-3.5 Local Event Enablement with PCL
------------------------------------
+Local Event Enablement with PCL
+-------------------------------
 
 Events can be activated and tracked for the duration of a process on a local
 basis using PCL such as follows.
@@ -134,15 +134,15 @@ basis using PCL such as follows.
 
     0.973913387  seconds time elapsed
 
-4. Event Filtering
-==================
+Event Filtering
+===============
 
 Documentation/trace/ftrace.rst covers in-depth how to filter events in
 ftrace.  Obviously using grep and awk of trace_pipe is an option as well
 as any script reading trace_pipe.
 
-5. Analysing Event Variances with PCL
-=====================================
+Analysing Event Variances with PCL
+==================================
 
 Any workload can exhibit variances between runs and it can be important
 to know what the standard deviation is. By and large, this is left to the
@@ -185,8 +185,8 @@ time on a system-wide basis using -a and sleep.
 
     1.002251757  seconds time elapsed   ( +-   0.005% )
 
-6. Higher-Level Analysis with Helper Scripts
-============================================
+Higher-Level Analysis with Helper Scripts
+=========================================
 
 When events are enabled the events that are triggering can be read from
 /sys/kernel/debug/tracing/trace_pipe in human-readable format although binary
@@ -217,8 +217,8 @@ also can do more such as
     processes, the parent process responsible for creating all the helpers
     can be identified
 
-7. Lower-Level Analysis with PCL
-================================
+Lower-Level Analysis with PCL
+=============================
 
 There may also be a requirement to identify what functions within a program
 were generating events within the kernel. To begin this sort of analysis, the
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] docs: trace: events: apply literal markup
  2022-03-13 10:55 [PATCH 1/3] docs: tracing: use refs for cross-referencing Roland Hieber
  2022-03-13 10:55 ` [PATCH 2/3] docs: trace: bring headings in order Roland Hieber
@ 2022-03-13 10:55 ` Roland Hieber
  2022-03-14  0:04   ` Steven Rostedt
  2022-03-13 23:55 ` [PATCH 1/3] docs: tracing: use refs for cross-referencing Steven Rostedt
  2 siblings, 1 reply; 10+ messages in thread
From: Roland Hieber @ 2022-03-13 10:55 UTC (permalink / raw)
  To: Jonathan Corbet, Steven Rostedt, Ingo Molnar, Daniel Bristot de Oliveira
  Cc: linux-doc, Roland Hieber

The document can be easier readable if not everything is in 'quotes',
but sometimes also in fixed-width font.

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
PATCH v2:
* new in v2

 Documentation/trace/events.rst | 298 ++++++++++++++++-----------------
 1 file changed, 149 insertions(+), 149 deletions(-)

diff --git a/Documentation/trace/events.rst b/Documentation/trace/events.rst
index 0d4f8f63236f..f4bbc4f7c115 100644
--- a/Documentation/trace/events.rst
+++ b/Documentation/trace/events.rst
@@ -22,25 +22,25 @@ Using Event Tracing
 
 .. _tracing_set_event_interface:
 
-Via the 'set_event' interface
------------------------------
+Via the ``set_event`` interface
+-------------------------------
 
 The events which are available for tracing can be found in the file
-/sys/kernel/debug/tracing/available_events.
+``/sys/kernel/debug/tracing/available_events``.
 
-To enable a particular event, such as 'sched_wakeup', simply echo it
-to /sys/kernel/debug/tracing/set_event. For example::
+To enable a particular event, such as ``sched_wakeup``, simply echo it
+to ``/sys/kernel/debug/tracing/set_event``. For example::
 
 	# echo sched_wakeup >> /sys/kernel/debug/tracing/set_event
 
-.. Note:: '>>' is necessary, otherwise it will firstly disable all the events.
+.. Note:: ``>>`` is necessary, otherwise it will firstly disable all the events.
 
 To disable an event, echo the event name to the set_event file prefixed
 with an exclamation point::
 
 	# echo '!sched_wakeup' >> /sys/kernel/debug/tracing/set_event
 
-To disable all events, echo an empty line to the set_event file::
+To disable all events, echo an empty line to the ``set_event`` file::
 
 	# echo > /sys/kernel/debug/tracing/set_event
 
@@ -49,7 +49,7 @@ To enable all events, echo ``*:*`` or ``*:`` to the set_event file::
 	# echo *:* > /sys/kernel/debug/tracing/set_event
 
 The events are organized into subsystems, such as ext4, irq, sched,
-etc., and a full event name looks like this: <subsystem>:<event>.  The
+etc., and a full event name looks like this: ``<subsystem>:<event>``.  The
 subsystem name is optional, but it is displayed in the available_events
 file.  All of the events in a subsystem can be specified via the syntax
 ``<subsystem>:*``; for example, to enable all irq events, you can use the
@@ -57,13 +57,13 @@ command::
 
 	# echo 'irq:*' > /sys/kernel/debug/tracing/set_event
 
-Via the 'enable' toggle
------------------------
+Via the ``enable`` toggle
+-------------------------
 
-The events available are also listed in /sys/kernel/debug/tracing/events/ hierarchy
+The events available are also listed in the ``/sys/kernel/debug/tracing/events/`` hierarchy
 of directories.
 
-To enable event 'sched_wakeup'::
+To enable event ``sched_wakeup``::
 
 	# echo 1 > /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
 
@@ -106,7 +106,7 @@ See The example provided in samples/trace_events
 Event formats
 =============
 
-Each trace event has a 'format' file associated with it that contains
+Each trace event has a ``format`` file associated with it that contains
 a description of each field in a logged event.  This information can
 be used to parse the binary trace stream, and is also the place to
 find the field names that can be used in :ref:`event filters <tracing_event_filters>`.
@@ -127,7 +127,7 @@ Each field in the format has the form::
 where offset is the offset of the field in the trace record and size
 is the size of the data item, in bytes.
 
-For example, here's the information displayed for the 'sched_wakeup'
+For example, here's the information displayed for the ``sched_wakeup``
 event::
 
 	# cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/format
@@ -152,7 +152,7 @@ event::
 
 This event contains 10 fields, the first 5 common and the remaining 5
 event-specific.  All the fields for this event are numeric, except for
-'comm' which is a string, a distinction important for event filtering.
+``comm`` which is a string, a distinction important for event filtering.
 
 .. _tracing_event_filters:
 
@@ -172,7 +172,7 @@ Expression syntax
 -----------------
 
 A filter expression consists of one or more 'predicates' that can be
-combined using the logical operators '&&' and '||'.  A predicate is
+combined using the logical operators ``&&`` and ``||``.  A predicate is
 simply a clause that compares the value of a field contained within a
 logged event with a constant value and returns either 0 or 1 depending
 on whether the field value matched (1) or didn't match (0)::
@@ -184,20 +184,20 @@ double-quotes can be used to prevent the shell from interpreting
 operators as shell metacharacters.
 
 The field-names available for use in filters can be found in the
-'format' files for trace events (see :ref:`tracing_event_filters`).
+``format`` files for trace events (see :ref:`tracing_event_filters`).
 
 The relational-operators depend on the type of the field being tested:
 
-The operators available for numeric fields are:
+The operators available for numeric fields are::
 
-==, !=, <, <=, >, >=, &
+  ==, !=, <, <=, >, >=, &
 
-And for string fields they are:
+And for string fields they are::
 
-==, !=, ~
+  ==, !=, ~
 
-The glob (~) accepts a wild card character (\*,?) and character classes
-([). For example::
+The glob (``~``) accepts a wild card character (``*``, ``?``) and character classes
+(``[``). For example::
 
   prev_comm ~ "*sh"
   prev_comm ~ "sh*"
@@ -217,7 +217,7 @@ Setting filters
 ---------------
 
 A filter for an individual event is set by writing a filter expression
-to the 'filter' file for the given event.
+to the ``filter`` file for the given event.
 
 For example::
 
@@ -241,7 +241,7 @@ an error message can be seen by looking at the filter e.g.::
 	^
 	parse_error: Field not found
 
-Currently the caret ('^') for an error always appears at the beginning of
+Currently the caret (``^``) for an error always appears at the beginning of
 the filter string; the error message should still be useful though
 even without more accurate position info.
 
@@ -258,10 +258,10 @@ string compare will be treated as not matching.
 Clearing filters
 ----------------
 
-To clear the filter for an event, write a '0' to the event's filter
+To clear the filter for an event, write a ``0`` to the event's filter
 file.
 
-To clear the filters for all events in a subsystem, write a '0' to the
+To clear the filters for all events in a subsystem, write a ``0`` to the
 subsystem's filter file.
 
 Subsystem filters
@@ -301,7 +301,7 @@ subsystem (all events end up with the same filter)::
 	common_pid == 0
 
 Attempt to set a filter using a non-common field for all events in the
-sched subsystem (all events but those that have a prev_pid field retain
+sched subsystem (all events but those that have a ``prev_pid`` field retain
 their old filters)::
 
 	# cd /sys/kernel/debug/tracing/events/sched
@@ -314,9 +314,9 @@ their old filters)::
 PID filtering
 -------------
 
-The set_event_pid file in the same directory as the top events directory
+The ``set_event_pid`` file in the same directory as the top events directory
 exists, will filter all events from tracing any task that does not have the
-PID listed in the set_event_pid file.
+PID listed in the ``set_event_pid`` file.
 ::
 
 	# cd /sys/kernel/debug/tracing
@@ -325,7 +325,7 @@ PID listed in the set_event_pid file.
 
 Will only trace events for the current task.
 
-To add more PIDs without losing the PIDs already included, use '>>'.
+To add more PIDs without losing the PIDs already included, use ``>>``.
 ::
 
 	# echo 123 244 1 >> set_event_pid
@@ -347,7 +347,7 @@ be invoked if the event being invoked passes the associated filter.
 If no filter is associated with the trigger, it always passes.
 
 Triggers are added to and removed from a particular event by writing
-trigger expressions to the 'trigger' file for the given event.
+trigger expressions to the ``trigger`` file for the given event.
 
 A given event can have any number of triggers associated with it,
 subject to any restrictions that individual commands may have in that
@@ -363,46 +363,46 @@ enabled, and also allows the current event filter implementation to be
 used for conditionally invoking triggers.
 
 The syntax for event triggers is roughly based on the syntax for
-set_ftrace_filter 'ftrace filter commands' (see the section
+``set_ftrace_filter`` ftrace filter commands (see the section
 :ref:`ftrace_filter_commands`), but there are major
 differences and the implementation isn't currently tied to it in any
 way, so beware about making generalizations between the two.
 
 .. Note::
-     Writing into trace_marker (See Documentation/trace/ftrace.rst)
+     Writing into ``trace_marker`` (See Documentation/trace/ftrace.rst)
      can also enable triggers that are written into
-     /sys/kernel/tracing/events/ftrace/print/trigger
+     ``/sys/kernel/tracing/events/ftrace/print/trigger``.
 
 Expression syntax
 -----------------
 
-Triggers are added by echoing the command to the 'trigger' file::
+Triggers are added by echoing the command to the ``trigger`` file::
 
   # echo 'command[:count] [if filter]' > trigger
 
-Triggers are removed by echoing the same command but starting with '!'
-to the 'trigger' file::
+Triggers are removed by echoing the same command but starting with ``!``
+to the ``trigger`` file::
 
   # echo '!command[:count] [if filter]' > trigger
 
 The [if filter] part isn't used in matching commands when removing, so
-leaving that off in a '!' command will accomplish the same thing as
+leaving that off in a ``!`` command will accomplish the same thing as
 having it in.
 
 The filter syntax is the same as that described in the section
 :ref:`tracing_event_filters` above.
 
-For ease of use, writing to the trigger file using '>' currently just
-adds or removes a single trigger and there's no explicit '>>' support
-('>' actually behaves like '>>') or truncation support to remove all
-triggers (you have to use '!' for each one added.)
+For ease of use, writing to the trigger file using ``>`` currently just
+adds or removes a single trigger and there's no explicit ``>>`` support
+(``>`` actually behaves like ``>>``) or truncation support to remove all
+triggers (you have to use ``!`` for each one added.)
 
 Supported trigger commands
 --------------------------
 
 The following commands are supported:
 
-- enable_event/disable_event
+- ``enable_event``/``disable_event``
 
   These commands can enable or disable another trace event whenever
   the triggering event is hit.  When these commands are registered,
@@ -412,7 +412,7 @@ The following commands are supported:
   in effect that can trigger it.
 
   For example, the following trigger causes kmalloc events to be
-  traced when a read system call is entered, and the :1 at the end
+  traced when a read system call is entered, and the ``:1`` at the end
   specifies that this enablement happens only once::
 
 	  # echo 'enable_event:kmem:kmalloc:1' > \
@@ -438,15 +438,15 @@ The following commands are supported:
 	  # echo '!disable_event:kmem:kmalloc' > \
 	      /sys/kernel/debug/tracing/events/syscalls/sys_exit_read/trigger
 
-  Note that there can be any number of enable/disable_event triggers
+  Note that there can be any number of ``enable_event``/``disable_event`` triggers
   per triggering event, but there can only be one trigger per
-  triggered event. e.g. sys_enter_read can have triggers enabling both
-  kmem:kmalloc and sched:sched_switch, but can't have two kmem:kmalloc
-  versions such as kmem:kmalloc and kmem:kmalloc:1 or 'kmem:kmalloc if
-  bytes_req == 256' and 'kmem:kmalloc if bytes_alloc == 256' (they
-  could be combined into a single filter on kmem:kmalloc though).
+  triggered event. e.g. ``sys_enter_read`` can have triggers enabling both
+  ``kmem:kmalloc`` and ``sched:sched_switch``, but can't have two ``kmem:kmalloc``
+  versions such as ``kmem:kmalloc`` and ``kmem:kmalloc:1`` or ``kmem:kmalloc if
+  bytes_req == 256`` and ``kmem:kmalloc if bytes_alloc == 256`` (they
+  could be combined into a single filter on ``kmem:kmalloc`` though).
 
-- stacktrace
+- ``stacktrace``
 
   This command dumps a stacktrace in the trace buffer whenever the
   triggering event occurs.
@@ -481,10 +481,10 @@ The following commands are supported:
 	  # echo '!stacktrace:5' > \
 		/sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
 
-  Note that there can be only one stacktrace trigger per triggering
+  Note that there can be only one ``stacktrace`` trigger per triggering
   event.
 
-- snapshot
+- ``snapshot``
 
   This command causes a snapshot to be triggered whenever the
   triggering event occurs.
@@ -510,10 +510,10 @@ The following commands are supported:
 	  # echo '!snapshot:1 if nr_rq > 1' > \
 		/sys/kernel/debug/tracing/events/block/block_unplug/trigger
 
-  Note that there can be only one snapshot trigger per triggering
+  Note that there can be only one ``snapshot`` trigger per triggering
   event.
 
-- traceon/traceoff
+- ``traceon``/``traceoff``
 
   These commands turn tracing on and off when the specified events are
   hit. The parameter determines how many times the tracing system is
@@ -528,7 +528,7 @@ The following commands are supported:
 	  # echo 'traceoff:1 if nr_rq > 1' > \
 		/sys/kernel/debug/tracing/events/block/block_unplug/trigger
 
-  To always disable tracing when nr_rq  > 1::
+  To always disable tracing when ``nr_rq``  > 1::
 
 	  # echo 'traceoff if nr_rq > 1' > \
 		/sys/kernel/debug/tracing/events/block/block_unplug/trigger
@@ -541,10 +541,10 @@ The following commands are supported:
 	  # echo '!traceoff if nr_rq > 1' > \
 		/sys/kernel/debug/tracing/events/block/block_unplug/trigger
 
-  Note that there can be only one traceon or traceoff trigger per
+  Note that there can be only one ``traceon`` or ``traceoff`` trigger per
   triggering event.
 
-- hist
+- ``hist``
 
   This command aggregates event hits into a hash table keyed on one or
   more trace event format fields (or stacktrace) and a set of running
@@ -592,17 +592,17 @@ Dyamically creating synthetic event definitions
 There are a couple ways to create a new synthetic event from a kernel
 module or other kernel code.
 
-The first creates the event in one step, using synth_event_create().
+The first creates the event in one step, using ``synth_event_create()``.
 In this method, the name of the event to create and an array defining
-the fields is supplied to synth_event_create().  If successful, a
+the fields is supplied to ``synth_event_create()``.  If successful, a
 synthetic event with that name and fields will exist following that
-call.  For example, to create a new "schedtest" synthetic event::
+call.  For example, to create a new ``schedtest`` synthetic event::
 
   ret = synth_event_create("schedtest", sched_fields,
                            ARRAY_SIZE(sched_fields), THIS_MODULE);
 
-The sched_fields param in this example points to an array of struct
-synth_field_desc, each of which describes an event field by type and
+The ``sched_fields`` param in this example points to an array of struct
+``synth_field_desc``, each of which describes an event field by type and
 name::
 
   static struct synth_field_desc sched_fields[] = {
@@ -615,11 +615,11 @@ name::
         { .type = "int",                .name = "my_int_field" },
   };
 
-See synth_field_size() for available types.
+See ``synth_field_size()`` for available types.
 
-If field_name contains [n], the field is considered to be a static array.
+If ``field_name`` contains ``[n]``, the field is considered to be a static array.
 
-If field_names contains[] (no subscript), the field is considered to
+If ``field_names`` contains ``[]`` (no subscript), the field is considered to
 be a dynamic array, which will only take as much space in the event as
 is required to hold the array.
 
@@ -630,7 +630,7 @@ other non-piecewise in-kernel APIs can, however, be used with dynamic
 arrays.
 
 If the event is created from within a module, a pointer to the module
-must be passed to synth_event_create().  This will ensure that the
+must be passed to ``synth_event_create()``.  This will ensure that the
 trace buffer won't contain unreadable events when the module is
 removed.
 
@@ -642,17 +642,17 @@ allows events to be created dynamically and without the need to create
 and populate an array of fields beforehand.
 
 To use this method, an empty or partially empty synthetic event should
-first be created using synth_event_gen_cmd_start() or
-synth_event_gen_cmd_array_start().  For synth_event_gen_cmd_start(),
+first be created using ``synth_event_gen_cmd_start()`` or
+``synth_event_gen_cmd_array_start()``.  For ``synth_event_gen_cmd_start()``,
 the name of the event along with one or more pairs of args each pair
-representing a 'type field_name;' field specification should be
-supplied.  For synth_event_gen_cmd_array_start(), the name of the
-event along with an array of struct synth_field_desc should be
-supplied. Before calling synth_event_gen_cmd_start() or
-synth_event_gen_cmd_array_start(), the user should create and
-initialize a dynevent_cmd object using synth_event_cmd_init().
-
-For example, to create a new "schedtest" synthetic event with two
+representing a ``type field_name;`` field specification should be
+supplied.  For ``synth_event_gen_cmd_array_start()``, the name of the
+event along with an array of ``struct synth_field_desc`` should be
+supplied. Before calling ``synth_event_gen_cmd_start()`` or
+``synth_event_gen_cmd_array_start()``, the user should create and
+initialize a ``dynevent_cmd`` object using ``synth_event_cmd_init()``.
+
+For example, to create a new ``schedtest`` synthetic event with two
 fields::
 
   struct dynevent_cmd cmd;
@@ -668,7 +668,7 @@ fields::
                                   "pid_t", "next_pid_field",
                                   "u64", "ts_ns");
 
-Alternatively, using an array of struct synth_field_desc fields
+Alternatively, using an array of ``struct synth_field_desc`` fields
 containing the same information::
 
   ret = synth_event_gen_cmd_array_start(&cmd, "schedtest", THIS_MODULE,
@@ -676,27 +676,27 @@ containing the same information::
 
 Once the synthetic event object has been created, it can then be
 populated with more fields.  Fields are added one by one using
-synth_event_add_field(), supplying the dynevent_cmd object, a field
-type, and a field name.  For example, to add a new int field named
-"intfield", the following call should be made::
+``synth_event_add_field()``, supplying the ``dynevent_cmd`` object, a field
+``type``, and a field ``name``.  For example, to add a new int field named
+``intfield``, the following call should be made::
 
   ret = synth_event_add_field(&cmd, "int", "intfield");
 
-See synth_field_size() for available types. If field_name contains [n]
+See ``synth_field_size()`` for available types. If ``field_name`` contains ``[n]``
 the field is considered to be an array.
 
 A group of fields can also be added all at once using an array of
-synth_field_desc with add_synth_fields().  For example, this would add
-just the first four sched_fields::
+``synth_field_desc`` with ``add_synth_fields()``.  For example, this would add
+just the first four ``sched_fields``::
 
   ret = synth_event_add_fields(&cmd, sched_fields, 4);
 
-If you already have a string of the form 'type field_name',
-synth_event_add_field_str() can be used to add it as-is; it will
-also automatically append a ';' to the string.
+If you already have a string of the form ``type field_name``,
+``synth_event_add_field_str()`` can be used to add it as-is; it will
+also automatically append a ``;`` to the string.
 
 Once all the fields have been added, the event should be finalized and
-registered by calling the synth_event_gen_cmd_end() function::
+registered by calling the ``synth_event_gen_cmd_end()`` function::
 
   ret = synth_event_gen_cmd_end(&cmd);
 
@@ -707,23 +707,23 @@ Tracing synthetic events from in-kernel code
 --------------------------------------------
 
 To trace a synthetic event, there are several options.  The first
-option is to trace the event in one call, using synth_event_trace()
-with a variable number of values, or synth_event_trace_array() with an
+option is to trace the event in one call, using ``synth_event_trace()``
+with a variable number of values, or ``synth_event_trace_array()`` with an
 array of values to be set.  A second option can be used to avoid the
 need for a pre-formed array of values or list of arguments, via
-synth_event_trace_start() and synth_event_trace_end() along with
-synth_event_add_next_val() or synth_event_add_val() to add the values
+``synth_event_trace_start()`` and ``synth_event_trace_end()`` along with
+``synth_event_add_next_val()`` or ``synth_event_add_val()`` to add the values
 piecewise.
 
 Tracing a synthetic event all at once
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-To trace a synthetic event all at once, the synth_event_trace() or
-synth_event_trace_array() functions can be used.
+To trace a synthetic event all at once, the ``synth_event_trace()`` or
+``synth_event_trace_array()`` functions can be used.
 
-The synth_event_trace() function is passed the trace_event_file
+The ``synth_event_trace()`` function is passed the ``trace_event_file``
 representing the synthetic event (which can be retrieved using
-trace_get_event_file() using the synthetic event name, "synthetic" as
+``trace_get_event_file()`` using the synthetic event name, "synthetic" as
 the system name, and the trace instance name (NULL if using the global
 trace array)), along with an variable number of u64 args, one for each
 synthetic event field, and the number of values being passed.
@@ -744,10 +744,10 @@ All vals should be cast to u64, and string vals are just pointers to
 strings, cast to u64.  Strings will be copied into space reserved in
 the event for the string, using these pointers.
 
-Alternatively, the synth_event_trace_array() function can be used to
-accomplish the same thing.  It is passed the trace_event_file
+Alternatively, the ``synth_event_trace_array()`` function can be used to
+accomplish the same thing.  It is passed the ``trace_event_file``
 representing the synthetic event (which can be retrieved using
-trace_get_event_file() using the synthetic event name, "synthetic" as
+``trace_get_event_file()`` using the synthetic event name, "synthetic" as
 the system name, and the trace instance name (NULL if using the global
 trace array)), along with an array of u64, one for each synthetic
 event field.
@@ -765,7 +765,7 @@ above, code like the following could be used::
   vals[5] = (u64)"thneed";        /* my_string_field */
   vals[6] = 398;                  /* my_int_field */
 
-The 'vals' array is just an array of u64, the number of which must
+The ``vals`` array is just an array of u64, the number of which must
 match the number of field in the synthetic event, and which must be in
 the same order as the synthetic event fields.
 
@@ -774,7 +774,7 @@ strings, cast to u64.  Strings will be copied into space reserved in
 the event for the string, using these pointers.
 
 In order to trace a synthetic event, a pointer to the trace event file
-is needed.  The trace_get_event_file() function can be used to get
+is needed.  The ``trace_get_event_file()`` function can be used to get
 it - it will find the file in the given trace instance (in this case
 NULL since the top trace array is being used) while at the same time
 preventing the instance containing it from going away::
@@ -785,34 +785,34 @@ preventing the instance containing it from going away::
 Before tracing the event, it should be enabled in some way, otherwise
 the synthetic event won't actually show up in the trace buffer.
 
-To enable a synthetic event from the kernel, trace_array_set_clr_event()
+To enable a synthetic event from the kernel, ``trace_array_set_clr_event()``
 can be used (which is not specific to synthetic events, so does need
 the "synthetic" system name to be specified explicitly).
 
-To enable the event, pass 'true' to it::
+To enable the event, pass ``true`` to it::
 
        trace_array_set_clr_event(schedtest_event_file->tr,
                                  "synthetic", "schedtest", true);
 
-To disable it pass false::
+To disable it pass ``false``::
 
        trace_array_set_clr_event(schedtest_event_file->tr,
                                  "synthetic", "schedtest", false);
 
-Finally, synth_event_trace_array() can be used to actually trace the
+Finally, ``synth_event_trace_array()`` can be used to actually trace the
 event, which should be visible in the trace buffer afterwards::
 
        ret = synth_event_trace_array(schedtest_event_file, vals,
                                      ARRAY_SIZE(vals));
 
 To remove the synthetic event, the event should be disabled, and the
-trace instance should be 'put' back using trace_put_event_file()::
+trace instance should be 'put' back using ``trace_put_event_file()``::
 
        trace_array_set_clr_event(schedtest_event_file->tr,
                                  "synthetic", "schedtest", false);
        trace_put_event_file(schedtest_event_file);
 
-If those have been successful, synth_event_delete() can be called to
+If those have been successful, ``synth_event_delete()`` can be called to
 remove the event::
 
        ret = synth_event_delete("schedtest");
@@ -821,16 +821,16 @@ Tracing a synthetic event piecewise
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 To trace a synthetic using the piecewise method described above, the
-synth_event_trace_start() function is used to 'open' the synthetic
+``synth_event_trace_start()`` function is used to 'open' the synthetic
 event trace::
 
        struct synth_event_trace_state trace_state;
 
        ret = synth_event_trace_start(schedtest_event_file, &trace_state);
 
-It's passed the trace_event_file representing the synthetic event
+It's passed the ``trace_event_file`` representing the synthetic event
 using the same methods as described above, along with a pointer to a
-struct synth_event_trace_state object, which will be zeroed before use and
+``struct synth_event_trace_state`` object, which will be zeroed before use and
 used to maintain state between this and following calls.
 
 Once the event has been opened, which means space for it has been
@@ -841,8 +841,8 @@ tradeoff is flexibility in doing the assignments vs the cost of a
 lookup per field.
 
 To assign the values one after the other without lookups,
-synth_event_add_next_val() should be used.  Each call is passed the
-same synth_event_trace_state object used in the synth_event_trace_start(),
+``synth_event_add_next_val()`` should be used.  Each call is passed the
+same ``synth_event_trace_state`` object used in the ``synth_event_trace_start()``,
 along with the value to set the next field in the event.  After each
 field is set, the 'cursor' points to the next field, which will be set
 by the subsequent call, continuing until all the fields have been set
@@ -870,9 +870,9 @@ this method would be (without error-handling code)::
        /* my_int_field */
        ret = synth_event_add_next_val(395, &trace_state);
 
-To assign the values in any order, synth_event_add_val() should be
-used.  Each call is passed the same synth_event_trace_state object used in
-the synth_event_trace_start(), along with the field name of the field
+To assign the values in any order, ``synth_event_add_val()`` should be
+used.  Each call is passed the same ``synth_event_trace_state`` object used in
+the ``synth_event_trace_start()``, along with the field name of the field
 to set and the value to set it to.  The same sequence of calls as in
 the above examples using this method would be (without error-handling
 code)::
@@ -887,17 +887,17 @@ code)::
                                  &trace_state);
        ret = synth_event_add_val("my_int_field", 3999, &trace_state);
 
-Note that synth_event_add_next_val() and synth_event_add_val() are
+Note that ``synth_event_add_next_val()`` and ``synth_event_add_val()`` are
 incompatible if used within the same trace of an event - either one
 can be used but not both at the same time.
 
 Finally, the event won't be actually traced until it's 'closed',
-which is done using synth_event_trace_end(), which takes only the
-struct synth_event_trace_state object used in the previous calls::
+which is done using ``synth_event_trace_end()``, which takes only the
+struct ``synth_event_trace_state`` object used in the previous calls::
 
        ret = synth_event_trace_end(&trace_state);
 
-Note that synth_event_trace_end() must be called at the end regardless
+Note that ``synth_event_trace_end()`` must be called at the end regardless
 of whether any of the add calls failed (say due to a bad field name
 being passed in).
 
@@ -905,18 +905,18 @@ Dyamically creating kprobe and kretprobe event definitions
 ----------------------------------------------------------
 
 To create a kprobe or kretprobe trace event from kernel code, the
-kprobe_event_gen_cmd_start() or kretprobe_event_gen_cmd_start()
+``kprobe_event_gen_cmd_start()`` or ``kretprobe_event_gen_cmd_start()``
 functions can be used.
 
 To create a kprobe event, an empty or partially empty kprobe event
-should first be created using kprobe_event_gen_cmd_start().  The name
+should first be created using ``kprobe_event_gen_cmd_start()``.  The name
 of the event and the probe location should be specfied along with one
 or args each representing a probe field should be supplied to this
-function.  Before calling kprobe_event_gen_cmd_start(), the user
-should create and initialize a dynevent_cmd object using
-kprobe_event_cmd_init().
+function.  Before calling ``kprobe_event_gen_cmd_start()``, the user
+should create and initialize a ``dynevent_cmd`` object using
+``kprobe_event_cmd_init()``.
 
-For example, to create a new "schedtest" kprobe event with two fields::
+For example, to create a new ``schedtest`` kprobe event with two fields::
 
   struct dynevent_cmd cmd;
   char *buf;
@@ -936,15 +936,15 @@ For example, to create a new "schedtest" kprobe event with two fields::
 
 Once the kprobe event object has been created, it can then be
 populated with more fields.  Fields can be added using
-kprobe_event_add_fields(), supplying the dynevent_cmd object along
+``kprobe_event_add_fields()``, supplying the ``dynevent_cmd`` object along
 with a variable arg list of probe fields.  For example, to add a
 couple additional fields, the following call could be made::
 
   ret = kprobe_event_add_fields(&cmd, "flags=%cx", "mode=+4($stack)");
 
 Once all the fields have been added, the event should be finalized and
-registered by calling the kprobe_event_gen_cmd_end() or
-kretprobe_event_gen_cmd_end() functions, depending on whether a kprobe
+registered by calling the ``kprobe_event_gen_cmd_end()`` or
+``kretprobe_event_gen_cmd_end()`` functions, depending on whether a kprobe
 or kretprobe command was started::
 
   ret = kprobe_event_gen_cmd_end(&cmd);
@@ -957,7 +957,7 @@ At this point, the event object is ready to be used for tracing new
 events.
 
 Similarly, a kretprobe event can be created using
-kretprobe_event_gen_cmd_start() with a probe name and location and
+``kretprobe_event_gen_cmd_start()`` with a probe name and location and
 additional params such as $retval::
 
   ret = kretprobe_event_gen_cmd_start(&cmd, "gen_kretprobe_test",
@@ -978,11 +978,11 @@ used to give the kprobe event file back and delete the event::
 
   ret = kprobe_event_delete("gen_kprobe_test");
 
-The "dynevent_cmd" low-level API
+The ``dynevent_cmd`` low-level API
 --------------------------------
 
 Both the in-kernel synthetic event and kprobe interfaces are built on
-top of a lower-level "dynevent_cmd" interface.  This interface is
+top of a lower-level ``dynevent_cmd`` interface.  This interface is
 meant to provide the basis for higher-level interfaces such as the
 synthetic and kprobe interfaces, which can be used as examples.
 
@@ -994,14 +994,14 @@ subystem for creating the corresponding trace events.
 
 In a nutshell, the way it works is that the higher-level interface
 code creates a struct dynevent_cmd object, then uses a couple
-functions, dynevent_arg_add() and dynevent_arg_pair_add() to build up
+functions, ``dynevent_arg_add()`` and ``dynevent_arg_pair_add()`` to build up
 a command string, which finally causes the command to be executed
-using the dynevent_create() function.  The details of the interface
+using the ``dynevent_create()`` function.  The details of the interface
 are described below.
 
 The first step in building a new command string is to create and
-initialize an instance of a dynevent_cmd.  Here, for instance, we
-create a dynevent_cmd on the stack and initialize it::
+initialize an instance of a ``dynevent_cmd``.  Here, for instance, we
+create a ``dynevent_cmd`` on the stack and initialize it::
 
   struct dynevent_cmd cmd;
   char *buf;
@@ -1012,20 +1012,20 @@ create a dynevent_cmd on the stack and initialize it::
   dynevent_cmd_init(cmd, buf, maxlen, DYNEVENT_TYPE_FOO,
                     foo_event_run_command);
 
-The dynevent_cmd initialization needs to be given a user-specified
-buffer and the length of the buffer (MAX_DYNEVENT_CMD_LEN can be used
+The ``dynevent_cmd`` initialization needs to be given a user-specified
+buffer and the length of the buffer (``MAX_DYNEVENT_CMD_LEN`` can be used
 for this purpose - at 2k it's generally too big to be comfortably put
 on the stack, so is dynamically allocated), a dynevent type id, which
 is meant to be used to check that further API calls are for the
-correct command type, and a pointer to an event-specific run_command()
+correct command type, and a pointer to an event-specific ``run_command()``
 callback that will be called to actually execute the event-specific
 command function.
 
 Once that's done, the command string can by built up by successive
 calls to argument-adding functions.
 
-To add a single argument, define and initialize a struct dynevent_arg
-or struct dynevent_arg_pair object.  Here's an example of the simplest
+To add a single argument, define and initialize a struct ``dynevent_arg``
+or ``struct dynevent_arg_pair`` object.  Here's an example of the simplest
 possible arg addition, which is simply to append the given string as
 a whitespace-separated argument to the command::
 
@@ -1037,15 +1037,15 @@ a whitespace-separated argument to the command::
 
   ret = dynevent_arg_add(cmd, &arg);
 
-The arg object is first initialized using dynevent_arg_init() and in
+The arg object is first initialized using ``dynevent_arg_init()`` and in
 this case the parameters are NULL or 0, which means there's no
 optional sanity-checking function or separator appended to the end of
 the arg.
 
 Here's another more complicated example using an 'arg pair', which is
 used to create an argument that consists of a couple components added
-together as a unit, for example, a 'type field_name;' arg or a simple
-expression arg e.g. 'flags=%cx'::
+together as a unit, for example, a ``type field_name;`` arg or a simple
+expression arg e.g. ``flags=%cx``::
 
   struct dynevent_arg_pair arg_pair;
 
@@ -1062,19 +1062,19 @@ neither part of the pair is NULL), along with a character to be used
 to add an operator between the pair (here none) and a separator to be
 appended onto the end of the arg pair (here ';').
 
-There's also a dynevent_str_add() function that can be used to simply
+There's also a ``dynevent_str_add()`` function that can be used to simply
 add a string as-is, with no spaces, delimeters, or arg check.
 
-Any number of dynevent_*_add() calls can be made to build up the string
-(until its length surpasses cmd->maxlen).  When all the arguments have
+Any number of ``dynevent_*_add()`` calls can be made to build up the string
+(until its length surpasses ``cmd->maxlen``).  When all the arguments have
 been added and the command string is complete, the only thing left to
 do is run the command, which happens by simply calling
-dynevent_create()::
+``dynevent_create()``::
 
   ret = dynevent_create(&cmd);
 
 At that point, if the return value is 0, the dynamic event has been
 created and is ready to use.
 
-See the dynevent_cmd function definitions themselves for the details
+See the ``dynevent_cmd`` function definitions themselves for the details
 of the API.
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] docs: tracing: use refs for cross-referencing
  2022-03-13 10:55 [PATCH 1/3] docs: tracing: use refs for cross-referencing Roland Hieber
  2022-03-13 10:55 ` [PATCH 2/3] docs: trace: bring headings in order Roland Hieber
  2022-03-13 10:55 ` [PATCH 3/3] docs: trace: events: apply literal markup Roland Hieber
@ 2022-03-13 23:55 ` Steven Rostedt
  2022-03-14 11:46   ` Roland Hieber
  2 siblings, 1 reply; 10+ messages in thread
From: Steven Rostedt @ 2022-03-13 23:55 UTC (permalink / raw)
  To: Roland Hieber
  Cc: Jonathan Corbet, Ingo Molnar, Daniel Bristot de Oliveira, linux-doc

On Sun, 13 Mar 2022 11:55:55 +0100
Roland Hieber <rhi@pengutronix.de> wrote:

> Help cross-linking the documents by using the :ref: role.

Note, I and many other people read the .rst files directly, and do not
rely on any processing. Is there a better way to do a cross reference
like this, because I find this a bit ugly to read.

-- Steve


> 
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> ---
> PATCH v2:
>  * new in v2
> 
>  Documentation/trace/events.rst          | 25 ++++++++++------
>  Documentation/trace/ftrace.rst          | 38 ++++++++++++++++---------
>  Documentation/trace/kprobetrace.rst     |  2 +-
>  Documentation/trace/timerlat-tracer.rst |  6 ++--
>  4 files changed, 46 insertions(+), 25 deletions(-)
> 
> diff --git a/Documentation/trace/events.rst b/Documentation/trace/events.rst
> index c47f381d0c00..e83d0d5378be 100644
> --- a/Documentation/trace/events.rst
> +++ b/Documentation/trace/events.rst
> @@ -20,6 +20,8 @@ tracing information should be printed.
>  2. Using Event Tracing
>  ======================
>  
> +.. _tracing_set_event_interface:
> +
>  2.1 Via the 'set_event' interface
>  ---------------------------------
>  
> @@ -91,21 +93,23 @@ In order to facilitate early boot debugging, use boot option::
>  
>  	trace_event=[event-list]
>  
> -event-list is a comma separated list of events. See section 2.1 for event
> -format.
> +event-list is a comma separated list of events. See
> +:ref:`tracing_set_event_interface` for event format.
>  
>  3. Defining an event-enabled tracepoint
>  =======================================
>  
>  See The example provided in samples/trace_events
>  
> +.. _tracing_event_formats:
> +
>  4. Event formats
>  ================
>  
>  Each trace event has a 'format' file associated with it that contains
>  a description of each field in a logged event.  This information can
>  be used to parse the binary trace stream, and is also the place to
> -find the field names that can be used in event filters (see section 5).
> +find the field names that can be used in :ref:`event filters <tracing_event_filters>`.
>  
>  It also displays the format string that will be used to print the
>  event in text mode, along with the event name and ID used for
> @@ -150,6 +154,8 @@ This event contains 10 fields, the first 5 common and the remaining 5
>  event-specific.  All the fields for this event are numeric, except for
>  'comm' which is a string, a distinction important for event filtering.
>  
> +.. _tracing_event_filters:
> +
>  5. Event filtering
>  ==================
>  
> @@ -178,7 +184,7 @@ double-quotes can be used to prevent the shell from interpreting
>  operators as shell metacharacters.
>  
>  The field-names available for use in filters can be found in the
> -'format' files for trace events (see section 4).
> +'format' files for trace events (see :ref:`tracing_event_filters`).
>  
>  The relational-operators depend on the type of the field being tested:
>  
> @@ -324,6 +330,7 @@ To add more PIDs without losing the PIDs already included, use '>>'.
>  
>  	# echo 123 244 1 >> set_event_pid
>  
> +.. _tracing_event_triggers:
>  
>  6. Event triggers
>  =================
> @@ -335,7 +342,7 @@ a stack trace whenever the trace event is hit.  Whenever a trace event
>  with attached triggers is invoked, the set of trigger commands
>  associated with that event is invoked.  Any given trigger can
>  additionally have an event filter of the same form as described in
> -section 5 (Event filtering) associated with it - the command will only
> +:ref:`tracing_event_filters` associated with it - the command will only
>  be invoked if the event being invoked passes the associated filter.
>  If no filter is associated with the trigger, it always passes.
>  
> @@ -356,8 +363,8 @@ enabled, and also allows the current event filter implementation to be
>  used for conditionally invoking triggers.
>  
>  The syntax for event triggers is roughly based on the syntax for
> -set_ftrace_filter 'ftrace filter commands' (see the 'Filter commands'
> -section of Documentation/trace/ftrace.rst), but there are major
> +set_ftrace_filter 'ftrace filter commands' (see the section
> +:ref:`ftrace_filter_commands`), but there are major
>  differences and the implementation isn't currently tied to it in any
>  way, so beware about making generalizations between the two.
>  
> @@ -382,8 +389,8 @@ The [if filter] part isn't used in matching commands when removing, so
>  leaving that off in a '!' command will accomplish the same thing as
>  having it in.
>  
> -The filter syntax is the same as that described in the 'Event
> -filtering' section above.
> +The filter syntax is the same as that described in the section
> +:ref:`tracing_event_filters` above.
>  
>  For ease of use, writing to the trigger file using '>' currently just
>  adds or removes a single trigger and there's no explicit '>>' support
> diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst
> index 45b8c56af67a..d018bd332200 100644
> --- a/Documentation/trace/ftrace.rst
> +++ b/Documentation/trace/ftrace.rst
> @@ -42,6 +42,7 @@ Implementation Details
>  
>  See Documentation/trace/ftrace-design.rst for details for arch porters and such.
>  
> +.. _ftrace_the_file_system:
>  
>  The File System
>  ---------------
> @@ -223,7 +224,7 @@ of ftrace. Here is a list of some of the key files:
>    set_ftrace_filter:
>  
>  	When dynamic ftrace is configured in (see the
> -	section below "dynamic ftrace"), the code is dynamically
> +	section :ref:`ftrace_dynamic_ftrace`), the code is dynamically
>  	modified (code text rewrite) to disable calling of the
>  	function profiler (mcount). This lets tracing be configured
>  	in with practically no overhead in performance.  This also
> @@ -237,7 +238,7 @@ of ftrace. Here is a list of some of the key files:
>  	can be written into this file.
>  
>  	This interface also allows for commands to be used. See the
> -	"Filter commands" section for more details.
> +	:ref:`ftrace_dynamic_ftrace` section for more details.
>  
>  	As a speed up, since processing strings can be quite expensive
>  	and requires a check of all functions registered to tracing, instead
> @@ -305,7 +306,7 @@ of ftrace. Here is a list of some of the key files:
>  
>  	Functions listed in this file will cause the function graph
>  	tracer to only trace these functions and the functions that
> -	they call. (See the section "dynamic ftrace" for more details).
> +	they call. (See the section :ref:`ftrace_dynamic_ftrace` for more details).
>  	Note, set_ftrace_filter and set_ftrace_notrace still affects
>  	what functions are being traced.
>  
> @@ -322,7 +323,7 @@ of ftrace. Here is a list of some of the key files:
>  	These are the function names that you can pass to
>  	"set_ftrace_filter", "set_ftrace_notrace",
>  	"set_graph_function", or "set_graph_notrace".
> -	(See the section "dynamic ftrace" below for more details.)
> +	(See the section :ref:`ftrace_dynamic_ftrace` for more details.)
>  
>    dyn_ftrace_total_info:
>  
> @@ -426,19 +427,19 @@ of ftrace. Here is a list of some of the key files:
>  
>  	This displays the "snapshot" buffer and also lets the user
>  	take a snapshot of the current running trace.
> -	See the "Snapshot" section below for more details.
> +	See the section :ref:`ftrace_snapshot` below for more details.
>  
>    stack_max_size:
>  
>  	When the stack tracer is activated, this will display the
>  	maximum stack size it has encountered.
> -	See the "Stack Trace" section below.
> +	See the section :ref:`ftrace_stack_trace` below.
>  
>    stack_trace:
>  
>  	This displays the stack back trace of the largest stack
>  	that was encountered when the stack tracer is activated.
> -	See the "Stack Trace" section below.
> +	See the section :ref:`ftrace_stack_trace` below.
>  
>    stack_trace_filter:
>  
> @@ -578,7 +579,7 @@ of ftrace. Here is a list of some of the key files:
>  
>  	This is a way to make multiple trace buffers where different
>  	events can be recorded in different buffers.
> -	See "Instances" section below.
> +	See section :ref:`ftrace_instances` below.
>  
>    events:
>  
> @@ -630,7 +631,7 @@ of ftrace. Here is a list of some of the key files:
>    hwlat_detector:
>  
>  	Directory for the Hardware Latency Detector.
> -	See "Hardware Latency Detector" section below.
> +	See section :ref:`ftrace_hardware_latency_detector` below.
>  
>    per_cpu:
>  
> @@ -739,7 +740,7 @@ Here is the list of current tracers that may be configured.
>    "hwlat"
>  
>  	The Hardware Latency tracer is used to detect if the hardware
> -	produces any latency. See "Hardware Latency Detector" section
> +	produces any latency. See section :ref:`ftrace_hardware_latency_detector`
>  	below.
>  
>    "irqsoff"
> @@ -2156,6 +2157,8 @@ events.
>      <idle>-0       2d..3    6us :      0:120:R ==> [002]  5882: 94:R sleep
>  
>  
> +.. _ftrace_hardware_latency_detector:
> +
>  Hardware Latency Detector
>  -------------------------
>  
> @@ -2258,7 +2261,7 @@ function
>  This tracer is the function tracer. Enabling the function tracer
>  can be done from the debug file system. Make sure the
>  ftrace_enabled is set; otherwise this tracer is a nop.
> -See the "ftrace_enabled" section below.
> +See the :ref:`ftrace_ftrace_enabled` section below.
>  ::
>  
>    # sysctl kernel.ftrace_enabled=1
> @@ -2679,6 +2682,8 @@ You might find other useful features for this tracer in the
>  following "dynamic ftrace" section such as tracing only specific
>  functions or tasks.
>  
> +.. _ftrace_dynamic_ftrace:
> +
>  dynamic ftrace
>  --------------
>  
> @@ -3029,6 +3034,7 @@ this special filter via::
>  
>   echo > set_graph_function
>  
> +.. _ftrace_ftrace_enabled:
>  
>  ftrace_enabled
>  --------------
> @@ -3053,6 +3059,7 @@ This can be disable (and enabled) with::
>    echo 0 > /proc/sys/kernel/ftrace_enabled
>    echo 1 > /proc/sys/kernel/ftrace_enabled
>  
> +.. _ftrace_filter_commands:
>  
>  Filter commands
>  ---------------
> @@ -3281,6 +3288,8 @@ This is where the buffer_total_size_kb is useful:
>  Writing to the top level buffer_size_kb will reset all the buffers
>  to be the same again.
>  
> +.. _ftrace_snapshot:
> +
>  Snapshot
>  --------
>  CONFIG_TRACER_SNAPSHOT makes a generic snapshot feature
> @@ -3303,8 +3312,8 @@ feature:
>  	of the snapshot. Echo 1 into this file to allocate a
>  	spare buffer and to take a snapshot (swap), then read
>  	the snapshot from this file in the same format as
> -	"trace" (described above in the section "The File
> -	System"). Both reads snapshot and tracing are executable
> +	"trace" (described above in the section :ref:`ftrace_the_file_system`).
> +	Both reads snapshot and tracing are executable
>  	in parallel. When the spare buffer is allocated, echoing
>  	0 frees it, and echoing else (positive) values clear the
>  	snapshot contents.
> @@ -3367,6 +3376,7 @@ one of the latency tracers, you will get the following results.
>    # cat snapshot
>    cat: snapshot: Device or resource busy
>  
> +.. _ftrace_instances:
>  
>  Instances
>  ---------
> @@ -3495,6 +3505,8 @@ Note, if a process has a trace file open in one of the instance
>  directories, the rmdir will fail with EBUSY.
>  
>  
> +.. _ftrace_stack_trace:
> +
>  Stack trace
>  -----------
>  Since the kernel has a fixed sized stack, it is important not to
> diff --git a/Documentation/trace/kprobetrace.rst b/Documentation/trace/kprobetrace.rst
> index b175d88f31eb..8c903e39bdf2 100644
> --- a/Documentation/trace/kprobetrace.rst
> +++ b/Documentation/trace/kprobetrace.rst
> @@ -141,7 +141,7 @@ id:
>  
>  trigger:
>    This allows to install trigger commands which are executed when the event is
> -  hit (for details, see Documentation/trace/events.rst, section 6).
> +  hit (for details, see :ref:`tracing_event_triggers`).
>  
>  Event Profiling
>  ---------------
> diff --git a/Documentation/trace/timerlat-tracer.rst b/Documentation/trace/timerlat-tracer.rst
> index 64d1fe6e9b93..92bfc3729025 100644
> --- a/Documentation/trace/timerlat-tracer.rst
> +++ b/Documentation/trace/timerlat-tracer.rst
> @@ -96,8 +96,8 @@ For example::
>  
>  In this case, the root cause of the timer latency does not point to a
>  single cause but to multiple ones. Firstly, the timer IRQ was delayed
> -for 13 us, which may point to a long IRQ disabled section (see IRQ
> -stacktrace section). Then the timer interrupt that wakes up the timerlat
> +for 13 us, which may point to a long IRQ disabled section (see section
> +:ref:`timerlat_tracer_irq_stacktrace`). Then the timer interrupt that wakes up the timerlat
>  thread took 7597 ns, and the qxl:21 device IRQ took 7139 ns. Finally,
>  the cc1 thread noise took 9909 ns of time before the context switch.
>  Such pieces of evidence are useful for the developer to use other
> @@ -133,6 +133,8 @@ in the timelines means circa 1 us, and the time moves ==>::
>                              |          +-> irq_noise: 6139 ns
>                              +-> irq_noise: 7597 ns
>  
> +.. _timerlat_tracer_irq_stacktrace:
> +
>  IRQ stacktrace
>  ---------------------------
>  


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] docs: trace: bring headings in order
  2022-03-13 10:55 ` [PATCH 2/3] docs: trace: bring headings in order Roland Hieber
@ 2022-03-14  0:01   ` Steven Rostedt
  2022-03-14 11:28     ` Roland Hieber
  0 siblings, 1 reply; 10+ messages in thread
From: Steven Rostedt @ 2022-03-14  0:01 UTC (permalink / raw)
  To: Roland Hieber
  Cc: Jonathan Corbet, Ingo Molnar, Daniel Bristot de Oliveira, linux-doc

On Sun, 13 Mar 2022 11:55:56 +0100
Roland Hieber <rhi@pengutronix.de> wrote:

>  
> -2.2 Inter-event hist triggers
> ------------------------------
> +Inter-event hist triggers
> +-------------------------
>  
>  Inter-event hist triggers are hist triggers that combine values from
>  one or more other events and create a histogram using that data.  Data
> @@ -1676,8 +1676,8 @@ pseudo-file.
>  
>  These features are described in more detail in the following sections.
>  
> -2.2.1 Histogram Variables
> --------------------------
> +Histogram Variables
> +-------------------
>  

Histogram Variables is a sub section of Inter-event hist triggers,
which this now removes. This affects the output a breaks the intention
of the document. I haven't looked at all the other updates, I just
stopped when I saw this.

-- Steve

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] docs: trace: events: apply literal markup
  2022-03-13 10:55 ` [PATCH 3/3] docs: trace: events: apply literal markup Roland Hieber
@ 2022-03-14  0:04   ` Steven Rostedt
  0 siblings, 0 replies; 10+ messages in thread
From: Steven Rostedt @ 2022-03-14  0:04 UTC (permalink / raw)
  To: Roland Hieber
  Cc: Jonathan Corbet, Ingo Molnar, Daniel Bristot de Oliveira, linux-doc

On Sun, 13 Mar 2022 11:55:57 +0100
Roland Hieber <rhi@pengutronix.de> wrote:

> The document can be easier readable if not everything is in 'quotes',
> but sometimes also in fixed-width font.
> 

It is definitely not easier to read. Many of us that use this
documentation do so by looking at the ascii file and not the processed
file. This makes it harder to read.

-- Steve


> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> ---

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] docs: trace: bring headings in order
  2022-03-14  0:01   ` Steven Rostedt
@ 2022-03-14 11:28     ` Roland Hieber
  0 siblings, 0 replies; 10+ messages in thread
From: Roland Hieber @ 2022-03-14 11:28 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Jonathan Corbet, Ingo Molnar, Daniel Bristot de Oliveira, linux-doc

On Sun, Mar 13, 2022 at 08:01:43PM -0400, Steven Rostedt wrote:
> On Sun, 13 Mar 2022 11:55:56 +0100
> Roland Hieber <rhi@pengutronix.de> wrote:
> 
> >  
> > -2.2 Inter-event hist triggers
> > ------------------------------
> > +Inter-event hist triggers
> > +-------------------------
> >  
> >  Inter-event hist triggers are hist triggers that combine values from
> >  one or more other events and create a histogram using that data.  Data
> > @@ -1676,8 +1676,8 @@ pseudo-file.
> >  
> >  These features are described in more detail in the following sections.
> >  
> > -2.2.1 Histogram Variables
> > --------------------------
> > +Histogram Variables
> > +-------------------
> >  
> 
> Histogram Variables is a sub section of Inter-event hist triggers,
> which this now removes. This affects the output a breaks the intention
> of the document. I haven't looked at all the other updates, I just
> stopped when I saw this.

Ah, yes. This was probably overlooked when the document was convert into
reST initially.

I'll fix it in the next iteration.

 - Roland

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] docs: tracing: use refs for cross-referencing
  2022-03-13 23:55 ` [PATCH 1/3] docs: tracing: use refs for cross-referencing Steven Rostedt
@ 2022-03-14 11:46   ` Roland Hieber
  2022-03-16 21:48     ` Jonathan Corbet
  0 siblings, 1 reply; 10+ messages in thread
From: Roland Hieber @ 2022-03-14 11:46 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Jonathan Corbet, Ingo Molnar, Daniel Bristot de Oliveira, linux-doc

On Sun, Mar 13, 2022 at 07:55:19PM -0400, Steven Rostedt wrote:
> On Sun, 13 Mar 2022 11:55:55 +0100
> Roland Hieber <rhi@pengutronix.de> wrote:
> 
> > Help cross-linking the documents by using the :ref: role.
> 
> Note, I and many other people read the .rst files directly, and do not
> rely on any processing. Is there a better way to do a cross reference
> like this, because I find this a bit ugly to read.

The main point of this series was to get rid of the manually numbered
sections (which the next patch does). Relying on manual section numbers
for cross-referencing is error-prone, which my first iteration of the
patch already showed… Unfortunately, the sphinx reST syntax is not very
flexible here.

I could imagine leaving the file names in when a reference points to a
different document, like in this hunk:

> > -set_ftrace_filter 'ftrace filter commands' (see the 'Filter commands'
> > -section of Documentation/trace/ftrace.rst), but there are major
> > +set_ftrace_filter 'ftrace filter commands' (see the section
> > +:ref:`ftrace_filter_commands`), but there are major

Otherwise jumping around in the same document should be easy by
searching for the reference label (i.e. pressing '#' or '*' in vim),
which is the same as searching for section numbers or titles.

 - Roland

> > Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> > ---
> > PATCH v2:
> >  * new in v2
> > 
> >  Documentation/trace/events.rst          | 25 ++++++++++------
> >  Documentation/trace/ftrace.rst          | 38 ++++++++++++++++---------
> >  Documentation/trace/kprobetrace.rst     |  2 +-
> >  Documentation/trace/timerlat-tracer.rst |  6 ++--
> >  4 files changed, 46 insertions(+), 25 deletions(-)
> > 
> > diff --git a/Documentation/trace/events.rst b/Documentation/trace/events.rst
> > index c47f381d0c00..e83d0d5378be 100644
> > --- a/Documentation/trace/events.rst
> > +++ b/Documentation/trace/events.rst
> > @@ -20,6 +20,8 @@ tracing information should be printed.
> >  2. Using Event Tracing
> >  ======================
> >  
> > +.. _tracing_set_event_interface:
> > +
> >  2.1 Via the 'set_event' interface
> >  ---------------------------------
> >  
> > @@ -91,21 +93,23 @@ In order to facilitate early boot debugging, use boot option::
> >  
> >  	trace_event=[event-list]
> >  
> > -event-list is a comma separated list of events. See section 2.1 for event
> > -format.
> > +event-list is a comma separated list of events. See
> > +:ref:`tracing_set_event_interface` for event format.
> >  
> >  3. Defining an event-enabled tracepoint
> >  =======================================
> >  
> >  See The example provided in samples/trace_events
> >  
> > +.. _tracing_event_formats:
> > +
> >  4. Event formats
> >  ================
> >  
> >  Each trace event has a 'format' file associated with it that contains
> >  a description of each field in a logged event.  This information can
> >  be used to parse the binary trace stream, and is also the place to
> > -find the field names that can be used in event filters (see section 5).
> > +find the field names that can be used in :ref:`event filters <tracing_event_filters>`.
> >  
> >  It also displays the format string that will be used to print the
> >  event in text mode, along with the event name and ID used for
> > @@ -150,6 +154,8 @@ This event contains 10 fields, the first 5 common and the remaining 5
> >  event-specific.  All the fields for this event are numeric, except for
> >  'comm' which is a string, a distinction important for event filtering.
> >  
> > +.. _tracing_event_filters:
> > +
> >  5. Event filtering
> >  ==================
> >  
> > @@ -178,7 +184,7 @@ double-quotes can be used to prevent the shell from interpreting
> >  operators as shell metacharacters.
> >  
> >  The field-names available for use in filters can be found in the
> > -'format' files for trace events (see section 4).
> > +'format' files for trace events (see :ref:`tracing_event_filters`).
> >  
> >  The relational-operators depend on the type of the field being tested:
> >  
> > @@ -324,6 +330,7 @@ To add more PIDs without losing the PIDs already included, use '>>'.
> >  
> >  	# echo 123 244 1 >> set_event_pid
> >  
> > +.. _tracing_event_triggers:
> >  
> >  6. Event triggers
> >  =================
> > @@ -335,7 +342,7 @@ a stack trace whenever the trace event is hit.  Whenever a trace event
> >  with attached triggers is invoked, the set of trigger commands
> >  associated with that event is invoked.  Any given trigger can
> >  additionally have an event filter of the same form as described in
> > -section 5 (Event filtering) associated with it - the command will only
> > +:ref:`tracing_event_filters` associated with it - the command will only
> >  be invoked if the event being invoked passes the associated filter.
> >  If no filter is associated with the trigger, it always passes.
> >  
> > @@ -356,8 +363,8 @@ enabled, and also allows the current event filter implementation to be
> >  used for conditionally invoking triggers.
> >  
> >  The syntax for event triggers is roughly based on the syntax for
> > -set_ftrace_filter 'ftrace filter commands' (see the 'Filter commands'
> > -section of Documentation/trace/ftrace.rst), but there are major
> > +set_ftrace_filter 'ftrace filter commands' (see the section
> > +:ref:`ftrace_filter_commands`), but there are major
> >  differences and the implementation isn't currently tied to it in any
> >  way, so beware about making generalizations between the two.
> >  
> > @@ -382,8 +389,8 @@ The [if filter] part isn't used in matching commands when removing, so
> >  leaving that off in a '!' command will accomplish the same thing as
> >  having it in.
> >  
> > -The filter syntax is the same as that described in the 'Event
> > -filtering' section above.
> > +The filter syntax is the same as that described in the section
> > +:ref:`tracing_event_filters` above.
> >  
> >  For ease of use, writing to the trigger file using '>' currently just
> >  adds or removes a single trigger and there's no explicit '>>' support
> > diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst
> > index 45b8c56af67a..d018bd332200 100644
> > --- a/Documentation/trace/ftrace.rst
> > +++ b/Documentation/trace/ftrace.rst
> > @@ -42,6 +42,7 @@ Implementation Details
> >  
> >  See Documentation/trace/ftrace-design.rst for details for arch porters and such.
> >  
> > +.. _ftrace_the_file_system:
> >  
> >  The File System
> >  ---------------
> > @@ -223,7 +224,7 @@ of ftrace. Here is a list of some of the key files:
> >    set_ftrace_filter:
> >  
> >  	When dynamic ftrace is configured in (see the
> > -	section below "dynamic ftrace"), the code is dynamically
> > +	section :ref:`ftrace_dynamic_ftrace`), the code is dynamically
> >  	modified (code text rewrite) to disable calling of the
> >  	function profiler (mcount). This lets tracing be configured
> >  	in with practically no overhead in performance.  This also
> > @@ -237,7 +238,7 @@ of ftrace. Here is a list of some of the key files:
> >  	can be written into this file.
> >  
> >  	This interface also allows for commands to be used. See the
> > -	"Filter commands" section for more details.
> > +	:ref:`ftrace_dynamic_ftrace` section for more details.
> >  
> >  	As a speed up, since processing strings can be quite expensive
> >  	and requires a check of all functions registered to tracing, instead
> > @@ -305,7 +306,7 @@ of ftrace. Here is a list of some of the key files:
> >  
> >  	Functions listed in this file will cause the function graph
> >  	tracer to only trace these functions and the functions that
> > -	they call. (See the section "dynamic ftrace" for more details).
> > +	they call. (See the section :ref:`ftrace_dynamic_ftrace` for more details).
> >  	Note, set_ftrace_filter and set_ftrace_notrace still affects
> >  	what functions are being traced.
> >  
> > @@ -322,7 +323,7 @@ of ftrace. Here is a list of some of the key files:
> >  	These are the function names that you can pass to
> >  	"set_ftrace_filter", "set_ftrace_notrace",
> >  	"set_graph_function", or "set_graph_notrace".
> > -	(See the section "dynamic ftrace" below for more details.)
> > +	(See the section :ref:`ftrace_dynamic_ftrace` for more details.)
> >  
> >    dyn_ftrace_total_info:
> >  
> > @@ -426,19 +427,19 @@ of ftrace. Here is a list of some of the key files:
> >  
> >  	This displays the "snapshot" buffer and also lets the user
> >  	take a snapshot of the current running trace.
> > -	See the "Snapshot" section below for more details.
> > +	See the section :ref:`ftrace_snapshot` below for more details.
> >  
> >    stack_max_size:
> >  
> >  	When the stack tracer is activated, this will display the
> >  	maximum stack size it has encountered.
> > -	See the "Stack Trace" section below.
> > +	See the section :ref:`ftrace_stack_trace` below.
> >  
> >    stack_trace:
> >  
> >  	This displays the stack back trace of the largest stack
> >  	that was encountered when the stack tracer is activated.
> > -	See the "Stack Trace" section below.
> > +	See the section :ref:`ftrace_stack_trace` below.
> >  
> >    stack_trace_filter:
> >  
> > @@ -578,7 +579,7 @@ of ftrace. Here is a list of some of the key files:
> >  
> >  	This is a way to make multiple trace buffers where different
> >  	events can be recorded in different buffers.
> > -	See "Instances" section below.
> > +	See section :ref:`ftrace_instances` below.
> >  
> >    events:
> >  
> > @@ -630,7 +631,7 @@ of ftrace. Here is a list of some of the key files:
> >    hwlat_detector:
> >  
> >  	Directory for the Hardware Latency Detector.
> > -	See "Hardware Latency Detector" section below.
> > +	See section :ref:`ftrace_hardware_latency_detector` below.
> >  
> >    per_cpu:
> >  
> > @@ -739,7 +740,7 @@ Here is the list of current tracers that may be configured.
> >    "hwlat"
> >  
> >  	The Hardware Latency tracer is used to detect if the hardware
> > -	produces any latency. See "Hardware Latency Detector" section
> > +	produces any latency. See section :ref:`ftrace_hardware_latency_detector`
> >  	below.
> >  
> >    "irqsoff"
> > @@ -2156,6 +2157,8 @@ events.
> >      <idle>-0       2d..3    6us :      0:120:R ==> [002]  5882: 94:R sleep
> >  
> >  
> > +.. _ftrace_hardware_latency_detector:
> > +
> >  Hardware Latency Detector
> >  -------------------------
> >  
> > @@ -2258,7 +2261,7 @@ function
> >  This tracer is the function tracer. Enabling the function tracer
> >  can be done from the debug file system. Make sure the
> >  ftrace_enabled is set; otherwise this tracer is a nop.
> > -See the "ftrace_enabled" section below.
> > +See the :ref:`ftrace_ftrace_enabled` section below.
> >  ::
> >  
> >    # sysctl kernel.ftrace_enabled=1
> > @@ -2679,6 +2682,8 @@ You might find other useful features for this tracer in the
> >  following "dynamic ftrace" section such as tracing only specific
> >  functions or tasks.
> >  
> > +.. _ftrace_dynamic_ftrace:
> > +
> >  dynamic ftrace
> >  --------------
> >  
> > @@ -3029,6 +3034,7 @@ this special filter via::
> >  
> >   echo > set_graph_function
> >  
> > +.. _ftrace_ftrace_enabled:
> >  
> >  ftrace_enabled
> >  --------------
> > @@ -3053,6 +3059,7 @@ This can be disable (and enabled) with::
> >    echo 0 > /proc/sys/kernel/ftrace_enabled
> >    echo 1 > /proc/sys/kernel/ftrace_enabled
> >  
> > +.. _ftrace_filter_commands:
> >  
> >  Filter commands
> >  ---------------
> > @@ -3281,6 +3288,8 @@ This is where the buffer_total_size_kb is useful:
> >  Writing to the top level buffer_size_kb will reset all the buffers
> >  to be the same again.
> >  
> > +.. _ftrace_snapshot:
> > +
> >  Snapshot
> >  --------
> >  CONFIG_TRACER_SNAPSHOT makes a generic snapshot feature
> > @@ -3303,8 +3312,8 @@ feature:
> >  	of the snapshot. Echo 1 into this file to allocate a
> >  	spare buffer and to take a snapshot (swap), then read
> >  	the snapshot from this file in the same format as
> > -	"trace" (described above in the section "The File
> > -	System"). Both reads snapshot and tracing are executable
> > +	"trace" (described above in the section :ref:`ftrace_the_file_system`).
> > +	Both reads snapshot and tracing are executable
> >  	in parallel. When the spare buffer is allocated, echoing
> >  	0 frees it, and echoing else (positive) values clear the
> >  	snapshot contents.
> > @@ -3367,6 +3376,7 @@ one of the latency tracers, you will get the following results.
> >    # cat snapshot
> >    cat: snapshot: Device or resource busy
> >  
> > +.. _ftrace_instances:
> >  
> >  Instances
> >  ---------
> > @@ -3495,6 +3505,8 @@ Note, if a process has a trace file open in one of the instance
> >  directories, the rmdir will fail with EBUSY.
> >  
> >  
> > +.. _ftrace_stack_trace:
> > +
> >  Stack trace
> >  -----------
> >  Since the kernel has a fixed sized stack, it is important not to
> > diff --git a/Documentation/trace/kprobetrace.rst b/Documentation/trace/kprobetrace.rst
> > index b175d88f31eb..8c903e39bdf2 100644
> > --- a/Documentation/trace/kprobetrace.rst
> > +++ b/Documentation/trace/kprobetrace.rst
> > @@ -141,7 +141,7 @@ id:
> >  
> >  trigger:
> >    This allows to install trigger commands which are executed when the event is
> > -  hit (for details, see Documentation/trace/events.rst, section 6).
> > +  hit (for details, see :ref:`tracing_event_triggers`).
> >  
> >  Event Profiling
> >  ---------------
> > diff --git a/Documentation/trace/timerlat-tracer.rst b/Documentation/trace/timerlat-tracer.rst
> > index 64d1fe6e9b93..92bfc3729025 100644
> > --- a/Documentation/trace/timerlat-tracer.rst
> > +++ b/Documentation/trace/timerlat-tracer.rst
> > @@ -96,8 +96,8 @@ For example::
> >  
> >  In this case, the root cause of the timer latency does not point to a
> >  single cause but to multiple ones. Firstly, the timer IRQ was delayed
> > -for 13 us, which may point to a long IRQ disabled section (see IRQ
> > -stacktrace section). Then the timer interrupt that wakes up the timerlat
> > +for 13 us, which may point to a long IRQ disabled section (see section
> > +:ref:`timerlat_tracer_irq_stacktrace`). Then the timer interrupt that wakes up the timerlat
> >  thread took 7597 ns, and the qxl:21 device IRQ took 7139 ns. Finally,
> >  the cc1 thread noise took 9909 ns of time before the context switch.
> >  Such pieces of evidence are useful for the developer to use other
> > @@ -133,6 +133,8 @@ in the timelines means circa 1 us, and the time moves ==>::
> >                              |          +-> irq_noise: 6139 ns
> >                              +-> irq_noise: 7597 ns
> >  
> > +.. _timerlat_tracer_irq_stacktrace:
> > +
> >  IRQ stacktrace
> >  ---------------------------
> >  
> 
> 

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] docs: tracing: use refs for cross-referencing
  2022-03-14 11:46   ` Roland Hieber
@ 2022-03-16 21:48     ` Jonathan Corbet
  2022-03-16 21:52       ` Steven Rostedt
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Corbet @ 2022-03-16 21:48 UTC (permalink / raw)
  To: Roland Hieber, Steven Rostedt
  Cc: Ingo Molnar, Daniel Bristot de Oliveira, linux-doc

Roland Hieber <rhi@pengutronix.de> writes:

> On Sun, Mar 13, 2022 at 07:55:19PM -0400, Steven Rostedt wrote:
>> On Sun, 13 Mar 2022 11:55:55 +0100
>> Roland Hieber <rhi@pengutronix.de> wrote:
>> 
>> > Help cross-linking the documents by using the :ref: role.
>> 
>> Note, I and many other people read the .rst files directly, and do not
>> rely on any processing. Is there a better way to do a cross reference
>> like this, because I find this a bit ugly to read.
>
> The main point of this series was to get rid of the manually numbered
> sections (which the next patch does). Relying on manual section numbers
> for cross-referencing is error-prone, which my first iteration of the
> patch already showed… Unfortunately, the sphinx reST syntax is not very
> flexible here.

I agree on the removal of the numbered sections.  Those always end up
being wrong after a while.

> I could imagine leaving the file names in when a reference points to a
> different document, like in this hunk:
>
>> > -set_ftrace_filter 'ftrace filter commands' (see the 'Filter commands'
>> > -section of Documentation/trace/ftrace.rst), but there are major
>> > +set_ftrace_filter 'ftrace filter commands' (see the section
>> > +:ref:`ftrace_filter_commands`), but there are major

In general, all of those references and labels clutter the source
considerably and aren't hugely useful to readers of the plain-text
documents.  There are times when they are the best thing to do, but I
think that moderation is indicated.  Just giving the file name will
generate a cross-reference to that file; I would hope that would be
enough most of the time.

Thanks,

jon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] docs: tracing: use refs for cross-referencing
  2022-03-16 21:48     ` Jonathan Corbet
@ 2022-03-16 21:52       ` Steven Rostedt
  0 siblings, 0 replies; 10+ messages in thread
From: Steven Rostedt @ 2022-03-16 21:52 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Roland Hieber, Ingo Molnar, Daniel Bristot de Oliveira, linux-doc

On Wed, 16 Mar 2022 15:48:56 -0600
Jonathan Corbet <corbet@lwn.net> wrote:

> > The main point of this series was to get rid of the manually numbered
> > sections (which the next patch does). Relying on manual section numbers
> > for cross-referencing is error-prone, which my first iteration of the
> > patch already showed… Unfortunately, the sphinx reST syntax is not very
> > flexible here.  
> 
> I agree on the removal of the numbered sections.  Those always end up
> being wrong after a while.
> 
> > I could imagine leaving the file names in when a reference points to a
> > different document, like in this hunk:
> >  
> >> > -set_ftrace_filter 'ftrace filter commands' (see the 'Filter commands'
> >> > -section of Documentation/trace/ftrace.rst), but there are major
> >> > +set_ftrace_filter 'ftrace filter commands' (see the section
> >> > +:ref:`ftrace_filter_commands`), but there are major  
> 
> In general, all of those references and labels clutter the source
> considerably and aren't hugely useful to readers of the plain-text
> documents.  There are times when they are the best thing to do, but I
> think that moderation is indicated.  Just giving the file name will
> generate a cross-reference to that file; I would hope that would be
> enough most of the time.

I agree on both points.

Thanks Jon.

-- Steve

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-03-16 21:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-13 10:55 [PATCH 1/3] docs: tracing: use refs for cross-referencing Roland Hieber
2022-03-13 10:55 ` [PATCH 2/3] docs: trace: bring headings in order Roland Hieber
2022-03-14  0:01   ` Steven Rostedt
2022-03-14 11:28     ` Roland Hieber
2022-03-13 10:55 ` [PATCH 3/3] docs: trace: events: apply literal markup Roland Hieber
2022-03-14  0:04   ` Steven Rostedt
2022-03-13 23:55 ` [PATCH 1/3] docs: tracing: use refs for cross-referencing Steven Rostedt
2022-03-14 11:46   ` Roland Hieber
2022-03-16 21:48     ` Jonathan Corbet
2022-03-16 21:52       ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.