-
Notifications
You must be signed in to change notification settings - Fork 91
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
Add fast trace collection & use it for instrumenting guest memory operations #103
base: main
Are you sure you want to change the base?
Conversation
e37690f
to
cbe1370
Compare
cbe1370
to
88a6083
Compare
In the future, the outb handler will need to take a Hypervisor instance in order to be able to access register and memory state of the VM, so it doesn't make sense for these interfaces to be more public than the `Hypervisor` trait. Nobody outside of Hyperlight seems to use these at the moment, so it's probably simplest to restrict these to `pub(crate)`. Signed-off-by: Lucy Menon <[email protected]>
538b2d8
to
becb995
Compare
This adds (unused) support for creating trace files for sandboxes and passing them around to relevant sandbox event handler code. This will be used for collecting debug trace and profiling information. Signed-off-by: Lucy Menon <[email protected]>
This will be useful in the near future, when it will allow transforming the exe_info into unwind information without an extra copy. Signed-off-by: Lucy Menon <[email protected]>
This adds a new interface which tracing code can use to request the values of registers from the hypervisor supervising a sandbox. Signed-off-by: Lucy Menon <[email protected]>
Signed-off-by: Lucy Menon <[email protected]>
This allows for producing profiles of memory usage. Signed-off-by: Lucy Menon <[email protected]>
Signed-off-by: Lucy Menon <[email protected]>
becb995
to
482ce23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me. Stack unwinding will definitely be very helpful. Btw, it's not totally clear to me how to use the two added features, nor the new trace_dump crate. Would it be possible to add a simple example or minimal docs somewhere? Lastly, should we try to compile some feature matrix of this in CI to make sure we don't break it in the future? Great job 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great @syntactically , I added a few review comments.
I agree with @ludfjig it would be nice to have some docs that explain how to use these features and how they interact (it isn't immediately obvious to me at least if the trace_guest
feature is useful on its own).
I also think it would be useful to perhaps have a README for the trace_dump tool that specifies how to use it , last I think we should maybe include the trace_dump binary in the GH release?
This adds a framework for quickly tracing events of interest in a guest, including getting stack traces out of the guest based on dwarf unwinding information. This capability is used to allow collecting stack traces of memory allocations/frees, providing various statistics on what causes the maximum memory consumption for a sandbox.