<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/trace/trace_events_hist.c, branch v5.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-06-01T12:23:22Z</updated>
<entry>
<title>tracing: Move synthetic events to a separate file</title>
<updated>2020-06-01T12:23:22Z</updated>
<author>
<name>Tom Zanussi</name>
<email>zanussi@kernel.org</email>
</author>
<published>2020-05-28T19:32:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=726721a51838e3983023f906580722fc83f804ee'/>
<id>urn:sha1:726721a51838e3983023f906580722fc83f804ee</id>
<content type='text'>
With the addition of the in-kernel synthetic event API, synthetic
events are no longer specifically tied to the histogram triggers.

The synthetic event code is also making trace_event_hist.c very
bloated, so for those reasons, move it to a separate file,
trace_events_synth.c, along with a new trace_synth.h header file.

Because synthetic events are now independent from hist triggers, add a
new CONFIG_SYNTH_EVENTS config option, and have CONFIG_HIST_TRIGGERS
select it, and have CONFIG_SYNTH_EVENT_GEN_TEST depend on it.

Link: http://lkml.kernel.org/r/4d1fa1f85ed5982706ac44844ac92451dcb04715.1590693308.git.zanussi@kernel.org

Signed-off-by: Tom Zanussi &lt;zanussi@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Add hist_debug trace event files for histogram debugging</title>
<updated>2020-06-01T12:22:30Z</updated>
<author>
<name>Tom Zanussi</name>
<email>zanussi@kernel.org</email>
</author>
<published>2020-04-03T19:31:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2d19bd79ae6509858582a9cade739c2e9a4fdca8'/>
<id>urn:sha1:2d19bd79ae6509858582a9cade739c2e9a4fdca8</id>
<content type='text'>
Add a new "hist_debug" file for each trace event, which when read will
dump out a bunch of internal details about the hist triggers defined
on that event.

This is normally off but can be enabled by saying 'y' to the new
CONFIG_HIST_TRIGGERS_DEBUG config option.

This is in support of the new Documentation file describing histogram
internals, Documentation/trace/histogram-design.rst, which was
requested by developers trying to understand the internals when
extending or making use of the hist triggers for higher-level tools.

The histogram-design.rst documentation refers to the hist_debug files
and demonstrates their use with output in the test examples.

Link: http://lkml.kernel.org/r/77914c22b0ba493d9783c53bbfbc6087d6a7e1b1.1585941485.git.zanussi@kernel.org

Signed-off-by: Tom Zanussi &lt;zanussi@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Check state.disabled in synth event trace functions</title>
<updated>2020-06-01T12:21:08Z</updated>
<author>
<name>Tom Zanussi</name>
<email>zanussi@kernel.org</email>
</author>
<published>2020-04-03T19:31:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1b94b3aed367ff2cdc84d325e0aa9d7cc9e3cf2a'/>
<id>urn:sha1:1b94b3aed367ff2cdc84d325e0aa9d7cc9e3cf2a</id>
<content type='text'>
Since trace_state.disabled is set in __synth_event_trace_start() at
the same time -ENOENT is returned, don't bother returning -ENOENT -
just have callers check trace_state.disabled instead, and avoid the
extra return val munging.

Link: http://lkml.kernel.org/r/87315c3889af870e8370e82b76cf48b426d70130.1585941485.git.zanussi@kernel.org

Suggested-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Signed-off-by: Tom Zanussi &lt;zanussi@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@godmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Fix memory leaks in trace_events_hist.c</title>
<updated>2020-04-23T01:24:00Z</updated>
<author>
<name>Vamshi K Sthambamkadi</name>
<email>vamshi.k.sthambamkadi@gmail.com</email>
</author>
<published>2020-04-22T06:15:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9da73974eb9c965dd9989befb593b8c8da9e4bdc'/>
<id>urn:sha1:9da73974eb9c965dd9989befb593b8c8da9e4bdc</id>
<content type='text'>
kmemleak report 1:
    [&lt;9092c50b&gt;] kmem_cache_alloc_trace+0x138/0x270
    [&lt;05a2c9ed&gt;] create_field_var+0xcf/0x180
    [&lt;528a2d68&gt;] action_create+0xe2/0xc80
    [&lt;63f50b61&gt;] event_hist_trigger_func+0x15b5/0x1920
    [&lt;28ea5d3d&gt;] trigger_process_regex+0x7b/0xc0
    [&lt;3138e86f&gt;] event_trigger_write+0x4d/0xb0
    [&lt;ffd66c19&gt;] __vfs_write+0x30/0x200
    [&lt;4f424a0d&gt;] vfs_write+0x96/0x1b0
    [&lt;da59a290&gt;] ksys_write+0x53/0xc0
    [&lt;3717101a&gt;] __ia32_sys_write+0x15/0x20
    [&lt;c5f23497&gt;] do_fast_syscall_32+0x70/0x250
    [&lt;46e2629c&gt;] entry_SYSENTER_32+0xaf/0x102

This is because save_vars[] of struct hist_trigger_data are
not destroyed

kmemleak report 2:
    [&lt;9092c50b&gt;] kmem_cache_alloc_trace+0x138/0x270
    [&lt;6e5e97c5&gt;] create_var+0x3c/0x110
    [&lt;de82f1b9&gt;] create_field_var+0xaf/0x180
    [&lt;528a2d68&gt;] action_create+0xe2/0xc80
    [&lt;63f50b61&gt;] event_hist_trigger_func+0x15b5/0x1920
    [&lt;28ea5d3d&gt;] trigger_process_regex+0x7b/0xc0
    [&lt;3138e86f&gt;] event_trigger_write+0x4d/0xb0
    [&lt;ffd66c19&gt;] __vfs_write+0x30/0x200
    [&lt;4f424a0d&gt;] vfs_write+0x96/0x1b0
    [&lt;da59a290&gt;] ksys_write+0x53/0xc0
    [&lt;3717101a&gt;] __ia32_sys_write+0x15/0x20
    [&lt;c5f23497&gt;] do_fast_syscall_32+0x70/0x250
    [&lt;46e2629c&gt;] entry_SYSENTER_32+0xaf/0x102

struct hist_field allocated through create_var() do not initialize
"ref" field to 1. The code in __destroy_hist_field() does not destroy
object if "ref" is initialized to zero, the condition
if (--hist_field-&gt;ref &gt; 1) always passes since unsigned int wraps.

kmemleak report 3:
    [&lt;f8666fcc&gt;] __kmalloc_track_caller+0x139/0x2b0
    [&lt;bb7f80a5&gt;] kstrdup+0x27/0x50
    [&lt;39d70006&gt;] init_var_ref+0x58/0xd0
    [&lt;8ca76370&gt;] create_var_ref+0x89/0xe0
    [&lt;f045fc39&gt;] action_create+0x38f/0xc80
    [&lt;7c146821&gt;] event_hist_trigger_func+0x15b5/0x1920
    [&lt;07de3f61&gt;] trigger_process_regex+0x7b/0xc0
    [&lt;e87daf8f&gt;] event_trigger_write+0x4d/0xb0
    [&lt;19bf1512&gt;] __vfs_write+0x30/0x200
    [&lt;64ce4d27&gt;] vfs_write+0x96/0x1b0
    [&lt;a6f34170&gt;] ksys_write+0x53/0xc0
    [&lt;7d4230cd&gt;] __ia32_sys_write+0x15/0x20
    [&lt;8eadca00&gt;] do_fast_syscall_32+0x70/0x250
    [&lt;235cf985&gt;] entry_SYSENTER_32+0xaf/0x102

hist_fields (system &amp; event_name) are not freed

Link: http://lkml.kernel.org/r/20200422061503.GA5151@cosmos

Signed-off-by: Vamshi K Sthambamkadi &lt;vamshi.k.sthambamkadi@gmail.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'trace-v5.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace</title>
<updated>2020-02-26T18:34:42Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-02-26T18:34:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=91ad64a84e9e63e2906ae714dfa3933dd3f64c64'/>
<id>urn:sha1:91ad64a84e9e63e2906ae714dfa3933dd3f64c64</id>
<content type='text'>
Pull tracing and bootconfig updates:
 "Fixes and changes to bootconfig before it goes live in a release.

  Change in API of bootconfig (before it comes live in a release):
  - Have a magic value "BOOTCONFIG" in initrd to know a bootconfig
    exists
  - Set CONFIG_BOOT_CONFIG to 'n' by default
  - Show error if "bootconfig" on cmdline but not compiled in
  - Prevent redefining the same value
  - Have a way to append values
  - Added a SELECT BLK_DEV_INITRD to fix a build failure

  Synthetic event fixes:
  - Switch to raw_smp_processor_id() for recording CPU value in preempt
    section. (No care for what the value actually is)
  - Fix samples always recording u64 values
  - Fix endianess
  - Check number of values matches number of fields
  - Fix a printing bug

  Fix of trace_printk() breaking postponed start up tests

  Make a function static that is only used in a single file"

* tag 'trace-v5.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  bootconfig: Fix CONFIG_BOOTTIME_TRACING dependency issue
  bootconfig: Add append value operator support
  bootconfig: Prohibit re-defining value on same key
  bootconfig: Print array as multiple commands for legacy command line
  bootconfig: Reject subkey and value on same parent key
  tools/bootconfig: Remove unneeded error message silencer
  bootconfig: Add bootconfig magic word for indicating bootconfig explicitly
  bootconfig: Set CONFIG_BOOT_CONFIG=n by default
  tracing: Clear trace_state when starting trace
  bootconfig: Mark boot_config_checksum() static
  tracing: Disable trace_printk() on post poned tests
  tracing: Have synthetic event test use raw_smp_processor_id()
  tracing: Fix number printing bug in print_synth_event()
  tracing: Check that number of vals matches number of synth event fields
  tracing: Make synth_event trace functions endian-correct
  tracing: Make sure synth_event_trace() example always uses u64
</content>
</entry>
<entry>
<title>tracing: Clear trace_state when starting trace</title>
<updated>2020-02-20T22:48:59Z</updated>
<author>
<name>Masami Hiramatsu</name>
<email>mhiramat@kernel.org</email>
</author>
<published>2020-02-17T09:52:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7ab215f22d04067094de8c81c20ba4c565ff8dd4'/>
<id>urn:sha1:7ab215f22d04067094de8c81c20ba4c565ff8dd4</id>
<content type='text'>
Clear trace_state data structure when starting trace
in __synth_event_trace_start() internal function.

Currently trace_state is initialized only in the
synth_event_trace_start() API, but the trace_state
in synth_event_trace() and synth_event_trace_array()
are on the stack without initialization.
This means those APIs will see wrong parameters and
wil skip closing process in __synth_event_trace_end()
because trace_state-&gt;disabled may be !0.

Link: http://lkml.kernel.org/r/158193315899.8868.1781259176894639952.stgit@devnote2

Reviewed-by: Tom Zanussi &lt;zanussi@kernel.org&gt;
Signed-off-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Fix number printing bug in print_synth_event()</title>
<updated>2020-02-20T21:24:17Z</updated>
<author>
<name>Tom Zanussi</name>
<email>zanussi@kernel.org</email>
</author>
<published>2020-02-14T22:56:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=784bd0847eda032ed2f3522f87250655a18c0190'/>
<id>urn:sha1:784bd0847eda032ed2f3522f87250655a18c0190</id>
<content type='text'>
Fix a varargs-related bug in print_synth_event() which resulted in
strange output and oopses on 32-bit x86 systems. The problem is that
trace_seq_printf() expects the varargs to match the format string, but
print_synth_event() was always passing u64 values regardless.  This
results in unspecified behavior when unpacking with va_arg() in
trace_seq_printf().

Add a function that takes the size into account when calling
trace_seq_printf().

