Change vCPU threads exit behavior in order to avoid sigprocmask#1603
Change vCPU threads exit behavior in order to avoid sigprocmask#1603serban300 merged 3 commits intofirecracker-microvm:masterfrom
Conversation
| // This is the main loop of the `Exited` state. | ||
| fn exited(&mut self) -> StateMachine<Self> { | ||
| // Transition to the exited state | ||
| fn exit(&mut self, exit_code: u8) -> StateMachine<Self> { |
There was a problem hiding this comment.
nit: why is this a separate function and not just the exited state?
There was a problem hiding this comment.
Because it needs to receive the exit_code as a parameter. From what I understand a StateFn can't receive parameters.
There was a problem hiding this comment.
What do you say about making the exit_code a field on the Vcpu struct in order to work around this?
There was a problem hiding this comment.
Personally I don't like it too much because exit_code is not generic state for the vCPU. It's just a code that has to be use once, right before exit. It would be really nice if we could send parameters to the state functions. Since it's not possible for the moment, I personally prefer to have the intermediate function exit() that receives the exit_code parameter.
84f4c95 to
61a5a6a
Compare
Try firecracker-microvm/firecracker#1603. Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
|
firecracker-containerd's integration tests are passing with this change! |
61a5a6a to
76a8bcf
Compare
|
Actually a |
Makes sense. Done. |
76a8bcf to
b2e5656
Compare
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 <seriorga@amazon.com>
Signed-off-by: Serban Iorga <seriorga@amazon.com>
exit the firecracker process with success code on KVM_EXIT_SHUTDOWN or KVM_EXIT_HLT Signed-off-by: Serban Iorga <seriorga@amazon.com>
b2e5656 to
fd4f04b
Compare
Reason for This PR
fixes #1456
Description of Changes
Don't allow vCPU threads to exit. If they finished execution, they will signal the VMM to exit and then wait forever.
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.
PR Checklist
[Author TODO: Meet these criteria. Where there are two options, keep one.][Reviewer TODO: Verify that these criteria are met. Request changes if not]git commit -s).clearly provided.
doc changes are included in this PR. Docs in scope are all
*.mdfileslocated either in the repository root, or in the
docs/directory.code is included in this PR.
reflected in
firecracker/swagger.yaml.this PR have user impact and have been added to the
CHANGELOG.mdfile.unsafecode has been added, or, the newly addedunsafecode is unavoidable and properly documented.