-
Notifications
You must be signed in to change notification settings - Fork 107
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
Minor enhancement and bugfixes #151
base: main
Are you sure you want to change the base?
Conversation
115959f
to
c0b6d85
Compare
2fd74d8
to
4bb478d
Compare
The first patch is temporary workaround for #152 |
The CI machine was updated, so I think the first commit is not required anymore. |
b344d2a
to
e62e2e6
Compare
Done |
Add method to query KVM_CAP_X86_DISABLE_EXITS for x86 platforms. Signed-off-by: Liu Jiang <[email protected]>
Kvm::check_extension_int() may return negative value as error code, so Kvm::get_max_vcpus() and Kvm::get_max_vcpu_id() should handle the error cases. Signed-off-by: Liu Jiang <[email protected]>
/// Returns the "disable idle exiting" capability. | ||
/// | ||
/// The `KVM_CAP_X86_DISABLE_EXITS` capability provides userspace with per-VM capability | ||
/// to not intercept MWAIT/HLT/PAUSE/CSTATE, which means though instructions won't cause |
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.
/// to not intercept MWAIT/HLT/PAUSE/CSTATE, which means though instructions won't cause | |
/// to not intercept MWAIT/HLT/PAUSE/CSTATE, which means such instructions won't cause |
or these
assert!(disable_exits & KVM_X86_DISABLE_EXITS_HLT != 0); | ||
assert!(disable_exits & KVM_X86_DISABLE_EXITS_PAUSE != 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.
Running this test on my laptop fails, should we check here for some capability before doing the asserts? Maybe this way we can also have a test case for get_disable_exits
returning 0.
src/ioctls/system.rs
Outdated
if x > 0 { | ||
x as u32 | ||
} else { | ||
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.
This can be slightly simplified.
if x > 0 { | |
x as u32 | |
} else { | |
0 | |
} | |
u32::try_from(x).unwrap_or(0) |
@jiangliu are you still interested in getting some of these changes merged? |
Enhance the kvm-ioctls with: