Skip to content

tracing: ctf: take IRQ lock before generating timestamp #93210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danieldegrasse
Copy link
Contributor

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.

Note that while this fixes a bug, I don't think it is critical enough for inclusion in 4.2

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>
@github-actions github-actions bot added the area: Tracing Tracing label Jul 16, 2025
@github-actions github-actions bot requested a review from nashif July 16, 2025 15:34
Copy link

@zephyrbot zephyrbot requested a review from teburd July 17, 2025 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants