configs: Fix difftest init bug in single-thread Sim#953
Open
xk23333 wants to merge 1 commit into
Open
Conversation
Signed-off-by: xuke <24212020033@m.fudan.edu.cn>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe single-core, non-SMT difftest configuration now enables memory deduplication for both the system and its first CPU. ChangesDifftest memory deduplication
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Collaborator
|
The CI smoke test did not pass. |
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.
Problem Description
When running GEM5 simulation with
--enable-difftestin single-core mode, the simulation aborts immediately with a memory access error.Error Log:
Root Cause Analysis
The issue stems from a configuration mismatch between GEM5 and the NEMU reference model regarding memory deduplication (
mem_dedup).CONFIG_ENABLE_MEM_DEDUP=1. This configuration requires the memory to be passed from the DUT (GEM5) rather than allocated internally by NEMU.configs/common/xiangshan.py, theconfig_difftest()function handles configuration differently for multi-core/SMT and single-core modes:sys.enable_mem_dedup = Trueandcpu.enable_mem_dedup = True.mem_dedupwere commented out.Because
enable_mem_dedupwas disabled in single-core mode, GEM5 did not pass the memory pointer to NEMU as expected. Consequently, NEMU failed to map the guest address, leading to thedifftest_memcpyassertion failure.Solution
Uncomment the
enable_mem_dedupsettings in the single-core branch ofconfig_difftest()to ensure consistency with the multi-core configuration and the NEMU build flags.Code Changes in
configs/common/xiangshan.py:Verification
After applying this fix, single-core simulations with
--enable-diffteststart successfully without triggering theguest_to_hostassertion failure.Summary by CodeRabbit