cpu: annotate faulting instructions in Exec trace output#2941
Merged
BobbyRBruce merged 1 commit intogem5:developfrom Mar 4, 2026
Merged
cpu: annotate faulting instructions in Exec trace output#2941BobbyRBruce merged 1 commit intogem5:developfrom
BobbyRBruce merged 1 commit intogem5:developfrom
Conversation
8f3b4d6 to
cf41ef0
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances gem5's execution trace output by annotating faulting instructions with a clear "FAULTING" marker when the ExecFaulting debug flag is enabled. This addresses confusion in Issue #2902 where faulting memory operations in O3CPU appear twice in the trace - once when they fault (triggering SE-mode page fault handling) and again when successfully re-executed after fault resolution. Without the marker, users can misinterpret this as duplicate execution rather than the expected fault-and-retry behavior.
Changes:
- Add include for
debug/ExecFaulting.hhheader - Append " FAULTING" marker to exec trace output when an instruction has faulted and ExecFaulting tracing is enabled
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
powerjg
approved these changes
Feb 11, 2026
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.
Summary
This PR makes gem5's
Exectrace output less misleading for faulting instructions by appending a clearFAULTINGmarker when an instruction is known to have faulted (andExecFaultingtracing is enabled).This is especially helpful for O3CPU runs in syscall-emulation (SE) mode where a faulting memory operation may be re-fetched and re-executed after the fault handler (e.g., lazy stack growth) runs. In that situation, users can otherwise interpret two
Execlines for the same PC as a “duplicate execution” bug.References: gem5 Issue #2902
Motivation / Problem
Issue #2902 reports that a RISC-V O3CPU run shows the same
sdinstruction appearing twice in theExectrace (with differentFetchSeqvalues), which looks like gem5 executes the store twice.In the reproducer attached to the issue, the first dynamic instance of the store faults due to SE-mode page-table handling / lazy stack growth (a
GenericPageTableFaultwhich triggersProcess::fixupFault()to allocate a new stack page). The CPU then squashes younger instructions and re-fetches from the faulting PC; the store appears again as a new dynamic instruction instance.Today, the
Exectrace line for the faulting instance looks identical to a normal executedMemWrite, making the trace easy to misread.What this PR changes
When
ExecFaultingis enabled and the tracer record is marked as faulting, theExectrace line now includes a trailingFAULTINGtag.This is deliberately minimal and formatting-only:
Before / After (example from Issue #2902)
Before
The trace excerpt in Issue #2902 looks like two identical stores:
After
With this change, the faulting dynamic instance is clearly labeled:
This makes it explicit that the first appearance is not a successful architectural store retirement, but a faulting instance which will be handled and then retried.
Notes
Execalready includes theExecFaultingflag (via theCompoundFlag('Exec', ...)), so users enabling--debug-flags=Execautomatically benefit from the clearer output.FAULTING) to minimize impact on existing trace parsing.