-
Notifications
You must be signed in to change notification settings - Fork 561
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
pre-populate code cache from provided profiling data #2463
Comments
One complication here is that the user of this interface typically does some kind of sampling to obtain the list of tags. Decoding is often needed to further find target bb entries, and self-sampling of this decoding code can produce tags for DR code. This then ends up instrumenting such bbs, even if they will never be executed. For static DR this can hit this assert:
We disabled -private_loader for static DR (#2117). For non-static-DR we would just avoid building this bb by checking for a DR It would be nice to turn asserts into just bb building failures during prepop: |
For the DR segment read: I'm going with a solution of looking for the start PC of the |
Adds a new API routine dr_prepopulate_cache() meant to be called between dr_app_setup() and dr_app_start() to build up a code cache in parallel with app execution, to avoid the cost of a cold cache upon attach. Fixes some auxiliary issues with building blocks ahead of time from sampling data: + Sets up TLS during bb building for dcontexts but does not enable signal handlers to avoid perturbing the app. + Adds is_DR_segment_reader_entry() to avoid pre-building a problematic self-sampled bb that reads DR segments when DR is a static library and we do not support mangling such reads. + Fixes an initialized-dcontext issue in dr_get_isa_mode(). Adds a test. Fixes #2463
Adds a new API routine dr_prepopulate_cache() meant to be called between dr_app_setup() and dr_app_start() to build up a code cache in parallel with app execution, to avoid the cost of a cold cache upon attach. Solves several issues with building blocks ahead of time: + Sets up TLS during bb building for dcontexts but does not enable signal handlers to avoid perturbing the app. + Adds is_DR_segment_reader_entry() to avoid pre-building a problematic self-sampled bb that reads DR segments when DR is a static library and we do not support mangling such reads. + Fixes an initialized-dcontext issue in dr_get_isa_mode(). Adds a test. Fixes #2463
Xref #1594. The caveat about the ISA mode apply here: it's up to the caller of this API there. The caveat about the mcontext at the top of the bb also applies: the example there is Dr. Memory which uses the mcontext of the very first bb event to get the mcontext for the primary thread to work around DR's failure to provide it there (#1152). |
Adds dr_prepopulate_indirect_targets() for filling in indirect branch target tables to avoid trips to dispatch when attaching. Adds a test to api.static_prepop. Issue: #2463
Adds dr_prepopulate_indirect_targets() for filling in indirect branch target tables to avoid trips to dispatch when attaching. Adds a test to api.static_prepop. Issue: #2463
Fixes two races with shared ibt tables: + Adding a new table entry must write the start_pc before the tag. This is accomplished with a new ENTRY_SET_TO_ENTRY hashtablex.h optional specifier. For ARM #2502 a new MEMORY_STORE_BARRIER macro is added. + Resizing a table must not clear the tags in the old table to avoid losing the tag on the target_delete ibl path. Adds a test api.ibl-stress which uses the DR IR to synthetically construct thousands of basic blocks with indirect branches betweent them. To make the test work, relaxes several is-on-stack checks to support pre-building basic blocks (#2463) from generated code or other locations not known prior to starting the application. Issue: #3098, #2502, #2463 Fixes #3098
Fixes two races with shared ibt tables: + Adding a new table entry must write the start_pc before the tag. This is accomplished with a new ENTRY_SET_TO_ENTRY hashtablex.h optional specifier. For ARM #2502 a new MEMORY_STORE_BARRIER macro is added. + Resizing a table must not clear the tags in the old table to avoid losing the tag on the target_delete ibl path. Adds a test api.ibl-stress which uses the DR IR to synthetically construct thousands of basic blocks with indirect branches betweent them. To make the test work, relaxes several is-on-stack checks to support pre-building basic blocks (#2463) from generated code or other locations not known prior to starting the application. Issue: #3098, #2502, #2463 Fixes #3098
In some attach scenarios (currently only fully supported with static DR in a start/stop type model) we want to pre-populate the code cache on the side so when we trigger the attach we can avoid the cost of building the cache up. This issue covers creating some kind of interface where a list of basic block start tags obtained from profiling can be passed to DR to create a pre-warmed cache.
The text was updated successfully, but these errors were encountered: