-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i#4014 dr$sim phys: Add offline -use_physical support (#5516)
Adds support for physical addresses to offline dr$sim traces. To support simulators wanting both virtual and physical addresses, and to simplify post-processing where the virtual PC values are needed, the regular trace entries remain all virtual. A new marker type TRACE_MARKER_TYPE_PHYSICAL_ADDRESS listing the corresponding physical address is added. The mappings are assumed to not change, allowing just one marker for each newly-observed page. This is done per-thread. An explicit TRACE_MARKER_TYPE_PHYSICAL_ADDRESS_NOT_AVAILABLE marker is inserted on failure to translate, to prevent analyzers from having to infer this due to the lack of the already-sparse markers. Separately emitted pairs of virtual and physical address markers were considered, with raw2trace inserting the physical at the right place, but that presents complexities with buffer handoff and with the first buffer. Instead, the physical are inserted via memmove directly into the buffer. This does not seem to be a performance concern: the translation lookup is the bottleneck. Since the memmoves occur only on the first instance of each page, they are much rarer than all the virtual-to-physical translations. Adds support for the new markers to the view tool. Adds a Linux x86_64 test that runs a tiny asm app and ensures a physical address marker is inserted. The test needs to run as sudo, along with its pre- and post- commands. To avoid a confusing blocking password query in local runs, a new set of tests controlled by a new CMake option RUN_SUDO_TESTS is added. It is set only for automated_ci, where we assume a passwordless sudo. A number of items remain for further work: + Performance is poor: the hashtable and caching need improvement. + There is a hardcoded limit on how many markers can be added per buffer. Once this is exceeded, further markers are dropped. We should split the buffer to handle this. + We may want to add a mode that checks for mapping changes. + Missing privileges results in every physical address being 0 instead of showing the failure. We need to check the capabilities to distinguish. + Better testing that we're actually getting physical addresses for online tests. + Better offline testing with larger apps. + Basic blocks that cross a page have only the first one translated. + A file descriptor per thread is used, which will not scale well with DR's descriptor protection and might hit rlimits. + Online traces still replace all virtual addresses with physical. We should break compatibility and transition them to use these markers, with dr$sim computing the physical addresses from the markers. Issue: #4014
- Loading branch information
1 parent
4091617
commit d96d930
Showing
17 changed files
with
293 additions
and
70 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Hello world! | ||
Output format: | ||
<record#>: T<tid> <record details> | ||
------------------------------------------------------------ | ||
1: T[0-9]+ <marker: version 3> | ||
2: T[0-9]+ <marker: filetype 0x40> | ||
3: T[0-9]+ <marker: cache line size [0-9]+> | ||
4: T[0-9]+ <marker: tid [0-9]+ on core [0-9]+> | ||
5: T[0-9]+ <marker: timestamp [0-9]+> | ||
6: T[0-9]+ <marker: physical address for following entry: 0x[0-9a-f][0-9a-f]+> | ||
7: T[0-9]+ ifetch .* |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.