<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/tracing/rtla/src/trace.c, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-03-26T14:35:20+00:00</updated>
<entry>
<title>rtla: Fix segfault in save_trace_to_file call</title>
<updated>2025-03-26T14:35:20+00:00</updated>
<author>
<name>Tomas Glozar</name>
<email>tglozar@redhat.com</email>
</author>
<published>2025-03-13T14:10:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c57c58a62e564c615520839742b28d315427a280'/>
<id>urn:sha1:c57c58a62e564c615520839742b28d315427a280</id>
<content type='text'>
Running rtla with exit on threshold, but without saving trace leads to a
segmenetation fault:

$ rtla timerlat hist -T 10
...
Max timerlat IRQ latency from idle: 4.29 us in cpu 0
Segmentation fault

This is caused by null pointer deference in the call of
save_trace_to_file, which attempts to dereference an uninitialized
osnoise_tool variable:

save_trace_to_file(record-&gt;trace.inst, params-&gt;trace_output);
                   ^ this is uninitialized if params-&gt;trace_output is
                     not set

Fix this by not attempting to dereference "record" if it is NULL and
passing NULL instead. As a safety measure, the first field is also
checked for NULL inside save_trace_to_file.

Cc: John Kacur &lt;jkacur@redhat.com&gt;
Cc: Luis Goncalves &lt;lgoncalv@redhat.com&gt;
Cc: Costa Shulyupin &lt;costa.shul@redhat.com&gt;
Link: https://lore.kernel.org/20250313141034.299117-1-tglozar@redhat.com
Fixes: dc4d4e7c72d1 ("rtla: Refactor save_trace_to_file")
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>rtla: Refactor save_trace_to_file</title>
<updated>2025-03-04T19:17:19+00:00</updated>
<author>
<name>Costa Shulyupin</name>
<email>costa.shul@redhat.com</email>
</author>
<published>2025-02-19T11:51:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dc4d4e7c72d17e6f6bdd9ce0d7a72a085828987f'/>
<id>urn:sha1:dc4d4e7c72d17e6f6bdd9ce0d7a72a085828987f</id>
<content type='text'>
The functions osnoise_hist_main(), osnoise_top_main(),
timerlat_hist_main(), and timerlat_top_main() are lengthy and contain
duplicated code.

Refactor by consolidating the duplicate lines into the
save_trace_to_file() function.

Cc: Daniel Bristot de Oliveira &lt;bristot@kernel.org&gt;
Cc: John Kacur &lt;jkacur@redhat.com&gt;
Cc: "Luis Claudio R. Goncalves" &lt;lgoncalv@redhat.com&gt;
Cc: Eder Zulian &lt;ezulian@redhat.com&gt;
Cc: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Cc: Gabriele Monaco &lt;gmonaco@redhat.com&gt;
Link: https://lore.kernel.org/20250219115138.406075-1-costa.shul@redhat.com
Signed-off-by: Costa Shulyupin &lt;costa.shul@redhat.com&gt;
Reviewed-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
Tested-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>rtla: Count all processed events</title>
<updated>2025-01-24T18:46:24+00:00</updated>
<author>
<name>Tomas Glozar</name>
<email>tglozar@redhat.com</email>
</author>
<published>2025-01-23T14:23:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2aee44f721a75daebc55c372271221286efd79ec'/>
<id>urn:sha1:2aee44f721a75daebc55c372271221286efd79ec</id>
<content type='text'>
Add a field processed_events to struct trace_instance and increment it
in collect_registered_events, regardless of whether a handler is
registered for the event.

The purpose is to calculate the percentage of events that were missed
due to tracefs buffer overflow.

Cc: John Kacur &lt;jkacur@redhat.com&gt;
Cc: Luis Goncalves &lt;lgoncalv@redhat.com&gt;
Cc: Gabriele Monaco &lt;gmonaco@redhat.com&gt;
Link: https://lore.kernel.org/20250123142339.990300-3-tglozar@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>rtla: Count missed trace events</title>
<updated>2025-01-24T18:46:16+00:00</updated>
<author>
<name>Tomas Glozar</name>
<email>tglozar@redhat.com</email>
</author>
<published>2025-01-23T14:23:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d6fcd28ffeaaa6a1733303096637e6bf15704efb'/>
<id>urn:sha1:d6fcd28ffeaaa6a1733303096637e6bf15704efb</id>
<content type='text'>
Add function collect_missed_events to trace.c to act as a callback for
tracefs_follow_missed_events, summing the number of total missed events
into a new field missing_events of struct trace_instance.

In case record-&gt;missed_events is negative, trace-&gt;missed_events is set
to UINT64_MAX to signify an unknown number of events was missed.

The callback is activated on initialization of the trace instance.

Cc: John Kacur &lt;jkacur@redhat.com&gt;
Cc: Luis Goncalves &lt;lgoncalv@redhat.com&gt;
Cc: Gabriele Monaco &lt;gmonaco@redhat.com&gt;
Link: https://lore.kernel.org/20250123142339.990300-2-tglozar@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tools/rtla: Add osnoise_trace_is_off()</title>
<updated>2025-01-24T18:46:11+00:00</updated>
<author>
<name>Costa Shulyupin</name>
<email>costa.shul@redhat.com</email>
</author>
<published>2025-01-15T17:58:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b91cfd9f75c02e7f4463f8416d99138630c4dfd0'/>
<id>urn:sha1:b91cfd9f75c02e7f4463f8416d99138630c4dfd0</id>
<content type='text'>
All of the users of trace_is_off() passes in &amp;record-&gt;trace as the second
parameter, where record is a pointer to a struct osnoise_tool. This record
could be NULL and there is a hidden dependency that the trace field is the
first field to allow &amp;record-&gt;trace to work with a NULL record pointer.

In order to make this code a bit more robust, as record shouldn't be
dereferenced if it is NULL, even if the code does work, create a new
function called osnoise_trace_is_off() that takes the pointer to a
struct osnoise_tool as its second parameter. This way it can properly test
if it is NULL before it dereferences it.

The old function trace_is_off() is removed and the function
osnoise_trace_is_off() is added into osnoise.c which is what the
struct osnoise_tool is associated with.

Cc: John Kacur &lt;jkacur@redhat.com&gt;
Cc: "Luis Claudio R. Goncalves" &lt;lgoncalv@redhat.com&gt;
Cc: Eder Zulian &lt;ezulian@redhat.com&gt;
Cc: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Cc: Tomas Glozar &lt;tglozar@redhat.com&gt;
Cc: Gabriele Monaco &lt;gmonaco@redhat.com&gt;
Link: https://lore.kernel.org/20250115180055.2136815-1-costa.shul@redhat.com
Signed-off-by: Costa Shulyupin &lt;costa.shul@redhat.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>rtla: Add trace_instance_stop</title>
<updated>2025-01-24T18:45:02+00:00</updated>
<author>
<name>Tomas Glozar</name>
<email>tglozar@redhat.com</email>
</author>
<published>2025-01-16T14:49:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e879b5dcf8d044f3865a32d95cc5b213f314c54f'/>
<id>urn:sha1:e879b5dcf8d044f3865a32d95cc5b213f314c54f</id>
<content type='text'>
Support not only turning trace on for the timerlat tracer, but also
turning it off.

This will be used in subsequent patches to stop the timerlat tracer
without also wiping the trace buffer.

Cc: stable@vger.kernel.org
Cc: John Kacur &lt;jkacur@redhat.com&gt;
Cc: Luis Goncalves &lt;lgoncalv@redhat.com&gt;
Cc: Gabriele Monaco &lt;gmonaco@redhat.com&gt;
Link: https://lore.kernel.org/20250116144931.649593-2-tglozar@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>rtla: Add --trace-buffer-size option</title>
<updated>2024-05-16T14:44:34+00:00</updated>
<author>
<name>Daniel Bristot de Oliveira</name>
<email>bristot@kernel.org</email>
</author>
<published>2024-05-16T14:15:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e9a4062e1527238c5649d0f4be794a8566fd77c9'/>
<id>urn:sha1:e9a4062e1527238c5649d0f4be794a8566fd77c9</id>
<content type='text'>
Add the option allow the users to set a different buffer size for the
trace. For example, in large systems, the user might be interested on
reducing the trace buffer to avoid large tracing files.

The buffer size is specified in kB, and it is only affecting
the tracing instance.

The function trace_set_buffer_size() appears on libtracefs v1.6,
so increase the minimum required version on Makefile.config.

Link: https://lkml.kernel.org/r/e7c9ca5b3865f28e131a49ec3b984fadf2d056c6.1715860611.git.bristot@kernel.org

Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Cc: Juri Lelli &lt;juri.lelli@redhat.com&gt;
Cc: John Kacur &lt;jkacur@redhat.com&gt;
Signed-off-by: Daniel Bristot de Oliveira &lt;bristot@kernel.org&gt;
</content>
</entry>
<entry>
<title>rtla: Fix double free</title>
<updated>2022-07-31T21:03:38+00:00</updated>
<author>
<name>Andreas Schwab</name>
<email>schwab@suse.de</email>
</author>
<published>2022-07-25T15:12:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4f753c3be52c1d930afc0fe3169baa605dbaf611'/>
<id>urn:sha1:4f753c3be52c1d930afc0fe3169baa605dbaf611</id>
<content type='text'>
Avoid double free by making trace_instance_destroy indempotent.  When
trace_instance_init fails, it calls trace_instance_destroy, but its only
caller osnoise_destroy_tool calls it again.

Link: https://lkml.kernel.org/r/mvmilnlkyzx.fsf_-_@suse.de

Fixes: 0605bf009f18 ("rtla: Add osnoise tool")
Signed-off-by: Andreas Schwab &lt;schwab@suse.de&gt;
Acked-by: Daniel Bristot de Oliveira &lt;bristot@kernel.org&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>rtla: Check for trace off also in the trace instance</title>
<updated>2022-03-15T18:36:50+00:00</updated>
<author>
<name>Daniel Bristot de Oliveira</name>
<email>bristot@kernel.org</email>
</author>
<published>2022-03-02T19:01:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=28d2160cb1a18cca87a51345e7df47499447f5a4'/>
<id>urn:sha1:28d2160cb1a18cca87a51345e7df47499447f5a4</id>
<content type='text'>
With the addition of --trigger option, it is also possible to stop
the trace from the -t tracing instance using the traceoff trigger.

Make rtla tools to check if the trace is stopped also in the trace
instance, stopping the execution of the tool.

Link: https://lkml.kernel.org/r/59fc7c6f23dddd5c8b7ef1782cf3da51ea2ce0f5.1646247211.git.bristot@kernel.org

Cc: Daniel Bristot de Oliveira &lt;bristot@kernel.org&gt;
Cc: Clark Williams &lt;williams@redhat.com&gt;
Cc: Juri Lelli &lt;juri.lelli@redhat.com&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Signed-off-by: Daniel Bristot de Oliveira &lt;bristot@kernel.org&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>rtla/trace: Save event histogram output to a file</title>
<updated>2022-03-15T18:36:50+00:00</updated>
<author>
<name>Daniel Bristot de Oliveira</name>
<email>bristot@kernel.org</email>
</author>
<published>2022-03-02T19:01:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=761916fd02c2525139aca957b8a53fda1d8b3616'/>
<id>urn:sha1:761916fd02c2525139aca957b8a53fda1d8b3616</id>
<content type='text'>
The hist: trigger generates a histogram in the file sys/event/hist.
If the hist: trigger is used, automatically save the histogram output of
the event sys:event in the sys_event_hist.txt file.

Link: https://lkml.kernel.org/r/b5c906af31d4e022ffe87fb0848fac5c089087c8.1646247211.git.bristot@kernel.org

Cc: Daniel Bristot de Oliveira &lt;bristot@kernel.org&gt;
Cc: Clark Williams &lt;williams@redhat.com&gt;
Cc: Juri Lelli &lt;juri.lelli@redhat.com&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Signed-off-by: Daniel Bristot de Oliveira &lt;bristot@kernel.org&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
</feed>