Before:

  modprobe-1731  [003] ....   919.039758: gen_synth_test: next_pid_field=777(null)next_comm_field=hula hoops ts_ns=1000000 ts_ms=1000 cpu=3(null)my_string_field=thneed my_int_field=598(null)

After:

 insmod-1136  [001] ....    36.634590: gen_synth_test: next_pid_field=777 next_comm_field=hula hoops ts_ns=1000000 ts_ms=1000 cpu=1 my_string_field=thneed my_int_field=598

Link: http://lkml.kernel.org/r/a9b59eb515dbbd7d4abe53b347dccf7a8e285657.1581720155.git.zanussi@kernel.org

Reported-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
Signed-off-by: Tom Zanussi &lt;zanussi@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Check that number of vals matches number of synth event fields</title>
<updated>2020-02-20T21:24:17Z</updated>
<author>
<name>Tom Zanussi</name>
<email>zanussi@kernel.org</email>
</author>
<published>2020-02-14T22:56:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3843083772dc2afde790a6d7160658b00a808da1'/>
<id>urn:sha1:3843083772dc2afde790a6d7160658b00a808da1</id>
<content type='text'>
Commit 7276531d4036('tracing: Consolidate trace() functions')
inadvertently dropped the synth_event_trace() and
synth_event_trace_array() checks that verify the number of values
passed in matches the number of fields in the synthetic event being
traced, so add them back.

Link: http://lkml.kernel.org/r/32819cac708714693669e0dfe10fe9d935e94a16.1581720155.git.zanussi@kernel.org

Signed-off-by: Tom Zanussi &lt;zanussi@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Make synth_event trace functions endian-correct</title>
<updated>2020-02-20T21:24:17Z</updated>
<author>
<name>Tom Zanussi</name>
<email>zanussi@kernel.org</email>
</author>
<published>2020-02-14T22:56:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1d9d4c90194a8c3b2f7da9f4bf3f8ba2ed810656'/>
<id>urn:sha1:1d9d4c90194a8c3b2f7da9f4bf3f8ba2ed810656</id>
<content type='text'>
synth_event_trace(), synth_event_trace_array() and
__synth_event_add_val() write directly into the trace buffer and need
to take endianness into account, like trace_event_raw_event_synth()
does.

Link: http://lkml.kernel.org/r/2011354355e405af9c9d28abba430d1f5ff7771a.1581720155.git.zanussi@kernel.org

Signed-off-by: Tom Zanussi &lt;zanussi@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'trace-v5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace</title>
<updated>2020-02-12T00:39:18Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-02-12T00:39:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=61a75954034f951a77d58b1cfb9186c62e6abcf8'/>
<id>urn:sha1:61a75954034f951a77d58b1cfb9186c62e6abcf8</id>
<content type='text'>
Pull tracing fixes from Steven Rostedt:
 "Various fixes:

   - Fix an uninitialized variable

   - Fix compile bug to bootconfig userspace tool (in tools directory)

   - Suppress some error messages of bootconfig userspace tool

   - Remove unneded CONFIG_LIBXBC from bootconfig

   - Allocate bootconfig xbc_nodes dynamically. To ease complaints about
     taking up static memory at boot up

   - Use of parse_args() to parse bootconfig instead of strstr() usage
     Prevents issues of double quotes containing the interested string

   - Fix missing ring_buffer_nest_end() on synthetic event error path

   - Return zero not -EINVAL on soft disabled synthetic event (soft
     disabling must be the same as hard disabling, which returns zero)

   - Consolidate synthetic event code (remove duplicate code)"

* tag 'trace-v5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Consolidate trace() functions
  tracing: Don't return -EINVAL when tracing soft disabled synth events
  tracing: Add missing nest end to synth_event_trace_start() error case
  tools/bootconfig: Suppress non-error messages
  bootconfig: Allocate xbc_nodes array dynamically
  bootconfig: Use parse_args() to find bootconfig and '--'
  tracing/kprobe: Fix uninitialized variable bug
  bootconfig: Remove unneeded CONFIG_LIBXBC
  tools/bootconfig: Fix wrong __VA_ARGS__ usage
</content>
</entry>
</feed>
