Skip to content

Commit 7e84bb0

Browse files
committed
vmm: properly unset immediate_exit on -EINTR
Also see [0] for more info. [0] https://docs.kernel.org/virt/kvm/api.html#the-kvm-run-structure
1 parent ec26934 commit 7e84bb0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

hypervisor/src/kvm/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,8 @@ impl cpu::Vcpu for KvmVcpu {
19871987
/// Triggers the running of the current virtual CPU returning an exit reason.
19881988
///
19891989
fn run(&self) -> std::result::Result<cpu::VmExit, cpu::HypervisorCpuError> {
1990-
match self.fd.lock().unwrap().run() {
1990+
let mut lock = self.fd.lock().unwrap();
1991+
match lock.run() {
19911992
Ok(run) => match run {
19921993
#[cfg(target_arch = "x86_64")]
19931994
VcpuExit::IoIn(addr, data) => {
@@ -2066,7 +2067,11 @@ impl cpu::Vcpu for KvmVcpu {
20662067
},
20672068

20682069
Err(ref e) => match e.errno() {
2069-
libc::EAGAIN | libc::EINTR => Ok(cpu::VmExit::Ignore),
2070+
libc::EINTR => {
2071+
lock.set_kvm_immediate_exit(0);
2072+
Ok(cpu::VmExit::Ignore)
2073+
}
2074+
libc::EAGAIN => Ok(cpu::VmExit::Ignore),
20702075
_ => Err(cpu::HypervisorCpuError::RunVcpu(anyhow!(
20712076
"VCPU error {:?}",
20722077
e

vmm/src/cpu.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,6 @@ impl CpuManager {
11131113
error!("Unexpected VM exit on \"immediate_exit\" run");
11141114
break;
11151115
}
1116-
vcpu.lock().as_ref().unwrap().vcpu.set_immediate_exit(false);
11171116
}
11181117

11191118
vcpu_run_interrupted.store(true, Ordering::SeqCst);

0 commit comments

Comments
 (0)