mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 20:19:07 +00:00
kvm: add wrapper for KVM_KVMCLOCK_CTRL VM ioctl
This ioctl will be used to resolve an issue where the jump forward in kvmclock on suspended VCPUs upon resume triggers the soft lockup detection. Using this ioctl prevents this detection from triggering, preventing a kernel panic on resume. TEST=cargo test -p kvm BUG=chromium:920875 Change-Id: Id1402a9d67d790e5e7e8655f2e5916210cc6e7cc Reviewed-on: https://chromium-review.googlesource.com/1415849 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
6a8fdd9f8e
commit
f1a3375725
1 changed files with 15 additions and 0 deletions
|
@ -1454,6 +1454,21 @@ impl Vcpu {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Signals to the host kernel that this VCPU is about to be paused.
|
||||
///
|
||||
/// See the documentation for KVM_KVMCLOCK_CTRL.
|
||||
pub fn kvmclock_ctrl(&self) -> Result<()> {
|
||||
let ret = unsafe {
|
||||
// The ioctl is safe because it does not read or write memory in this process.
|
||||
ioctl(self, KVM_KVMCLOCK_CTRL())
|
||||
};
|
||||
|
||||
if ret < 0 {
|
||||
return errno_result();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Specifies set of signals that are blocked during execution of KVM_RUN.
|
||||
/// Signals that are not blocked will will cause KVM_RUN to return
|
||||
/// with -EINTR.
|
||||
|
|
Loading…
Reference in a new issue