-
Notifications
You must be signed in to change notification settings - Fork 61
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
event ABI issues #1
Comments
I agree with all the issues that you listed above ! Adding the registers directly in the event will improve performance, since we need the registers info anyway. An yes, expanding This is a draft of how this new design could be implemented: KVM
QEMU
How it should work:
At this point, the traps are set. When an exception is triggered, and we go back to QEMU exit handler:
And the code is the same for a |
Copy pasting this issue which @tklengyel opened in Wenzel/kvm-vmi :
The current event ABI looks as follows:
There are multiple issues with this design.
Using
enum
is not OK when making an ABI as different compilers may disagree on what the underlying storage for the enum should be. For example the kernel and the userspace can (and most likely will) be compiled with different compilers. Same principle stands for using storage types such asint
,long
andbool
. It is best to use storage types that explicitly specify their widths, such asuint32_t
.In similar vein, structure padding has to be explicitly carried out. Different compilers may pad structures differently, so to avoid any misalignment, always pad structure members to 64-bit width.
Adding the event ABI version field to the structure will allow future expansion of the structure while providing downstream clients a direct way to verify that their tool can cope with the running ABI version.
This struct is being filled in by the kernel module for each vCPU. This design requires the userside to query the kernel for each vCPU to see if there are any pending events. On VMs with many vCPUs this will require many cycles even if there are no pending events on most of the vCPUs. On Xen the way we handle this is by using a queue to push events into on the hypervisor side and have the userside pop them. The nfqueue library already implements something akin to this - transferring information to userspace to be processed via a queue- so I would look there for inspiration.
Getting registers is performed in a separate system-call currently. However, the event struct could very well just carry that information by default. We already do this with Xen. See https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/include/public/vm_event.h;h=b7487a12f3920d30b948ce9a996fb3eb9e8773da;hb=refs/heads/master#l160
After some discussion with Jonas, what will make most sense actually is simply expanding
kvm_run
to provide a VMI exit-code for events we trigger for monitoring.The text was updated successfully, but these errors were encountered: