-
Notifications
You must be signed in to change notification settings - Fork 130
Add support for KVM_SIGNAL_MSI #42
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
Conversation
|
@andreeaflorescu @sameo @rbradford I don't see how I can properly test this new ioctl... |
rbradford
left a comment
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.
I think testing such ioctls will often present challenges and we need to be tolerant of lowering the coverage where necessary. With such little logic in the handling of this ioctl I do not feel overly concerned that anything might break it.
|
@andreeaflorescu @rbradford PR updated, let me know what you think? |
|
@sboeuf need to update your coverage amount. |
|
Yeah so I lowered the coverage from 91.3 to 91.2 and now all green! |
src/ioctls/vm.rs
Outdated
| // exactly the size of the struct | ||
| let ret = unsafe { ioctl_with_ref(self, KVM_SIGNAL_MSI(), &msi) }; | ||
| if ret != -1 { | ||
| Ok(()) |
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.
As per KVM API documentation this ioctl:
Returns: >0 on delivery, 0 if guest blocked the MSI, and -1 on error
We should keep the same return values in this wrapper as well.
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.
should I create a new error for 0?
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.
I think you should return 0 and let the caller handle that exit code.
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.
Ok sounds good.
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.
P.S. It's worth specifying this in the function documentation as well.
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.
Ok it's updated now, let me know what you think.
8f48374 to
f883bcc
Compare
ff3b30a to
2feeda7
Compare
Any consumer of this crate who would like to implement MSI/MSI-X support will need KVM_SIGNAL_MSI to notify directly the local APIC emulated by KVM, using MSI/MSI-X vectors. Signed-off-by: Sebastien Boeuf <[email protected]>
This pull request primary goal is to add the support for the KVM ioctl
KVM_SIGNAL_MSI.The reason being to allow consumers of this crate to directly inject MSI messages instead of using legacy pin based interrupts.
The second part of this pull request implements the
Clonetrait forVmFdso that anyone can safely cloneVmFd. The need for cloning is to be able to move theVmFdinto a closure or a thread.