Skip to content
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

drcachesim offline simulation does not properly combine multiple processes #2384

Open
derekbruening opened this issue Apr 24, 2017 · 4 comments

Comments

@derekbruening
Copy link
Contributor

derekbruening commented Apr 24, 2017

It looks like we never made a test for a multi-process offline simulation. Looking at the code, the files are closed on fork, but there's no fork init event to open a new one, so I would expect a failure on writing out the child's trace.

derekbruening added a commit that referenced this issue Jun 2, 2017
The extra checks fail on the multiproc test so we fix that here for online
by adding a fork event handler that sends a new header to the simulator.
We partially solve #2384 by creating a new offline dir and files but more
work is needed to merge the final traces in the added test here: that's
left for #2384.
derekbruening added a commit that referenced this issue Jun 2, 2017
Fixes two issues with offline traces (#1729): first, changes the reader to
not assume a separate tid header right after the initial tid,pid header, as
offline traces (as opposed to online) do not contain it.  Second, changes
raw2trace to not emit a superfluous tid entry of 0 just prior to the real
initial tid entry for each thread.

Adds asserts to catch related errors in the future in the test suite.
The extra checks failed on the multiproc test so we fix that here for online
by adding a fork event handler that sends a new header to the simulator.
We partially solve #2384 by creating a new offline dir and files but more
work is needed to merge the final traces in the added test here: that's
left for #2384.
@derekbruening
Copy link
Contributor Author

Pasting from my notes:

*** TODO need separate subdir per process b/c of modules.log, so painful to add test

Should allow multiple -indir options. But that brings up complications:

  • Do we map the binaries from multiple modules.log simultaneously?
    Going to hit scalability issues: maybe it's better to instead support
    merging two final traces?

  • The droption accum separates with spaces: so what about paths with spaces
    in them?

For now I just have a test of the output from one process.

@derekbruening
Copy link
Contributor Author

#3059 covers adding non-space separator support to droption

@derekbruening
Copy link
Contributor Author

To summarize the current status, the generation of offline files works fine (they go to separate dirs, courtesy of the commits referenced above), but trying to merge them back together to pass to the simulator for a single multi-process simulation is not yet supported.

@derekbruening derekbruening changed the title drcachesim offline does not properly handle fork drcachesim offline simulation does not properly combined multiple processes Aug 3, 2018
@derekbruening derekbruening changed the title drcachesim offline simulation does not properly combined multiple processes drcachesim offline simulation does not properly combine multiple processes Aug 3, 2018
@derekbruening
Copy link
Contributor Author

Note that the scheduler supports mixing multiple processes (as separate
"workloads" if different scheduling policies are desired), and we do
recommend dynamic rescheduling (see
https://dynamorio.org/sec_drcachesim_sched.html. We will be trying to make
that the default rather than the current poor static schedule default).
For analyzers, just combining the files into one directory would be a
workaround that ignores addressing differences.

Status today of multiple address space support:

  • If you collect physical addresses during tracing (-use_physical, which
    requires privileges and adds overhead) and use those during simulation
    (same -use_physical) then mixing multiple processes is all handled
    nicely.

  • If you don't -use_physical during tracing then:

    • If you pass -use_physical it will convert virtual to physical by
      dropping top bits but this can lead to address collisions between
      processes when there was no collision in reality.

    • You could create a "v2p" textproto and add dr$sim support akin to the
      TLB simulator support added in PR i#6662 public traces, part 9: TLB simulator with v2p #6961.

We might want to add some flag to shift addresses (but at a point where the
v2p will still differentiate them), or provide the tool to create the v2p
textprotos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants