mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-25 05:03:05 +00:00
6ed5aea011
This commit addresses a number of issues with the way in which the SIGRTMIN() + 0 signal is used to kick VCPU threads. It 1. Moves the registration of the signal handler to the main thread. There's no need to register the handler once for each VCPU as there's one handler per process, rather than one per thread. 2. Ensures expect is not called in the VCPU thread before start_barrier.wait() is called. In the current code, failure to register the signal handler causes crosvm to hang rather than to exit as the VCPU thread panics before calling start_barrier.wait(). The main thread then blocks forever while waiting on the barrier. 3. Uses the KVM_SET_SIGNAL_MASK ioctl to remove a race condition in the current code. In the current code, a SIGRTMIN() + 0 signal, received during a vm exit, would be consumed before the next call to KVM_RUN, which would execute as normal and not be interrupted. This could delay the VM from stopping when requested to do so. Note that the new code doesn't unblock all signals during the call to KVM_RUN. It only unblocks SIGRTMIN() + 0. This is important as SIGCHILD is blocked at the start of run_config, and we probably don't want this unblocked periodically in each of the VCPU threads. TEST=run crosvm and stop it in both single and multi-process mode. BUG=none Signed-off-by: Mark Ryan <mark.d.ryan@intel.com> Change-Id: Ibda7d6220482aa11b2f5feee410d1d2b67a7e774 Reviewed-on: https://chromium-review.googlesource.com/1019443 Commit-Ready: Mark D Ryan <mark.d.ryan@intel.com> Tested-by: Mark D Ryan <mark.d.ryan@intel.com> Reviewed-by: Zach Reizner <zachr@chromium.org> |
||
---|---|---|
.. | ||
poll_token_derive | ||
src | ||
build.rs | ||
Cargo.toml | ||
sock_ctrl_msg.c |