Skip to content

Commit 646b83b

Browse files
author
Serban Iorga
committed
remove VcpuEvent::Exit
When the emulation thread issues a VcpuEvent::Exit to a certain vCPU, the vCPU state machine finishes execution but also sends a signal to the emulation thread to close the VMM. This seems redundant. The emulation thread can simply close the VMM directly. Signed-off-by: Serban Iorga <[email protected]>
1 parent 4827569 commit 646b83b

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

src/vmm/src/vstate.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,11 +1011,6 @@ impl Vcpu {
10111011

10121012
// Break this emulation loop on any transition request/external event.
10131013
match self.event_receiver.try_recv() {
1014-
// Running ---- Exit ----> Exited
1015-
Ok(VcpuEvent::Exit) => {
1016-
// Move to 'exited' state.
1017-
state = StateMachine::next(Self::exited);
1018-
}
10191014
// Running ---- Pause ----> Paused
10201015
Ok(VcpuEvent::Pause) => {
10211016
// Nothing special to do.
@@ -1049,12 +1044,6 @@ impl Vcpu {
10491044
// This is the main loop of the `Paused` state.
10501045
fn paused(&mut self) -> StateMachine<Self> {
10511046
match self.event_receiver.recv() {
1052-
// Paused ---- Exit ----> Exited
1053-
#[cfg(target_arch = "x86_64")]
1054-
Ok(VcpuEvent::Exit) => {
1055-
// Move to 'exited' state.
1056-
StateMachine::next(Self::exited)
1057-
}
10581047
// Paused ---- Resume ----> Running
10591048
Ok(VcpuEvent::Resume) => {
10601049
// Nothing special to do.
@@ -1111,8 +1100,6 @@ pub struct VcpuState {
11111100
#[derive(Debug)]
11121101
/// List of events that the Vcpu can receive.
11131102
pub enum VcpuEvent {
1114-
/// Kill the Vcpu.
1115-
Exit,
11161103
/// Pause the Vcpu.
11171104
Pause,
11181105
/// Event that should resume the Vcpu.
@@ -1574,17 +1561,6 @@ mod tests {
15741561

15751562
// Queue a Resume event, expect a response.
15761563
queue_event_expect_response(&vcpu_handle, VcpuEvent::Resume, VcpuResponse::Resumed);
1577-
1578-
// Stop it by sending exit.
1579-
assert!(vcpu_handle.send_event(VcpuEvent::Exit).is_ok());
1580-
1581-
// Validate vCPU thread ends execution.
1582-
vcpu_handle
1583-
.join_vcpu_thread()
1584-
.expect("failed to join thread");
1585-
1586-
// Validate that the vCPU signaled its exit.
1587-
assert_eq!(vcpu_exit_evt.read().unwrap(), 1);
15881564
}
15891565

15901566
#[test]

0 commit comments

Comments
 (0)