diff options
author | Dmitry Torokhov <dtor@chromium.org> | 2018-02-21 10:21:56 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-08 00:37:33 -0800 |
commit | 532a94c1c83c1f829a03e5c95ae584a57c0e86d5 (patch) | |
tree | 530ec3652f5fb3d139ac245d9b943862b4849e52 /tests | |
parent | e423460238fe1cfb8853faef3b855f1ce53b756c (diff) | |
download | crosvm-532a94c1c83c1f829a03e5c95ae584a57c0e86d5.tar crosvm-532a94c1c83c1f829a03e5c95ae584a57c0e86d5.tar.gz crosvm-532a94c1c83c1f829a03e5c95ae584a57c0e86d5.tar.bz2 crosvm-532a94c1c83c1f829a03e5c95ae584a57c0e86d5.tar.lz crosvm-532a94c1c83c1f829a03e5c95ae584a57c0e86d5.tar.xz crosvm-532a94c1c83c1f829a03e5c95ae584a57c0e86d5.tar.zst crosvm-532a94c1c83c1f829a03e5c95ae584a57c0e86d5.zip |
Fix race between un-pausing vcpu and requesting vcpu pause
To ensure that we do not miss pause request sent while we were in paused state, or were exiting paused state, let's start using KVM_SET_SIGNAL_MASK. SIGRTMIN() + 0 signal will be blocked and thus is not delivered, and it will only be checked when KVM_RUN is being executed, reliably interrupting KVM_RUN. TEST=cargo test --features plugin; cargo test -p kvm; ./build_test BUG=chromium:800626 Change-Id: Iae67a411c23c2b14fbfcbc7d53d0bc86ec4b67d9 Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/944850 Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/plugin_vcpu_pause.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/plugin_vcpu_pause.c b/tests/plugin_vcpu_pause.c index a9a27f8..ff69b04 100644 --- a/tests/plugin_vcpu_pause.c +++ b/tests/plugin_vcpu_pause.c @@ -238,6 +238,21 @@ int main(int argc, char** argv) { return 1; } + signal_unpause(crosvm, false); + + /* Wait until VCPU thread tells us that it is no longer paused */ + read(g_kill_evt, &dummy, sizeof(dummy)); + + /* + * Try pausing VCPUs 3rd time to see if we will miss pause + * request as we are exiting previous pause. + */ + ret = signal_pause(crosvm); + if (ret) { + fprintf(stderr, "failed to pause vcpus (2nd time): %d\n", ret); + return 1; + } + signal_unpause(crosvm, true); /* Wait until VCPU thread tells us that it is no longer paused */ |