You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This continues the work from the prior commit toward the goal of
releasing all resources with a clean shutdown. The VCPU threads in
non-test configurations were running with an unbreakable wait, so
they only way to get past them was with exit():
// Wait indefinitely
// The VMM thread will kill the entire process
let barrier = Barrier::new(2);
barrier.wait();
Here that is changed, along with several other entangled issues.
One was that Drop methods were used to try and clean up the Vmm
and the VcpuHandles, but these were not being called. The reason
is that there was a cyclic dependency: threads held onto the Vmm,
so the Vmm could not exit VCPU threads in its Drop method (as it
wouldn't be dropped so long as the VCPU threads were around).
Another complexity surrounds defining the difference between an
exited thread (from which an exit event can be read out of the
channel) and a finished thread (which tears down the channel).
Trying to send a message to a thread which has finished will
panic, and some CPUs might be in the exit state while others may
not...and reading the "exit state" by taking the message out of
the channel removes it. It's a bit complicated.
This commit tries to move toward simplification by being explicit
about the Vmm.stop() call being responsible for exiting the VCPUs,
and making the VcpuHandle's Drop method only do the simple task
of joining an exited thread.
0 commit comments