Repository navigation
feat(ktrace): added trace sessions and .ktrace extraction through /dev/ktrace - #347
Merged
Merged
Conversation
…ly during a session
…tead of a fixed capacity
…on state and per-CPU record counts
…session as a .ktrace file
… tracing sessions
… recorded nothing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Medium Risk
New SMP-aware ring buffer and session state machine in the kernel plus devfs/syscall error plumbing; failures are mostly isolated but bugs could affect tracing correctness or concurrent open/start/stop behavior.
Overview
Adds kernel trace sessions with
start()/stop()that clear per-CPU rings on start, drop events outside recording, stamp records withclock::now_ns(), and on stop close rings until reserved slots commit. Stopped sessions can be read as a versioned.ktraceblob (header, CPU table, oldest-first records, including wrapped rings) via/dev/ktrace/trace, with/dev/ktrace/control(start/stopwrites) and/dev/ktrace/status(text snapshot). Boot registers these nodes throughktrace::register_devfs_nodes()afterktrace::init().Introduces shared
devfs::text_snapshot_nodeandappend_str/append_u64helpers (grow-on-read instead of fixed caps);sysstatdrops its local snapshot node and uses this type for/dev/sysinfo/*. Plumbsfs::ERR_NODATAandEBUSYthrough resource providers and syscalls asENODATA/EBUSY. Adds a userlandktraceapp (start,stop,status,dump -o FILE) plus kernel tests for devfs snapshots and ktrace session/control/trace behavior.Reviewed by Cursor Bugbot for commit d5b874a. Bugbot is set up for automated code reviews on this repo. Configure here.