Commit graph

205 commits

Author SHA1 Message Date
Fin Maaß
4d859419d9 drivers: serial: don't check return value of uart_irq_update()
Remove return value checks of uart_irq_update().
Needed for changing it's return value to void.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-19 17:46:51 -04:00
Mikolaj Klikowicz
8afa8f1b5a tracing: ctf: use 64-bit timestamps
Changes CTF events to use 64bit timestamp. This enables tracing of
longer
execution as 32bit timestamps overflows after ~4s.

Signed-off-by: Mikolaj Klikowicz <mklikowicz@antmicro.com>
2026-05-05 14:07:47 -05:00
Jedrzej Czykier
2ad8645dac tracing: relax TRACING_BACKEND_UART dependency to SERIAL
Currently, TRACING_BACKEND_UART depends on UART_CONSOLE. This is overly
restrictive because the UART tracing backend relies entirely on the
generic UART driver APIs and does not utilize console subsystem.

Signed-off-by: Jedrzej Czykier <jczykier@antmicro.com>
2026-04-21 10:19:05 +01:00
Murali Iyengar
09f92ad393 tracing: add external tracing module support
Enhancement request:
zephyrproject-rtos/zephyr#37912

Code reference from
zephyrproject-rtos/zephyr#39552

Adds out of tree tracing backend support

Signed-off-by: Murali Iyengar <murali.r.iyengar@intel.com>
2026-01-29 17:20:22 +01:00
Igor Knippenberg
4a3c5ed1f6 tracing: systemview: fix assertion fail on first thread switch
Segger Systemview calls k_current_get() in sys_trace_k_thread_switched_in.
During early boot, this hook is triggered while k_is_pre_kernel() is true.

This triggers an assertion failure when CONFIG_ASSERT is enabled.

Add a guard to ignore the thread switch event if it is called pre-kernel.

Signed-off-by: Igor Knippenberg <knippenberg@filics.eu>
2025-12-30 17:40:05 +01:00
Peter Ujfalusi
ebb5625bee intel_adsp: Add debug slot manager
Currently all drivers which uses a slot from the debug window have fragile
hardwired slot 'mapping', they are locked to use specific slots even if
there are free slots available for them to take.

The new API hides the management of the slots and descriptors and users
can ask, release or even seize slots that they want to use.

Add a new debug slot manager API and a new default no config option to
allow selection between the hardwired or dynamic debug slot management.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2025-12-12 04:54:53 -05:00
Vijay Sharma
432d9d2a6b tracing: trace timer calls
Add tracing support for timer expiry and stop function callbacks,
enabling measurement of callback execution duration and facilitating
debugging of cases where callbacks take longer than expected.

Signed-off-by: Vijay Sharma <vijshar@qti.qualcomm.com>
2025-12-09 22:40:13 -05:00
Anas Nashif
2bfe6c498b tracing: move event ids from uint8_t to uint16_t
We are hitting the limit of 256 events possible with event id right now
defined as uint8_t.

The bandwidth increase is minimal (2 bytes per event) compared to the
payload data, and the scalability benefits far outweigh the costs.

Existing CTF traces with 8-bit IDs won't be compatible.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-12-09 14:55:15 -05:00
Jukka Rissanen
8046a24104 net: Fix network API calls that were not namespaced
Some of the networking calls were not namespaced so fix it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-21 12:01:31 +01:00
Jukka Rissanen
d45cd6716b net: Convert network codebase to use renamed network APIs
Rename network symbols in network stack to use the renamed network APIs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-17 14:01:32 -05:00
Dev Joshi
080734ce0f tracing: rtio: Add tracing hooks for rtio
This commit adds tracing support/hooks for rtio subsystem. It was
requested in #76972.

Signed-off-by: Dev Joshi <devbhave@qti.qualcomm.com>
2025-11-13 20:45:24 -05:00
Anas Nashif
303af992e5 style: fix 'if (' usage in cmake files
Replace with 'if(' and 'else(' per the cmake style guidelines.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-29 11:44:13 +02:00
Rob Barnes
5ce408b647 kernel: assert if k_current_get is called pre-kernel
k_current_get is not valid pre-kernel. It will return an invalid dummy
thread or invalid memory. The invalid memory case can occur when
CURRENT_THREAD_USE_TLS is enabled.

Assert in k_current_get when called pre-kernel so offending code may be
identified.

k_is_pre_kernel is moved up in kernel.h to avoid needing a prototype for
k_is_pre_kernel.

Signed-off-by: Rob Barnes <robbarnes@google.com>
2025-10-28 11:52:34 +02:00
Alberto Escolar Piedras
8fb6cb7537 tracing: ctf: Fix arguments for socket tracing functions (again)
Zephyr's socklen_t was changed in
c546c1cad1
to be uint32_t instea of size_t.
Let's fix accordingly the prototypes which expect it.

Note this was already fixed in
37ff1b254f
But it was reverted in
d849ab1263

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-10-27 16:14:50 -04:00
Anas Nashif
d849ab1263 tracing: fix various style issues
run clang-format and fix various checkpatch issues.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
fc4db3dd1d tracing: ctf: do not use signal as an argument
Violates coding guideline rule 21.2

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
21e44ea8d4 tracing: systemview: add tracing for mail boxes
Add missing hooks for mail boxes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
a6dee79282 tracing: systemview: add tracing for events
Add missing hooks for events.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
59a3fe86d3 tracing: systemview: add tracing for stacks
Add missing hooks for stack objects.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
539308f336 tracing: systemview: add tracing for message queues
Add missing hooks for message queues.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
63582601f2 tracing: ctf: add event support
Add hooks for events.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
61dd33445e tracing: ctf: add mbox support
Add hooks for mail boxes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
1823d4cf18 tracing: ctf: thread extended
Add more thread related tracing functions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
906db71942 tracing: ctf: add poll
Add hooks for poll object.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
ba453c1337 tracing: ctf: add work queues
Add hooks for work queues.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
e23d663b85 tracing: ctf: add condition variables
Add hooks for condition variables.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
26fa18ef2d tracing: ctf: add tracing for message queues
Add hooks for message queues.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
9e99699167 tracing: ctf: add tracing for memory slabs
Add hooks for memory slabs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
7b1e72474c tracing: ctf: add missing return value for mutex_unlock
Add missing return for mutex_unlock.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Anas Nashif
afef4b6a17 tracing: add semihosting backend
Using semihosting on supported architectures (arm, xtensa, riscv) it now
possible to generate tracing giles easily and without being restricted
by size.
Using qemu for example, it is now possible to generate the tracing file
simply by running:

 west build -p -b mps2/an385 tests/kernel/msgq/msgq_api/ \
 	-t run --snippet semihost-tracing

This will generate a tracing file in the build/ directory which can be
viewed with babeltrace.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-25 15:59:19 +03:00
Måns Ansgariusson
ebe128e61f subsys/tracing: Remove retired k_pipe references in SYSVIEW config
Due to the k_pipe rework, references to k_pipe in the SYSVIEW configuration
are now obsolete. This commit removes these references.

Signed-off-by: Måns Ansgariusson <Mansgariusson@gmail.com>
2025-10-10 12:55:37 -04:00
Måns Ansgariusson
98917a022b tracing: Remove retired k_pipe tracing api
The old k_pipe api was retired in #95408, the tracing hooks should be
removed as well.

Signed-off-by: Måns Ansgariusson <Mansgariusson@gmail.com>
2025-10-08 08:44:11 +02:00
Alberto Escolar Piedras
37ff1b254f tracing: ctf: Fix arguments socket tracing functions
Zephyr's socklen_t was changed in
c546c1cad1
to be uint32_t instea of size_t.
Let's fix accordingly the prototypes which expect it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-10-06 20:00:20 +03:00
Daniel Leung
4ef1163e39 samples: tracing: fix missing k_event funcs for UART test
With the UART transport test (sample.tracing.transport.uart),
it would fail on qemu_x86_64 complaining about missing
k_event tracing functions. So add them to fix the compilation
error.

Fixes #96818

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-10-03 21:19:57 -04:00
Alberto Escolar Piedras
896bdce53a subsys/tracing/tracing_backend_posix: Set file to be closed on exec
If the process does an exec() (or fork, or..) all descriptors are kept
open by default, unless O_CLOEXEC is set when opening them.
This is usefull for stdin/out/err so that new process is connected to
them, but it is very rare for it to be usefull for any other descriptor.

In general this leads to descriptors being kept open unnecessarily,
which either will block other process from getting them (for example
if the child survives the parent but it does something else).
Or for a "leak" which unnecessarily uses descriptors and memory in the
child process.

Let's ensure we do not leak it for this component as we do not need it.

Note glibc fopen supports the "e" modifier as an extension to pass
O_CLOEXEC to the open syscall.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-10-02 22:00:02 +02:00
Kristoffer Skøien
2faf1aa86d tracing: Added board qualifier to SEGGER SystemView
Added CONFIG_BOARD_QUALIFIERS as target core to SEGGER SystemView config

Signed-off-by: Kristoffer Skøien <kristoffer.skoien@nordicsemi.no>
2025-09-09 17:28:10 +02:00
Anas Nashif
f5d7081710 kernel: do not include ksched.h in subsys/soc code
Do not directly include and use APIs from ksched.h outside of the
kernel. For now do this using more suitable (ipi.h and
kernel_internal.h) internal APIs until more cleanup is done.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-09-09 11:45:06 +02:00
Daniel DeGrasse
c7e60346a0 tracing: ctf: take IRQ lock before generating timestamp
CTF tracing relies on all packet timestamps being increasing- if a
timestamp of a later packet is less than the prior packet, the CTF
parser assumes the timestamp field has overflowed and adds to the
overall timestamp to account for this.

When taking a timestamp for a CTF packet, it was possible for an interrupt
to occur before the packet was submitted to the tracing core framework
but after the timestamp was generated. The interrupt itself would
generate a tracing event with a later timestamp then the packet in
question, leading to the packets being recorded out of order.

To resolve this, take an IRQ lock before generating the timestamp and
release it after submitting the packet to the tracing core.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-09-08 15:54:35 -04:00
WenBin Zhang
d28602adaf tracing: systemview: Add isr name for Segger-sysview
With symtab enabled, the isr name is collected by symbol table

Signed-off-by: WenBin Zhang <freey7955@gmail.com>
2025-08-13 22:12:01 -04:00
Anas Nashif
6c85528cbe tracing: ctf: fix arguments for timer_status_sync
In the metadata, found that timer_status_sync_pending was missing the
timeout parameter. Noticed when tracing tests/kernel/common.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-08-01 19:38:40 +01:00
Anas Nashif
d794732087 tracing: ctf: add missing k_sleep events
In a096b34835 which introduced tracing of k_sleep, the events in the
metadata file were missed causing issues when running with babeltrace.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-08-01 19:38:40 +01:00
WenBin Zhang
d01edb10e1 tracing: Fix k_mem_slab_free tracing systemview
Fix k_mem_slabe_free tracing error.

Signed-off-by: WenBin Zhang <freey7955@gmail.com>
2025-07-31 10:53:30 +01:00
Anas Nashif
a096b34835 tracing: ctf: trace k_sleep()
Trace sleep events in CTF:

[19:00:00.181375400] (+0.000044700) k_sleep_enter: ...
..
[19:00:00.290203800] (+0.000031500) k_sleep_exit: ...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-25 23:29:14 +02:00
Alexander Paschoaletto
8c03410af0 tracing: msgq: adding dedicated tracing for k_msgq_put_front
This commit adds the tracing macros and functions related
specifically to the k_msgq_put_front API.

Signed-off-by: Alexander Paschoaletto <axelpinheiro@gmail.com>
2025-07-25 08:16:58 -04:00
Alberto Escolar Piedras
af750b2b41 subsys/tracing/backend_posix: Remove NATIVE_APPLICATION support
It is not possible to build anymore in that mode, so we do not
need to support it in this driver cmake files.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-07-19 09:38:15 +02:00
Krzysztof Sychla
dcdc7d315e tracing: Allow disabling idle traces
This change allows for enabling/disabling the idle traces by setting the
CONFIG_TRACING_IDLE config.

Signed-off-by: Krzysztof Sychla <ksychla@antmicro.com>
2025-06-27 08:59:32 -10:00
Koen Van Herck
6ccd228d62 subsys/tracing: do not select (RTT_)CONSOLE in SEGGER_SYSTEMVIEW
Tracing using Segger's SystemView works fine without enabling RTT_CONSOLE
(or CONSOLE, in general).
SEGGER_SYSTEMVIEW was automatically selecting RTT_CONSOLE, which prevents
applications from using another console backend (e.g. UART_CONSOLE).

Signed-off-by: Koen Van Herck <koen.v.herck@gmail.com>
2025-06-24 20:04:07 -10:00
The Nguyen
f51a89268f tracing: fix build error on USB backend
This commit to fix build error due to a wrong syntax in case USBD
highspeed was enabled

Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
2025-06-18 10:54:32 +02:00
Filip Kokosinski
15b73eda7d subsys/tracing: select backend name in Kconfig
This commit allows tracing backend name selection through Kconfig.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2025-06-17 16:05:59 +02:00
Filip Kokosinski
ef20311522 subsys/tracing: add names to Kconfig choice symbols
This commit adds names to Kconfig choice sysmbols. This allows for their
selection from Kconfig, e.g.:

    choice TRACING_FORMAT_CHOICE
    	default TRACING_TEST if CONFIG_FOO
	default TRACING_CTF if CONFIG_BAR
    endchoice

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2025-06-17 16:05:29 +02:00